Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 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. |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 26 | * |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame] | 27 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 28 | |
| 29 | |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 30 | |
| 31 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 32 | /**======================================================================== |
| 33 | |
| 34 | \file wlan_hdd_cfg80211.c |
| 35 | |
| 36 | \brief WLAN Host Device Driver implementation |
| 37 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 38 | ========================================================================*/ |
| 39 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 40 | /**========================================================================= |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 41 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 42 | EDIT HISTORY FOR FILE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 43 | |
| 44 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 45 | This section contains comments describing changes made to the module. |
| 46 | Notice that changes are listed in reverse chronological order. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 47 | |
| 48 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 49 | $Header:$ $DateTime: $ $Author: $ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 50 | |
| 51 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 52 | when who what, where, why |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 53 | -------- --- -------------------------------------------------------- |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 54 | 21/12/09 Ashwani Created module. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 55 | |
| 56 | 07/06/10 Kumar Deepak Implemented cfg80211 callbacks for ANDROID |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 57 | Ganesh K |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 58 | ==========================================================================*/ |
| 59 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 60 | |
| 61 | #include <linux/version.h> |
| 62 | #include <linux/module.h> |
| 63 | #include <linux/kernel.h> |
| 64 | #include <linux/init.h> |
| 65 | #include <linux/wireless.h> |
| 66 | #include <wlan_hdd_includes.h> |
| 67 | #include <net/arp.h> |
| 68 | #include <net/cfg80211.h> |
| 69 | #include <linux/wireless.h> |
| 70 | #include <wlan_hdd_wowl.h> |
| 71 | #include <aniGlobal.h> |
| 72 | #include "ccmApi.h" |
| 73 | #include "sirParams.h" |
| 74 | #include "dot11f.h" |
| 75 | #include "wlan_hdd_assoc.h" |
| 76 | #include "wlan_hdd_wext.h" |
| 77 | #include "sme_Api.h" |
| 78 | #include "wlan_hdd_p2p.h" |
| 79 | #include "wlan_hdd_cfg80211.h" |
| 80 | #include "wlan_hdd_hostapd.h" |
| 81 | #include "sapInternal.h" |
| 82 | #include "wlan_hdd_softap_tx_rx.h" |
| 83 | #include "wlan_hdd_main.h" |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 84 | #include "wlan_hdd_assoc.h" |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 85 | #include "wlan_hdd_power.h" |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 86 | #include "wlan_hdd_trace.h" |
| 87 | #include "vos_types.h" |
| 88 | #include "vos_trace.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 89 | #ifdef WLAN_BTAMP_FEATURE |
| 90 | #include "bap_hdd_misc.h" |
| 91 | #endif |
| 92 | #include <qc_sap_ioctl.h> |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 93 | #ifdef FEATURE_WLAN_TDLS |
| 94 | #include "wlan_hdd_tdls.h" |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 95 | #include "wlan_hdd_wmm.h" |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 96 | #include "wlan_qct_wda.h" |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 97 | #endif |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 98 | #include "wlan_nv.h" |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 99 | #include "wlan_hdd_dev_pwr.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 100 | |
| 101 | #define g_mode_rates_size (12) |
| 102 | #define a_mode_rates_size (8) |
| 103 | #define FREQ_BASE_80211G (2407) |
| 104 | #define FREQ_BAND_DIFF_80211G (5) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 105 | #define MAX_SCAN_SSID 9 |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 106 | #define MAX_PENDING_LOG 5 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 107 | #define GET_IE_LEN_IN_BSS_DESC(lenInBss) ( lenInBss + sizeof(lenInBss) - \ |
krunal soni | 2a6a906 | 2014-02-11 14:14:23 -0800 | [diff] [blame] | 108 | ((uintptr_t)OFFSET_OF( tSirBssDescription, ieFields))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 109 | |
| 110 | #define HDD2GHZCHAN(freq, chan, flag) { \ |
| 111 | .band = IEEE80211_BAND_2GHZ, \ |
| 112 | .center_freq = (freq), \ |
| 113 | .hw_value = (chan),\ |
| 114 | .flags = (flag), \ |
| 115 | .max_antenna_gain = 0 ,\ |
| 116 | .max_power = 30, \ |
| 117 | } |
| 118 | |
| 119 | #define HDD5GHZCHAN(freq, chan, flag) { \ |
| 120 | .band = IEEE80211_BAND_5GHZ, \ |
| 121 | .center_freq = (freq), \ |
| 122 | .hw_value = (chan),\ |
| 123 | .flags = (flag), \ |
| 124 | .max_antenna_gain = 0 ,\ |
| 125 | .max_power = 30, \ |
| 126 | } |
| 127 | |
| 128 | #define HDD_G_MODE_RATETAB(rate, rate_id, flag)\ |
| 129 | {\ |
| 130 | .bitrate = rate, \ |
| 131 | .hw_value = rate_id, \ |
| 132 | .flags = flag, \ |
| 133 | } |
| 134 | |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 135 | #ifndef WLAN_FEATURE_TDLS_DEBUG |
| 136 | #define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_INFO |
| 137 | #else |
| 138 | #define TDLS_LOG_LEVEL VOS_TRACE_LEVEL_ERROR |
| 139 | #endif |
| 140 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 141 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 142 | #define WLAN_AKM_SUITE_FT_8021X 0x000FAC03 |
| 143 | #define WLAN_AKM_SUITE_FT_PSK 0x000FAC04 |
| 144 | #endif |
| 145 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 146 | #define HDD_CHANNEL_14 14 |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 147 | #define WLAN_HDD_MAX_FEATURE_SET 8 |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 148 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 149 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 150 | /* |
| 151 | * Used to allocate the size of 4096 for the link layer stats. |
| 152 | * The size of 4096 is considered assuming that all data per |
| 153 | * respective event fit with in the limit.Please take a call |
| 154 | * on the limit based on the data requirements on link layer |
| 155 | * statistics. |
| 156 | */ |
| 157 | #define LL_STATS_EVENT_BUF_SIZE 4096 |
| 158 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 159 | #ifdef WLAN_FEATURE_EXTSCAN |
| 160 | /* |
| 161 | * Used to allocate the size of 4096 for the EXTScan NL data. |
| 162 | * The size of 4096 is considered assuming that all data per |
| 163 | * respective event fit with in the limit.Please take a call |
| 164 | * on the limit based on the data requirements. |
| 165 | */ |
| 166 | |
| 167 | #define EXTSCAN_EVENT_BUF_SIZE 4096 |
| 168 | #define EXTSCAN_MAX_CACHED_RESULTS_PER_IND 32 |
| 169 | #endif |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 170 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 171 | /*EXT TDLS*/ |
| 172 | /* |
| 173 | * Used to allocate the size of 4096 for the TDLS. |
| 174 | * The size of 4096 is considered assuming that all data per |
| 175 | * respective event fit with in the limit.Please take a call |
| 176 | * on the limit based on the data requirements on link layer |
| 177 | * statistics. |
| 178 | */ |
| 179 | #define EXTTDLS_EVENT_BUF_SIZE 4096 |
| 180 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 181 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 182 | { |
| 183 | WLAN_CIPHER_SUITE_WEP40, |
| 184 | WLAN_CIPHER_SUITE_WEP104, |
| 185 | WLAN_CIPHER_SUITE_TKIP, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 186 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 187 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 188 | WLAN_CIPHER_SUITE_KRK, |
| 189 | WLAN_CIPHER_SUITE_CCMP, |
| 190 | #else |
| 191 | WLAN_CIPHER_SUITE_CCMP, |
| 192 | #endif |
| 193 | #ifdef FEATURE_WLAN_WAPI |
| 194 | WLAN_CIPHER_SUITE_SMS4, |
| 195 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 196 | #ifdef WLAN_FEATURE_11W |
| 197 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 198 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 199 | }; |
| 200 | |
| 201 | static inline int is_broadcast_ether_addr(const u8 *addr) |
| 202 | { |
| 203 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && |
| 204 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 205 | } |
| 206 | |
| 207 | static struct ieee80211_channel hdd_channels_2_4_GHZ[] = |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 208 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 209 | HDD2GHZCHAN(2412, 1, 0) , |
| 210 | HDD2GHZCHAN(2417, 2, 0) , |
| 211 | HDD2GHZCHAN(2422, 3, 0) , |
| 212 | HDD2GHZCHAN(2427, 4, 0) , |
| 213 | HDD2GHZCHAN(2432, 5, 0) , |
| 214 | HDD2GHZCHAN(2437, 6, 0) , |
| 215 | HDD2GHZCHAN(2442, 7, 0) , |
| 216 | HDD2GHZCHAN(2447, 8, 0) , |
| 217 | HDD2GHZCHAN(2452, 9, 0) , |
| 218 | HDD2GHZCHAN(2457, 10, 0) , |
| 219 | HDD2GHZCHAN(2462, 11, 0) , |
| 220 | HDD2GHZCHAN(2467, 12, 0) , |
| 221 | HDD2GHZCHAN(2472, 13, 0) , |
| 222 | HDD2GHZCHAN(2484, 14, 0) , |
| 223 | }; |
| 224 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 225 | static struct ieee80211_channel hdd_social_channels_2_4_GHZ[] = |
| 226 | { |
| 227 | HDD2GHZCHAN(2412, 1, 0) , |
| 228 | HDD2GHZCHAN(2437, 6, 0) , |
| 229 | HDD2GHZCHAN(2462, 11, 0) , |
| 230 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 231 | |
| 232 | static struct ieee80211_channel hdd_channels_5_GHZ[] = |
| 233 | { |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 234 | HDD5GHZCHAN(4920, 240, 0) , |
| 235 | HDD5GHZCHAN(4940, 244, 0) , |
| 236 | HDD5GHZCHAN(4960, 248, 0) , |
| 237 | HDD5GHZCHAN(4980, 252, 0) , |
| 238 | HDD5GHZCHAN(5040, 208, 0) , |
| 239 | HDD5GHZCHAN(5060, 212, 0) , |
| 240 | HDD5GHZCHAN(5080, 216, 0) , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 241 | HDD5GHZCHAN(5180, 36, 0) , |
| 242 | HDD5GHZCHAN(5200, 40, 0) , |
| 243 | HDD5GHZCHAN(5220, 44, 0) , |
| 244 | HDD5GHZCHAN(5240, 48, 0) , |
| 245 | HDD5GHZCHAN(5260, 52, 0) , |
| 246 | HDD5GHZCHAN(5280, 56, 0) , |
| 247 | HDD5GHZCHAN(5300, 60, 0) , |
| 248 | HDD5GHZCHAN(5320, 64, 0) , |
| 249 | HDD5GHZCHAN(5500,100, 0) , |
| 250 | HDD5GHZCHAN(5520,104, 0) , |
| 251 | HDD5GHZCHAN(5540,108, 0) , |
| 252 | HDD5GHZCHAN(5560,112, 0) , |
| 253 | HDD5GHZCHAN(5580,116, 0) , |
| 254 | HDD5GHZCHAN(5600,120, 0) , |
| 255 | HDD5GHZCHAN(5620,124, 0) , |
| 256 | HDD5GHZCHAN(5640,128, 0) , |
| 257 | HDD5GHZCHAN(5660,132, 0) , |
| 258 | HDD5GHZCHAN(5680,136, 0) , |
| 259 | HDD5GHZCHAN(5700,140, 0) , |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 260 | #ifdef FEATURE_WLAN_CH144 |
| 261 | HDD5GHZCHAN(5720,144, 0) , |
| 262 | #endif /* FEATURE_WLAN_CH144 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 263 | HDD5GHZCHAN(5745,149, 0) , |
| 264 | HDD5GHZCHAN(5765,153, 0) , |
| 265 | HDD5GHZCHAN(5785,157, 0) , |
| 266 | HDD5GHZCHAN(5805,161, 0) , |
| 267 | HDD5GHZCHAN(5825,165, 0) , |
| 268 | }; |
| 269 | |
| 270 | static struct ieee80211_rate g_mode_rates[] = |
| 271 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 272 | HDD_G_MODE_RATETAB(10, 0x1, 0), |
| 273 | HDD_G_MODE_RATETAB(20, 0x2, 0), |
| 274 | HDD_G_MODE_RATETAB(55, 0x4, 0), |
| 275 | HDD_G_MODE_RATETAB(110, 0x8, 0), |
| 276 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 277 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 278 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 279 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 280 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 281 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 282 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 283 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 284 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 285 | |
| 286 | static struct ieee80211_rate a_mode_rates[] = |
| 287 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 288 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 289 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 290 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 291 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 292 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 293 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 294 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 295 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
| 296 | }; |
| 297 | |
| 298 | static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ = |
| 299 | { |
| 300 | .channels = hdd_channels_2_4_GHZ, |
| 301 | .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ), |
| 302 | .band = IEEE80211_BAND_2GHZ, |
| 303 | .bitrates = g_mode_rates, |
| 304 | .n_bitrates = g_mode_rates_size, |
| 305 | .ht_cap.ht_supported = 1, |
| 306 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 307 | | IEEE80211_HT_CAP_GRN_FLD |
| 308 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 309 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 310 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 311 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 312 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 313 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 314 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 315 | }; |
| 316 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 317 | static struct ieee80211_supported_band wlan_hdd_band_p2p_2_4_GHZ = |
| 318 | { |
| 319 | .channels = hdd_social_channels_2_4_GHZ, |
| 320 | .n_channels = ARRAY_SIZE(hdd_social_channels_2_4_GHZ), |
| 321 | .band = IEEE80211_BAND_2GHZ, |
| 322 | .bitrates = g_mode_rates, |
| 323 | .n_bitrates = g_mode_rates_size, |
| 324 | .ht_cap.ht_supported = 1, |
| 325 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 326 | | IEEE80211_HT_CAP_GRN_FLD |
| 327 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 328 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 329 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 330 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 331 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 332 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 333 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 334 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 335 | |
| 336 | static struct ieee80211_supported_band wlan_hdd_band_5_GHZ = |
| 337 | { |
| 338 | .channels = hdd_channels_5_GHZ, |
| 339 | .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ), |
| 340 | .band = IEEE80211_BAND_5GHZ, |
| 341 | .bitrates = a_mode_rates, |
| 342 | .n_bitrates = a_mode_rates_size, |
| 343 | .ht_cap.ht_supported = 1, |
| 344 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 345 | | IEEE80211_HT_CAP_GRN_FLD |
| 346 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 347 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT |
| 348 | | IEEE80211_HT_CAP_SGI_40 |
| 349 | | IEEE80211_HT_CAP_SUP_WIDTH_20_40, |
| 350 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 351 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 352 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 353 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 354 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 355 | }; |
| 356 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 357 | /* This structure contain information what kind of frame are expected in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 358 | TX/RX direction for each kind of interface */ |
| 359 | static const struct ieee80211_txrx_stypes |
| 360 | wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = { |
| 361 | [NL80211_IFTYPE_STATION] = { |
| 362 | .tx = 0xffff, |
| 363 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 364 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 365 | }, |
| 366 | [NL80211_IFTYPE_AP] = { |
| 367 | .tx = 0xffff, |
| 368 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 369 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 370 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 371 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 372 | BIT(SIR_MAC_MGMT_AUTH) | |
| 373 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 374 | BIT(SIR_MAC_MGMT_ACTION), |
| 375 | }, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 376 | [NL80211_IFTYPE_ADHOC] = { |
| 377 | .tx = 0xffff, |
| 378 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 379 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 380 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 381 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 382 | BIT(SIR_MAC_MGMT_AUTH) | |
| 383 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 384 | BIT(SIR_MAC_MGMT_ACTION), |
| 385 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 386 | [NL80211_IFTYPE_P2P_CLIENT] = { |
| 387 | .tx = 0xffff, |
| 388 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 389 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 390 | }, |
| 391 | [NL80211_IFTYPE_P2P_GO] = { |
| 392 | /* This is also same as for SoftAP */ |
| 393 | .tx = 0xffff, |
| 394 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 395 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 396 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 397 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 398 | BIT(SIR_MAC_MGMT_AUTH) | |
| 399 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 400 | BIT(SIR_MAC_MGMT_ACTION), |
| 401 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 402 | }; |
| 403 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 404 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 405 | static const struct ieee80211_iface_limit |
| 406 | wlan_hdd_iface_limit[] = { |
| 407 | { |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 408 | /* max = 3 ; Our driver create two interfaces during driver init |
| 409 | * wlan0 and p2p0 interfaces. p2p0 is considered as station |
| 410 | * interface until a group is formed. In JB architecture, once the |
| 411 | * group is formed, interface type of p2p0 is changed to P2P GO or |
| 412 | * Client. |
| 413 | * When supplicant remove the group, it first issue a set interface |
| 414 | * cmd to change the mode back to Station. In JB this works fine as |
| 415 | * we advertize two station type interface during driver init. |
| 416 | * Some vendors create separate interface for P2P GO/Client, |
| 417 | * after group formation(Third one). But while group remove |
| 418 | * supplicant first tries to change the mode(3rd interface) to STATION |
| 419 | * But as we advertized only two sta type interfaces nl80211 was |
| 420 | * returning error for the third one which was leading to failure in |
| 421 | * delete interface. Ideally while removing the group, supplicant |
| 422 | * should not try to change the 3rd interface mode to Station type. |
| 423 | * Till we get a fix in wpa_supplicant, we advertize max STA |
| 424 | * interface type to 3 |
| 425 | */ |
| 426 | .max = 3, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 427 | .types = BIT(NL80211_IFTYPE_STATION), |
| 428 | }, |
| 429 | { |
| 430 | .max = 1, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 431 | .types = BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP), |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 432 | }, |
| 433 | { |
| 434 | .max = 1, |
| 435 | .types = BIT(NL80211_IFTYPE_P2P_GO) | |
| 436 | BIT(NL80211_IFTYPE_P2P_CLIENT), |
| 437 | }, |
| 438 | }; |
| 439 | |
| 440 | /* By default, only single channel concurrency is allowed */ |
| 441 | static struct ieee80211_iface_combination |
| 442 | wlan_hdd_iface_combination = { |
| 443 | .limits = wlan_hdd_iface_limit, |
| 444 | .num_different_channels = 1, |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 445 | /* |
| 446 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 447 | * and p2p0 interfaces during driver init |
| 448 | * Some vendors create separate interface for P2P operations. |
| 449 | * wlan0: STA interface |
| 450 | * p2p0: P2P Device interface, action frames goes |
| 451 | * through this interface. |
| 452 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 453 | * created for p2p operations(GO/CLIENT interface). |
| 454 | */ |
| 455 | .max_interfaces = WLAN_MAX_INTERFACES, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 456 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 457 | .beacon_int_infra_match = false, |
| 458 | }; |
| 459 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 460 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 461 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 462 | |
| 463 | /* Data rate 100KBPS based on IE Index */ |
| 464 | struct index_data_rate_type |
| 465 | { |
| 466 | v_U8_t beacon_rate_index; |
| 467 | v_U16_t supported_rate[4]; |
| 468 | }; |
| 469 | |
| 470 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 471 | The IDX field is the rate index |
| 472 | The HI field is the rate when RSSI is strong or being ignored |
| 473 | (in this case we report actual rate) |
| 474 | The MID field is the rate when RSSI is moderate |
| 475 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 476 | The LO field is the rate when RSSI is low |
| 477 | (in this case we don't report rates, actual current rate used) |
| 478 | */ |
| 479 | static const struct |
| 480 | { |
| 481 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 482 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 483 | } supported_data_rate[] = |
| 484 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 485 | /* IDX HI HM LM LO (RSSI-based index */ |
| 486 | {2, { 10, 10, 10, 0}}, |
| 487 | {4, { 20, 20, 10, 0}}, |
| 488 | {11, { 55, 20, 10, 0}}, |
| 489 | {12, { 60, 55, 20, 0}}, |
| 490 | {18, { 90, 55, 20, 0}}, |
| 491 | {22, {110, 55, 20, 0}}, |
| 492 | {24, {120, 90, 60, 0}}, |
| 493 | {36, {180, 120, 60, 0}}, |
| 494 | {44, {220, 180, 60, 0}}, |
| 495 | {48, {240, 180, 90, 0}}, |
| 496 | {66, {330, 180, 90, 0}}, |
| 497 | {72, {360, 240, 90, 0}}, |
| 498 | {96, {480, 240, 120, 0}}, |
| 499 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 500 | }; |
| 501 | |
| 502 | /* MCS Based rate table */ |
| 503 | static struct index_data_rate_type supported_mcs_rate[] = |
| 504 | { |
| 505 | /* MCS L20 L40 S20 S40 */ |
| 506 | {0, {65, 135, 72, 150}}, |
| 507 | {1, {130, 270, 144, 300}}, |
| 508 | {2, {195, 405, 217, 450}}, |
| 509 | {3, {260, 540, 289, 600}}, |
| 510 | {4, {390, 810, 433, 900}}, |
| 511 | {5, {520, 1080, 578, 1200}}, |
| 512 | {6, {585, 1215, 650, 1350}}, |
| 513 | {7, {650, 1350, 722, 1500}} |
| 514 | }; |
| 515 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 516 | #ifdef WLAN_FEATURE_11AC |
| 517 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 518 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 519 | |
| 520 | struct index_vht_data_rate_type |
| 521 | { |
| 522 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 523 | v_U16_t supported_VHT80_rate[2]; |
| 524 | v_U16_t supported_VHT40_rate[2]; |
| 525 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 526 | }; |
| 527 | |
| 528 | typedef enum |
| 529 | { |
| 530 | DATA_RATE_11AC_MAX_MCS_7, |
| 531 | DATA_RATE_11AC_MAX_MCS_8, |
| 532 | DATA_RATE_11AC_MAX_MCS_9, |
| 533 | DATA_RATE_11AC_MAX_MCS_NA |
| 534 | } eDataRate11ACMaxMcs; |
| 535 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 536 | /* SSID broadcast type */ |
| 537 | typedef enum eSSIDBcastType |
| 538 | { |
| 539 | eBCAST_UNKNOWN = 0, |
| 540 | eBCAST_NORMAL = 1, |
| 541 | eBCAST_HIDDEN = 2, |
| 542 | } tSSIDBcastType; |
| 543 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 544 | /* MCS Based VHT rate table */ |
| 545 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 546 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 547 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 548 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 549 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 550 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 551 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 552 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 553 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 554 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 555 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 556 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 557 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 558 | }; |
| 559 | #endif /* WLAN_FEATURE_11AC */ |
| 560 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 561 | /*array index points to MCS and array value points respective rssi*/ |
| 562 | static int rssiMcsTbl[][10] = |
| 563 | { |
| 564 | /*MCS 0 1 2 3 4 5 6 7 8 9*/ |
| 565 | {-82, -79, -77, -74, -70, -66, -65, -64, -59, -57}, //20 |
| 566 | {-79, -76, -74, -71, -67, -63, -62, -61, -56, -54}, //40 |
| 567 | {-76, -73, -71, -68, -64, -60, -59, -58, -53, -51} //80 |
| 568 | }; |
| 569 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 570 | extern struct net_device_ops net_ops_struct; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 571 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 572 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter); |
| 573 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 574 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 575 | #ifdef WLAN_NL80211_TESTMODE |
| 576 | enum wlan_hdd_tm_attr |
| 577 | { |
| 578 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 579 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 580 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 581 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 582 | /* keep last */ |
| 583 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 584 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 585 | }; |
| 586 | |
| 587 | enum wlan_hdd_tm_cmd |
| 588 | { |
| 589 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 590 | }; |
| 591 | |
| 592 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 593 | |
| 594 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 595 | { |
| 596 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 597 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 598 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 599 | }; |
| 600 | #endif /* WLAN_NL80211_TESTMODE */ |
| 601 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 602 | #ifdef FEATURE_WLAN_CH_AVOID |
| 603 | /* |
| 604 | * FUNCTION: wlan_hdd_send_avoid_freq_event |
| 605 | * This is called when wlan driver needs to send vendor specific |
| 606 | * avoid frequency range event to userspace |
| 607 | */ |
| 608 | int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx, |
| 609 | tHddAvoidFreqList *pAvoidFreqList) |
| 610 | { |
| 611 | struct sk_buff *vendor_event; |
| 612 | |
| 613 | ENTER(); |
| 614 | |
| 615 | if (!pHddCtx) |
| 616 | { |
| 617 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 618 | "%s: HDD context is null", __func__); |
| 619 | return -1; |
| 620 | } |
| 621 | |
| 622 | if (!pAvoidFreqList) |
| 623 | { |
| 624 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 625 | "%s: pAvoidFreqList is null", __func__); |
| 626 | return -1; |
| 627 | } |
| 628 | |
| 629 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 630 | sizeof(tHddAvoidFreqList), |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 631 | QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 632 | GFP_KERNEL); |
| 633 | if (!vendor_event) |
| 634 | { |
| 635 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 636 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 637 | return -1; |
| 638 | } |
| 639 | |
| 640 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 641 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 642 | |
| 643 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 644 | |
| 645 | EXIT(); |
| 646 | return 0; |
| 647 | } |
| 648 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 649 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 650 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 651 | |
| 652 | static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats, |
| 653 | struct sk_buff *vendor_event) |
| 654 | { |
| 655 | if (nla_put_u8(vendor_event, |
| 656 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_PREAMBLE, |
| 657 | stats->rate.preamble) || |
| 658 | nla_put_u8(vendor_event, |
| 659 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_NSS, |
| 660 | stats->rate.nss) || |
| 661 | nla_put_u8(vendor_event, |
| 662 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BW, |
| 663 | stats->rate.bw) || |
| 664 | nla_put_u8(vendor_event, |
| 665 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX, |
| 666 | stats->rate.rateMcsIdx) || |
| 667 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE, |
| 668 | stats->rate.bitrate ) || |
| 669 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU, |
| 670 | stats->txMpdu ) || |
| 671 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU, |
| 672 | stats->rxMpdu ) || |
| 673 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST, |
| 674 | stats->mpduLost ) || |
| 675 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES, |
| 676 | stats->retries) || |
| 677 | nla_put_u32(vendor_event, |
| 678 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT, |
| 679 | stats->retriesShort ) || |
| 680 | nla_put_u32(vendor_event, |
| 681 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG, |
| 682 | stats->retriesLong)) |
| 683 | { |
| 684 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 685 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 686 | return FALSE; |
| 687 | } |
| 688 | return TRUE; |
| 689 | } |
| 690 | |
| 691 | static v_BOOL_t put_wifi_peer_info( tpSirWifiPeerInfo stats, |
| 692 | struct sk_buff *vendor_event) |
| 693 | { |
| 694 | u32 i = 0; |
| 695 | struct nlattr *rateInfo; |
| 696 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE, |
| 697 | stats->type) || |
| 698 | nla_put(vendor_event, |
| 699 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS, |
| 700 | VOS_MAC_ADDR_SIZE, &stats->peerMacAddress[0]) || |
| 701 | nla_put_u32(vendor_event, |
| 702 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES, |
| 703 | stats->capabilities) || |
| 704 | nla_put_u32(vendor_event, |
| 705 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES, |
| 706 | stats->numRate)) |
| 707 | { |
| 708 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 709 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 710 | goto error; |
| 711 | } |
| 712 | |
| 713 | rateInfo = nla_nest_start(vendor_event, |
| 714 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 715 | if(!rateInfo) |
| 716 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 717 | for (i = 0; i < stats->numRate; i++) |
| 718 | { |
| 719 | struct nlattr *rates; |
| 720 | tpSirWifiRateStat pRateStats = (tpSirWifiRateStat )((uint8 *) |
| 721 | stats->rateStats + |
| 722 | (i * sizeof(tSirWifiRateStat))); |
| 723 | rates = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 724 | if(!rates) |
| 725 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 726 | |
| 727 | if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event)) |
| 728 | { |
| 729 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 730 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 731 | return FALSE; |
| 732 | } |
| 733 | nla_nest_end(vendor_event, rates); |
| 734 | } |
| 735 | nla_nest_end(vendor_event, rateInfo); |
| 736 | |
| 737 | return TRUE; |
| 738 | error: |
| 739 | return FALSE; |
| 740 | } |
| 741 | |
| 742 | static v_BOOL_t put_wifi_wmm_ac_stat( tpSirWifiWmmAcStat stats, |
| 743 | struct sk_buff *vendor_event) |
| 744 | { |
| 745 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_AC, |
| 746 | stats->ac ) || |
| 747 | nla_put_u32(vendor_event, |
| 748 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MPDU, |
| 749 | stats->txMpdu ) || |
| 750 | nla_put_u32(vendor_event, |
| 751 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MPDU, |
| 752 | stats->rxMpdu ) || |
| 753 | nla_put_u32(vendor_event, |
| 754 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MCAST, |
| 755 | stats->txMcast ) || |
| 756 | nla_put_u32(vendor_event, |
| 757 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MCAST, |
| 758 | stats->rxMcast ) || |
| 759 | nla_put_u32(vendor_event, |
| 760 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_AMPDU, |
| 761 | stats->rxAmpdu ) || |
| 762 | nla_put_u32(vendor_event, |
| 763 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_AMPDU, |
| 764 | stats->txAmpdu ) || |
| 765 | nla_put_u32(vendor_event, |
| 766 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_MPDU_LOST, |
| 767 | stats->mpduLost )|| |
| 768 | nla_put_u32(vendor_event, |
| 769 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES, |
| 770 | stats->retries ) || |
| 771 | nla_put_u32(vendor_event, |
| 772 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_SHORT, |
| 773 | stats->retriesShort ) || |
| 774 | nla_put_u32(vendor_event, |
| 775 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_LONG, |
| 776 | stats->retriesLong ) || |
| 777 | nla_put_u32(vendor_event, |
| 778 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MIN, |
| 779 | stats->contentionTimeMin ) || |
| 780 | nla_put_u32(vendor_event, |
| 781 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MAX, |
| 782 | stats->contentionTimeMax ) || |
| 783 | nla_put_u32(vendor_event, |
| 784 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_AVG, |
| 785 | stats->contentionTimeAvg ) || |
| 786 | nla_put_u32(vendor_event, |
| 787 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_NUM_SAMPLES, |
| 788 | stats->contentionNumSamples )) |
| 789 | { |
| 790 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 791 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 792 | return FALSE; |
| 793 | } |
| 794 | return TRUE; |
| 795 | } |
| 796 | |
| 797 | static v_BOOL_t put_wifi_interface_info(tpSirWifiInterfaceInfo stats, |
| 798 | struct sk_buff *vendor_event) |
| 799 | { |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 800 | if (nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 801 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE, stats->mode ) || |
| 802 | nla_put(vendor_event, |
| 803 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MAC_ADDR, |
| 804 | VOS_MAC_ADDR_SIZE, stats->macAddr) || |
| 805 | nla_put_u32(vendor_event, |
| 806 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_STATE, |
| 807 | stats->state ) || |
| 808 | nla_put_u32(vendor_event, |
| 809 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_ROAMING, |
| 810 | stats->roaming ) || |
| 811 | nla_put_u32(vendor_event, |
| 812 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_CAPABILITIES, |
| 813 | stats->capabilities ) || |
| 814 | nla_put(vendor_event, |
| 815 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_SSID, |
| 816 | strlen(stats->ssid), stats->ssid) || |
| 817 | nla_put(vendor_event, |
| 818 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_BSSID, |
| 819 | WNI_CFG_BSSID_LEN, stats->bssid) || |
| 820 | nla_put(vendor_event, |
| 821 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_AP_COUNTRY_STR, |
| 822 | WNI_CFG_COUNTRY_CODE_LEN, stats->apCountryStr) || |
| 823 | nla_put(vendor_event, |
| 824 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_COUNTRY_STR, |
| 825 | WNI_CFG_COUNTRY_CODE_LEN, stats->countryStr) |
| 826 | ) |
| 827 | { |
| 828 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 829 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 830 | return FALSE; |
| 831 | } |
| 832 | return TRUE; |
| 833 | } |
| 834 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 835 | static v_BOOL_t put_wifi_iface_stats(hdd_adapter_t *pAdapter, |
| 836 | tpSirWifiIfaceStat pWifiIfaceStat, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 837 | struct sk_buff *vendor_event) |
| 838 | { |
| 839 | int i = 0; |
| 840 | struct nlattr *wmmInfo; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 841 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 842 | WLANTL_InterfaceStatsType *pWifiIfaceStatTL = NULL; |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 843 | tSirWifiWmmAcStat accessclassStats; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 844 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 845 | if (FALSE == put_wifi_interface_info( |
| 846 | &pWifiIfaceStat->info, |
| 847 | vendor_event)) |
| 848 | { |
| 849 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 850 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 851 | return FALSE; |
| 852 | |
| 853 | } |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 854 | pWifiIfaceStatTL = (WLANTL_InterfaceStatsType *) |
| 855 | vos_mem_malloc(sizeof(WLANTL_InterfaceStatsType)); |
| 856 | if (NULL == pWifiIfaceStatTL) |
| 857 | { |
| 858 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 859 | return FALSE; |
| 860 | } |
| 861 | |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 862 | accessclassStats = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK]; |
| 863 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK] = |
| 864 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE]; |
| 865 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE] = accessclassStats; |
| 866 | |
| 867 | accessclassStats.ac = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac; |
| 868 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac = |
| 869 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac; |
| 870 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac = accessclassStats.ac; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 871 | |
| 872 | if ( pWifiIfaceStat->info.state == WIFI_ASSOCIATED) |
| 873 | { |
| 874 | if (VOS_STATUS_SUCCESS == |
| 875 | WLANTL_CollectInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 876 | pHddStaCtx->conn_info.staId[0], pWifiIfaceStatTL)) |
| 877 | { |
| 878 | /* mgmtRx, MgmtActionRx, rxMcast, rxMpdu, rxAmpdu, rssiData are |
| 879 | * obtained from TL structure |
| 880 | */ |
| 881 | |
| 882 | pWifiIfaceStat->mgmtRx = pWifiIfaceStat->beaconRx + |
| 883 | pWifiIfaceStatTL->mgmtRx; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 884 | pWifiIfaceStat->rssiData = pWifiIfaceStatTL->rssiData; |
| 885 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 886 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMcast |
| 887 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMcast; |
| 888 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMcast |
| 889 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMcast; |
| 890 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMcast |
| 891 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMcast; |
| 892 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMcast |
| 893 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMcast; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 894 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 895 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMpdu |
| 896 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMpdu; |
| 897 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMpdu |
| 898 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMpdu; |
| 899 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMpdu |
| 900 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMpdu; |
| 901 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMpdu |
| 902 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 903 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 904 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxAmpdu |
| 905 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxAmpdu; |
| 906 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxAmpdu |
| 907 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxAmpdu; |
| 908 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxAmpdu |
| 909 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxAmpdu; |
| 910 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxAmpdu |
| 911 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxAmpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 912 | } |
| 913 | else |
| 914 | { |
| 915 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in getting stats from TL")); |
| 916 | } |
| 917 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 918 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].txMcast = |
| 919 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO]; |
| 920 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].txMcast = |
| 921 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI]; |
| 922 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].txMcast = |
| 923 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE]; |
| 924 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].txMcast = |
| 925 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK]; |
| 926 | } |
| 927 | else |
| 928 | { |
| 929 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Interface not Associated")); |
| 930 | } |
| 931 | |
| 932 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 933 | |
| 934 | if (nla_put_u32(vendor_event, |
| 935 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX, |
| 936 | pWifiIfaceStat->beaconRx) || |
| 937 | nla_put_u32(vendor_event, |
| 938 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_RX, |
| 939 | pWifiIfaceStat->mgmtRx) || |
| 940 | nla_put_u32(vendor_event, |
| 941 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_RX, |
| 942 | pWifiIfaceStat->mgmtActionRx) || |
| 943 | nla_put_u32(vendor_event, |
| 944 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_TX, |
| 945 | pWifiIfaceStat->mgmtActionTx) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 946 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 947 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_MGMT, |
| 948 | pWifiIfaceStat->rssiMgmt) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 949 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 950 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_DATA, |
| 951 | pWifiIfaceStat->rssiData) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 952 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 953 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_ACK, |
| 954 | pWifiIfaceStat->rssiAck)) |
| 955 | { |
| 956 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 957 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 958 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 959 | return FALSE; |
| 960 | } |
| 961 | |
| 962 | wmmInfo = nla_nest_start(vendor_event, |
| 963 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 964 | if(!wmmInfo) |
| 965 | { |
| 966 | vos_mem_free(pWifiIfaceStatTL); |
| 967 | return FALSE; |
| 968 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 969 | for (i = 0; i < WIFI_AC_MAX; i++) |
| 970 | { |
| 971 | struct nlattr *wmmStats; |
| 972 | wmmStats = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 973 | if(!wmmStats) |
| 974 | { |
| 975 | vos_mem_free(pWifiIfaceStatTL); |
| 976 | return FALSE; |
| 977 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 978 | if (FALSE == put_wifi_wmm_ac_stat( |
| 979 | &pWifiIfaceStat->AccessclassStats[i], |
| 980 | vendor_event)) |
| 981 | { |
| 982 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 983 | FL("QCA_WLAN_VENDOR_ATTR put Fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 984 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 985 | return FALSE; |
| 986 | } |
| 987 | |
| 988 | nla_nest_end(vendor_event, wmmStats); |
| 989 | } |
| 990 | nla_nest_end(vendor_event, wmmInfo); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 991 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 992 | return TRUE; |
| 993 | } |
| 994 | |
| 995 | static tSirWifiInterfaceMode |
| 996 | hdd_map_device_to_ll_iface_mode ( int deviceMode ) |
| 997 | { |
| 998 | switch (deviceMode) |
| 999 | { |
| 1000 | case WLAN_HDD_INFRA_STATION: |
| 1001 | return WIFI_INTERFACE_STA; |
| 1002 | case WLAN_HDD_SOFTAP: |
| 1003 | return WIFI_INTERFACE_SOFTAP; |
| 1004 | case WLAN_HDD_P2P_CLIENT: |
| 1005 | return WIFI_INTERFACE_P2P_CLIENT; |
| 1006 | case WLAN_HDD_P2P_GO: |
| 1007 | return WIFI_INTERFACE_P2P_GO; |
| 1008 | case WLAN_HDD_IBSS: |
| 1009 | return WIFI_INTERFACE_IBSS; |
| 1010 | default: |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 1011 | return WIFI_INTERFACE_UNKNOWN; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1012 | } |
| 1013 | } |
| 1014 | |
| 1015 | static v_BOOL_t hdd_get_interface_info(hdd_adapter_t *pAdapter, |
| 1016 | tpSirWifiInterfaceInfo pInfo) |
| 1017 | { |
| 1018 | v_U8_t *staMac = NULL; |
| 1019 | hdd_station_ctx_t *pHddStaCtx; |
| 1020 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1021 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1022 | |
| 1023 | pInfo->mode = hdd_map_device_to_ll_iface_mode(pAdapter->device_mode); |
| 1024 | |
| 1025 | vos_mem_copy(pInfo->macAddr, |
| 1026 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 1027 | |
| 1028 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1029 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 1030 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))) |
| 1031 | { |
| 1032 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1033 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) |
| 1034 | { |
| 1035 | pInfo->state = WIFI_DISCONNECTED; |
| 1036 | } |
| 1037 | if (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) |
| 1038 | { |
| 1039 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1040 | "%s: Session ID %d, Connection is in progress", __func__, |
| 1041 | pAdapter->sessionId); |
| 1042 | pInfo->state = WIFI_ASSOCIATING; |
| 1043 | } |
| 1044 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 1045 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 1046 | { |
| 1047 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 1048 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1049 | "%s: client " MAC_ADDRESS_STR |
| 1050 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 1051 | MAC_ADDR_ARRAY(staMac)); |
| 1052 | pInfo->state = WIFI_AUTHENTICATING; |
| 1053 | } |
| 1054 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 1055 | { |
| 1056 | pInfo->state = WIFI_ASSOCIATED; |
| 1057 | vos_mem_copy(pInfo->bssid, |
| 1058 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 1059 | vos_mem_copy(pInfo->ssid, |
| 1060 | pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 1061 | pHddStaCtx->conn_info.SSID.SSID.length); |
| 1062 | //NULL Terminate the string. |
| 1063 | pInfo->ssid[pHddStaCtx->conn_info.SSID.SSID.length] = 0; |
| 1064 | } |
| 1065 | } |
| 1066 | vos_mem_copy(pInfo->countryStr, |
| 1067 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1068 | |
| 1069 | vos_mem_copy(pInfo->apCountryStr, |
| 1070 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1071 | |
| 1072 | return TRUE; |
| 1073 | } |
| 1074 | |
| 1075 | /* |
| 1076 | * hdd_link_layer_process_peer_stats () - This function is called after |
| 1077 | * receiving Link Layer Peer statistics from FW.This function converts |
| 1078 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1079 | * layers. |
| 1080 | */ |
| 1081 | static v_VOID_t hdd_link_layer_process_peer_stats(hdd_adapter_t *pAdapter, |
| 1082 | v_VOID_t *pData) |
| 1083 | { |
| 1084 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1085 | tpSirWifiRateStat pWifiRateStat; |
| 1086 | tpSirWifiPeerStat pWifiPeerStat; |
| 1087 | tpSirWifiPeerInfo pWifiPeerInfo; |
| 1088 | struct nlattr *peerInfo; |
| 1089 | struct sk_buff *vendor_event; |
| 1090 | int status, i; |
| 1091 | |
| 1092 | status = wlan_hdd_validate_context(pHddCtx); |
| 1093 | if (0 != status) |
| 1094 | { |
| 1095 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1096 | FL("HDD context is not valid") ); |
| 1097 | return; |
| 1098 | } |
| 1099 | |
| 1100 | pWifiPeerStat = (tpSirWifiPeerStat) pData; |
| 1101 | |
| 1102 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1103 | "LL_STATS_PEER_ALL : numPeers %u", |
| 1104 | pWifiPeerStat->numPeers); |
| 1105 | { |
| 1106 | for (i = 0; i < pWifiPeerStat->numPeers; i++) |
| 1107 | { |
| 1108 | pWifiPeerInfo = (tpSirWifiPeerInfo) |
| 1109 | ((uint8 *)pWifiPeerStat->peerInfo + |
| 1110 | ( i * sizeof(tSirWifiPeerInfo))); |
| 1111 | |
Dasari Srinivas | 1be0c4e | 2014-10-19 13:03:41 +0530 | [diff] [blame] | 1112 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) { |
| 1113 | pWifiPeerInfo->type = WIFI_PEER_AP; |
| 1114 | } |
| 1115 | if (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) { |
| 1116 | pWifiPeerInfo->type = WIFI_PEER_P2P_GO; |
| 1117 | } |
| 1118 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1119 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1120 | " %d) LL_STATS Channel Stats " |
| 1121 | " Peer Type %u " |
| 1122 | " peerMacAddress %pM " |
| 1123 | " capabilities 0x%x " |
| 1124 | " numRate %u ", |
| 1125 | i, |
| 1126 | pWifiPeerInfo->type, |
| 1127 | pWifiPeerInfo->peerMacAddress, |
| 1128 | pWifiPeerInfo->capabilities, |
| 1129 | pWifiPeerInfo->numRate); |
| 1130 | { |
| 1131 | int j; |
| 1132 | for (j = 0; j < pWifiPeerInfo->numRate; j++) |
| 1133 | { |
| 1134 | pWifiRateStat = (tpSirWifiRateStat) |
| 1135 | ((tANI_U8 *) pWifiPeerInfo->rateStats + |
| 1136 | ( j * sizeof(tSirWifiRateStat))); |
| 1137 | |
| 1138 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1139 | " peer Rate Stats " |
| 1140 | " preamble %u " |
| 1141 | " nss %u " |
| 1142 | " bw %u " |
| 1143 | " rateMcsIdx %u " |
| 1144 | " reserved %u " |
| 1145 | " bitrate %u " |
| 1146 | " txMpdu %u " |
| 1147 | " rxMpdu %u " |
| 1148 | " mpduLost %u " |
| 1149 | " retries %u " |
| 1150 | " retriesShort %u " |
| 1151 | " retriesLong %u", |
| 1152 | pWifiRateStat->rate.preamble, |
| 1153 | pWifiRateStat->rate.nss, |
| 1154 | pWifiRateStat->rate.bw, |
| 1155 | pWifiRateStat->rate.rateMcsIdx, |
| 1156 | pWifiRateStat->rate.reserved, |
| 1157 | pWifiRateStat->rate.bitrate, |
| 1158 | pWifiRateStat->txMpdu, |
| 1159 | pWifiRateStat->rxMpdu, |
| 1160 | pWifiRateStat->mpduLost, |
| 1161 | pWifiRateStat->retries, |
| 1162 | pWifiRateStat->retriesShort, |
| 1163 | pWifiRateStat->retriesLong); |
| 1164 | } |
| 1165 | } |
| 1166 | } |
| 1167 | } |
| 1168 | |
| 1169 | /* |
| 1170 | * Allocate a size of 4096 for the peer stats comprising |
| 1171 | * each of size = sizeof (tSirWifiPeerInfo) + numRate * |
| 1172 | * sizeof (tSirWifiRateStat).Each field is put with an |
| 1173 | * NL attribute.The size of 4096 is considered assuming |
| 1174 | * that number of rates shall not exceed beyond 50 with |
| 1175 | * the sizeof (tSirWifiRateStat) being 32. |
| 1176 | */ |
| 1177 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1178 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1179 | QCA_NL80211_VENDOR_SUBCMD_LL_PEER_INFO_STATS_INDEX, |
| 1180 | GFP_KERNEL); |
| 1181 | if (!vendor_event) |
| 1182 | { |
| 1183 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1184 | "%s: cfg80211_vendor_event_alloc failed", |
| 1185 | __func__); |
| 1186 | return; |
| 1187 | } |
| 1188 | if (nla_put_u32(vendor_event, |
| 1189 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS, |
| 1190 | pWifiPeerStat->numPeers)) |
| 1191 | { |
| 1192 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1193 | "%s: QCA_WLAN_VENDOR_ATTR put fail", __func__); |
| 1194 | kfree_skb(vendor_event); |
| 1195 | return; |
| 1196 | } |
| 1197 | |
| 1198 | peerInfo = nla_nest_start(vendor_event, |
| 1199 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1200 | if(!peerInfo) |
| 1201 | { |
| 1202 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1203 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO put fail", |
| 1204 | __func__); |
| 1205 | kfree_skb(vendor_event); |
| 1206 | return; |
| 1207 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1208 | |
| 1209 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1210 | pWifiPeerStat->peerInfo); |
| 1211 | |
| 1212 | for (i = 1; i <= pWifiPeerStat->numPeers; i++) |
| 1213 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1214 | int numRate = pWifiPeerInfo->numRate; |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1215 | struct nlattr *peers = nla_nest_start(vendor_event, i); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1216 | |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1217 | if(!peers) |
| 1218 | { |
| 1219 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1220 | "%s: peer stats put fail", |
| 1221 | __func__); |
| 1222 | kfree_skb(vendor_event); |
| 1223 | return; |
| 1224 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1225 | if (FALSE == put_wifi_peer_info( |
| 1226 | pWifiPeerInfo, vendor_event)) |
| 1227 | { |
| 1228 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1229 | "%s: put_wifi_peer_info put fail", __func__); |
| 1230 | kfree_skb(vendor_event); |
| 1231 | return; |
| 1232 | } |
| 1233 | |
| 1234 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1235 | pWifiPeerStat->peerInfo + |
| 1236 | (i * sizeof(tSirWifiPeerInfo)) + |
| 1237 | (numRate * sizeof (tSirWifiRateStat))); |
| 1238 | nla_nest_end(vendor_event, peers); |
| 1239 | } |
| 1240 | nla_nest_end(vendor_event, peerInfo); |
| 1241 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1242 | } |
| 1243 | |
| 1244 | /* |
| 1245 | * hdd_link_layer_process_iface_stats () - This function is called after |
| 1246 | * receiving Link Layer Interface statistics from FW.This function converts |
| 1247 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1248 | * layers. |
| 1249 | */ |
| 1250 | static v_VOID_t hdd_link_layer_process_iface_stats(hdd_adapter_t *pAdapter, |
| 1251 | v_VOID_t *pData) |
| 1252 | { |
| 1253 | tpSirWifiIfaceStat pWifiIfaceStat; |
| 1254 | struct sk_buff *vendor_event; |
| 1255 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1256 | int status; |
| 1257 | |
| 1258 | status = wlan_hdd_validate_context(pHddCtx); |
| 1259 | if (0 != status) |
| 1260 | { |
| 1261 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1262 | FL("HDD context is not valid") ); |
| 1263 | return; |
| 1264 | } |
| 1265 | /* |
| 1266 | * Allocate a size of 4096 for the interface stats comprising |
| 1267 | * sizeof (tpSirWifiIfaceStat).The size of 4096 is considered |
| 1268 | * assuming that all these fit with in the limit.Please take |
| 1269 | * a call on the limit based on the data requirements on |
| 1270 | * interface statistics. |
| 1271 | */ |
| 1272 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1273 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1274 | QCA_NL80211_VENDOR_SUBCMD_LL_IFACE_STATS_INDEX, |
| 1275 | GFP_KERNEL); |
| 1276 | if (!vendor_event) |
| 1277 | { |
| 1278 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1279 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1280 | return; |
| 1281 | } |
| 1282 | |
| 1283 | pWifiIfaceStat = (tpSirWifiIfaceStat) pData; |
| 1284 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1285 | |
| 1286 | if (FALSE == hdd_get_interface_info( pAdapter, |
| 1287 | &pWifiIfaceStat->info)) |
| 1288 | { |
| 1289 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1290 | FL("hdd_get_interface_info get fail") ); |
| 1291 | kfree_skb(vendor_event); |
| 1292 | return; |
| 1293 | } |
| 1294 | |
| 1295 | if (FALSE == put_wifi_iface_stats( pAdapter, pWifiIfaceStat, |
| 1296 | vendor_event)) |
| 1297 | { |
| 1298 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1299 | FL("put_wifi_iface_stats fail") ); |
| 1300 | kfree_skb(vendor_event); |
| 1301 | return; |
| 1302 | } |
| 1303 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1304 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1305 | "WMI_LINK_STATS_IFACE Data"); |
| 1306 | |
| 1307 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1308 | "LL_STATS_IFACE: " |
| 1309 | " Mode %u " |
| 1310 | " MAC %pM " |
| 1311 | " State %u " |
| 1312 | " Roaming %u " |
| 1313 | " capabilities 0x%x " |
| 1314 | " SSID %s " |
| 1315 | " BSSID %pM", |
| 1316 | pWifiIfaceStat->info.mode, |
| 1317 | pWifiIfaceStat->info.macAddr, |
| 1318 | pWifiIfaceStat->info.state, |
| 1319 | pWifiIfaceStat->info.roaming, |
| 1320 | pWifiIfaceStat->info.capabilities, |
| 1321 | pWifiIfaceStat->info.ssid, |
| 1322 | pWifiIfaceStat->info.bssid); |
| 1323 | |
| 1324 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1325 | " AP country str: %c%c%c", |
| 1326 | pWifiIfaceStat->info.apCountryStr[0], |
| 1327 | pWifiIfaceStat->info.apCountryStr[1], |
| 1328 | pWifiIfaceStat->info.apCountryStr[2]); |
| 1329 | |
| 1330 | |
| 1331 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1332 | " Country Str Association: %c%c%c", |
| 1333 | pWifiIfaceStat->info.countryStr[0], |
| 1334 | pWifiIfaceStat->info.countryStr[1], |
| 1335 | pWifiIfaceStat->info.countryStr[2]); |
| 1336 | |
| 1337 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1338 | " beaconRx %u " |
| 1339 | " mgmtRx %u " |
| 1340 | " mgmtActionRx %u " |
| 1341 | " mgmtActionTx %u " |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1342 | " rssiMgmt %d " |
| 1343 | " rssiData %d " |
| 1344 | " rssiAck %d", |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1345 | pWifiIfaceStat->beaconRx, |
| 1346 | pWifiIfaceStat->mgmtRx, |
| 1347 | pWifiIfaceStat->mgmtActionRx, |
| 1348 | pWifiIfaceStat->mgmtActionTx, |
| 1349 | pWifiIfaceStat->rssiMgmt, |
| 1350 | pWifiIfaceStat->rssiData, |
| 1351 | pWifiIfaceStat->rssiAck ); |
| 1352 | |
| 1353 | |
| 1354 | { |
| 1355 | int i; |
| 1356 | for (i = 0 ; i < WIFI_AC_MAX; i ++) |
| 1357 | { |
| 1358 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1359 | |
| 1360 | " %d) LL_STATS IFACE: " |
| 1361 | " ac: %u txMpdu: %u " |
| 1362 | " rxMpdu: %u txMcast: %u " |
| 1363 | " rxMcast: %u rxAmpdu: %u " |
| 1364 | " txAmpdu: %u mpduLost: %u " |
| 1365 | " retries: %u retriesShort: %u " |
| 1366 | " retriesLong: %u contentionTimeMin: %u " |
| 1367 | " contentionTimeMax: %u contentionTimeAvg: %u " |
| 1368 | " contentionNumSamples: %u", |
| 1369 | i, |
| 1370 | pWifiIfaceStat->AccessclassStats[i].ac, |
| 1371 | pWifiIfaceStat->AccessclassStats[i].txMpdu, |
| 1372 | pWifiIfaceStat->AccessclassStats[i].rxMpdu, |
| 1373 | pWifiIfaceStat->AccessclassStats[i].txMcast, |
| 1374 | pWifiIfaceStat->AccessclassStats[i].rxMcast, |
| 1375 | pWifiIfaceStat->AccessclassStats[i].rxAmpdu, |
| 1376 | pWifiIfaceStat->AccessclassStats[i].txAmpdu, |
| 1377 | pWifiIfaceStat->AccessclassStats[i].mpduLost, |
| 1378 | pWifiIfaceStat->AccessclassStats[i].retries, |
| 1379 | pWifiIfaceStat-> |
| 1380 | AccessclassStats[i].retriesShort, |
| 1381 | pWifiIfaceStat->AccessclassStats[i].retriesLong, |
| 1382 | pWifiIfaceStat-> |
| 1383 | AccessclassStats[i].contentionTimeMin, |
| 1384 | pWifiIfaceStat-> |
| 1385 | AccessclassStats[i].contentionTimeMax, |
| 1386 | pWifiIfaceStat-> |
| 1387 | AccessclassStats[i].contentionTimeAvg, |
| 1388 | pWifiIfaceStat-> |
| 1389 | AccessclassStats[i].contentionNumSamples); |
| 1390 | |
| 1391 | } |
| 1392 | } |
| 1393 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1394 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1395 | } |
| 1396 | |
| 1397 | /* |
| 1398 | * hdd_link_layer_process_radio_stats () - This function is called after |
| 1399 | * receiving Link Layer Radio statistics from FW.This function converts |
| 1400 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1401 | * layers. |
| 1402 | */ |
| 1403 | static v_VOID_t hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, |
| 1404 | v_VOID_t *pData) |
| 1405 | { |
| 1406 | int status, i; |
| 1407 | tpSirWifiRadioStat pWifiRadioStat; |
| 1408 | tpSirWifiChannelStats pWifiChannelStats; |
| 1409 | struct sk_buff *vendor_event; |
| 1410 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1411 | struct nlattr *chList; |
| 1412 | |
| 1413 | status = wlan_hdd_validate_context(pHddCtx); |
| 1414 | if (0 != status) |
| 1415 | { |
| 1416 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1417 | FL("HDD context is not valid") ); |
| 1418 | return; |
| 1419 | } |
| 1420 | pWifiRadioStat = (tpSirWifiRadioStat) pData; |
| 1421 | |
| 1422 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1423 | "LL_STATS_RADIO" |
| 1424 | " radio is %d onTime is %u " |
| 1425 | " txTime is %u rxTime is %u " |
| 1426 | " onTimeScan is %u onTimeNbd is %u " |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1427 | " onTimeEXTScan is %u onTimeRoamScan is %u " |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1428 | " onTimePnoScan is %u onTimeHs20 is %u " |
| 1429 | " numChannels is %u", |
| 1430 | pWifiRadioStat->radio, pWifiRadioStat->onTime, |
| 1431 | pWifiRadioStat->txTime, pWifiRadioStat->rxTime, |
| 1432 | pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1433 | pWifiRadioStat->onTimeEXTScan, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1434 | pWifiRadioStat->onTimeRoamScan, |
| 1435 | pWifiRadioStat->onTimePnoScan, |
| 1436 | pWifiRadioStat->onTimeHs20, |
| 1437 | pWifiRadioStat->numChannels); |
| 1438 | /* |
| 1439 | * Allocate a size of 4096 for the Radio stats comprising |
| 1440 | * sizeof (tSirWifiRadioStat) + numChannels * sizeof |
| 1441 | * (tSirWifiChannelStats).Each channel data is put with an |
| 1442 | * NL attribute.The size of 4096 is considered assuming that |
| 1443 | * number of channels shall not exceed beyond 60 with the |
| 1444 | * sizeof (tSirWifiChannelStats) being 24 bytes. |
| 1445 | */ |
| 1446 | |
| 1447 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1448 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN , |
| 1449 | QCA_NL80211_VENDOR_SUBCMD_LL_RADIO_STATS_INDEX, |
| 1450 | GFP_KERNEL); |
| 1451 | |
| 1452 | if (!vendor_event) |
| 1453 | { |
| 1454 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1455 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1456 | return; |
| 1457 | } |
| 1458 | |
| 1459 | if (nla_put_u32(vendor_event, |
| 1460 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID, |
| 1461 | pWifiRadioStat->radio) || |
| 1462 | nla_put_u32(vendor_event, |
| 1463 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME, |
| 1464 | pWifiRadioStat->onTime) || |
| 1465 | nla_put_u32(vendor_event, |
| 1466 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME, |
| 1467 | pWifiRadioStat->txTime) || |
| 1468 | nla_put_u32(vendor_event, |
| 1469 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME, |
| 1470 | pWifiRadioStat->rxTime) || |
| 1471 | nla_put_u32(vendor_event, |
| 1472 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN, |
| 1473 | pWifiRadioStat->onTimeScan) || |
| 1474 | nla_put_u32(vendor_event, |
| 1475 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD, |
| 1476 | pWifiRadioStat->onTimeNbd) || |
| 1477 | nla_put_u32(vendor_event, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1478 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_EXTSCAN, |
| 1479 | pWifiRadioStat->onTimeEXTScan)|| |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1480 | nla_put_u32(vendor_event, |
| 1481 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN, |
| 1482 | pWifiRadioStat->onTimeRoamScan) || |
| 1483 | nla_put_u32(vendor_event, |
| 1484 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN, |
| 1485 | pWifiRadioStat->onTimePnoScan) || |
| 1486 | nla_put_u32(vendor_event, |
| 1487 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20, |
| 1488 | pWifiRadioStat->onTimeHs20) || |
| 1489 | nla_put_u32(vendor_event, |
| 1490 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS, |
| 1491 | pWifiRadioStat->numChannels)) |
| 1492 | { |
| 1493 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1494 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1495 | kfree_skb(vendor_event); |
| 1496 | return ; |
| 1497 | } |
| 1498 | |
| 1499 | chList = nla_nest_start(vendor_event, |
| 1500 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1501 | if(!chList) |
| 1502 | { |
| 1503 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1504 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO put fail", |
| 1505 | __func__); |
| 1506 | kfree_skb(vendor_event); |
| 1507 | return; |
| 1508 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1509 | for (i = 0; i < pWifiRadioStat->numChannels; i++) |
| 1510 | { |
| 1511 | struct nlattr *chInfo; |
| 1512 | |
| 1513 | pWifiChannelStats = (tpSirWifiChannelStats) ((uint8*) |
| 1514 | pWifiRadioStat->channels + |
| 1515 | (i * sizeof(tSirWifiChannelStats))); |
| 1516 | |
| 1517 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1518 | " %d) Channel Info" |
| 1519 | " width is %u " |
| 1520 | " CenterFreq %u " |
| 1521 | " CenterFreq0 %u " |
| 1522 | " CenterFreq1 %u " |
| 1523 | " onTime %u " |
| 1524 | " ccaBusyTime %u", |
| 1525 | i, |
| 1526 | pWifiChannelStats->channel.width, |
| 1527 | pWifiChannelStats->channel.centerFreq, |
| 1528 | pWifiChannelStats->channel.centerFreq0, |
| 1529 | pWifiChannelStats->channel.centerFreq1, |
| 1530 | pWifiChannelStats->onTime, |
| 1531 | pWifiChannelStats->ccaBusyTime); |
| 1532 | |
| 1533 | |
| 1534 | chInfo = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1535 | if(!chInfo) |
| 1536 | { |
| 1537 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1538 | "%s: failed to put chInfo", |
| 1539 | __func__); |
| 1540 | kfree_skb(vendor_event); |
| 1541 | return; |
| 1542 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1543 | |
| 1544 | if (nla_put_u32(vendor_event, |
| 1545 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH, |
| 1546 | pWifiChannelStats->channel.width) || |
| 1547 | nla_put_u32(vendor_event, |
| 1548 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ, |
| 1549 | pWifiChannelStats->channel.centerFreq) || |
| 1550 | nla_put_u32(vendor_event, |
| 1551 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ0, |
| 1552 | pWifiChannelStats->channel.centerFreq0) || |
| 1553 | nla_put_u32(vendor_event, |
| 1554 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ1, |
| 1555 | pWifiChannelStats->channel.centerFreq1) || |
| 1556 | nla_put_u32(vendor_event, |
| 1557 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME, |
| 1558 | pWifiChannelStats->onTime) || |
| 1559 | nla_put_u32(vendor_event, |
| 1560 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME, |
| 1561 | pWifiChannelStats->ccaBusyTime)) |
| 1562 | { |
| 1563 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1564 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1565 | kfree_skb(vendor_event); |
| 1566 | return ; |
| 1567 | } |
| 1568 | nla_nest_end(vendor_event, chInfo); |
| 1569 | } |
| 1570 | nla_nest_end(vendor_event, chList); |
| 1571 | |
| 1572 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 1573 | return; |
| 1574 | } |
| 1575 | |
| 1576 | /* |
| 1577 | * hdd_link_layer_stats_ind_callback () - This function is called after |
| 1578 | * receiving Link Layer indications from FW.This callback converts the firmware |
| 1579 | * data to the NL data and send the same to the kernel/upper layers. |
| 1580 | */ |
| 1581 | static void hdd_link_layer_stats_ind_callback ( void *pCtx, |
| 1582 | int indType, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1583 | void *pRsp, u8 *macAddr) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1584 | { |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1585 | hdd_context_t *pHddCtx = (hdd_context_t *)pCtx; |
| 1586 | hdd_adapter_t *pAdapter = NULL; |
| 1587 | tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults)pRsp; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1588 | int status; |
| 1589 | |
| 1590 | status = wlan_hdd_validate_context(pHddCtx); |
| 1591 | |
| 1592 | if (0 != status) |
| 1593 | { |
| 1594 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1595 | FL("HDD context is not valid")); |
| 1596 | return; |
| 1597 | } |
| 1598 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1599 | |
| 1600 | |
| 1601 | pAdapter = hdd_get_adapter_by_macaddr(pHddCtx, macAddr); |
| 1602 | if (NULL == pAdapter) |
| 1603 | { |
| 1604 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1605 | FL(" MAC address %pM does not exist with host"), |
| 1606 | macAddr); |
| 1607 | return; |
| 1608 | } |
| 1609 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1610 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1611 | "%s: Interface: %s LLStats indType: %d", __func__, |
| 1612 | pAdapter->dev->name, indType); |
| 1613 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1614 | switch (indType) |
| 1615 | { |
| 1616 | case SIR_HAL_LL_STATS_RESULTS_RSP: |
| 1617 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1618 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1619 | FL("RESPONSE SIR_HAL_LL_STATS_RESULTS_RSP") ); |
| 1620 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1621 | "LL_STATS RESULTS RESPONSE paramID = 0x%x", |
| 1622 | linkLayerStatsResults->paramId); |
| 1623 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1624 | "LL_STATS RESULTS RESPONSE ifaceId = %u MAC: %pM", |
| 1625 | linkLayerStatsResults->ifaceId, macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1626 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1627 | "LL_STATS RESULTS RESPONSE respId = %u", |
| 1628 | linkLayerStatsResults->respId); |
| 1629 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1630 | "LL_STATS RESULTS RESPONSE moreResultToFollow = %u", |
| 1631 | linkLayerStatsResults->moreResultToFollow); |
| 1632 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1633 | "LL_STATS RESULTS RESPONSE result = %p", |
| 1634 | linkLayerStatsResults->result); |
| 1635 | if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO ) |
| 1636 | { |
| 1637 | hdd_link_layer_process_radio_stats(pAdapter, |
| 1638 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1639 | } |
| 1640 | else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE ) |
| 1641 | { |
| 1642 | hdd_link_layer_process_iface_stats(pAdapter, |
| 1643 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1644 | } |
| 1645 | else if ( linkLayerStatsResults->paramId & |
| 1646 | WMI_LINK_STATS_ALL_PEER ) |
| 1647 | { |
| 1648 | hdd_link_layer_process_peer_stats(pAdapter, |
| 1649 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1650 | } /* WMI_LINK_STATS_ALL_PEER */ |
| 1651 | else |
| 1652 | { |
| 1653 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1654 | FL("INVALID LL_STATS_NOTIFY RESPONSE ***********")); |
| 1655 | } |
| 1656 | |
| 1657 | break; |
| 1658 | } |
| 1659 | default: |
| 1660 | hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType); |
| 1661 | break; |
| 1662 | } |
| 1663 | return; |
| 1664 | } |
| 1665 | |
| 1666 | const struct |
| 1667 | nla_policy |
| 1668 | qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX +1] = |
| 1669 | { |
| 1670 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = |
| 1671 | { .type = NLA_U32 }, |
| 1672 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = |
| 1673 | { .type = NLA_U32 }, |
| 1674 | }; |
| 1675 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1676 | static int __wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1677 | struct wireless_dev *wdev, |
| 1678 | const void *data, |
| 1679 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1680 | { |
| 1681 | int status; |
| 1682 | 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] | 1683 | tSirLLStatsSetReq linkLayerStatsSetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1684 | struct net_device *dev = wdev->netdev; |
| 1685 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1686 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1687 | hdd_station_ctx_t *pHddStaCtx; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1688 | |
| 1689 | status = wlan_hdd_validate_context(pHddCtx); |
| 1690 | if (0 != status) |
| 1691 | { |
| 1692 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1693 | FL("HDD context is not valid")); |
| 1694 | return -EINVAL; |
| 1695 | } |
| 1696 | |
| 1697 | if (NULL == pAdapter) |
| 1698 | { |
| 1699 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1700 | FL("HDD adapter is Null")); |
| 1701 | return -ENODEV; |
| 1702 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1703 | /* check the LLStats Capability */ |
| 1704 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1705 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1706 | { |
| 1707 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1708 | FL("Link Layer Statistics not supported by Firmware")); |
| 1709 | return -EINVAL; |
| 1710 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1711 | |
| 1712 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, |
| 1713 | (struct nlattr *)data, |
| 1714 | data_len, qca_wlan_vendor_ll_set_policy)) |
| 1715 | { |
| 1716 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1717 | return -EINVAL; |
| 1718 | } |
| 1719 | if (!tb_vendor |
| 1720 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]) |
| 1721 | { |
| 1722 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MPDU size Not present")); |
| 1723 | return -EINVAL; |
| 1724 | } |
| 1725 | if (!tb_vendor[ |
| 1726 | QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]) |
| 1727 | { |
| 1728 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Stats Gathering Not Present")); |
| 1729 | return -EINVAL; |
| 1730 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1731 | // 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] | 1732 | linkLayerStatsSetReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1733 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1734 | linkLayerStatsSetReq.mpduSizeThreshold = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1735 | nla_get_u32( |
| 1736 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]); |
| 1737 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1738 | linkLayerStatsSetReq.aggressiveStatisticsGathering = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1739 | nla_get_u32( |
| 1740 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]); |
| 1741 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1742 | vos_mem_copy(linkLayerStatsSetReq.macAddr, |
| 1743 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1744 | |
| 1745 | |
| 1746 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1747 | "LL_STATS_SET reqId = %d", linkLayerStatsSetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1748 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1749 | "LL_STATS_SET MAC = %pM", linkLayerStatsSetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1750 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1751 | "LL_STATS_SET mpduSizeThreshold = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1752 | linkLayerStatsSetReq.mpduSizeThreshold); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1753 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1754 | "LL_STATS_SET aggressive Statistics Gathering = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1755 | linkLayerStatsSetReq.aggressiveStatisticsGathering); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1756 | |
| 1757 | if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB( |
| 1758 | pHddCtx->hHal, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1759 | hdd_link_layer_stats_ind_callback)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1760 | { |
| 1761 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1762 | "sme_SetLinkLayerStatsIndCB Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1763 | return -EINVAL; |
| 1764 | |
| 1765 | } |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1766 | |
| 1767 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1768 | if (VOS_STATUS_SUCCESS != |
| 1769 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1770 | pHddStaCtx->conn_info.staId[0], WIFI_STATS_IFACE)) |
| 1771 | { |
| 1772 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1773 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 1774 | return -EINVAL; |
| 1775 | } |
| 1776 | |
| 1777 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 1778 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 1779 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 1780 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 1781 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1782 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1783 | &linkLayerStatsSetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1784 | { |
| 1785 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1786 | "sme_LLStatsSetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1787 | return -EINVAL; |
| 1788 | } |
| 1789 | |
| 1790 | pAdapter->isLinkLayerStatsSet = 1; |
| 1791 | |
| 1792 | return 0; |
| 1793 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1794 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1795 | struct wireless_dev *wdev, |
| 1796 | const void *data, |
| 1797 | int data_len) |
| 1798 | { |
| 1799 | int ret = 0; |
| 1800 | |
| 1801 | vos_ssr_protect(__func__); |
| 1802 | ret = __wlan_hdd_cfg80211_ll_stats_set(wiphy, wdev, data, data_len); |
| 1803 | vos_ssr_unprotect(__func__); |
| 1804 | |
| 1805 | return ret; |
| 1806 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1807 | |
| 1808 | const struct |
| 1809 | nla_policy |
| 1810 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 1811 | { |
| 1812 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 1813 | * command. When reporting |
| 1814 | * the stats results, the driver uses the same value to indicate |
| 1815 | * which GET request the results |
| 1816 | * correspond to. |
| 1817 | */ |
| 1818 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 1819 | |
| 1820 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 1821 | requested for retrieval */ |
| 1822 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 1823 | }; |
| 1824 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1825 | static int __wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1826 | struct wireless_dev *wdev, |
| 1827 | const void *data, |
| 1828 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1829 | { |
| 1830 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1831 | 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] | 1832 | tSirLLStatsGetReq linkLayerStatsGetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1833 | struct net_device *dev = wdev->netdev; |
| 1834 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1835 | int status; |
| 1836 | |
| 1837 | status = wlan_hdd_validate_context(pHddCtx); |
| 1838 | if (0 != status) |
| 1839 | { |
| 1840 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1841 | FL("HDD context is not valid")); |
| 1842 | return -EINVAL ; |
| 1843 | } |
| 1844 | |
| 1845 | if (NULL == pAdapter) |
| 1846 | { |
| 1847 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1848 | "%s: HDD adapter is Null", __func__); |
| 1849 | return -ENODEV; |
| 1850 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1851 | /* check the LLStats Capability */ |
| 1852 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1853 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1854 | { |
| 1855 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1856 | FL("Link Layer Statistics not supported by Firmware")); |
| 1857 | return -EINVAL; |
| 1858 | } |
| 1859 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1860 | |
| 1861 | if (!pAdapter->isLinkLayerStatsSet) |
| 1862 | { |
| 1863 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1864 | "%s: isLinkLayerStatsSet : %d", |
| 1865 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1866 | return -EINVAL; |
| 1867 | } |
| 1868 | |
| 1869 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 1870 | (struct nlattr *)data, |
| 1871 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 1872 | { |
| 1873 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1874 | return -EINVAL; |
| 1875 | } |
| 1876 | |
| 1877 | if (!tb_vendor |
| 1878 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 1879 | { |
| 1880 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 1881 | return -EINVAL; |
| 1882 | } |
| 1883 | |
| 1884 | if (!tb_vendor |
| 1885 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 1886 | { |
| 1887 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 1888 | return -EINVAL; |
| 1889 | } |
| 1890 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1891 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1892 | linkLayerStatsGetReq.reqId = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1893 | nla_get_u32( tb_vendor[ |
| 1894 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1895 | linkLayerStatsGetReq.paramIdMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1896 | nla_get_u32( tb_vendor[ |
| 1897 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 1898 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1899 | vos_mem_copy(linkLayerStatsGetReq.macAddr, |
| 1900 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1901 | |
| 1902 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1903 | "LL_STATS_GET reqId = %d", linkLayerStatsGetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1904 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1905 | "LL_STATS_GET MAC = %pM", linkLayerStatsGetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1906 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1907 | "LL_STATS_GET paramIdMask = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1908 | linkLayerStatsGetReq.paramIdMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1909 | |
| 1910 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1911 | &linkLayerStatsGetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1912 | { |
| 1913 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1914 | "sme_LLStatsGetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1915 | return -EINVAL; |
| 1916 | } |
| 1917 | return 0; |
| 1918 | } |
| 1919 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1920 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1921 | struct wireless_dev *wdev, |
| 1922 | const void *data, |
| 1923 | int data_len) |
| 1924 | { |
| 1925 | int ret = 0; |
| 1926 | |
| 1927 | vos_ssr_protect(__func__); |
| 1928 | ret = __wlan_hdd_cfg80211_ll_stats_get(wiphy, wdev, data, data_len); |
| 1929 | vos_ssr_unprotect(__func__); |
| 1930 | |
| 1931 | return ret; |
| 1932 | } |
| 1933 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1934 | const struct |
| 1935 | nla_policy |
| 1936 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 1937 | { |
| 1938 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 1939 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 1940 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 1941 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 1942 | }; |
| 1943 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1944 | static int __wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 1945 | struct wireless_dev *wdev, |
| 1946 | const void *data, |
| 1947 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1948 | { |
| 1949 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1950 | 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] | 1951 | tSirLLStatsClearReq linkLayerStatsClearReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1952 | struct net_device *dev = wdev->netdev; |
| 1953 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1954 | u32 statsClearReqMask; |
| 1955 | u8 stopReq; |
| 1956 | int status; |
| 1957 | |
| 1958 | status = wlan_hdd_validate_context(pHddCtx); |
| 1959 | if (0 != status) |
| 1960 | { |
| 1961 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1962 | FL("HDD context is not valid")); |
| 1963 | return -EINVAL; |
| 1964 | } |
| 1965 | |
| 1966 | if (NULL == pAdapter) |
| 1967 | { |
| 1968 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1969 | "%s: HDD adapter is Null", __func__); |
| 1970 | return -ENODEV; |
| 1971 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1972 | /* check the LLStats Capability */ |
| 1973 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1974 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1975 | { |
| 1976 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1977 | FL("Enable LLStats Capability")); |
| 1978 | return -EINVAL; |
| 1979 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1980 | |
| 1981 | if (!pAdapter->isLinkLayerStatsSet) |
| 1982 | { |
| 1983 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1984 | "%s: isLinkLayerStatsSet : %d", |
| 1985 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1986 | return -EINVAL; |
| 1987 | } |
| 1988 | |
| 1989 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 1990 | (struct nlattr *)data, |
| 1991 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 1992 | { |
| 1993 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1994 | return -EINVAL; |
| 1995 | } |
| 1996 | |
| 1997 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 1998 | |
| 1999 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 2000 | { |
| 2001 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 2002 | return -EINVAL; |
| 2003 | |
| 2004 | } |
| 2005 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2006 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2007 | statsClearReqMask = linkLayerStatsClearReq.statsClearReqMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2008 | nla_get_u32( |
| 2009 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 2010 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2011 | stopReq = linkLayerStatsClearReq.stopReq = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2012 | nla_get_u8( |
| 2013 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 2014 | |
| 2015 | // 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] | 2016 | linkLayerStatsClearReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2017 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2018 | vos_mem_copy(linkLayerStatsClearReq.macAddr, |
| 2019 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2020 | |
| 2021 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2022 | "LL_STATS_CLEAR reqId = %d", linkLayerStatsClearReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2023 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2024 | "LL_STATS_CLEAR MAC = %pM", linkLayerStatsClearReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2025 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2026 | "LL_STATS_CLEAR statsClearReqMask = 0x%X", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2027 | linkLayerStatsClearReq.statsClearReqMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2028 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2029 | "LL_STATS_CLEAR stopReq = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2030 | linkLayerStatsClearReq.stopReq); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2031 | |
| 2032 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2033 | &linkLayerStatsClearReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2034 | { |
| 2035 | struct sk_buff *temp_skbuff; |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 2036 | hdd_station_ctx_t *pHddStaCtx; |
| 2037 | |
| 2038 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2039 | if (VOS_STATUS_SUCCESS != |
| 2040 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 2041 | pHddStaCtx->conn_info.staId[0], statsClearReqMask)) |
| 2042 | { |
| 2043 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2044 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 2045 | return -EINVAL; |
| 2046 | } |
| 2047 | if ((statsClearReqMask & WIFI_STATS_IFACE_AC) || |
| 2048 | (statsClearReqMask & WIFI_STATS_IFACE)) { |
| 2049 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 2050 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 2051 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 2052 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 2053 | } |
| 2054 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2055 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 2056 | 2 * sizeof(u32) + |
| 2057 | NLMSG_HDRLEN); |
| 2058 | |
| 2059 | if (temp_skbuff != NULL) |
| 2060 | { |
| 2061 | |
| 2062 | if (nla_put_u32(temp_skbuff, |
| 2063 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 2064 | statsClearReqMask) || |
| 2065 | nla_put_u32(temp_skbuff, |
| 2066 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 2067 | stopReq)) |
| 2068 | { |
| 2069 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 2070 | kfree_skb(temp_skbuff); |
| 2071 | return -EINVAL; |
| 2072 | } |
| 2073 | /* If the ask is to stop the stats collection as part of clear |
| 2074 | * (stopReq = 1) , ensure that no further requests of get |
| 2075 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 2076 | * However it the stopReq as part of the clear request is 0 , |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2077 | * the request to get the statistics are honoured as in this |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2078 | * case the firmware is just asked to clear the statistics. |
| 2079 | */ |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2080 | if (linkLayerStatsClearReq.stopReq == 1) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2081 | pAdapter->isLinkLayerStatsSet = 0; |
| 2082 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 2083 | } |
| 2084 | return -ENOMEM; |
| 2085 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2086 | return -EINVAL; |
| 2087 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2088 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 2089 | struct wireless_dev *wdev, |
| 2090 | const void *data, |
| 2091 | int data_len) |
| 2092 | { |
| 2093 | int ret = 0; |
| 2094 | |
| 2095 | vos_ssr_protect(__func__); |
| 2096 | ret = __wlan_hdd_cfg80211_ll_stats_clear(wiphy, wdev, data, data_len); |
| 2097 | vos_ssr_unprotect(__func__); |
| 2098 | |
| 2099 | return ret; |
| 2100 | |
| 2101 | |
| 2102 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2103 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 2104 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2105 | #ifdef WLAN_FEATURE_EXTSCAN |
| 2106 | static const struct nla_policy |
| 2107 | wlan_hdd_extscan_config_policy |
| 2108 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = |
| 2109 | { |
| 2110 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = |
| 2111 | { .type = NLA_U32 }, |
| 2112 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = |
| 2113 | { .type = NLA_U32 }, |
| 2114 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 }, |
| 2115 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = |
| 2116 | { .type = NLA_U32 }, |
| 2117 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = { .type = NLA_U8 }, |
| 2118 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = { .type = NLA_U8 }, |
| 2119 | |
| 2120 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = { .type = NLA_U8 }, |
| 2121 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = { .type = NLA_U8 }, |
| 2122 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 }, |
| 2123 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = |
| 2124 | { .type = NLA_U8 }, |
| 2125 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = |
| 2126 | { .type = NLA_U32 }, |
| 2127 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = |
| 2128 | { .type = NLA_U32 }, |
| 2129 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = |
| 2130 | { .type = NLA_U32 }, |
| 2131 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD] = |
| 2132 | { .type = NLA_U8 }, |
| 2133 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = |
| 2134 | { .type = NLA_U8 }, |
| 2135 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = |
| 2136 | { .type = NLA_U8 }, |
| 2137 | |
| 2138 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = |
| 2139 | { .type = NLA_U32 }, |
| 2140 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = |
| 2141 | { .type = NLA_UNSPEC }, |
| 2142 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = |
| 2143 | { .type = NLA_S32 }, |
| 2144 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = |
| 2145 | { .type = NLA_S32 }, |
| 2146 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = |
| 2147 | { .type = NLA_U32 }, |
| 2148 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = |
| 2149 | { .type = NLA_U32 }, |
| 2150 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE] = |
| 2151 | { .type = NLA_U32 }, |
| 2152 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE] |
| 2153 | = { .type = NLA_U32 }, |
| 2154 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING] = |
| 2155 | { .type = NLA_U32 }, |
| 2156 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP] = { .type = |
| 2157 | NLA_U32 }, |
| 2158 | }; |
| 2159 | |
| 2160 | static void wlan_hdd_cfg80211_extscan_get_capabilities_ind(void *ctx, void *pMsg) |
| 2161 | { |
| 2162 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2163 | struct sk_buff *skb = NULL; |
| 2164 | tpSirEXTScanCapabilitiesEvent pData = |
| 2165 | (tpSirEXTScanCapabilitiesEvent) pMsg; |
| 2166 | |
| 2167 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2168 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2169 | "or pData(%p) is null"), pData); |
| 2170 | return; |
| 2171 | } |
| 2172 | |
| 2173 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2174 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2175 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES_INDEX, |
| 2176 | GFP_KERNEL); |
| 2177 | |
| 2178 | if (!skb) { |
| 2179 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2180 | FL("cfg80211_vendor_event_alloc failed")); |
| 2181 | return; |
| 2182 | } |
| 2183 | |
| 2184 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2185 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan cache size (%u)", pData->scanCacheSize); |
| 2186 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan buckets (%u)", pData->scanBuckets); |
| 2187 | hddLog(VOS_TRACE_LEVEL_INFO, "Max AP per scan (%u)", pData->maxApPerScan); |
| 2188 | hddLog(VOS_TRACE_LEVEL_INFO, "maxRssiSampleSize (%u)", |
| 2189 | pData->maxRssiSampleSize); |
| 2190 | hddLog(VOS_TRACE_LEVEL_INFO, "maxScanReportingThreshold (%u)", |
| 2191 | pData->maxScanReportingThreshold); |
| 2192 | hddLog(VOS_TRACE_LEVEL_INFO, "maxHotlistAPs (%u)", pData->maxHotlistAPs); |
| 2193 | hddLog(VOS_TRACE_LEVEL_INFO, "maxSignificantWifiChangeAPs (%u)", |
| 2194 | pData->maxSignificantWifiChangeAPs); |
| 2195 | hddLog(VOS_TRACE_LEVEL_INFO, "maxBsidHistoryEntries (%u)", |
| 2196 | pData->maxBsidHistoryEntries); |
| 2197 | |
| 2198 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2199 | pData->requestId) || |
| 2200 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status) || |
| 2201 | nla_put_u32(skb, |
| 2202 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE, |
| 2203 | pData->scanCacheSize) || |
| 2204 | nla_put_u32(skb, |
| 2205 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS, |
| 2206 | pData->scanBuckets) || |
| 2207 | nla_put_u32(skb, |
| 2208 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN, |
| 2209 | pData->maxApPerScan) || |
| 2210 | nla_put_u32(skb, |
| 2211 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE, |
| 2212 | pData->maxRssiSampleSize) || |
| 2213 | nla_put_u32(skb, |
| 2214 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD, |
| 2215 | pData->maxScanReportingThreshold) || |
| 2216 | nla_put_u32(skb, |
| 2217 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_APS, |
| 2218 | pData->maxHotlistAPs) || |
| 2219 | nla_put_u32(skb, |
| 2220 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS, |
| 2221 | pData->maxSignificantWifiChangeAPs) || |
| 2222 | nla_put_u32(skb, |
| 2223 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES, |
| 2224 | pData->maxBsidHistoryEntries)) { |
| 2225 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2226 | goto nla_put_failure; |
| 2227 | } |
| 2228 | |
| 2229 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2230 | return; |
| 2231 | |
| 2232 | nla_put_failure: |
| 2233 | kfree_skb(skb); |
| 2234 | return; |
| 2235 | } |
| 2236 | |
| 2237 | |
| 2238 | static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg) |
| 2239 | { |
| 2240 | tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg; |
| 2241 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2242 | struct sk_buff *skb = NULL; |
| 2243 | tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal ); |
| 2244 | |
| 2245 | |
| 2246 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2247 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2248 | "or pData(%p) is null"), pData); |
| 2249 | return; |
| 2250 | } |
| 2251 | |
| 2252 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2253 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2254 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START_INDEX, |
| 2255 | GFP_KERNEL); |
| 2256 | |
| 2257 | if (!skb) { |
| 2258 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2259 | FL("cfg80211_vendor_event_alloc failed")); |
| 2260 | return; |
| 2261 | } |
| 2262 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2263 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2264 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2265 | |
| 2266 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2267 | pData->requestId) || |
| 2268 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2269 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2270 | goto nla_put_failure; |
| 2271 | } |
| 2272 | |
| 2273 | /* |
| 2274 | * Store the Request ID for comparing with the requestID obtained |
| 2275 | * in other requests.HDD shall return a failure is the extscan_stop |
| 2276 | * request is issued with a different requestId as that of the |
| 2277 | * extscan_start request. Also, This requestId shall be used while |
| 2278 | * indicating the full scan results to the upper layers. |
| 2279 | * The requestId is stored with the assumption that the firmware |
| 2280 | * shall return the ext scan start request's requestId in ext scan |
| 2281 | * start response. |
| 2282 | */ |
| 2283 | if (pData->status == 0) |
| 2284 | pMac->sme.extScanStartReqId = pData->requestId; |
| 2285 | |
| 2286 | |
| 2287 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2288 | return; |
| 2289 | |
| 2290 | nla_put_failure: |
| 2291 | kfree_skb(skb); |
| 2292 | return; |
| 2293 | } |
| 2294 | |
| 2295 | |
| 2296 | static void wlan_hdd_cfg80211_extscan_stop_rsp(void *ctx, void *pMsg) |
| 2297 | { |
| 2298 | tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg; |
| 2299 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2300 | struct sk_buff *skb = NULL; |
| 2301 | |
| 2302 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2303 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2304 | "or pData(%p) is null"), pData); |
| 2305 | return; |
| 2306 | } |
| 2307 | |
| 2308 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2309 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2310 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP_INDEX, |
| 2311 | GFP_KERNEL); |
| 2312 | |
| 2313 | if (!skb) { |
| 2314 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2315 | FL("cfg80211_vendor_event_alloc failed")); |
| 2316 | return; |
| 2317 | } |
| 2318 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2319 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2320 | |
| 2321 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2322 | pData->requestId) || |
| 2323 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2324 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2325 | goto nla_put_failure; |
| 2326 | } |
| 2327 | |
| 2328 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2329 | return; |
| 2330 | |
| 2331 | nla_put_failure: |
| 2332 | kfree_skb(skb); |
| 2333 | return; |
| 2334 | } |
| 2335 | |
| 2336 | |
| 2337 | static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx, |
| 2338 | void *pMsg) |
| 2339 | { |
| 2340 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2341 | struct sk_buff *skb = NULL; |
| 2342 | tpSirEXTScanSetBssidHotListRspParams pData = |
| 2343 | (tpSirEXTScanSetBssidHotListRspParams) pMsg; |
| 2344 | |
| 2345 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2346 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2347 | "or pData(%p) is null"), pData); |
| 2348 | return; |
| 2349 | } |
| 2350 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2351 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2352 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST_INDEX, |
| 2353 | GFP_KERNEL); |
| 2354 | |
| 2355 | if (!skb) { |
| 2356 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2357 | FL("cfg80211_vendor_event_alloc failed")); |
| 2358 | return; |
| 2359 | } |
| 2360 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2361 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2362 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2363 | |
| 2364 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2365 | pData->requestId) || |
| 2366 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2367 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2368 | goto nla_put_failure; |
| 2369 | } |
| 2370 | |
| 2371 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2372 | return; |
| 2373 | |
| 2374 | nla_put_failure: |
| 2375 | kfree_skb(skb); |
| 2376 | return; |
| 2377 | } |
| 2378 | |
| 2379 | static void wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(void *ctx, |
| 2380 | void *pMsg) |
| 2381 | { |
| 2382 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2383 | struct sk_buff *skb = NULL; |
| 2384 | tpSirEXTScanResetBssidHotlistRspParams pData = |
| 2385 | (tpSirEXTScanResetBssidHotlistRspParams) pMsg; |
| 2386 | |
| 2387 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2388 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2389 | "or pData(%p) is null"), pData); |
| 2390 | return; |
| 2391 | } |
| 2392 | |
| 2393 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2394 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2395 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST_INDEX, |
| 2396 | GFP_KERNEL); |
| 2397 | |
| 2398 | if (!skb) { |
| 2399 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2400 | FL("cfg80211_vendor_event_alloc failed")); |
| 2401 | return; |
| 2402 | } |
| 2403 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2404 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2405 | |
| 2406 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2407 | pData->requestId) || |
| 2408 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2409 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2410 | goto nla_put_failure; |
| 2411 | } |
| 2412 | |
| 2413 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2414 | return; |
| 2415 | |
| 2416 | nla_put_failure: |
| 2417 | kfree_skb(skb); |
| 2418 | return; |
| 2419 | } |
| 2420 | |
| 2421 | |
| 2422 | static void wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(void *ctx, |
| 2423 | void *pMsg) |
| 2424 | { |
| 2425 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2426 | struct sk_buff *skb = NULL; |
| 2427 | tpSirEXTScanSetSignificantChangeRspParams pData = |
| 2428 | (tpSirEXTScanSetSignificantChangeRspParams) pMsg; |
| 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 | |
| 2436 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2437 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2438 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE_INDEX, |
| 2439 | GFP_KERNEL); |
| 2440 | |
| 2441 | if (!skb) { |
| 2442 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2443 | FL("cfg80211_vendor_event_alloc failed")); |
| 2444 | return; |
| 2445 | } |
| 2446 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2447 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2448 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2449 | |
| 2450 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2451 | pData->requestId) || |
| 2452 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2453 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2454 | goto nla_put_failure; |
| 2455 | } |
| 2456 | |
| 2457 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2458 | return; |
| 2459 | |
| 2460 | nla_put_failure: |
| 2461 | kfree_skb(skb); |
| 2462 | return; |
| 2463 | } |
| 2464 | |
| 2465 | |
| 2466 | static void wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(void *ctx, |
| 2467 | void *pMsg) |
| 2468 | { |
| 2469 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2470 | struct sk_buff *skb = NULL; |
| 2471 | tpSirEXTScanResetSignificantChangeRspParams pData = |
| 2472 | (tpSirEXTScanResetSignificantChangeRspParams) pMsg; |
| 2473 | |
| 2474 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2475 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2476 | "or pData(%p) is null"), pData); |
| 2477 | return; |
| 2478 | } |
| 2479 | |
| 2480 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2481 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2482 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE_INDEX, |
| 2483 | GFP_KERNEL); |
| 2484 | |
| 2485 | if (!skb) { |
| 2486 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2487 | FL("cfg80211_vendor_event_alloc failed")); |
| 2488 | return; |
| 2489 | } |
| 2490 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2491 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2492 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2493 | |
| 2494 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2495 | pData->requestId) || |
| 2496 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2497 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2498 | goto nla_put_failure; |
| 2499 | } |
| 2500 | |
| 2501 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2502 | return; |
| 2503 | |
| 2504 | nla_put_failure: |
| 2505 | kfree_skb(skb); |
| 2506 | return; |
| 2507 | } |
| 2508 | |
| 2509 | static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx, |
| 2510 | void *pMsg) |
| 2511 | { |
| 2512 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2513 | struct sk_buff *skb = NULL; |
| 2514 | tANI_U32 i = 0, j, resultsPerEvent; |
| 2515 | tANI_S32 totalResults; |
| 2516 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2517 | tpSirWifiScanResult pSirWifiScanResult; |
| 2518 | |
| 2519 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2520 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2521 | "or pData(%p) is null"), pData); |
| 2522 | return; |
| 2523 | } |
| 2524 | totalResults = pData->numOfAps; |
| 2525 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2526 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2527 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2528 | |
| 2529 | do{ |
| 2530 | resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ? |
| 2531 | EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults); |
| 2532 | totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND; |
| 2533 | |
| 2534 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2535 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2536 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS_INDEX, |
| 2537 | GFP_KERNEL); |
| 2538 | |
| 2539 | if (!skb) { |
| 2540 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2541 | FL("cfg80211_vendor_event_alloc failed")); |
| 2542 | return; |
| 2543 | } |
| 2544 | |
| 2545 | hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent); |
| 2546 | |
| 2547 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2548 | pData->requestId) || |
| 2549 | nla_put_u32(skb, |
| 2550 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2551 | resultsPerEvent)) { |
| 2552 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2553 | goto fail; |
| 2554 | } |
| 2555 | if (nla_put_u8(skb, |
| 2556 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2557 | pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 ))) |
| 2558 | { |
| 2559 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2560 | goto fail; |
| 2561 | } |
| 2562 | |
| 2563 | if (resultsPerEvent) { |
| 2564 | struct nlattr *aps; |
| 2565 | |
| 2566 | aps = nla_nest_start(skb, |
| 2567 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2568 | if (!aps) |
| 2569 | { |
| 2570 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2571 | goto fail; |
| 2572 | } |
| 2573 | |
| 2574 | for (j = 0; j < resultsPerEvent; j++, i++) { |
| 2575 | struct nlattr *ap; |
| 2576 | pSirWifiScanResult = (tpSirWifiScanResult) ((tANI_U8 *) |
| 2577 | pData->ap + ( i* sizeof(tSirWifiScanResult))); |
| 2578 | |
| 2579 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) " |
| 2580 | "Ssid (%s)" |
| 2581 | "Bssid: %pM " |
| 2582 | "Channel (%u)" |
| 2583 | "Rssi (%d)" |
| 2584 | "RTT (%u)" |
| 2585 | "RTT_SD (%u)", |
| 2586 | i, |
| 2587 | pSirWifiScanResult->ts, |
| 2588 | pSirWifiScanResult->ssid, |
| 2589 | pSirWifiScanResult->bssid, |
| 2590 | pSirWifiScanResult->channel, |
| 2591 | pSirWifiScanResult->rssi, |
| 2592 | pSirWifiScanResult->rtt, |
| 2593 | pSirWifiScanResult->rtt_sd); |
| 2594 | |
| 2595 | ap = nla_nest_start(skb, j + 1); |
| 2596 | if (!ap) |
| 2597 | { |
| 2598 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2599 | goto fail; |
| 2600 | } |
| 2601 | |
| 2602 | if (nla_put_u64(skb, |
| 2603 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2604 | pSirWifiScanResult->ts) ) |
| 2605 | { |
| 2606 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2607 | goto fail; |
| 2608 | } |
| 2609 | if (nla_put(skb, |
| 2610 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2611 | sizeof(pSirWifiScanResult->ssid), |
| 2612 | pSirWifiScanResult->ssid) ) |
| 2613 | { |
| 2614 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2615 | goto fail; |
| 2616 | } |
| 2617 | if (nla_put(skb, |
| 2618 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2619 | sizeof(pSirWifiScanResult->bssid), |
| 2620 | pSirWifiScanResult->bssid) ) |
| 2621 | { |
| 2622 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2623 | goto fail; |
| 2624 | } |
| 2625 | if (nla_put_u32(skb, |
| 2626 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2627 | pSirWifiScanResult->channel) ) |
| 2628 | { |
| 2629 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2630 | goto fail; |
| 2631 | } |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 2632 | if (nla_put_s32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2633 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2634 | pSirWifiScanResult->rssi) ) |
| 2635 | { |
| 2636 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2637 | goto fail; |
| 2638 | } |
| 2639 | if (nla_put_u32(skb, |
| 2640 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2641 | pSirWifiScanResult->rtt) ) |
| 2642 | { |
| 2643 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2644 | goto fail; |
| 2645 | } |
| 2646 | if (nla_put_u32(skb, |
| 2647 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2648 | pSirWifiScanResult->rtt_sd)) |
| 2649 | { |
| 2650 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2651 | goto fail; |
| 2652 | } |
| 2653 | |
| 2654 | nla_nest_end(skb, ap); |
| 2655 | } |
| 2656 | nla_nest_end(skb, aps); |
| 2657 | |
| 2658 | } |
| 2659 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2660 | } while (totalResults > 0); |
| 2661 | |
| 2662 | return; |
| 2663 | fail: |
| 2664 | kfree_skb(skb); |
| 2665 | return; |
| 2666 | } |
| 2667 | |
| 2668 | static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx, |
| 2669 | void *pMsg) |
| 2670 | { |
| 2671 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2672 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2673 | struct sk_buff *skb = NULL; |
| 2674 | tANI_U32 i; |
| 2675 | |
| 2676 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2677 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2678 | "or pData(%p) is null"), pData); |
| 2679 | return; |
| 2680 | } |
| 2681 | |
| 2682 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2683 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2684 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX, |
| 2685 | GFP_KERNEL); |
| 2686 | |
| 2687 | if (!skb) { |
| 2688 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2689 | FL("cfg80211_vendor_event_alloc failed")); |
| 2690 | return; |
| 2691 | } |
| 2692 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2693 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2694 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2695 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2696 | |
| 2697 | for (i = 0; i < pData->numOfAps; i++) { |
| 2698 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) " |
| 2699 | "Ssid (%s) " |
| 2700 | "Bssid (" MAC_ADDRESS_STR ") " |
| 2701 | "Channel (%u) " |
| 2702 | "Rssi (%d) " |
| 2703 | "RTT (%u) " |
| 2704 | "RTT_SD (%u) ", |
| 2705 | i, |
| 2706 | pData->ap[i].ts, |
| 2707 | pData->ap[i].ssid, |
| 2708 | MAC_ADDR_ARRAY(pData->ap[i].bssid), |
| 2709 | pData->ap[i].channel, |
| 2710 | pData->ap[i].rssi, |
| 2711 | pData->ap[i].rtt, |
| 2712 | pData->ap[i].rtt_sd); |
| 2713 | } |
| 2714 | |
| 2715 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2716 | pData->requestId) || |
| 2717 | nla_put_u32(skb, |
| 2718 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2719 | pData->numOfAps)) { |
| 2720 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2721 | goto fail; |
| 2722 | } |
| 2723 | if (pData->numOfAps) { |
| 2724 | struct nlattr *aps; |
| 2725 | |
| 2726 | aps = nla_nest_start(skb, |
| 2727 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2728 | if (!aps) |
| 2729 | goto fail; |
| 2730 | |
| 2731 | for (i = 0; i < pData->numOfAps; i++) { |
| 2732 | struct nlattr *ap; |
| 2733 | |
| 2734 | ap = nla_nest_start(skb, i + 1); |
| 2735 | if (!ap) |
| 2736 | goto fail; |
| 2737 | |
| 2738 | if (nla_put_u64(skb, |
| 2739 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2740 | pData->ap[i].ts) || |
| 2741 | nla_put(skb, |
| 2742 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2743 | sizeof(pData->ap[i].ssid), |
| 2744 | pData->ap[i].ssid) || |
| 2745 | nla_put(skb, |
| 2746 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2747 | sizeof(pData->ap[i].bssid), |
| 2748 | pData->ap[i].bssid) || |
| 2749 | nla_put_u32(skb, |
| 2750 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2751 | pData->ap[i].channel) || |
| 2752 | nla_put_s32(skb, |
| 2753 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2754 | pData->ap[i].rssi) || |
| 2755 | nla_put_u32(skb, |
| 2756 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2757 | pData->ap[i].rtt) || |
| 2758 | nla_put_u32(skb, |
| 2759 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2760 | pData->ap[i].rtt_sd)) |
| 2761 | goto fail; |
| 2762 | |
| 2763 | nla_nest_end(skb, ap); |
| 2764 | } |
| 2765 | nla_nest_end(skb, aps); |
| 2766 | |
| 2767 | if (nla_put_u8(skb, |
| 2768 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2769 | pData->moreData)) |
| 2770 | goto fail; |
| 2771 | } |
| 2772 | |
| 2773 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2774 | return; |
| 2775 | |
| 2776 | fail: |
| 2777 | kfree_skb(skb); |
| 2778 | return; |
| 2779 | |
| 2780 | } |
| 2781 | static void wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(void *ctx, |
| 2782 | void *pMsg) |
| 2783 | { |
| 2784 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2785 | struct sk_buff *skb = NULL; |
| 2786 | tANI_U32 i, j; |
| 2787 | tpSirWifiSignificantChangeEvent pData = |
| 2788 | (tpSirWifiSignificantChangeEvent) pMsg; |
| 2789 | |
| 2790 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2791 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2792 | "or pData(%p) is null"), pData); |
| 2793 | return; |
| 2794 | } |
| 2795 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2796 | EXTSCAN_EVENT_BUF_SIZE, |
| 2797 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE_INDEX, |
| 2798 | GFP_KERNEL); |
| 2799 | |
| 2800 | if (!skb) { |
| 2801 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2802 | FL("cfg80211_vendor_event_alloc failed")); |
| 2803 | return; |
| 2804 | } |
| 2805 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2806 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2807 | hddLog(VOS_TRACE_LEVEL_INFO, "total List Size %u ", pData->numSigRssiBss); |
| 2808 | hddLog(VOS_TRACE_LEVEL_INFO, " CUrrent List size (%u)", |
| 2809 | pData->numSigRssiBss); |
| 2810 | hddLog(VOS_TRACE_LEVEL_INFO, "moreData (%u)", pData->moreData); |
| 2811 | |
| 2812 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 2813 | hddLog(VOS_TRACE_LEVEL_INFO , "Rssi List [%d] BSSID: (%pM) Channel %u " |
| 2814 | " num RSSI %u ", |
| 2815 | i, pData->sigRssiResult[i].bssid, |
| 2816 | pData->sigRssiResult[i].channel, |
| 2817 | pData->sigRssiResult[i].numRssi); |
| 2818 | |
| 2819 | for (j = 0; j < pData->sigRssiResult[i].numRssi; j++){ |
| 2820 | |
| 2821 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2822 | " [%d]", |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 2823 | pData->sigRssiResult[i].rssi[j]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2824 | |
| 2825 | } |
| 2826 | } |
| 2827 | |
| 2828 | |
| 2829 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2830 | pData->requestId) || |
| 2831 | nla_put_u32(skb, |
| 2832 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2833 | pData->numSigRssiBss)) { |
| 2834 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2835 | goto fail; |
| 2836 | } |
| 2837 | |
| 2838 | if (pData->numSigRssiBss) { |
| 2839 | struct nlattr *aps; |
| 2840 | aps = nla_nest_start(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2841 | if (!aps) |
| 2842 | goto fail; |
| 2843 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 2844 | struct nlattr *ap; |
| 2845 | |
| 2846 | ap = nla_nest_start(skb, i); |
| 2847 | if (!ap) |
| 2848 | goto fail; |
| 2849 | if (nla_put(skb, |
| 2850 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_BSSID, |
| 2851 | sizeof(tSirMacAddr), pData->sigRssiResult[i].bssid) || |
| 2852 | nla_put_u32(skb, |
| 2853 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_CHANNEL, |
| 2854 | pData->sigRssiResult[i].channel) || |
| 2855 | nla_put_u32(skb, |
| 2856 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_NUM_RSSI, |
| 2857 | pData->sigRssiResult[i].numRssi) || |
| 2858 | nla_put(skb, |
| 2859 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_RSSI_LIST, |
| 2860 | sizeof(s32) * pData->sigRssiResult[i].numRssi, |
| 2861 | pData->sigRssiResult[i].rssi)) |
| 2862 | goto fail; |
| 2863 | nla_nest_end(skb, ap); |
| 2864 | } |
| 2865 | nla_nest_end(skb, aps); |
| 2866 | if (nla_put_u8(skb, |
| 2867 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2868 | pData->moreData)) |
| 2869 | goto fail; |
| 2870 | } |
| 2871 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2872 | return; |
| 2873 | fail: |
| 2874 | kfree_skb(skb); |
| 2875 | return; |
| 2876 | } |
| 2877 | |
| 2878 | static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx, |
| 2879 | void *pMsg) |
| 2880 | { |
| 2881 | struct sk_buff *skb; |
| 2882 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2883 | tpSirWifiFullScanResultEvent pData = |
| 2884 | (tpSirWifiFullScanResultEvent) (pMsg); |
| 2885 | |
| 2886 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2887 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2888 | "or pData(%p) is null"), pData); |
| 2889 | return; |
| 2890 | } |
| 2891 | |
| 2892 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2893 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2894 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX, |
| 2895 | GFP_KERNEL); |
| 2896 | |
| 2897 | if (!skb) { |
| 2898 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2899 | FL("cfg80211_vendor_event_alloc failed")); |
| 2900 | return; |
| 2901 | } |
| 2902 | |
| 2903 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2904 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId); |
| 2905 | hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData); |
| 2906 | hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) " |
| 2907 | "Ssid (%s)" |
| 2908 | "Bssid (" MAC_ADDRESS_STR ")" |
| 2909 | "Channel (%u)" |
| 2910 | "Rssi (%d)" |
| 2911 | "RTT (%u)" |
| 2912 | "RTT_SD (%u)"), |
| 2913 | pData->ap.ts, |
| 2914 | pData->ap.ssid, |
| 2915 | MAC_ADDR_ARRAY(pData->ap.bssid), |
| 2916 | pData->ap.channel, |
| 2917 | pData->ap.rssi, |
| 2918 | pData->ap.rtt, |
| 2919 | pData->ap.rtt_sd); |
| 2920 | hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength); |
| 2921 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2922 | pData->requestId) || |
| 2923 | nla_put_u64(skb, |
| 2924 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2925 | pData->ap.ts) || |
| 2926 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2927 | sizeof(pData->ap.ssid), |
| 2928 | pData->ap.ssid) || |
| 2929 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2930 | WNI_CFG_BSSID_LEN, |
| 2931 | pData->ap.bssid) || |
| 2932 | nla_put_u32(skb, |
| 2933 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2934 | pData->ap.channel) || |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 2935 | 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] | 2936 | pData->ap.rssi) || |
| 2937 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2938 | pData->ap.rtt) || |
| 2939 | nla_put_u32(skb, |
| 2940 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2941 | pData->ap.rtt_sd) || |
| 2942 | nla_put_u16(skb, |
| 2943 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 2944 | pData->ap.beaconPeriod) || |
| 2945 | nla_put_u16(skb, |
| 2946 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 2947 | pData->ap.capability) || |
| 2948 | nla_put_u32(skb, |
| 2949 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
| 2950 | pData->ieLength)) |
| 2951 | { |
| 2952 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2953 | goto nla_put_failure; |
| 2954 | } |
| 2955 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 2956 | pData->ieLength, |
| 2957 | pData->ie)) |
| 2958 | { |
| 2959 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2960 | goto nla_put_failure; |
| 2961 | } |
| 2962 | |
| 2963 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2964 | return; |
| 2965 | |
| 2966 | nla_put_failure: |
| 2967 | kfree_skb(skb); |
| 2968 | return; |
| 2969 | } |
| 2970 | |
| 2971 | static void wlan_hdd_cfg80211_extscan_scan_res_available_event(void *ctx, |
| 2972 | void *pMsg) |
| 2973 | { |
| 2974 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2975 | struct sk_buff *skb = NULL; |
| 2976 | tpSirEXTScanResultsAvailableIndParams pData = |
| 2977 | (tpSirEXTScanResultsAvailableIndParams) pMsg; |
| 2978 | |
| 2979 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 2980 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 2981 | "or pData(%p) is null"), pData); |
| 2982 | return; |
| 2983 | } |
| 2984 | |
| 2985 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2986 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2987 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX, |
| 2988 | GFP_KERNEL); |
| 2989 | |
| 2990 | if (!skb) { |
| 2991 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2992 | FL("cfg80211_vendor_event_alloc failed")); |
| 2993 | return; |
| 2994 | } |
| 2995 | |
| 2996 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2997 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2998 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", |
| 2999 | pData->numResultsAvailable); |
| 3000 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3001 | pData->requestId) || |
| 3002 | nla_put_u32(skb, |
| 3003 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3004 | pData->numResultsAvailable)) { |
| 3005 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3006 | goto nla_put_failure; |
| 3007 | } |
| 3008 | |
| 3009 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 3010 | return; |
| 3011 | |
| 3012 | nla_put_failure: |
| 3013 | kfree_skb(skb); |
| 3014 | return; |
| 3015 | } |
| 3016 | |
| 3017 | static void wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx, void *pMsg) |
| 3018 | { |
| 3019 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3020 | struct sk_buff *skb = NULL; |
| 3021 | tpSirEXTScanProgressIndParams pData = |
| 3022 | (tpSirEXTScanProgressIndParams) pMsg; |
| 3023 | |
| 3024 | if (wlan_hdd_validate_context(pHddCtx) || !pData) { |
| 3025 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid " |
| 3026 | "or pData(%p) is null"), pData); |
| 3027 | return; |
| 3028 | } |
| 3029 | |
| 3030 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 3031 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3032 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX, |
| 3033 | GFP_KERNEL); |
| 3034 | |
| 3035 | if (!skb) { |
| 3036 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3037 | FL("cfg80211_vendor_event_alloc failed")); |
| 3038 | return; |
| 3039 | } |
| 3040 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3041 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)", |
| 3042 | pData->extScanEventType); |
| 3043 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)", |
| 3044 | pData->status); |
| 3045 | |
| 3046 | if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE, |
| 3047 | pData->extScanEventType) || |
| 3048 | nla_put_u32(skb, |
Dasari Srinivas | 5a28865 | 2014-06-30 17:13:22 +0530 | [diff] [blame] | 3049 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3050 | pData->requestId) || |
| 3051 | nla_put_u32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3052 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS, |
| 3053 | pData->status)) { |
| 3054 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3055 | goto nla_put_failure; |
| 3056 | } |
| 3057 | |
| 3058 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 3059 | return; |
| 3060 | |
| 3061 | nla_put_failure: |
| 3062 | kfree_skb(skb); |
| 3063 | return; |
| 3064 | } |
| 3065 | |
| 3066 | void wlan_hdd_cfg80211_extscan_callback(void *ctx, const tANI_U16 evType, |
| 3067 | void *pMsg) |
| 3068 | { |
| 3069 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3070 | |
| 3071 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dasari Srinivas | b46ed1d | 2014-10-08 13:03:08 +0530 | [diff] [blame] | 3072 | hddLog(VOS_TRACE_LEVEL_INFO, FL("HDD context is not valid")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3073 | return; |
| 3074 | } |
| 3075 | |
| 3076 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 3077 | |
| 3078 | |
| 3079 | switch(evType) { |
| 3080 | case SIR_HAL_EXTSCAN_START_RSP: |
| 3081 | wlan_hdd_cfg80211_extscan_start_rsp(ctx, pMsg); |
| 3082 | break; |
| 3083 | |
| 3084 | case SIR_HAL_EXTSCAN_STOP_RSP: |
| 3085 | wlan_hdd_cfg80211_extscan_stop_rsp(ctx, pMsg); |
| 3086 | break; |
| 3087 | case SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP: |
| 3088 | /* There is no need to send this response to upper layer |
| 3089 | Just log the message */ |
| 3090 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3091 | FL("Rcvd SIR_HAL_EXTSCAN_CACHED_RESULTS_RSP")); |
| 3092 | break; |
| 3093 | case SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP: |
| 3094 | wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(ctx, pMsg); |
| 3095 | break; |
| 3096 | |
| 3097 | case SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP: |
| 3098 | wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg); |
| 3099 | break; |
| 3100 | |
| 3101 | case SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP: |
| 3102 | wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(ctx, pMsg); |
| 3103 | break; |
| 3104 | |
| 3105 | case SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP: |
| 3106 | wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(ctx, pMsg); |
| 3107 | break; |
| 3108 | case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP: |
| 3109 | wlan_hdd_cfg80211_extscan_get_capabilities_ind(ctx, pMsg); |
| 3110 | break; |
| 3111 | case SIR_HAL_EXTSCAN_PROGRESS_IND: |
| 3112 | wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg); |
| 3113 | break; |
| 3114 | case SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND: |
| 3115 | wlan_hdd_cfg80211_extscan_scan_res_available_event(ctx, pMsg); |
| 3116 | break; |
| 3117 | case SIR_HAL_EXTSCAN_SCAN_RESULT_IND: |
| 3118 | wlan_hdd_cfg80211_extscan_cached_results_ind(ctx, pMsg); |
| 3119 | break; |
| 3120 | case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND: |
| 3121 | wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg); |
| 3122 | break; |
| 3123 | case SIR_HAL_EXTSCAN_SIGNF_WIFI_CHANGE_IND: |
| 3124 | wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(ctx, pMsg); |
| 3125 | break; |
| 3126 | case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 3127 | wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg); |
| 3128 | break; |
| 3129 | default: |
| 3130 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 3131 | break; |
| 3132 | } |
| 3133 | } |
| 3134 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3135 | static int __wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3136 | struct wireless_dev *wdev, |
| 3137 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3138 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3139 | tSirGetEXTScanCapabilitiesReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3140 | struct net_device *dev = wdev->netdev; |
| 3141 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3142 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3143 | struct nlattr |
| 3144 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3145 | eHalStatus status; |
| 3146 | |
| 3147 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering")); |
| 3148 | status = wlan_hdd_validate_context(pHddCtx); |
| 3149 | if (0 != status) |
| 3150 | { |
| 3151 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3152 | FL("HDD context is not valid")); |
| 3153 | return -EINVAL; |
| 3154 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3155 | /* check the EXTScan Capability */ |
| 3156 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3157 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3158 | { |
| 3159 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3160 | FL("EXTScan not enabled/supported by Firmware")); |
| 3161 | return -EINVAL; |
| 3162 | } |
| 3163 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3164 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3165 | data, dataLen, |
| 3166 | wlan_hdd_extscan_config_policy)) { |
| 3167 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3168 | return -EINVAL; |
| 3169 | } |
| 3170 | |
| 3171 | /* Parse and fetch request Id */ |
| 3172 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3173 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3174 | return -EINVAL; |
| 3175 | } |
| 3176 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3177 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3178 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3179 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3180 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3181 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3182 | reqMsg.sessionId = pAdapter->sessionId; |
| 3183 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3184 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3185 | status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3186 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3187 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3188 | FL("sme_EXTScanGetCapabilities failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3189 | return -EINVAL; |
| 3190 | } |
| 3191 | |
| 3192 | return 0; |
| 3193 | } |
| 3194 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3195 | static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3196 | struct wireless_dev *wdev, |
| 3197 | const void *data, int dataLen) |
| 3198 | { |
| 3199 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3200 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3201 | vos_ssr_protect(__func__); |
| 3202 | ret = __wlan_hdd_cfg80211_extscan_get_capabilities(wiphy, wdev, data, dataLen); |
| 3203 | vos_ssr_unprotect(__func__); |
| 3204 | |
| 3205 | return ret; |
| 3206 | } |
| 3207 | |
| 3208 | static int __wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3209 | struct wireless_dev *wdev, |
| 3210 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3211 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3212 | tSirEXTScanGetCachedResultsReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3213 | struct net_device *dev = wdev->netdev; |
| 3214 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3215 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3216 | struct nlattr |
| 3217 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3218 | eHalStatus status; |
| 3219 | |
| 3220 | status = wlan_hdd_validate_context(pHddCtx); |
| 3221 | if (0 != status) |
| 3222 | { |
| 3223 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3224 | FL("HDD context is not valid")); |
| 3225 | return -EINVAL; |
| 3226 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3227 | /* check the EXTScan Capability */ |
| 3228 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3229 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3230 | { |
| 3231 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3232 | FL("EXTScan not enabled/supported by Firmware")); |
| 3233 | return -EINVAL; |
| 3234 | } |
| 3235 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3236 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3237 | data, dataLen, |
| 3238 | wlan_hdd_extscan_config_policy)) { |
| 3239 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3240 | return -EINVAL; |
| 3241 | } |
| 3242 | /* Parse and fetch request Id */ |
| 3243 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3244 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3245 | return -EINVAL; |
| 3246 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3247 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3248 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3249 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3250 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3251 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3252 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3253 | reqMsg.sessionId = pAdapter->sessionId; |
| 3254 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3255 | |
| 3256 | /* Parse and fetch flush parameter */ |
| 3257 | if (!tb |
| 3258 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]) |
| 3259 | { |
| 3260 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed")); |
| 3261 | goto failed; |
| 3262 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3263 | reqMsg.flush = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3264 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]); |
| 3265 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3266 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3267 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3268 | status = sme_getCachedResults(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3269 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3270 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3271 | FL("sme_getCachedResults failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3272 | return -EINVAL; |
| 3273 | } |
| 3274 | return 0; |
| 3275 | |
| 3276 | failed: |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3277 | return -EINVAL; |
| 3278 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3279 | static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3280 | struct wireless_dev *wdev, |
| 3281 | const void *data, int dataLen) |
| 3282 | { |
| 3283 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3284 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3285 | vos_ssr_protect(__func__); |
| 3286 | ret = __wlan_hdd_cfg80211_extscan_get_cached_results(wiphy, wdev, data, dataLen); |
| 3287 | vos_ssr_unprotect(__func__); |
| 3288 | |
| 3289 | return ret; |
| 3290 | } |
| 3291 | |
| 3292 | static int __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3293 | struct wireless_dev *wdev, |
Edhar, Mahesh Kumar | ed8631f | 2015-01-20 14:31:47 +0530 | [diff] [blame] | 3294 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3295 | { |
| 3296 | tpSirEXTScanSetBssidHotListReqParams pReqMsg = NULL; |
| 3297 | struct net_device *dev = wdev->netdev; |
| 3298 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3299 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3300 | struct nlattr |
| 3301 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3302 | struct nlattr |
| 3303 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3304 | struct nlattr *apTh; |
| 3305 | eHalStatus status; |
| 3306 | tANI_U8 i = 0; |
| 3307 | int rem; |
| 3308 | |
| 3309 | status = wlan_hdd_validate_context(pHddCtx); |
| 3310 | if (0 != status) |
| 3311 | { |
| 3312 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3313 | FL("HDD context is not valid")); |
| 3314 | return -EINVAL; |
| 3315 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3316 | /* check the EXTScan Capability */ |
| 3317 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3318 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3319 | { |
| 3320 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3321 | FL("EXTScan not enabled/supported by Firmware")); |
| 3322 | return -EINVAL; |
| 3323 | } |
| 3324 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3325 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3326 | data, dataLen, |
| 3327 | wlan_hdd_extscan_config_policy)) { |
| 3328 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3329 | return -EINVAL; |
| 3330 | } |
| 3331 | |
| 3332 | /* Parse and fetch request Id */ |
| 3333 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3334 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3335 | return -EINVAL; |
| 3336 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3337 | pReqMsg = (tpSirEXTScanSetBssidHotListReqParams) |
| 3338 | vos_mem_malloc(sizeof(*pReqMsg)); |
| 3339 | if (!pReqMsg) { |
| 3340 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3341 | return -ENOMEM; |
| 3342 | } |
| 3343 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3344 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3345 | pReqMsg->requestId = nla_get_u32( |
| 3346 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3347 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3348 | |
| 3349 | /* Parse and fetch number of APs */ |
| 3350 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]) { |
| 3351 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3352 | goto fail; |
| 3353 | } |
| 3354 | |
| 3355 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3356 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3357 | |
| 3358 | pReqMsg->numAp = nla_get_u32( |
| 3359 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]); |
| 3360 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3361 | |
| 3362 | nla_for_each_nested(apTh, |
| 3363 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3364 | if(nla_parse(tb2, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3365 | nla_data(apTh), nla_len(apTh), |
| 3366 | NULL)) { |
| 3367 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3368 | goto fail; |
| 3369 | } |
| 3370 | |
| 3371 | /* Parse and fetch MAC address */ |
| 3372 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3373 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3374 | goto fail; |
| 3375 | } |
| 3376 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3377 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3378 | sizeof(tSirMacAddr)); |
| 3379 | hddLog(VOS_TRACE_LEVEL_INFO, FL("BSSID: %pM "), pReqMsg->ap[i].bssid); |
| 3380 | |
| 3381 | /* Parse and fetch low RSSI */ |
| 3382 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3383 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3384 | goto fail; |
| 3385 | } |
| 3386 | pReqMsg->ap[i].low = nla_get_s32( |
| 3387 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3388 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3389 | |
| 3390 | /* Parse and fetch high RSSI */ |
| 3391 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3392 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3393 | goto fail; |
| 3394 | } |
| 3395 | pReqMsg->ap[i].high = nla_get_s32( |
| 3396 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3397 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"), |
| 3398 | pReqMsg->ap[i].high); |
| 3399 | |
| 3400 | /* Parse and fetch channel */ |
| 3401 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3402 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3403 | goto fail; |
| 3404 | } |
| 3405 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3406 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3407 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3408 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3409 | i++; |
| 3410 | } |
| 3411 | status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg); |
| 3412 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3413 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3414 | FL("sme_SetBssHotlist failed(err=%d)"), status); |
| 3415 | vos_mem_free(pReqMsg); |
| 3416 | return -EINVAL; |
| 3417 | } |
| 3418 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3419 | vos_mem_free(pReqMsg); |
| 3420 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3421 | return 0; |
| 3422 | |
| 3423 | fail: |
| 3424 | vos_mem_free(pReqMsg); |
| 3425 | return -EINVAL; |
| 3426 | } |
| 3427 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3428 | static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
| 3429 | struct wireless_dev *wdev, |
| 3430 | const void *data, int dataLen) |
| 3431 | { |
| 3432 | int ret = 0; |
| 3433 | |
| 3434 | vos_ssr_protect(__func__); |
| 3435 | ret = __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(wiphy, wdev, data, |
| 3436 | dataLen); |
| 3437 | vos_ssr_unprotect(__func__); |
| 3438 | |
| 3439 | return ret; |
| 3440 | } |
| 3441 | |
| 3442 | static int __wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3443 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3444 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3445 | { |
| 3446 | tpSirEXTScanSetSignificantChangeReqParams pReqMsg = NULL; |
| 3447 | struct net_device *dev = wdev->netdev; |
| 3448 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3449 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3450 | struct nlattr |
| 3451 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3452 | struct nlattr |
| 3453 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3454 | struct nlattr *apTh; |
| 3455 | eHalStatus status; |
| 3456 | int i = 0; |
| 3457 | int rem; |
| 3458 | |
| 3459 | status = wlan_hdd_validate_context(pHddCtx); |
| 3460 | if (0 != status) |
| 3461 | { |
| 3462 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3463 | FL("HDD context is not valid")); |
| 3464 | return -EINVAL; |
| 3465 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3466 | /* check the EXTScan Capability */ |
| 3467 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3468 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3469 | { |
| 3470 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3471 | FL("EXTScan not enabled/supported by Firmware")); |
| 3472 | return -EINVAL; |
| 3473 | } |
| 3474 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3475 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3476 | data, dataLen, |
| 3477 | wlan_hdd_extscan_config_policy)) { |
| 3478 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3479 | return -EINVAL; |
| 3480 | } |
| 3481 | |
| 3482 | /* Parse and fetch request Id */ |
| 3483 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3484 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3485 | return -EINVAL; |
| 3486 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3487 | pReqMsg = (tpSirEXTScanSetSignificantChangeReqParams) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3488 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3489 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3490 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3491 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3492 | } |
| 3493 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3494 | |
| 3495 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3496 | pReqMsg->requestId = nla_get_u32( |
| 3497 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3498 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3499 | |
| 3500 | /* Parse and fetch RSSI sample size */ |
| 3501 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]) |
| 3502 | { |
| 3503 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr RSSI sample size failed")); |
| 3504 | goto fail; |
| 3505 | } |
| 3506 | pReqMsg->rssiSampleSize = nla_get_u32( |
| 3507 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]); |
| 3508 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3509 | FL("RSSI sample size (%u)"), pReqMsg->rssiSampleSize); |
| 3510 | |
| 3511 | /* Parse and fetch lost AP sample size */ |
| 3512 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]) |
| 3513 | { |
| 3514 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr lost AP sample size failed")); |
| 3515 | goto fail; |
| 3516 | } |
| 3517 | pReqMsg->lostApSampleSize = nla_get_u32( |
| 3518 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]); |
| 3519 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3520 | FL("Lost AP sample size (%u)"), pReqMsg->lostApSampleSize); |
| 3521 | /* Parse and fetch minimum Breaching */ |
| 3522 | if (!tb |
| 3523 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]) { |
| 3524 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr minBreaching failed")); |
| 3525 | goto fail; |
| 3526 | } |
| 3527 | pReqMsg->minBreaching = nla_get_u32( |
| 3528 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]); |
| 3529 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Breaching (%d)"), pReqMsg->minBreaching); |
| 3530 | |
| 3531 | /* Parse and fetch number of APs */ |
| 3532 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]) { |
| 3533 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3534 | goto fail; |
| 3535 | } |
| 3536 | pReqMsg->numAp = nla_get_u32( |
| 3537 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]); |
| 3538 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3539 | |
| 3540 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3541 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3542 | |
| 3543 | nla_for_each_nested(apTh, |
| 3544 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3545 | if(nla_parse(tb2, |
| 3546 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3547 | nla_data(apTh), nla_len(apTh), |
| 3548 | NULL)) { |
| 3549 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3550 | goto fail; |
| 3551 | } |
| 3552 | |
| 3553 | /* Parse and fetch MAC address */ |
| 3554 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3555 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3556 | goto fail; |
| 3557 | } |
| 3558 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3559 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3560 | sizeof(tSirMacAddr)); |
| 3561 | |
| 3562 | /* Parse and fetch low RSSI */ |
| 3563 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3564 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3565 | goto fail; |
| 3566 | } |
| 3567 | pReqMsg->ap[i].low = nla_get_s32( |
| 3568 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3569 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3570 | |
| 3571 | /* Parse and fetch high RSSI */ |
| 3572 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3573 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3574 | goto fail; |
| 3575 | } |
| 3576 | pReqMsg->ap[i].high = nla_get_s32( |
| 3577 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3578 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3579 | FL("RSSI High (%d)"), pReqMsg->ap[i].high); |
| 3580 | |
| 3581 | /* Parse and fetch channel */ |
| 3582 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3583 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3584 | goto fail; |
| 3585 | } |
| 3586 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3587 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3588 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3589 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3590 | i++; |
| 3591 | } |
| 3592 | |
| 3593 | status = sme_SetSignificantChange(pHddCtx->hHal, pReqMsg); |
| 3594 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3595 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3596 | FL("sme_SetSignificantChange failed(err=%d)"), status); |
| 3597 | vos_mem_free(pReqMsg); |
| 3598 | return -EINVAL; |
| 3599 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3600 | vos_mem_free(pReqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3601 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Exiting")); |
| 3602 | return 0; |
| 3603 | |
| 3604 | fail: |
| 3605 | vos_mem_free(pReqMsg); |
| 3606 | return -EINVAL; |
| 3607 | } |
| 3608 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3609 | static int wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
| 3610 | struct wireless_dev *wdev, |
| 3611 | const void *data, int dataLen) |
| 3612 | { |
| 3613 | int ret = 0; |
| 3614 | |
| 3615 | vos_ssr_protect(__func__); |
| 3616 | ret = __wlan_hdd_cfg80211_extscan_set_significant_change(wiphy, wdev, data, |
| 3617 | dataLen); |
| 3618 | vos_ssr_unprotect(__func__); |
| 3619 | |
| 3620 | return ret; |
| 3621 | } |
| 3622 | |
| 3623 | static int __wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3624 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3625 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3626 | { |
| 3627 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3628 | tANI_U32 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 3629 | tANI_U8 numChannels = 0; |
| 3630 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3631 | tANI_U32 requestId; |
| 3632 | tWifiBand wifiBand; |
| 3633 | eHalStatus status; |
| 3634 | struct sk_buff *replySkb; |
| 3635 | tANI_U8 i; |
| 3636 | |
| 3637 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering")); |
| 3638 | status = wlan_hdd_validate_context(pHddCtx); |
| 3639 | if (0 != status) |
| 3640 | { |
| 3641 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3642 | FL("HDD context is not valid")); |
| 3643 | return -EINVAL; |
| 3644 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3645 | /* check the EXTScan Capability */ |
| 3646 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3647 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3648 | { |
| 3649 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3650 | FL("EXTScan not enabled/supported by Firmware")); |
| 3651 | return -EINVAL; |
| 3652 | } |
| 3653 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3654 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3655 | data, dataLen, |
| 3656 | wlan_hdd_extscan_config_policy)) { |
| 3657 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3658 | return -EINVAL; |
| 3659 | } |
| 3660 | |
| 3661 | /* Parse and fetch request Id */ |
| 3662 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3663 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3664 | return -EINVAL; |
| 3665 | } |
| 3666 | requestId = nla_get_u32( |
| 3667 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3668 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); |
| 3669 | |
| 3670 | /* Parse and fetch wifi band */ |
| 3671 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) |
| 3672 | { |
| 3673 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3674 | return -EINVAL; |
| 3675 | } |
| 3676 | wifiBand = nla_get_u32( |
| 3677 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); |
| 3678 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); |
| 3679 | |
| 3680 | status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), |
| 3681 | wifiBand, ChannelList, |
| 3682 | &numChannels); |
| 3683 | if (eHAL_STATUS_SUCCESS != status) { |
| 3684 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3685 | FL("sme_GetValidChannelsByBand failed (err=%d)"), status); |
| 3686 | return -EINVAL; |
| 3687 | } |
| 3688 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of channels (%d)"), numChannels); |
| 3689 | for (i = 0; i < numChannels; i++) |
| 3690 | hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %u ", ChannelList[i]); |
| 3691 | |
| 3692 | replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 3693 | sizeof(u32) * numChannels + |
| 3694 | NLMSG_HDRLEN); |
| 3695 | |
| 3696 | if (!replySkb) { |
| 3697 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3698 | FL("valid channels: buffer alloc fail")); |
| 3699 | return -EINVAL; |
| 3700 | } |
| 3701 | if (nla_put_u32(replySkb, |
| 3702 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS, |
| 3703 | numChannels) || |
| 3704 | nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS, |
| 3705 | sizeof(u32) * numChannels, ChannelList)) { |
| 3706 | |
| 3707 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3708 | kfree_skb(replySkb); |
| 3709 | return -EINVAL; |
| 3710 | } |
| 3711 | |
| 3712 | return cfg80211_vendor_cmd_reply(replySkb); |
| 3713 | } |
| 3714 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3715 | static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
| 3716 | struct wireless_dev *wdev, |
| 3717 | const void *data, int dataLen) |
| 3718 | { |
| 3719 | int ret = 0; |
| 3720 | |
| 3721 | vos_ssr_protect(__func__); |
| 3722 | ret = __wlan_hdd_cfg80211_extscan_get_valid_channels(wiphy, wdev, data, |
| 3723 | dataLen); |
| 3724 | vos_ssr_unprotect(__func__); |
| 3725 | |
| 3726 | return ret; |
| 3727 | } |
| 3728 | |
| 3729 | static int __wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3730 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3731 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3732 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3733 | tpSirEXTScanStartReqParams pReqMsg = NULL; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3734 | struct net_device *dev = wdev->netdev; |
| 3735 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3736 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3737 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3738 | struct nlattr *bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3739 | struct nlattr *channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3740 | struct nlattr *buckets; |
| 3741 | struct nlattr *channels; |
| 3742 | int rem1; |
| 3743 | int rem2; |
| 3744 | eHalStatus status; |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3745 | tANI_U32 j = 0, index = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3746 | |
| 3747 | status = wlan_hdd_validate_context(pHddCtx); |
| 3748 | if (0 != status) |
| 3749 | { |
| 3750 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3751 | FL("HDD context is not valid")); |
| 3752 | return -EINVAL; |
| 3753 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3754 | /* check the EXTScan Capability */ |
| 3755 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3756 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3757 | { |
| 3758 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3759 | FL("EXTScan not enabled/supported by Firmware")); |
| 3760 | return -EINVAL; |
| 3761 | } |
| 3762 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3763 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3764 | data, dataLen, |
| 3765 | wlan_hdd_extscan_config_policy)) { |
| 3766 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3767 | return -EINVAL; |
| 3768 | } |
| 3769 | |
| 3770 | /* Parse and fetch request Id */ |
| 3771 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3772 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3773 | return -EINVAL; |
| 3774 | } |
| 3775 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3776 | pReqMsg = (tpSirEXTScanStartReqParams) |
| 3777 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3778 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3779 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3780 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3781 | } |
| 3782 | |
| 3783 | pReqMsg->requestId = nla_get_u32( |
| 3784 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3785 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3786 | |
| 3787 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3788 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3789 | |
| 3790 | /* Parse and fetch base period */ |
| 3791 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]) { |
| 3792 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed")); |
| 3793 | goto fail; |
| 3794 | } |
| 3795 | pReqMsg->basePeriod = nla_get_u32( |
| 3796 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]); |
| 3797 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"), |
| 3798 | pReqMsg->basePeriod); |
| 3799 | |
| 3800 | /* Parse and fetch max AP per scan */ |
| 3801 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]) { |
| 3802 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed")); |
| 3803 | goto fail; |
| 3804 | } |
| 3805 | pReqMsg->maxAPperScan = nla_get_u32( |
| 3806 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]); |
| 3807 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"), |
| 3808 | pReqMsg->maxAPperScan); |
| 3809 | |
| 3810 | /* Parse and fetch report threshold */ |
| 3811 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]) { |
| 3812 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed")); |
| 3813 | goto fail; |
| 3814 | } |
| 3815 | pReqMsg->reportThreshold = nla_get_u8( |
| 3816 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]); |
| 3817 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"), |
| 3818 | pReqMsg->reportThreshold); |
| 3819 | |
| 3820 | /* Parse and fetch number of buckets */ |
| 3821 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]) { |
| 3822 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed")); |
| 3823 | goto fail; |
| 3824 | } |
| 3825 | pReqMsg->numBuckets = nla_get_u8( |
| 3826 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]); |
| 3827 | if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) { |
| 3828 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets " |
| 3829 | "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS); |
| 3830 | pReqMsg->numBuckets = WLAN_EXTSCAN_MAX_BUCKETS; |
| 3831 | } |
| 3832 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"), |
| 3833 | pReqMsg->numBuckets); |
| 3834 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) { |
| 3835 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed")); |
| 3836 | goto fail; |
| 3837 | } |
| 3838 | |
| 3839 | nla_for_each_nested(buckets, |
| 3840 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) { |
| 3841 | if(nla_parse(bucket, |
| 3842 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3843 | nla_data(buckets), nla_len(buckets), NULL)) { //policy |
| 3844 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3845 | goto fail; |
| 3846 | } |
| 3847 | |
| 3848 | /* Parse and fetch bucket spec */ |
| 3849 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) { |
| 3850 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket index failed")); |
| 3851 | goto fail; |
| 3852 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3853 | |
| 3854 | pReqMsg->buckets[index].bucket = nla_get_u8( |
| 3855 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]); |
| 3856 | |
| 3857 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bucket spec Index (%d)"), |
| 3858 | pReqMsg->buckets[index].bucket); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3859 | |
| 3860 | /* Parse and fetch wifi band */ |
| 3861 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) { |
| 3862 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3863 | goto fail; |
| 3864 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3865 | pReqMsg->buckets[index].band = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3866 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]); |
| 3867 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3868 | pReqMsg->buckets[index].band); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3869 | |
| 3870 | /* Parse and fetch period */ |
| 3871 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) { |
| 3872 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr period failed")); |
| 3873 | goto fail; |
| 3874 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3875 | pReqMsg->buckets[index].period = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3876 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]); |
| 3877 | hddLog(VOS_TRACE_LEVEL_INFO, FL("period (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3878 | pReqMsg->buckets[index].period); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3879 | |
| 3880 | /* Parse and fetch report events */ |
| 3881 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) { |
| 3882 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report events failed")); |
| 3883 | goto fail; |
| 3884 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3885 | pReqMsg->buckets[index].reportEvents = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3886 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]); |
| 3887 | hddLog(VOS_TRACE_LEVEL_INFO, FL("report events (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3888 | pReqMsg->buckets[index].reportEvents); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3889 | |
| 3890 | /* Parse and fetch number of channels */ |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3891 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) |
| 3892 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3893 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr num channels failed")); |
| 3894 | goto fail; |
| 3895 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3896 | pReqMsg->buckets[index].numChannels = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3897 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]); |
| 3898 | hddLog(VOS_TRACE_LEVEL_INFO, FL("num channels (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3899 | pReqMsg->buckets[index].numChannels); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3900 | |
| 3901 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) { |
| 3902 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel spec failed")); |
| 3903 | goto fail; |
| 3904 | } |
| 3905 | |
| 3906 | j = 0; |
| 3907 | nla_for_each_nested(channels, |
| 3908 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) { |
| 3909 | if(nla_parse(channel, |
| 3910 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3911 | nla_data(channels), nla_len(channels), |
| 3912 | NULL)) { //wlan_hdd_extscan_config_policy here |
| 3913 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3914 | goto fail; |
| 3915 | } |
| 3916 | |
| 3917 | /* Parse and fetch channel */ |
| 3918 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) { |
| 3919 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3920 | goto fail; |
| 3921 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3922 | pReqMsg->buckets[index].channels[j].channel = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3923 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]); |
| 3924 | hddLog(VOS_TRACE_LEVEL_INFO, FL("channel (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3925 | pReqMsg->buckets[index].channels[j].channel); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3926 | |
| 3927 | /* Parse and fetch dwell time */ |
| 3928 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) { |
| 3929 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dwelltime failed")); |
| 3930 | goto fail; |
| 3931 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3932 | pReqMsg->buckets[index].channels[j].dwellTimeMs = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3933 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]); |
| 3934 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Dwell time (%u ms)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3935 | pReqMsg->buckets[index].channels[j].dwellTimeMs); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3936 | |
| 3937 | /* Parse and fetch channel spec passive */ |
| 3938 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) { |
| 3939 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3940 | FL("attr channel spec passive failed")); |
| 3941 | goto fail; |
| 3942 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3943 | pReqMsg->buckets[index].channels[j].passive = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3944 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]); |
| 3945 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Chnl spec passive (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3946 | pReqMsg->buckets[index].channels[j].passive); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3947 | j++; |
| 3948 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3949 | index++; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3950 | } |
| 3951 | status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg); |
| 3952 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3953 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3954 | FL("sme_EXTScanStart failed(err=%d)"), status); |
| 3955 | vos_mem_free(pReqMsg); |
| 3956 | return -EINVAL; |
| 3957 | } |
| 3958 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3959 | vos_mem_free(pReqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3960 | return 0; |
| 3961 | |
| 3962 | fail: |
| 3963 | vos_mem_free(pReqMsg); |
| 3964 | return -EINVAL; |
| 3965 | } |
| 3966 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3967 | static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
| 3968 | struct wireless_dev *wdev, |
| 3969 | const void *data, int dataLen) |
| 3970 | { |
| 3971 | int ret = 0; |
| 3972 | |
| 3973 | vos_ssr_protect(__func__); |
| 3974 | ret = __wlan_hdd_cfg80211_extscan_start(wiphy, wdev, data, dataLen); |
| 3975 | vos_ssr_unprotect(__func__); |
| 3976 | |
| 3977 | return ret; |
| 3978 | } |
| 3979 | |
| 3980 | static int __wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3981 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3982 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3983 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3984 | tSirEXTScanStopReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3985 | struct net_device *dev = wdev->netdev; |
| 3986 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3987 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3988 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3989 | eHalStatus status; |
| 3990 | |
| 3991 | status = wlan_hdd_validate_context(pHddCtx); |
| 3992 | if (0 != status) |
| 3993 | { |
| 3994 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3995 | FL("HDD context is not valid")); |
| 3996 | return -EINVAL; |
| 3997 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3998 | /* check the EXTScan Capability */ |
| 3999 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4000 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4001 | { |
| 4002 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4003 | FL("EXTScan not enabled/supported by Firmware")); |
| 4004 | return -EINVAL; |
| 4005 | } |
| 4006 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4007 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4008 | data, dataLen, |
| 4009 | wlan_hdd_extscan_config_policy)) { |
| 4010 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4011 | return -EINVAL; |
| 4012 | } |
| 4013 | |
| 4014 | /* Parse and fetch request Id */ |
| 4015 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4016 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4017 | return -EINVAL; |
| 4018 | } |
| 4019 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4020 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4021 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4022 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4023 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4024 | reqMsg.sessionId = pAdapter->sessionId; |
| 4025 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4026 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4027 | status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4028 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4029 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4030 | FL("sme_EXTScanStop failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4031 | return -EINVAL; |
| 4032 | } |
| 4033 | |
| 4034 | return 0; |
| 4035 | } |
| 4036 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4037 | static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
| 4038 | struct wireless_dev *wdev, |
| 4039 | const void *data, int dataLen) |
| 4040 | { |
| 4041 | int ret = 0; |
| 4042 | |
| 4043 | vos_ssr_protect(__func__); |
| 4044 | ret = __wlan_hdd_cfg80211_extscan_stop(wiphy, wdev, data, dataLen); |
| 4045 | vos_ssr_unprotect(__func__); |
| 4046 | |
| 4047 | return ret; |
| 4048 | } |
| 4049 | |
| 4050 | static int __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4051 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4052 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4053 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4054 | tSirEXTScanResetBssidHotlistReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4055 | struct net_device *dev = wdev->netdev; |
| 4056 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4057 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4058 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4059 | eHalStatus status; |
| 4060 | |
| 4061 | status = wlan_hdd_validate_context(pHddCtx); |
| 4062 | if (0 != status) |
| 4063 | { |
| 4064 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4065 | FL("HDD context is not valid")); |
| 4066 | return -EINVAL; |
| 4067 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4068 | /* check the EXTScan Capability */ |
| 4069 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4070 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4071 | { |
| 4072 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4073 | FL("EXTScan not enabled/supported by Firmware")); |
| 4074 | return -EINVAL; |
| 4075 | } |
| 4076 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4077 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4078 | data, dataLen, |
| 4079 | wlan_hdd_extscan_config_policy)) { |
| 4080 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4081 | return -EINVAL; |
| 4082 | } |
| 4083 | |
| 4084 | /* Parse and fetch request Id */ |
| 4085 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4086 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4087 | return -EINVAL; |
| 4088 | } |
| 4089 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4090 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4091 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4092 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4093 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4094 | reqMsg.sessionId = pAdapter->sessionId; |
| 4095 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4096 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4097 | status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4098 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4099 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4100 | FL("sme_ResetBssHotlist failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4101 | return -EINVAL; |
| 4102 | } |
| 4103 | |
| 4104 | return 0; |
| 4105 | } |
| 4106 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4107 | static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
| 4108 | struct wireless_dev *wdev, |
| 4109 | const void *data, int dataLen) |
| 4110 | { |
| 4111 | int ret = 0; |
| 4112 | |
| 4113 | vos_ssr_protect(__func__); |
| 4114 | ret = __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(wiphy, wdev, data, dataLen); |
| 4115 | vos_ssr_unprotect(__func__); |
| 4116 | |
| 4117 | return ret; |
| 4118 | } |
| 4119 | |
| 4120 | static int __wlan_hdd_cfg80211_extscan_reset_significant_change( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4121 | struct wiphy *wiphy, |
| 4122 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4123 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4124 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4125 | tSirEXTScanResetSignificantChangeReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4126 | struct net_device *dev = wdev->netdev; |
| 4127 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4128 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4129 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4130 | eHalStatus status; |
| 4131 | |
| 4132 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Entering")); |
| 4133 | status = wlan_hdd_validate_context(pHddCtx); |
| 4134 | if (0 != status) |
| 4135 | { |
| 4136 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4137 | FL("HDD context is not valid")); |
| 4138 | return -EINVAL; |
| 4139 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4140 | /* check the EXTScan Capability */ |
| 4141 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4142 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4143 | { |
| 4144 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4145 | FL("EXTScan not enabled/supported by Firmware")); |
| 4146 | return -EINVAL; |
| 4147 | } |
| 4148 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4149 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4150 | data, dataLen, |
| 4151 | wlan_hdd_extscan_config_policy)) { |
| 4152 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4153 | return -EINVAL; |
| 4154 | } |
| 4155 | |
| 4156 | /* Parse and fetch request Id */ |
| 4157 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4158 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4159 | return -EINVAL; |
| 4160 | } |
| 4161 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4162 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4163 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4164 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4165 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4166 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4167 | reqMsg.sessionId = pAdapter->sessionId; |
| 4168 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4169 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4170 | status = sme_ResetSignificantChange(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4171 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4172 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4173 | FL("sme_ResetSignificantChange failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4174 | return -EINVAL; |
| 4175 | } |
| 4176 | |
| 4177 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Exiting")); |
| 4178 | return 0; |
| 4179 | } |
| 4180 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4181 | static int wlan_hdd_cfg80211_extscan_reset_significant_change( |
| 4182 | struct wiphy *wiphy, |
| 4183 | struct wireless_dev *wdev, |
| 4184 | const void *data, int dataLen) |
| 4185 | { |
| 4186 | int ret = 0; |
| 4187 | |
| 4188 | vos_ssr_protect(__func__); |
| 4189 | ret = __wlan_hdd_cfg80211_extscan_reset_significant_change(wiphy, |
| 4190 | wdev, data, |
| 4191 | dataLen); |
| 4192 | vos_ssr_unprotect(__func__); |
| 4193 | |
| 4194 | return ret; |
| 4195 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4196 | #endif /* WLAN_FEATURE_EXTSCAN */ |
| 4197 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4198 | /*EXT TDLS*/ |
| 4199 | static const struct nla_policy |
| 4200 | wlan_hdd_tdls_config_enable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX +1] = |
| 4201 | { |
| 4202 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4203 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL] = {.type = NLA_S32 }, |
| 4204 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS] = |
| 4205 | {.type = NLA_S32 }, |
| 4206 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS] = {.type = NLA_S32 }, |
| 4207 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS] = {.type = NLA_S32 }, |
| 4208 | |
| 4209 | }; |
| 4210 | |
| 4211 | static const struct nla_policy |
| 4212 | wlan_hdd_tdls_config_disable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX +1] = |
| 4213 | { |
| 4214 | [QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4215 | |
| 4216 | }; |
| 4217 | |
| 4218 | static const struct nla_policy |
| 4219 | wlan_hdd_tdls_config_state_change_policy[ |
| 4220 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAX +1] = |
| 4221 | { |
| 4222 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4223 | [QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE] = {.type = NLA_S32 }, |
| 4224 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4225 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL] = {.type = NLA_S32 }, |
| 4226 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS] = |
| 4227 | {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4228 | |
| 4229 | }; |
| 4230 | |
| 4231 | static const struct nla_policy |
| 4232 | wlan_hdd_tdls_config_get_status_policy[ |
| 4233 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX +1] = |
| 4234 | { |
| 4235 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4236 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE] = {.type = NLA_S32 }, |
| 4237 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4238 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL] = {.type = NLA_S32 }, |
| 4239 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS] |
| 4240 | = {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4241 | |
| 4242 | }; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4243 | |
| 4244 | static const struct nla_policy |
| 4245 | wlan_hdd_mac_config[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX+1] = |
| 4246 | { |
| 4247 | [QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI] = {.type = NLA_UNSPEC }, |
| 4248 | }; |
| 4249 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4250 | static int __wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4251 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4252 | const void *data, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4253 | int data_len) |
| 4254 | { |
| 4255 | |
| 4256 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4257 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX + 1]; |
| 4258 | |
| 4259 | if (0 != wlan_hdd_validate_context(pHddCtx)){ |
| 4260 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("hdd Ctx invalid while spoof macAddr")); |
| 4261 | return -EINVAL; |
| 4262 | } |
| 4263 | if (FALSE == pHddCtx->cfg_ini->enableMacSpoofing) { |
| 4264 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN disabled in ini")); |
| 4265 | return -ENOTSUPP; |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4266 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4267 | if (TRUE != sme_IsFeatureSupportedByFW(MAC_SPOOFED_SCAN)){ |
| 4268 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN not supported by FW")); |
| 4269 | return -ENOTSUPP; |
| 4270 | } |
| 4271 | |
| 4272 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX, |
| 4273 | data, data_len, wlan_hdd_mac_config)) { |
| 4274 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4275 | return -EINVAL; |
| 4276 | } |
| 4277 | |
| 4278 | /* Parse and fetch mac address */ |
| 4279 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]) { |
| 4280 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4281 | return -EINVAL; |
| 4282 | } |
| 4283 | |
| 4284 | memcpy(pHddCtx->spoofMacAddr.randomMacAddr.bytes, nla_data( |
| 4285 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4286 | VOS_MAC_ADDR_LAST_3_BYTES); |
| 4287 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4288 | pHddCtx->spoofMacAddr.isEnabled = TRUE; |
| 4289 | |
| 4290 | 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] | 4291 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4292 | VOS_MAC_ADDR_FIRST_3_BYTES); |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4293 | if ((pHddCtx->spoofMacAddr.randomMacAddr.bytes[0] == 0) && |
| 4294 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[1] == 0) && |
| 4295 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[2] == 0)) |
| 4296 | { |
| 4297 | hddLog(LOG1, FL("ZERO MAC OUI Recieved. Disabling Spoofing")); |
| 4298 | vos_mem_zero(pHddCtx->spoofMacAddr.randomMacAddr.bytes, |
| 4299 | VOS_MAC_ADDRESS_LEN); |
| 4300 | pHddCtx->spoofMacAddr.isEnabled = FALSE; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4301 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4302 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4303 | if (VOS_STATUS_SUCCESS != hdd_processSpoofMacAddrRequest(pHddCtx)) |
| 4304 | { |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4305 | hddLog(LOGE, FL("Failed to send Spoof Mac Addr to FW")); |
| 4306 | } |
| 4307 | |
| 4308 | return 0; |
| 4309 | } |
| 4310 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4311 | static int wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
| 4312 | struct wireless_dev *wdev, |
| 4313 | const void *data, |
| 4314 | int data_len) |
| 4315 | { |
| 4316 | int ret = 0; |
| 4317 | |
| 4318 | vos_ssr_protect(__func__); |
| 4319 | ret = __wlan_hdd_cfg80211_set_spoofed_mac_oui(wiphy, wdev, data, data_len); |
| 4320 | vos_ssr_unprotect(__func__); |
| 4321 | |
| 4322 | return ret; |
| 4323 | } |
| 4324 | |
| 4325 | static int __wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4326 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4327 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4328 | int data_len) |
| 4329 | { |
| 4330 | u8 peer[6] = {0}; |
| 4331 | struct net_device *dev = wdev->netdev; |
| 4332 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4333 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4334 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; |
| 4335 | eHalStatus ret; |
| 4336 | tANI_S32 state; |
| 4337 | tANI_S32 reason; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4338 | tANI_S32 global_operating_class = 0; |
| 4339 | tANI_S32 channel = 0; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4340 | struct sk_buff *skb = NULL; |
| 4341 | |
| 4342 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4343 | if (0 != ret) { |
| 4344 | |
| 4345 | return -EINVAL; |
| 4346 | } |
| 4347 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 4348 | |
| 4349 | return -ENOTSUPP; |
| 4350 | } |
| 4351 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, |
| 4352 | data, data_len, |
| 4353 | wlan_hdd_tdls_config_get_status_policy)) { |
| 4354 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4355 | return -EINVAL; |
| 4356 | } |
| 4357 | |
| 4358 | /* Parse and fetch mac address */ |
| 4359 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]) { |
| 4360 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4361 | return -EINVAL; |
| 4362 | } |
| 4363 | |
| 4364 | memcpy(peer, nla_data( |
| 4365 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]), |
| 4366 | sizeof(peer)); |
| 4367 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4368 | |
| 4369 | ret = wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason); |
| 4370 | |
| 4371 | if (0 != ret) { |
| 4372 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4373 | FL("get status Failed")); |
| 4374 | return -EINVAL; |
| 4375 | } |
| 4376 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4377 | 4 * sizeof(s32) + |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4378 | NLMSG_HDRLEN); |
| 4379 | |
| 4380 | if (!skb) { |
| 4381 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4382 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 4383 | return -EINVAL; |
| 4384 | } |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4385 | 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] | 4386 | reason, |
| 4387 | state, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4388 | global_operating_class, |
| 4389 | channel, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4390 | MAC_ADDR_ARRAY(peer)); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4391 | if (nla_put_s32(skb, |
| 4392 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE, |
| 4393 | state) || |
| 4394 | nla_put_s32(skb, |
| 4395 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON, |
| 4396 | reason) || |
| 4397 | nla_put_s32(skb, |
| 4398 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS, |
| 4399 | global_operating_class) || |
| 4400 | nla_put_s32(skb, |
| 4401 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL, |
| 4402 | channel)) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4403 | |
| 4404 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4405 | goto nla_put_failure; |
| 4406 | } |
| 4407 | |
| 4408 | return cfg80211_vendor_cmd_reply(skb); |
| 4409 | |
| 4410 | nla_put_failure: |
| 4411 | kfree_skb(skb); |
| 4412 | return -EINVAL; |
| 4413 | } |
| 4414 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4415 | static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
| 4416 | struct wireless_dev *wdev, |
| 4417 | const void *data, |
| 4418 | int data_len) |
| 4419 | { |
| 4420 | int ret = 0; |
| 4421 | |
| 4422 | vos_ssr_protect(__func__); |
| 4423 | ret = __wlan_hdd_cfg80211_exttdls_get_status(wiphy, wdev, data, data_len); |
| 4424 | vos_ssr_unprotect(__func__); |
| 4425 | |
| 4426 | return ret; |
| 4427 | } |
| 4428 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4429 | static int wlan_hdd_cfg80211_exttdls_callback(tANI_U8* mac, |
| 4430 | tANI_S32 state, |
| 4431 | tANI_S32 reason, |
| 4432 | void *ctx) |
| 4433 | { |
| 4434 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)ctx; |
| 4435 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4436 | struct sk_buff *skb = NULL; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4437 | tANI_S32 global_operating_class = 0; |
| 4438 | tANI_S32 channel = 0; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4439 | |
| 4440 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 4441 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid ")); |
| 4442 | return -EINVAL; |
| 4443 | } |
| 4444 | |
| 4445 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 4446 | |
| 4447 | return -ENOTSUPP; |
| 4448 | } |
| 4449 | skb = cfg80211_vendor_event_alloc( |
| 4450 | pHddCtx->wiphy, |
| 4451 | EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 4452 | QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX, |
| 4453 | GFP_KERNEL); |
| 4454 | |
| 4455 | if (!skb) { |
| 4456 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4457 | FL("cfg80211_vendor_event_alloc failed")); |
| 4458 | return -EINVAL; |
| 4459 | } |
| 4460 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4461 | hddLog(VOS_TRACE_LEVEL_INFO, "Reason: (%d) Status: (%d) Class: (%d) Channel: (%d)", |
| 4462 | reason, |
| 4463 | state, |
| 4464 | global_operating_class, |
| 4465 | channel); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4466 | hddLog(VOS_TRACE_LEVEL_WARN, "tdls peer " MAC_ADDRESS_STR, |
| 4467 | MAC_ADDR_ARRAY(mac)); |
| 4468 | |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4469 | if (nla_put(skb, |
| 4470 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR, |
| 4471 | VOS_MAC_ADDR_SIZE, mac) || |
| 4472 | nla_put_s32(skb, |
| 4473 | QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE, |
| 4474 | state) || |
| 4475 | nla_put_s32(skb, |
| 4476 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON, |
| 4477 | reason) || |
| 4478 | nla_put_s32(skb, |
| 4479 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL, |
| 4480 | channel) || |
| 4481 | nla_put_s32(skb, |
| 4482 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS, |
| 4483 | global_operating_class) |
| 4484 | ) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4485 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4486 | goto nla_put_failure; |
| 4487 | } |
| 4488 | |
| 4489 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 4490 | return (0); |
| 4491 | |
| 4492 | nla_put_failure: |
| 4493 | kfree_skb(skb); |
| 4494 | return -EINVAL; |
| 4495 | } |
| 4496 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4497 | static int __wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4498 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4499 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4500 | int data_len) |
| 4501 | { |
| 4502 | u8 peer[6] = {0}; |
| 4503 | struct net_device *dev = wdev->netdev; |
| 4504 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4505 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4506 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1]; |
| 4507 | eHalStatus status; |
| 4508 | tdls_req_params_t pReqMsg = {0}; |
| 4509 | |
| 4510 | status = wlan_hdd_validate_context(pHddCtx); |
| 4511 | if (0 != status) { |
| 4512 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4513 | FL("HDD context is not valid")); |
| 4514 | return -EINVAL; |
| 4515 | } |
| 4516 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 4517 | |
| 4518 | return -ENOTSUPP; |
| 4519 | } |
| 4520 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX, |
| 4521 | data, data_len, |
| 4522 | wlan_hdd_tdls_config_enable_policy)) { |
| 4523 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4524 | return -EINVAL; |
| 4525 | } |
| 4526 | |
| 4527 | /* Parse and fetch mac address */ |
| 4528 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]) { |
| 4529 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4530 | return -EINVAL; |
| 4531 | } |
| 4532 | |
| 4533 | memcpy(peer, nla_data( |
| 4534 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]), |
| 4535 | sizeof(peer)); |
| 4536 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4537 | |
| 4538 | /* Parse and fetch channel */ |
| 4539 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]) { |
| 4540 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 4541 | return -EINVAL; |
| 4542 | } |
| 4543 | pReqMsg.channel = nla_get_s32( |
| 4544 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]); |
| 4545 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Channel Num (%d)"), pReqMsg.channel); |
| 4546 | |
| 4547 | /* Parse and fetch global operating class */ |
| 4548 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]) { |
| 4549 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr operating class failed")); |
| 4550 | return -EINVAL; |
| 4551 | } |
| 4552 | pReqMsg.global_operating_class = nla_get_s32( |
| 4553 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]); |
| 4554 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Operating class (%d)"), |
| 4555 | pReqMsg.global_operating_class); |
| 4556 | |
| 4557 | /* Parse and fetch latency ms */ |
| 4558 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]) { |
| 4559 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr latency failed")); |
| 4560 | return -EINVAL; |
| 4561 | } |
| 4562 | pReqMsg.max_latency_ms = nla_get_s32( |
| 4563 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]); |
| 4564 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Latency (%d)"), |
| 4565 | pReqMsg.max_latency_ms); |
| 4566 | |
| 4567 | /* Parse and fetch required bandwidth kbps */ |
| 4568 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]) { |
| 4569 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bandwidth failed")); |
| 4570 | return -EINVAL; |
| 4571 | } |
| 4572 | |
| 4573 | pReqMsg.min_bandwidth_kbps = nla_get_s32( |
| 4574 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]); |
| 4575 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bandwidth (%d)"), |
| 4576 | pReqMsg.min_bandwidth_kbps); |
| 4577 | |
| 4578 | return (wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 4579 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 4580 | &pReqMsg, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4581 | wlan_hdd_cfg80211_exttdls_callback)); |
| 4582 | } |
| 4583 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4584 | static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
| 4585 | struct wireless_dev *wdev, |
| 4586 | const void *data, |
| 4587 | int data_len) |
| 4588 | { |
| 4589 | int ret = 0; |
| 4590 | |
| 4591 | vos_ssr_protect(__func__); |
| 4592 | ret = __wlan_hdd_cfg80211_exttdls_enable(wiphy, wdev, data, data_len); |
| 4593 | vos_ssr_unprotect(__func__); |
| 4594 | |
| 4595 | return ret; |
| 4596 | } |
| 4597 | |
| 4598 | static int __wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4599 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4600 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4601 | int data_len) |
| 4602 | { |
| 4603 | u8 peer[6] = {0}; |
| 4604 | struct net_device *dev = wdev->netdev; |
| 4605 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4606 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4607 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1]; |
| 4608 | eHalStatus status; |
| 4609 | |
| 4610 | status = wlan_hdd_validate_context(pHddCtx); |
| 4611 | if (0 != status) { |
| 4612 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4613 | FL("HDD context is not valid")); |
| 4614 | return -EINVAL; |
| 4615 | } |
| 4616 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
| 4617 | |
| 4618 | return -ENOTSUPP; |
| 4619 | } |
| 4620 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX, |
| 4621 | data, data_len, |
| 4622 | wlan_hdd_tdls_config_disable_policy)) { |
| 4623 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4624 | return -EINVAL; |
| 4625 | } |
| 4626 | /* Parse and fetch mac address */ |
| 4627 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]) { |
| 4628 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4629 | return -EINVAL; |
| 4630 | } |
| 4631 | |
| 4632 | memcpy(peer, nla_data( |
| 4633 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]), |
| 4634 | sizeof(peer)); |
| 4635 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4636 | |
| 4637 | return (wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer)); |
| 4638 | } |
| 4639 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4640 | static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
| 4641 | struct wireless_dev *wdev, |
| 4642 | const void *data, |
| 4643 | int data_len) |
| 4644 | { |
| 4645 | int ret = 0; |
| 4646 | |
| 4647 | vos_ssr_protect(__func__); |
| 4648 | ret = __wlan_hdd_cfg80211_exttdls_disable(wiphy, wdev, data, data_len); |
| 4649 | vos_ssr_unprotect(__func__); |
| 4650 | |
| 4651 | return ret; |
| 4652 | } |
| 4653 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4654 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4655 | __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4656 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4657 | const void *data, int data_len) |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4658 | { |
| 4659 | struct net_device *dev = wdev->netdev; |
| 4660 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4661 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4662 | struct sk_buff *skb = NULL; |
| 4663 | tANI_U32 fset = 0; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4664 | int ret = 0; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4665 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4666 | |
| 4667 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4668 | if (0 != ret) |
| 4669 | { |
| 4670 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4671 | "%s: HDD context is not valid (%d)",__func__, ret); |
| 4672 | return ret; |
| 4673 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4674 | if (wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { |
| 4675 | hddLog(LOG1, FL("Infra Station mode is supported by driver")); |
| 4676 | fset |= WIFI_FEATURE_INFRA; |
| 4677 | } |
| 4678 | |
| 4679 | if (TRUE == hdd_is_5g_supported(pHddCtx)) { |
| 4680 | hddLog(LOG1, FL("INFRA_5G is supported by firmware")); |
| 4681 | fset |= WIFI_FEATURE_INFRA_5G; |
| 4682 | } |
| 4683 | |
| 4684 | #ifdef WLAN_FEATURE_P2P |
| 4685 | if ((wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) && |
| 4686 | (wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_GO))) { |
| 4687 | hddLog(LOG1, FL("WiFi-Direct is supported by driver")); |
| 4688 | fset |= WIFI_FEATURE_P2P; |
| 4689 | } |
| 4690 | #endif |
| 4691 | |
| 4692 | /* Soft-AP is supported currently by default */ |
| 4693 | fset |= WIFI_FEATURE_SOFT_AP; |
| 4694 | |
| 4695 | #ifdef WLAN_FEATURE_EXTSCAN |
| 4696 | if ((TRUE == pHddCtx->cfg_ini->fEnableEXTScan) && |
| 4697 | sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) { |
| 4698 | hddLog(LOG1, FL("EXTScan is supported by firmware")); |
| 4699 | fset |= WIFI_FEATURE_EXTSCAN; |
| 4700 | } |
| 4701 | #endif |
| 4702 | |
| 4703 | #ifdef WLAN_FEATURE_NAN |
| 4704 | if (sme_IsFeatureSupportedByFW(NAN)) { |
| 4705 | hddLog(LOG1, FL("NAN is supported by firmware")); |
| 4706 | fset |= WIFI_FEATURE_NAN; |
| 4707 | } |
| 4708 | #endif |
| 4709 | |
| 4710 | /* D2D RTT is not supported currently by default */ |
| 4711 | if (sme_IsFeatureSupportedByFW(RTT)) { |
| 4712 | hddLog(LOG1, FL("RTT is supported by firmware")); |
| 4713 | fset |= WIFI_FEATURE_D2AP_RTT; |
| 4714 | } |
| 4715 | |
| 4716 | #ifdef FEATURE_WLAN_BATCH_SCAN |
| 4717 | if (fset & WIFI_FEATURE_EXTSCAN) { |
| 4718 | hddLog(LOG1, FL("Batch scan is supported as extscan is supported")); |
| 4719 | fset &= ~WIFI_FEATURE_BATCH_SCAN; |
| 4720 | } else if (sme_IsFeatureSupportedByFW(BATCH_SCAN)) { |
| 4721 | hddLog(LOG1, FL("Batch scan is supported by firmware")); |
| 4722 | fset |= WIFI_FEATURE_BATCH_SCAN; |
| 4723 | } |
| 4724 | #endif |
| 4725 | |
| 4726 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 4727 | if (pHddCtx->cfg_ini->configPNOScanSupport && |
| 4728 | (eHAL_STATUS_SUCCESS == wlan_hdd_is_pno_allowed(pAdapter))) { |
| 4729 | hddLog(LOG1, FL("PNO is supported by firmware")); |
| 4730 | fset |= WIFI_FEATURE_PNO; |
| 4731 | } |
| 4732 | #endif |
| 4733 | |
| 4734 | /* STA+STA is supported currently by default */ |
| 4735 | fset |= WIFI_FEATURE_ADDITIONAL_STA; |
| 4736 | |
| 4737 | #ifdef FEATURE_WLAN_TDLS |
| 4738 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSSupport) && |
| 4739 | sme_IsFeatureSupportedByFW(TDLS)) { |
| 4740 | hddLog(LOG1, FL("TDLS is supported by firmware")); |
| 4741 | fset |= WIFI_FEATURE_TDLS; |
| 4742 | } |
| 4743 | |
| 4744 | /* TDLS_OFFCHANNEL is not supported currently by default */ |
| 4745 | #endif |
| 4746 | |
| 4747 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 4748 | /* AP+STA concurrency is supported currently by default */ |
| 4749 | fset |= WIFI_FEATURE_AP_STA; |
| 4750 | #endif |
| 4751 | |
| 4752 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) + |
| 4753 | NLMSG_HDRLEN); |
| 4754 | |
| 4755 | if (!skb) { |
| 4756 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 4757 | return -EINVAL; |
| 4758 | } |
| 4759 | hddLog(LOG1, FL("Supported Features : 0x%x"), fset); |
| 4760 | |
| 4761 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_FEATURE_SET, fset)) { |
| 4762 | hddLog(LOGE, FL("nla put fail")); |
| 4763 | goto nla_put_failure; |
| 4764 | } |
| 4765 | |
| 4766 | return cfg80211_vendor_cmd_reply(skb); |
| 4767 | |
| 4768 | nla_put_failure: |
| 4769 | kfree_skb(skb); |
| 4770 | return -EINVAL; |
| 4771 | } |
| 4772 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 4773 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4774 | wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
| 4775 | struct wireless_dev *wdev, |
| 4776 | const void *data, int data_len) |
| 4777 | { |
| 4778 | int ret = 0; |
| 4779 | |
| 4780 | vos_ssr_protect(__func__); |
| 4781 | ret = __wlan_hdd_cfg80211_get_supported_features(wiphy, wdev, data, data_len); |
| 4782 | vos_ssr_unprotect(__func__); |
| 4783 | |
| 4784 | return ret; |
| 4785 | } |
| 4786 | |
| 4787 | static int |
| 4788 | __wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 4789 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4790 | const void *data, int data_len) |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 4791 | { |
| 4792 | uint32_t feature_set_matrix[WLAN_HDD_MAX_FEATURE_SET] = {0}; |
| 4793 | uint8_t i, feature_sets, max_feature_sets; |
| 4794 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX + 1]; |
| 4795 | struct sk_buff *reply_skb; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4796 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4797 | int ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 4798 | |
| 4799 | ENTER(); |
| 4800 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4801 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4802 | if (0 != ret) |
| 4803 | { |
| 4804 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4805 | "%s: HDD context is not valid, ret = %d",__func__, ret); |
| 4806 | return ret; |
| 4807 | } |
| 4808 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 4809 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX, |
| 4810 | data, data_len, NULL)) { |
| 4811 | hddLog(LOGE, FL("Invalid ATTR")); |
| 4812 | return -EINVAL; |
| 4813 | } |
| 4814 | |
| 4815 | /* Parse and fetch max feature set */ |
| 4816 | if (!tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]) { |
| 4817 | hddLog(LOGE, FL("Attr max feature set size failed")); |
| 4818 | return -EINVAL; |
| 4819 | } |
| 4820 | max_feature_sets = nla_get_u32( |
| 4821 | tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]); |
| 4822 | hddLog(LOG1, FL("Max feature set size (%d)"), max_feature_sets); |
| 4823 | |
| 4824 | /* Fill feature combination matrix */ |
| 4825 | feature_sets = 0; |
| 4826 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 4827 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 4828 | WIFI_FEATURE_P2P; |
| 4829 | |
| 4830 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 4831 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 4832 | WIFI_FEATURE_SOFT_AP; |
| 4833 | |
| 4834 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 4835 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_P2P | |
| 4836 | WIFI_FEATURE_SOFT_AP; |
| 4837 | |
| 4838 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 4839 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 4840 | WIFI_FEATURE_SOFT_AP | |
| 4841 | WIFI_FEATURE_P2P; |
| 4842 | |
| 4843 | /* Add more feature combinations here */ |
| 4844 | |
| 4845 | feature_sets = VOS_MIN(feature_sets, max_feature_sets); |
| 4846 | hddLog(LOG1, FL("Number of feature sets (%d)"), feature_sets); |
| 4847 | hddLog(LOG1, "Feature set matrix"); |
| 4848 | for (i = 0; i < feature_sets; i++) |
| 4849 | hddLog(LOG1, "[%d] 0x%02X", i, feature_set_matrix[i]); |
| 4850 | |
| 4851 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 4852 | sizeof(u32) * feature_sets + |
| 4853 | NLMSG_HDRLEN); |
| 4854 | |
| 4855 | if (reply_skb) { |
| 4856 | if (nla_put_u32(reply_skb, |
| 4857 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET_SIZE, |
| 4858 | feature_sets) || |
| 4859 | nla_put(reply_skb, |
| 4860 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET, |
| 4861 | sizeof(u32) * feature_sets, feature_set_matrix)) { |
| 4862 | hddLog(LOGE, FL("nla put fail")); |
| 4863 | kfree_skb(reply_skb); |
| 4864 | return -EINVAL; |
| 4865 | } |
| 4866 | |
| 4867 | return cfg80211_vendor_cmd_reply(reply_skb); |
| 4868 | } |
| 4869 | hddLog(LOGE, FL("Feature set matrix: buffer alloc fail")); |
| 4870 | return -ENOMEM; |
| 4871 | |
| 4872 | max_buffer_err: |
| 4873 | hddLog(LOGE, FL("Feature set max buffer size reached. feature_sets(%d) max(%d)"), |
| 4874 | feature_sets, WLAN_HDD_MAX_FEATURE_SET); |
| 4875 | return -EINVAL; |
| 4876 | } |
| 4877 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4878 | static int |
| 4879 | wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
| 4880 | struct wireless_dev *wdev, |
| 4881 | const void *data, int data_len) |
| 4882 | { |
| 4883 | int ret = 0; |
| 4884 | |
| 4885 | vos_ssr_protect(__func__); |
| 4886 | ret = __wlan_hdd_cfg80211_get_concurrency_matrix(wiphy, wdev, data, |
| 4887 | data_len); |
| 4888 | vos_ssr_unprotect(__func__); |
| 4889 | |
| 4890 | return ret; |
| 4891 | } |
| 4892 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 4893 | static const struct nla_policy |
| 4894 | wlan_hdd_set_no_dfs_flag_config_policy[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX |
| 4895 | +1] = |
| 4896 | { |
| 4897 | [QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG] = {.type = NLA_U32 }, |
| 4898 | }; |
| 4899 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4900 | static int __wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 4901 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4902 | const void *data, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 4903 | int data_len) |
| 4904 | { |
| 4905 | struct net_device *dev = wdev->netdev; |
| 4906 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4907 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4908 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4909 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX + 1]; |
| 4910 | eHalStatus status; |
| 4911 | u32 dfsFlag = 0; |
| 4912 | |
| 4913 | status = wlan_hdd_validate_context(pHddCtx); |
| 4914 | if (0 != status) { |
| 4915 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4916 | FL("HDD context is not valid")); |
| 4917 | return -EINVAL; |
| 4918 | } |
| 4919 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX, |
| 4920 | data, data_len, |
| 4921 | wlan_hdd_set_no_dfs_flag_config_policy)) { |
| 4922 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4923 | return -EINVAL; |
| 4924 | } |
| 4925 | |
| 4926 | /* Parse and fetch required bandwidth kbps */ |
| 4927 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]) { |
| 4928 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dfs flag failed")); |
| 4929 | return -EINVAL; |
| 4930 | } |
| 4931 | |
| 4932 | dfsFlag = nla_get_u32( |
| 4933 | tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]); |
| 4934 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" DFS flag (%d)"), |
| 4935 | dfsFlag); |
| 4936 | |
| 4937 | pHddCtx->disable_dfs_flag = dfsFlag; |
| 4938 | |
| 4939 | sme_disable_dfs_channel(hHal, dfsFlag); |
| 4940 | sme_FilterScanResults(hHal, pAdapter->sessionId); |
| 4941 | return 0; |
| 4942 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4943 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4944 | static int wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
| 4945 | struct wireless_dev *wdev, |
| 4946 | const void *data, |
| 4947 | int data_len) |
| 4948 | { |
| 4949 | int ret = 0; |
| 4950 | |
| 4951 | vos_ssr_protect(__func__); |
| 4952 | ret = __wlan_hdd_cfg80211_disable_dfs_channels(wiphy, wdev, data, data_len); |
| 4953 | vos_ssr_unprotect(__func__); |
| 4954 | |
| 4955 | return ret; |
| 4956 | |
| 4957 | } |
| 4958 | |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 4959 | const struct |
| 4960 | nla_policy qca_wlan_vendor_attr[QCA_WLAN_VENDOR_ATTR_MAX+1] = |
| 4961 | { |
| 4962 | [QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY] = { .type = NLA_U32 }, |
| 4963 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { .type = NLA_UNSPEC }, |
| 4964 | }; |
| 4965 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4966 | static int __wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4967 | struct wireless_dev *wdev, const void *data, int data_len) |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 4968 | { |
| 4969 | |
| 4970 | u8 bssid[6] = {0}; |
| 4971 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4972 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 4973 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4974 | v_U32_t isFwrRoamEnabled = FALSE; |
| 4975 | int ret; |
| 4976 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4977 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4978 | if (0 != ret) { |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 4979 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4980 | FL("HDD context is not valid, ret = %d"), ret); |
| 4981 | return ret; |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 4982 | } |
| 4983 | |
| 4984 | ret = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, |
| 4985 | data, data_len, |
| 4986 | qca_wlan_vendor_attr); |
| 4987 | if (ret){ |
| 4988 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4989 | return -EINVAL; |
| 4990 | } |
| 4991 | |
| 4992 | /* Parse and fetch Enable flag */ |
| 4993 | if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]) { |
| 4994 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr enable failed")); |
| 4995 | return -EINVAL; |
| 4996 | } |
| 4997 | |
| 4998 | isFwrRoamEnabled = nla_get_u32( |
| 4999 | tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]); |
| 5000 | |
| 5001 | hddLog(VOS_TRACE_LEVEL_INFO, FL("isFwrRoamEnabled (%d)"), isFwrRoamEnabled); |
| 5002 | |
| 5003 | /* Parse and fetch bssid */ |
| 5004 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 5005 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bss id failed")); |
| 5006 | return -EINVAL; |
| 5007 | } |
| 5008 | |
| 5009 | memcpy(bssid, nla_data( |
| 5010 | tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 5011 | sizeof(bssid)); |
| 5012 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(bssid)); |
| 5013 | |
| 5014 | //Update roaming |
| 5015 | status = sme_ConfigFwrRoaming((tHalHandle)(pHddCtx->hHal), isFwrRoamEnabled); |
| 5016 | return status; |
| 5017 | } |
| 5018 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5019 | static int wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
| 5020 | struct wireless_dev *wdev, const void *data, int data_len) |
| 5021 | { |
| 5022 | int ret = 0; |
| 5023 | |
| 5024 | vos_ssr_protect(__func__); |
| 5025 | ret = __wlan_hdd_cfg80211_firmware_roaming(wiphy, wdev, data, data_len); |
| 5026 | vos_ssr_unprotect(__func__); |
| 5027 | |
| 5028 | return ret; |
| 5029 | } |
| 5030 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5031 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 5032 | { |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5033 | { |
| 5034 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5035 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAMING, |
| 5036 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5037 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5038 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5039 | .doit = wlan_hdd_cfg80211_firmware_roaming |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5040 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5041 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5042 | { |
| 5043 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5044 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 5045 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5046 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5047 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5048 | .doit = wlan_hdd_cfg80211_ll_stats_clear |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5049 | }, |
| 5050 | |
| 5051 | { |
| 5052 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5053 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 5054 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5055 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5056 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5057 | .doit = wlan_hdd_cfg80211_ll_stats_set |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5058 | }, |
| 5059 | |
| 5060 | { |
| 5061 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5062 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 5063 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5064 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5065 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5066 | .doit = wlan_hdd_cfg80211_ll_stats_get |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5067 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5068 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5069 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5070 | { |
| 5071 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5072 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START, |
| 5073 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5074 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5075 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5076 | .doit = wlan_hdd_cfg80211_extscan_start |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5077 | }, |
| 5078 | { |
| 5079 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5080 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP, |
| 5081 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5082 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5083 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5084 | .doit = wlan_hdd_cfg80211_extscan_stop |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5085 | }, |
| 5086 | { |
| 5087 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5088 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS, |
| 5089 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5090 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5091 | .doit = wlan_hdd_cfg80211_extscan_get_valid_channels |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5092 | }, |
| 5093 | { |
| 5094 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5095 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES, |
| 5096 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5097 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5098 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5099 | .doit = wlan_hdd_cfg80211_extscan_get_capabilities |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5100 | }, |
| 5101 | { |
| 5102 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5103 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS, |
| 5104 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5105 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5106 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5107 | .doit = wlan_hdd_cfg80211_extscan_get_cached_results |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5108 | }, |
| 5109 | { |
| 5110 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5111 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST, |
| 5112 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5113 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5114 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5115 | .doit = wlan_hdd_cfg80211_extscan_set_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5116 | }, |
| 5117 | { |
| 5118 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5119 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST, |
| 5120 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5121 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5122 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5123 | .doit = wlan_hdd_cfg80211_extscan_reset_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5124 | }, |
| 5125 | { |
| 5126 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5127 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE, |
| 5128 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5129 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5130 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5131 | .doit = wlan_hdd_cfg80211_extscan_set_significant_change |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5132 | }, |
| 5133 | { |
| 5134 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5135 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE, |
| 5136 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5137 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5138 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5139 | .doit = wlan_hdd_cfg80211_extscan_reset_significant_change |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5140 | }, |
| 5141 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5142 | /*EXT TDLS*/ |
| 5143 | { |
| 5144 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5145 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE, |
| 5146 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5147 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5148 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5149 | .doit = wlan_hdd_cfg80211_exttdls_enable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5150 | }, |
| 5151 | { |
| 5152 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5153 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE, |
| 5154 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5155 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5156 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5157 | .doit = wlan_hdd_cfg80211_exttdls_disable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5158 | }, |
| 5159 | { |
| 5160 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5161 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS, |
| 5162 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5163 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5164 | .doit = wlan_hdd_cfg80211_exttdls_get_status |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5165 | }, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5166 | { |
| 5167 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5168 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES, |
| 5169 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5170 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5171 | .doit = wlan_hdd_cfg80211_get_supported_features |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5172 | }, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5173 | { |
| 5174 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5175 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG, |
| 5176 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5177 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5178 | .doit = wlan_hdd_cfg80211_disable_dfs_channels |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5179 | }, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5180 | { |
| 5181 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5182 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MAC_OUI, |
| 5183 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5184 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5185 | .doit = wlan_hdd_cfg80211_set_spoofed_mac_oui |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5186 | }, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5187 | { |
| 5188 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5189 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX, |
| 5190 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5191 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5192 | .doit = wlan_hdd_cfg80211_get_concurrency_matrix |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5193 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5194 | }; |
| 5195 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5196 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5197 | static const |
| 5198 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5199 | { |
| 5200 | #ifdef FEATURE_WLAN_CH_AVOID |
| 5201 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5202 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5203 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5204 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5205 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 5206 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5207 | { |
| 5208 | /* Index = 1*/ |
| 5209 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5210 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 5211 | }, |
| 5212 | { |
| 5213 | /* Index = 2*/ |
| 5214 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5215 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 5216 | }, |
| 5217 | { |
| 5218 | /* Index = 3*/ |
| 5219 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5220 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 5221 | }, |
| 5222 | { |
| 5223 | /* Index = 4*/ |
| 5224 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5225 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 5226 | }, |
| 5227 | { |
| 5228 | /* Index = 5*/ |
| 5229 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5230 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 5231 | }, |
| 5232 | { |
| 5233 | /* Index = 6*/ |
| 5234 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5235 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 5236 | }, |
| 5237 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5238 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5239 | { |
| 5240 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5241 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START |
| 5242 | }, |
| 5243 | { |
| 5244 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5245 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP |
| 5246 | }, |
| 5247 | { |
| 5248 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5249 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES |
| 5250 | }, |
| 5251 | { |
| 5252 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5253 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS |
| 5254 | }, |
| 5255 | { |
| 5256 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5257 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE |
| 5258 | }, |
| 5259 | { |
| 5260 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5261 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT |
| 5262 | }, |
| 5263 | { |
| 5264 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5265 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT |
| 5266 | }, |
| 5267 | { |
| 5268 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5269 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND |
| 5270 | }, |
| 5271 | { |
| 5272 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5273 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST |
| 5274 | }, |
| 5275 | { |
| 5276 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5277 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST |
| 5278 | }, |
| 5279 | { |
| 5280 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5281 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE |
| 5282 | }, |
| 5283 | { |
| 5284 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5285 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE |
| 5286 | }, |
| 5287 | { |
| 5288 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5289 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE |
| 5290 | }, |
| 5291 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5292 | /*EXT TDLS*/ |
| 5293 | { |
| 5294 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5295 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE |
| 5296 | }, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5297 | }; |
| 5298 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5299 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5300 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5301 | * This function is called by hdd_wlan_startup() |
| 5302 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5303 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5304 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5305 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5306 | { |
| 5307 | struct wiphy *wiphy; |
| 5308 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5309 | /* |
| 5310 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5311 | */ |
| 5312 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 5313 | |
| 5314 | if (!wiphy) |
| 5315 | { |
| 5316 | /* Print error and jump into err label and free the memory */ |
| 5317 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 5318 | return NULL; |
| 5319 | } |
| 5320 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5321 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5322 | return wiphy; |
| 5323 | } |
| 5324 | |
| 5325 | /* |
| 5326 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5327 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5328 | * private ioctl to change the band value |
| 5329 | */ |
| 5330 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 5331 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5332 | int i, j; |
| 5333 | eNVChannelEnabledType channelEnabledState; |
| 5334 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5335 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5336 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5337 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5338 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5339 | |
| 5340 | if (NULL == wiphy->bands[i]) |
| 5341 | { |
| 5342 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 5343 | __func__, i); |
| 5344 | continue; |
| 5345 | } |
| 5346 | |
| 5347 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 5348 | { |
| 5349 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 5350 | |
| 5351 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 5352 | band->channels[j].hw_value); |
| 5353 | |
| 5354 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 5355 | { |
Abhishek Singh | 678227a | 2014-11-04 10:52:38 +0530 | [diff] [blame] | 5356 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5357 | continue; |
| 5358 | } |
| 5359 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 5360 | { |
| 5361 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5362 | continue; |
| 5363 | } |
| 5364 | |
| 5365 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 5366 | NV_CHANNEL_INVALID == channelEnabledState) |
| 5367 | { |
| 5368 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5369 | } |
| 5370 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 5371 | { |
| 5372 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 5373 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 5374 | } |
| 5375 | else |
| 5376 | { |
| 5377 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 5378 | |IEEE80211_CHAN_RADAR); |
| 5379 | } |
| 5380 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5381 | } |
| 5382 | return 0; |
| 5383 | } |
| 5384 | /* |
| 5385 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5386 | * This function is called by hdd_wlan_startup() |
| 5387 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5388 | * This function is used to initialize and register wiphy structure. |
| 5389 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5390 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5391 | struct wiphy *wiphy, |
| 5392 | hdd_config_t *pCfg |
| 5393 | ) |
| 5394 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5395 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 5396 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5397 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5398 | ENTER(); |
| 5399 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5400 | /* Now bind the underlying wlan device with wiphy */ |
| 5401 | set_wiphy_dev(wiphy, dev); |
| 5402 | |
| 5403 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5404 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5405 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 5406 | /* the flag for the other case would be initialzed in |
| 5407 | vos_init_wiphy_from_nv_bin */ |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 5408 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5409 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5410 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5411 | /* This will disable updating of NL channels from passive to |
| 5412 | * active if a beacon is received on passive channel. */ |
| 5413 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Amar Singhal | f007319 | 2013-09-20 12:34:56 -0700 | [diff] [blame] | 5414 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5415 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5416 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5417 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 5418 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 5419 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 5420 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5421 | | WIPHY_FLAG_OFFCHAN_TX; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5422 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5423 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5424 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5425 | #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] | 5426 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 5427 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 5428 | || pCfg->isFastRoamIniFeatureEnabled |
| 5429 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5430 | #ifdef FEATURE_WLAN_ESE |
| 5431 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 5432 | #endif |
| 5433 | ) |
| 5434 | { |
| 5435 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 5436 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 5437 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5438 | #ifdef FEATURE_WLAN_TDLS |
| 5439 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 5440 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 5441 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 5442 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 5443 | if (pCfg->configPNOScanSupport) |
| 5444 | { |
| 5445 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 5446 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 5447 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 5448 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 5449 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 5450 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5451 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5452 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 5453 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 5454 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5455 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 5456 | driver need to determine what to do with both |
| 5457 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5458 | |
| 5459 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5460 | #else |
| 5461 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5462 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5463 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5464 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 5465 | |
Madan Mohan Koyyalamudi | 6815b16 | 2013-07-19 17:17:46 +0530 | [diff] [blame] | 5466 | wiphy->max_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5467 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 5468 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 5469 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5470 | /* Supports STATION & AD-HOC modes right now */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5471 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5472 | | BIT(NL80211_IFTYPE_ADHOC) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5473 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 5474 | | BIT(NL80211_IFTYPE_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5475 | | BIT(NL80211_IFTYPE_AP); |
| 5476 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5477 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5478 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5479 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 5480 | if( pCfg->enableMCC ) |
| 5481 | { |
| 5482 | /* Currently, supports up to two channels */ |
| 5483 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5484 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5485 | if( !pCfg->allowMCCGODiffBI ) |
| 5486 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5487 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5488 | } |
| 5489 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 5490 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5491 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5492 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5493 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5494 | /* Before registering we need to update the ht capabilitied based |
| 5495 | * on ini values*/ |
| 5496 | if( !pCfg->ShortGI20MhzEnable ) |
| 5497 | { |
| 5498 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5499 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5500 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5501 | } |
| 5502 | |
| 5503 | if( !pCfg->ShortGI40MhzEnable ) |
| 5504 | { |
| 5505 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 5506 | } |
| 5507 | |
| 5508 | if( !pCfg->nChannelBondingMode5GHz ) |
| 5509 | { |
| 5510 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 5511 | } |
| 5512 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5513 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 5514 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 5515 | { |
| 5516 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 5517 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5518 | |
| 5519 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 5520 | { |
| 5521 | |
| 5522 | if (NULL == wiphy->bands[i]) |
| 5523 | { |
| 5524 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 5525 | __func__, i); |
| 5526 | continue; |
| 5527 | } |
| 5528 | |
| 5529 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 5530 | { |
| 5531 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 5532 | |
| 5533 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 5534 | { |
| 5535 | // Enable social channels for P2P |
| 5536 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 5537 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 5538 | else |
| 5539 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5540 | continue; |
| 5541 | } |
| 5542 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 5543 | { |
| 5544 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5545 | continue; |
| 5546 | } |
| 5547 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5548 | } |
| 5549 | /*Initialise the supported cipher suite details*/ |
| 5550 | wiphy->cipher_suites = hdd_cipher_suites; |
| 5551 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 5552 | |
| 5553 | /*signal strength in mBm (100*dBm) */ |
| 5554 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 5555 | |
| 5556 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 5557 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5558 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5559 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5560 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 5561 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5562 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 5563 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 5564 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5565 | EXIT(); |
| 5566 | return 0; |
| 5567 | } |
| 5568 | |
| 5569 | /* In this function we are registering wiphy. */ |
| 5570 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 5571 | { |
| 5572 | ENTER(); |
| 5573 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5574 | if (0 > wiphy_register(wiphy)) |
| 5575 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5576 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5577 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 5578 | return -EIO; |
| 5579 | } |
| 5580 | |
| 5581 | EXIT(); |
| 5582 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5583 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5584 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5585 | /* In this function we are updating channel list when, |
| 5586 | regulatory domain is FCC and country code is US. |
| 5587 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 5588 | As per FCC smart phone is not a indoor device. |
| 5589 | GO should not opeate on indoor channels */ |
| 5590 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 5591 | { |
| 5592 | int j; |
| 5593 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5594 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 5595 | //Default counrtycode from NV at the time of wiphy initialization. |
| 5596 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 5597 | &defaultCountryCode[0])) |
| 5598 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 5599 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5600 | } |
| 5601 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 5602 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5603 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 5604 | { |
| 5605 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 5606 | return; |
| 5607 | } |
| 5608 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 5609 | { |
| 5610 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 5611 | // Mark UNII -1 band channel as passive |
| 5612 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 5613 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 5614 | } |
| 5615 | } |
| 5616 | } |
| 5617 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 5618 | /* This function registers for all frame which supplicant is interested in */ |
| 5619 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5620 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5621 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5622 | /* Register for all P2P action, public action etc frames */ |
| 5623 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 5624 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5625 | ENTER(); |
| 5626 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5627 | /* Right now we are registering these frame when driver is getting |
| 5628 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 5629 | frame register ops, we will move this code as a part of that */ |
| 5630 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5631 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5632 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 5633 | |
| 5634 | /* GAS Initial Response */ |
| 5635 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5636 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5637 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5638 | /* GAS Comeback Request */ |
| 5639 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5640 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 5641 | |
| 5642 | /* GAS Comeback Response */ |
| 5643 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5644 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 5645 | |
| 5646 | /* P2P Public Action */ |
| 5647 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5648 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5649 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 5650 | |
| 5651 | /* P2P Action */ |
| 5652 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5653 | (v_U8_t*)P2P_ACTION_FRAME, |
| 5654 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5655 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 5656 | /* WNM BSS Transition Request frame */ |
| 5657 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5658 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 5659 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 5660 | |
| 5661 | /* WNM-Notification */ |
| 5662 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5663 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 5664 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5665 | } |
| 5666 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 5667 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5668 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5669 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5670 | /* Register for all P2P action, public action etc frames */ |
| 5671 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 5672 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5673 | ENTER(); |
| 5674 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5675 | /* Right now we are registering these frame when driver is getting |
| 5676 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 5677 | frame register ops, we will move this code as a part of that */ |
| 5678 | /* GAS Initial Request */ |
| 5679 | |
| 5680 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5681 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 5682 | |
| 5683 | /* GAS Initial Response */ |
| 5684 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5685 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5686 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5687 | /* GAS Comeback Request */ |
| 5688 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5689 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 5690 | |
| 5691 | /* GAS Comeback Response */ |
| 5692 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5693 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 5694 | |
| 5695 | /* P2P Public Action */ |
| 5696 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5697 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5698 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 5699 | |
| 5700 | /* P2P Action */ |
| 5701 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5702 | (v_U8_t*)P2P_ACTION_FRAME, |
| 5703 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 5704 | /* WNM-Notification */ |
| 5705 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5706 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 5707 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5708 | } |
| 5709 | |
| 5710 | #ifdef FEATURE_WLAN_WAPI |
| 5711 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
| 5712 | const u8 *mac_addr, u8 *key , int key_Len) |
| 5713 | { |
| 5714 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5715 | tCsrRoamSetKey setKey; |
| 5716 | v_BOOL_t isConnected = TRUE; |
| 5717 | int status = 0; |
| 5718 | v_U32_t roamId= 0xFF; |
| 5719 | tANI_U8 *pKeyPtr = NULL; |
| 5720 | int n = 0; |
| 5721 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 5722 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 5723 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 5724 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5725 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 5726 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5727 | setKey.keyId = key_index; // Store Key ID |
| 5728 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 5729 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 5730 | setKey.paeRole = 0 ; // the PAE role |
| 5731 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 5732 | { |
| 5733 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 5734 | } |
| 5735 | else |
| 5736 | { |
| 5737 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 5738 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 5739 | } |
| 5740 | setKey.keyLength = key_Len; |
| 5741 | pKeyPtr = setKey.Key; |
| 5742 | memcpy( pKeyPtr, key, key_Len); |
| 5743 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5744 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5745 | __func__, key_Len); |
| 5746 | for (n = 0 ; n < key_Len; n++) |
| 5747 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 5748 | __func__,n,setKey.Key[n]); |
| 5749 | |
| 5750 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 5751 | if ( isConnected ) |
| 5752 | { |
| 5753 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5754 | pAdapter->sessionId, &setKey, &roamId ); |
| 5755 | } |
| 5756 | if ( status != 0 ) |
| 5757 | { |
| 5758 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5759 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 5760 | __LINE__, status ); |
| 5761 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 5762 | } |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 5763 | /* Need to clear any trace of key value in the memory. |
| 5764 | * Thus zero out the memory even though it is local |
| 5765 | * variable. |
| 5766 | */ |
| 5767 | vos_mem_zero(&setKey, sizeof(setKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5768 | } |
| 5769 | #endif /* FEATURE_WLAN_WAPI*/ |
| 5770 | |
| 5771 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5772 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5773 | beacon_data_t **ppBeacon, |
| 5774 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5775 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5776 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5777 | beacon_data_t **ppBeacon, |
| 5778 | struct cfg80211_beacon_data *params, |
| 5779 | int dtim_period) |
| 5780 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5781 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5782 | int size; |
| 5783 | beacon_data_t *beacon = NULL; |
| 5784 | beacon_data_t *old = NULL; |
| 5785 | int head_len,tail_len; |
| 5786 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5787 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5788 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5789 | { |
| 5790 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5791 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5792 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5793 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5794 | |
| 5795 | old = pAdapter->sessionCtx.ap.beacon; |
| 5796 | |
| 5797 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5798 | { |
| 5799 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5800 | FL("session(%d) old and new heads points to NULL"), |
| 5801 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5802 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5803 | } |
| 5804 | |
| 5805 | if (params->tail && !params->tail_len) |
| 5806 | { |
| 5807 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5808 | FL("tail_len is zero but tail is not NULL")); |
| 5809 | return -EINVAL; |
| 5810 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5811 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5812 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 5813 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 5814 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5815 | { |
| 5816 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5817 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5818 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5819 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5820 | #endif |
| 5821 | |
| 5822 | if(params->head) |
| 5823 | head_len = params->head_len; |
| 5824 | else |
| 5825 | head_len = old->head_len; |
| 5826 | |
| 5827 | if(params->tail || !old) |
| 5828 | tail_len = params->tail_len; |
| 5829 | else |
| 5830 | tail_len = old->tail_len; |
| 5831 | |
| 5832 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 5833 | |
| 5834 | beacon = kzalloc(size, GFP_KERNEL); |
| 5835 | |
| 5836 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5837 | { |
| 5838 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5839 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5840 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5841 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5842 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5843 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5844 | if(params->dtim_period || !old ) |
| 5845 | beacon->dtim_period = params->dtim_period; |
| 5846 | else |
| 5847 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5848 | #else |
| 5849 | if(dtim_period || !old ) |
| 5850 | beacon->dtim_period = dtim_period; |
| 5851 | else |
| 5852 | beacon->dtim_period = old->dtim_period; |
| 5853 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5854 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5855 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 5856 | beacon->tail = beacon->head + head_len; |
| 5857 | beacon->head_len = head_len; |
| 5858 | beacon->tail_len = tail_len; |
| 5859 | |
| 5860 | if(params->head) { |
| 5861 | memcpy (beacon->head,params->head,beacon->head_len); |
| 5862 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5863 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5864 | if(old) |
| 5865 | memcpy (beacon->head,old->head,beacon->head_len); |
| 5866 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5867 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5868 | if(params->tail) { |
| 5869 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 5870 | } |
| 5871 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5872 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5873 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 5874 | } |
| 5875 | |
| 5876 | *ppBeacon = beacon; |
| 5877 | |
| 5878 | kfree(old); |
| 5879 | |
| 5880 | return 0; |
| 5881 | |
| 5882 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5883 | |
| 5884 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid) |
| 5885 | { |
| 5886 | int left = length; |
| 5887 | v_U8_t *ptr = pIes; |
| 5888 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5889 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5890 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5891 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5892 | elem_id = ptr[0]; |
| 5893 | elem_len = ptr[1]; |
| 5894 | left -= 2; |
| 5895 | if(elem_len > left) |
| 5896 | { |
| 5897 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 5898 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5899 | eid,elem_len,left); |
| 5900 | return NULL; |
| 5901 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5902 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5903 | { |
| 5904 | return ptr; |
| 5905 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5906 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5907 | left -= elem_len; |
| 5908 | ptr += (elem_len + 2); |
| 5909 | } |
| 5910 | return NULL; |
| 5911 | } |
| 5912 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5913 | /* Check if rate is 11g rate or not */ |
| 5914 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 5915 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 5916 | 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] | 5917 | u8 i; |
| 5918 | for (i = 0; i < 8; i++) |
| 5919 | { |
| 5920 | if(rate == gRateArray[i]) |
| 5921 | return TRUE; |
| 5922 | } |
| 5923 | return FALSE; |
| 5924 | } |
| 5925 | |
| 5926 | /* Check for 11g rate and set proper 11g only mode */ |
| 5927 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 5928 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 5929 | { |
| 5930 | u8 i, num_rates = pIe[0]; |
| 5931 | |
| 5932 | pIe += 1; |
| 5933 | for ( i = 0; i < num_rates; i++) |
| 5934 | { |
| 5935 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 5936 | { |
| 5937 | /* If rate set have 11g rate than change the mode to 11G */ |
| 5938 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 5939 | if (pIe[i] & BASIC_RATE_MASK) |
| 5940 | { |
| 5941 | /* If we have 11g rate as basic rate, it means mode |
| 5942 | is 11g only mode. |
| 5943 | */ |
| 5944 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 5945 | *pCheckRatesfor11g = FALSE; |
| 5946 | } |
| 5947 | } |
| 5948 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 5949 | { |
| 5950 | *require_ht = TRUE; |
| 5951 | } |
| 5952 | } |
| 5953 | return; |
| 5954 | } |
| 5955 | |
| 5956 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 5957 | { |
| 5958 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 5959 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 5960 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 5961 | u8 checkRatesfor11g = TRUE; |
| 5962 | u8 require_ht = FALSE; |
| 5963 | u8 *pIe=NULL; |
| 5964 | |
| 5965 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 5966 | |
| 5967 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 5968 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 5969 | if (pIe != NULL) |
| 5970 | { |
| 5971 | pIe += 1; |
| 5972 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 5973 | &pConfig->SapHw_mode); |
| 5974 | } |
| 5975 | |
| 5976 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 5977 | WLAN_EID_EXT_SUPP_RATES); |
| 5978 | if (pIe != NULL) |
| 5979 | { |
| 5980 | |
| 5981 | pIe += 1; |
| 5982 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 5983 | &pConfig->SapHw_mode); |
| 5984 | } |
| 5985 | |
| 5986 | if( pConfig->channel > 14 ) |
| 5987 | { |
| 5988 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 5989 | } |
| 5990 | |
| 5991 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 5992 | WLAN_EID_HT_CAPABILITY); |
| 5993 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5994 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5995 | { |
| 5996 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 5997 | if(require_ht) |
| 5998 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 5999 | } |
| 6000 | } |
| 6001 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6002 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 6003 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 6004 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6005 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6006 | v_U8_t *pIe = NULL; |
| 6007 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6008 | |
| 6009 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 6010 | pBeacon->tail, pBeacon->tail_len); |
| 6011 | |
| 6012 | if (pIe) |
| 6013 | { |
| 6014 | ielen = pIe[1] + 2; |
| 6015 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 6016 | { |
| 6017 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 6018 | } |
| 6019 | else |
| 6020 | { |
| 6021 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 6022 | return -EINVAL; |
| 6023 | } |
| 6024 | *total_ielen += ielen; |
| 6025 | } |
| 6026 | return 0; |
| 6027 | } |
| 6028 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6029 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 6030 | v_U8_t *genie, v_U8_t *total_ielen) |
| 6031 | { |
| 6032 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6033 | int left = pBeacon->tail_len; |
| 6034 | v_U8_t *ptr = pBeacon->tail; |
| 6035 | v_U8_t elem_id, elem_len; |
| 6036 | v_U16_t ielen = 0; |
| 6037 | |
| 6038 | if ( NULL == ptr || 0 == left ) |
| 6039 | return; |
| 6040 | |
| 6041 | while (left >= 2) |
| 6042 | { |
| 6043 | elem_id = ptr[0]; |
| 6044 | elem_len = ptr[1]; |
| 6045 | left -= 2; |
| 6046 | if (elem_len > left) |
| 6047 | { |
| 6048 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 6049 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 6050 | elem_id, elem_len, left); |
| 6051 | return; |
| 6052 | } |
| 6053 | if (IE_EID_VENDOR == elem_id) |
| 6054 | { |
| 6055 | /* skipping the VSIE's which we don't want to include or |
| 6056 | * it will be included by existing code |
| 6057 | */ |
| 6058 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 6059 | #ifdef WLAN_FEATURE_WFD |
| 6060 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 6061 | #endif |
| 6062 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6063 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6064 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 6065 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6066 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 6067 | { |
| 6068 | ielen = ptr[1] + 2; |
| 6069 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 6070 | { |
| 6071 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 6072 | *total_ielen += ielen; |
| 6073 | } |
| 6074 | else |
| 6075 | { |
| 6076 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 6077 | "IE Length is too big " |
| 6078 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 6079 | elem_id, elem_len, *total_ielen); |
| 6080 | } |
| 6081 | } |
| 6082 | } |
| 6083 | |
| 6084 | left -= elem_len; |
| 6085 | ptr += (elem_len + 2); |
| 6086 | } |
| 6087 | return; |
| 6088 | } |
| 6089 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6090 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6091 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 6092 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6093 | #else |
| 6094 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 6095 | struct cfg80211_beacon_data *params) |
| 6096 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6097 | { |
| 6098 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6099 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6100 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6101 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6102 | |
| 6103 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 6104 | |
| 6105 | if(genie == NULL) { |
| 6106 | |
| 6107 | return -ENOMEM; |
| 6108 | } |
| 6109 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6110 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6111 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6112 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6113 | hddLog(LOGE, |
| 6114 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6115 | ret = -EINVAL; |
| 6116 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6117 | } |
| 6118 | |
| 6119 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6120 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6121 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 6122 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6123 | hddLog(LOGE, |
| 6124 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6125 | ret = -EINVAL; |
| 6126 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6127 | } |
| 6128 | #endif |
| 6129 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6130 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6131 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6132 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6133 | hddLog(LOGE, |
| 6134 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6135 | ret = -EINVAL; |
| 6136 | goto done; |
| 6137 | } |
| 6138 | |
| 6139 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 6140 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6141 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6142 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6143 | |
| 6144 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6145 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 6146 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 6147 | { |
| 6148 | hddLog(LOGE, |
| 6149 | "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] | 6150 | ret = -EINVAL; |
| 6151 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6152 | } |
| 6153 | |
| 6154 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6155 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 6156 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6157 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6158 | ==eHAL_STATUS_FAILURE) |
| 6159 | { |
| 6160 | hddLog(LOGE, |
| 6161 | "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] | 6162 | ret = -EINVAL; |
| 6163 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6164 | } |
| 6165 | |
| 6166 | // Added for ProResp IE |
| 6167 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 6168 | { |
| 6169 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 6170 | u8 probe_rsp_ie_len[3] = {0}; |
| 6171 | u8 counter = 0; |
| 6172 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 6173 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 6174 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 6175 | Store More then 255 bytes into One Variable. |
| 6176 | */ |
| 6177 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 6178 | { |
| 6179 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 6180 | { |
| 6181 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 6182 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 6183 | } |
| 6184 | else |
| 6185 | { |
| 6186 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 6187 | rem_probe_resp_ie_len = 0; |
| 6188 | } |
| 6189 | } |
| 6190 | |
| 6191 | rem_probe_resp_ie_len = 0; |
| 6192 | |
| 6193 | if (probe_rsp_ie_len[0] > 0) |
| 6194 | { |
| 6195 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6196 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 6197 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6198 | probe_rsp_ie_len[0], NULL, |
| 6199 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6200 | { |
| 6201 | hddLog(LOGE, |
| 6202 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6203 | ret = -EINVAL; |
| 6204 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6205 | } |
| 6206 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 6207 | } |
| 6208 | |
| 6209 | if (probe_rsp_ie_len[1] > 0) |
| 6210 | { |
| 6211 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6212 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 6213 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6214 | probe_rsp_ie_len[1], NULL, |
| 6215 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6216 | { |
| 6217 | hddLog(LOGE, |
| 6218 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6219 | ret = -EINVAL; |
| 6220 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6221 | } |
| 6222 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 6223 | } |
| 6224 | |
| 6225 | if (probe_rsp_ie_len[2] > 0) |
| 6226 | { |
| 6227 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6228 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 6229 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6230 | probe_rsp_ie_len[2], NULL, |
| 6231 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6232 | { |
| 6233 | hddLog(LOGE, |
| 6234 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6235 | ret = -EINVAL; |
| 6236 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6237 | } |
| 6238 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 6239 | } |
| 6240 | |
| 6241 | if (probe_rsp_ie_len[1] == 0 ) |
| 6242 | { |
| 6243 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6244 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 6245 | eANI_BOOLEAN_FALSE) ) |
| 6246 | { |
| 6247 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6248 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6249 | } |
| 6250 | } |
| 6251 | |
| 6252 | if (probe_rsp_ie_len[2] == 0 ) |
| 6253 | { |
| 6254 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6255 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 6256 | eANI_BOOLEAN_FALSE) ) |
| 6257 | { |
| 6258 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6259 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6260 | } |
| 6261 | } |
| 6262 | |
| 6263 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6264 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 6265 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6266 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6267 | == eHAL_STATUS_FAILURE) |
| 6268 | { |
| 6269 | hddLog(LOGE, |
| 6270 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6271 | ret = -EINVAL; |
| 6272 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6273 | } |
| 6274 | } |
| 6275 | else |
| 6276 | { |
| 6277 | // Reset WNI_CFG_PROBE_RSP Flags |
| 6278 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 6279 | |
| 6280 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6281 | "%s: No Probe Response IE received in set beacon", |
| 6282 | __func__); |
| 6283 | } |
| 6284 | |
| 6285 | // Added for AssocResp IE |
| 6286 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 6287 | { |
| 6288 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6289 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 6290 | params->assocresp_ies_len, NULL, |
| 6291 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6292 | { |
| 6293 | hddLog(LOGE, |
| 6294 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6295 | ret = -EINVAL; |
| 6296 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6297 | } |
| 6298 | |
| 6299 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6300 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 6301 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6302 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6303 | == eHAL_STATUS_FAILURE) |
| 6304 | { |
| 6305 | hddLog(LOGE, |
| 6306 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6307 | ret = -EINVAL; |
| 6308 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6309 | } |
| 6310 | } |
| 6311 | else |
| 6312 | { |
| 6313 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6314 | "%s: No Assoc Response IE received in set beacon", |
| 6315 | __func__); |
| 6316 | |
| 6317 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6318 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 6319 | eANI_BOOLEAN_FALSE) ) |
| 6320 | { |
| 6321 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6322 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6323 | } |
| 6324 | } |
| 6325 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6326 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6327 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6328 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6329 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6330 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6331 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6332 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 6333 | * called by wlan_hdd_cfg80211_start_bss() and |
| 6334 | * wlan_hdd_cfg80211_set_channel() |
| 6335 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6336 | * channel list. |
| 6337 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 6338 | 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] | 6339 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6340 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6341 | v_U32_t num_ch = 0; |
| 6342 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 6343 | u32 indx = 0; |
| 6344 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6345 | v_U8_t fValidChannel = FALSE, count = 0; |
| 6346 | 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] | 6347 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6348 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6349 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6350 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6351 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6352 | /* Validate the channel */ |
| 6353 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6354 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6355 | if ( channel == rfChannels[count].channelNum ) |
| 6356 | { |
| 6357 | fValidChannel = TRUE; |
| 6358 | break; |
| 6359 | } |
| 6360 | } |
| 6361 | if (fValidChannel != TRUE) |
| 6362 | { |
| 6363 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6364 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6365 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6366 | } |
| 6367 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6368 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6369 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6370 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 6371 | valid_ch, &num_ch)) |
| 6372 | { |
| 6373 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6374 | "%s: failed to get valid channel list", __func__); |
| 6375 | return VOS_STATUS_E_FAILURE; |
| 6376 | } |
| 6377 | for (indx = 0; indx < num_ch; indx++) |
| 6378 | { |
| 6379 | if (channel == valid_ch[indx]) |
| 6380 | { |
| 6381 | break; |
| 6382 | } |
| 6383 | } |
| 6384 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6385 | if (indx >= num_ch) |
| 6386 | { |
| 6387 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6388 | { |
| 6389 | eCsrBand band; |
| 6390 | unsigned int freq; |
| 6391 | |
| 6392 | sme_GetFreqBand(hHal, &band); |
| 6393 | |
| 6394 | if (eCSR_BAND_5G == band) |
| 6395 | { |
| 6396 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 6397 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 6398 | { |
| 6399 | freq = ieee80211_channel_to_frequency(channel, |
| 6400 | IEEE80211_BAND_2GHZ); |
| 6401 | } |
| 6402 | else |
| 6403 | { |
| 6404 | freq = ieee80211_channel_to_frequency(channel, |
| 6405 | IEEE80211_BAND_5GHZ); |
| 6406 | } |
| 6407 | #else |
| 6408 | freq = ieee80211_channel_to_frequency(channel); |
| 6409 | #endif |
| 6410 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 6411 | return VOS_STATUS_SUCCESS; |
| 6412 | } |
| 6413 | } |
| 6414 | |
| 6415 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6416 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6417 | return VOS_STATUS_E_FAILURE; |
| 6418 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6419 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6420 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6421 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6422 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6423 | } |
| 6424 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6425 | /** |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6426 | * FUNCTION: __wlan_hdd_cfg80211_set_channel |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6427 | * This function is used to set the channel number |
| 6428 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6429 | 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] | 6430 | struct ieee80211_channel *chan, |
| 6431 | enum nl80211_channel_type channel_type |
| 6432 | ) |
| 6433 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6434 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6435 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6436 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6437 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6438 | hdd_context_t *pHddCtx; |
| 6439 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6440 | |
| 6441 | ENTER(); |
| 6442 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6443 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6444 | if( NULL == dev ) |
| 6445 | { |
| 6446 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6447 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6448 | return -ENODEV; |
| 6449 | } |
| 6450 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6451 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6452 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6453 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 6454 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6455 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6456 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 6457 | hdd_device_modetoString(pAdapter->device_mode), |
| 6458 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6459 | |
| 6460 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6461 | status = wlan_hdd_validate_context(pHddCtx); |
| 6462 | |
| 6463 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6464 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6465 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6466 | "%s: HDD context is not valid", __func__); |
| 6467 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6468 | } |
| 6469 | |
| 6470 | /* |
| 6471 | * Do freq to chan conversion |
| 6472 | * TODO: for 11a |
| 6473 | */ |
| 6474 | |
| 6475 | channel = ieee80211_frequency_to_channel(freq); |
| 6476 | |
| 6477 | /* Check freq range */ |
| 6478 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 6479 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 6480 | { |
| 6481 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6482 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6483 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 6484 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 6485 | return -EINVAL; |
| 6486 | } |
| 6487 | |
| 6488 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6489 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 6490 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 6491 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6492 | { |
| 6493 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6494 | { |
| 6495 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6496 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6497 | return -EINVAL; |
| 6498 | } |
| 6499 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 6500 | "%s: set channel to [%d] for device mode =%d", |
| 6501 | __func__, channel,pAdapter->device_mode); |
| 6502 | } |
| 6503 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6504 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6505 | ) |
| 6506 | { |
| 6507 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6508 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 6509 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6510 | |
| 6511 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 6512 | { |
| 6513 | /* Link is up then return cant set channel*/ |
| 6514 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6515 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6516 | return -EINVAL; |
| 6517 | } |
| 6518 | |
| 6519 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 6520 | pHddStaCtx->conn_info.operationChannel = channel; |
| 6521 | pRoamProfile->ChannelInfo.ChannelList = |
| 6522 | &pHddStaCtx->conn_info.operationChannel; |
| 6523 | } |
| 6524 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6525 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6526 | ) |
| 6527 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6528 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6529 | { |
| 6530 | if(VOS_STATUS_SUCCESS != |
| 6531 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6532 | { |
| 6533 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6534 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6535 | return -EINVAL; |
| 6536 | } |
| 6537 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 6538 | } |
| 6539 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6540 | { |
| 6541 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 6542 | |
| 6543 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 6544 | channel set by supplicant |
| 6545 | */ |
| 6546 | if ( cfg_param->apAutoChannelSelection ) |
| 6547 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6548 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 6549 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6550 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6551 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 6552 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6553 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6554 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6555 | else |
| 6556 | { |
| 6557 | if(VOS_STATUS_SUCCESS != |
| 6558 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6559 | { |
| 6560 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6561 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6562 | return -EINVAL; |
| 6563 | } |
| 6564 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 6565 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6566 | } |
| 6567 | } |
| 6568 | else |
| 6569 | { |
| 6570 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 6571 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 6572 | return -EINVAL; |
| 6573 | } |
| 6574 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6575 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6576 | } |
| 6577 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6578 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, |
| 6579 | struct net_device *dev, |
| 6580 | struct ieee80211_channel *chan, |
| 6581 | enum nl80211_channel_type channel_type |
| 6582 | ) |
| 6583 | { |
| 6584 | int ret; |
| 6585 | |
| 6586 | vos_ssr_protect(__func__); |
| 6587 | ret = __wlan_hdd_cfg80211_set_channel(wiphy, dev, chan, channel_type); |
| 6588 | vos_ssr_unprotect(__func__); |
| 6589 | |
| 6590 | return ret; |
| 6591 | } |
| 6592 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6593 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 6594 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 6595 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6596 | #else |
| 6597 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 6598 | struct cfg80211_beacon_data *params, |
| 6599 | const u8 *ssid, size_t ssid_len, |
| 6600 | enum nl80211_hidden_ssid hidden_ssid) |
| 6601 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6602 | { |
| 6603 | tsap_Config_t *pConfig; |
| 6604 | beacon_data_t *pBeacon = NULL; |
| 6605 | struct ieee80211_mgmt *pMgmt_frame; |
| 6606 | v_U8_t *pIe=NULL; |
| 6607 | v_U16_t capab_info; |
| 6608 | eCsrAuthType RSNAuthType; |
| 6609 | eCsrEncryptionType RSNEncryptType; |
| 6610 | eCsrEncryptionType mcRSNEncryptType; |
| 6611 | int status = VOS_STATUS_SUCCESS; |
| 6612 | tpWLAN_SAPEventCB pSapEventCallback; |
| 6613 | hdd_hostapd_state_t *pHostapdState; |
| 6614 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 6615 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6616 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6617 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6618 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6619 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 6620 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6621 | tSmeConfigParams *psmeConfig; |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 6622 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 6623 | v_BOOL_t MFPRequired = VOS_FALSE; |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 6624 | v_BOOL_t sapEnable11AC = |
| 6625 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapEnable11AC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6626 | ENTER(); |
| 6627 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6628 | iniConfig = pHddCtx->cfg_ini; |
| 6629 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6630 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 6631 | |
| 6632 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 6633 | |
| 6634 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6635 | |
| 6636 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 6637 | |
| 6638 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 6639 | |
| 6640 | //channel is already set in the set_channel Call back |
| 6641 | //pConfig->channel = pCommitConfig->channel; |
| 6642 | |
| 6643 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6644 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6645 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 6646 | |
| 6647 | pConfig->dtim_period = pBeacon->dtim_period; |
| 6648 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6649 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6650 | pConfig->dtim_period); |
| 6651 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 6652 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6653 | { |
| 6654 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6655 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 6656 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 6657 | { |
| 6658 | tANI_BOOLEAN restartNeeded; |
| 6659 | pConfig->ieee80211d = 1; |
| 6660 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 6661 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 6662 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 6663 | } |
| 6664 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6665 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6666 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6667 | pConfig->ieee80211d = 1; |
| 6668 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 6669 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 6670 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6671 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6672 | else |
| 6673 | { |
| 6674 | pConfig->ieee80211d = 0; |
| 6675 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6676 | /* |
| 6677 | * If auto channel is configured i.e. channel is 0, |
| 6678 | * so skip channel validation. |
| 6679 | */ |
| 6680 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 6681 | { |
| 6682 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 6683 | { |
| 6684 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6685 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6686 | return -EINVAL; |
| 6687 | } |
| 6688 | } |
| 6689 | else |
| 6690 | { |
| 6691 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 6692 | { |
| 6693 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 6694 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 6695 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 6696 | } |
| 6697 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 6698 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6699 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6700 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6701 | { |
| 6702 | pConfig->ieee80211d = 0; |
| 6703 | } |
| 6704 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 6705 | |
| 6706 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6707 | |
| 6708 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6709 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 6710 | |
| 6711 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 6712 | |
| 6713 | /*Set wps station to configured*/ |
| 6714 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 6715 | |
| 6716 | if(pIe) |
| 6717 | { |
| 6718 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 6719 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6720 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6721 | return -EINVAL; |
| 6722 | } |
| 6723 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 6724 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 6725 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6726 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 6727 | * WPS state |
| 6728 | */ |
| 6729 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 6730 | { |
| 6731 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 6732 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 6733 | { |
| 6734 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 6735 | } |
| 6736 | } |
| 6737 | } |
| 6738 | else |
| 6739 | { |
| 6740 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 6741 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6742 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6743 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 6744 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 6745 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 6746 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 6747 | eCSR_ENCRYPT_TYPE_NONE; |
| 6748 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6749 | pConfig->RSNWPAReqIELength = 0; |
| 6750 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6751 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6752 | WLAN_EID_RSN); |
| 6753 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6754 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6755 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 6756 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 6757 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6758 | /* The actual processing may eventually be more extensive than |
| 6759 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6760 | * by the app. |
| 6761 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6762 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6763 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 6764 | &RSNEncryptType, |
| 6765 | &mcRSNEncryptType, |
| 6766 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6767 | &MFPCapable, |
| 6768 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6769 | pConfig->pRSNWPAReqIE[1]+2, |
| 6770 | pConfig->pRSNWPAReqIE ); |
| 6771 | |
| 6772 | if( VOS_STATUS_SUCCESS == status ) |
| 6773 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6774 | /* Now copy over all the security attributes you have |
| 6775 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6776 | * */ |
| 6777 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 6778 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 6779 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 6780 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 6781 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6782 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6783 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 6784 | } |
| 6785 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6786 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6787 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 6788 | pBeacon->tail, pBeacon->tail_len); |
| 6789 | |
| 6790 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 6791 | { |
| 6792 | if (pConfig->pRSNWPAReqIE) |
| 6793 | { |
| 6794 | /*Mixed mode WPA/WPA2*/ |
| 6795 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 6796 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 6797 | } |
| 6798 | else |
| 6799 | { |
| 6800 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 6801 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 6802 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6803 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6804 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 6805 | &RSNEncryptType, |
| 6806 | &mcRSNEncryptType, |
| 6807 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6808 | &MFPCapable, |
| 6809 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6810 | pConfig->pRSNWPAReqIE[1]+2, |
| 6811 | pConfig->pRSNWPAReqIE ); |
| 6812 | |
| 6813 | if( VOS_STATUS_SUCCESS == status ) |
| 6814 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6815 | /* Now copy over all the security attributes you have |
| 6816 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6817 | * */ |
| 6818 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 6819 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 6820 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 6821 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 6822 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6823 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6824 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 6825 | } |
| 6826 | } |
| 6827 | } |
| 6828 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6829 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 6830 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 6831 | return -EINVAL; |
| 6832 | } |
| 6833 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6834 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 6835 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6836 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6837 | if (params->ssid != NULL) |
| 6838 | { |
| 6839 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 6840 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 6841 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 6842 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 6843 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6844 | #else |
| 6845 | if (ssid != NULL) |
| 6846 | { |
| 6847 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 6848 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 6849 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 6850 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 6851 | } |
| 6852 | #endif |
| 6853 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6854 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6855 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6856 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6857 | /* default value */ |
| 6858 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 6859 | pConfig->num_accept_mac = 0; |
| 6860 | pConfig->num_deny_mac = 0; |
| 6861 | |
| 6862 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 6863 | pBeacon->tail, pBeacon->tail_len); |
| 6864 | |
| 6865 | /* pIe for black list is following form: |
| 6866 | type : 1 byte |
| 6867 | length : 1 byte |
| 6868 | OUI : 4 bytes |
| 6869 | acl type : 1 byte |
| 6870 | no of mac addr in black list: 1 byte |
| 6871 | 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] | 6872 | */ |
| 6873 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6874 | { |
| 6875 | pConfig->SapMacaddr_acl = pIe[6]; |
| 6876 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6877 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6878 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 6879 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 6880 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6881 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 6882 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 6883 | { |
| 6884 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 6885 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6886 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6887 | } |
| 6888 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 6889 | pBeacon->tail, pBeacon->tail_len); |
| 6890 | |
| 6891 | /* pIe for white list is following form: |
| 6892 | type : 1 byte |
| 6893 | length : 1 byte |
| 6894 | OUI : 4 bytes |
| 6895 | acl type : 1 byte |
| 6896 | no of mac addr in white list: 1 byte |
| 6897 | 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] | 6898 | */ |
| 6899 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6900 | { |
| 6901 | pConfig->SapMacaddr_acl = pIe[6]; |
| 6902 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6903 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6904 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 6905 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 6906 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6907 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 6908 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 6909 | { |
| 6910 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 6911 | acl_entry++; |
| 6912 | } |
| 6913 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 6914 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6915 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 6916 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6917 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 6918 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 6919 | * This is valid only if mode is set to 11n in hostapd, sapEnable11AC |
| 6920 | * is set in .ini and 11ac is supported by both host and firmware. |
Kiet Lam | 0f32042 | 2013-11-21 19:29:17 +0530 | [diff] [blame] | 6921 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 6922 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 6923 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 6924 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 6925 | (sapEnable11AC) && (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 6926 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6927 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 6928 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6929 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 6930 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 6931 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6932 | /* If ACS disable and selected channel <= 14 |
| 6933 | * OR |
| 6934 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 6935 | * AND |
| 6936 | * VHT in 2.4G Disabled |
| 6937 | * THEN |
| 6938 | * Fallback to 11N mode |
| 6939 | */ |
| 6940 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 6941 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 6942 | operatingBand == eSAP_RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6943 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 6944 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 6945 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 6946 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 6947 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 6948 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6949 | } |
| 6950 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6951 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6952 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 6953 | pConfig->ht_capab = |
| 6954 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 6955 | |
| 6956 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 6957 | { |
| 6958 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 6959 | return -EINVAL; |
| 6960 | } |
| 6961 | |
| 6962 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6963 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6964 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 6965 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6966 | pConfig->obssProtEnabled = |
| 6967 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6968 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6969 | #ifdef WLAN_FEATURE_11W |
| 6970 | pConfig->mfpCapable = MFPCapable; |
| 6971 | pConfig->mfpRequired = MFPRequired; |
| 6972 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 6973 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 6974 | #endif |
| 6975 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6976 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6977 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6978 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 6979 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 6980 | (int)pConfig->channel); |
| 6981 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 6982 | pConfig->SapHw_mode, pConfig->privacy, |
| 6983 | pConfig->authType); |
| 6984 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 6985 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 6986 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 6987 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6988 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6989 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6990 | { |
| 6991 | //Bss already started. just return. |
| 6992 | //TODO Probably it should update some beacon params. |
| 6993 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 6994 | EXIT(); |
| 6995 | return 0; |
| 6996 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6997 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 6998 | if (vos_max_concurrent_connections_reached()) { |
| 6999 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7000 | return -EINVAL; |
| 7001 | } |
| 7002 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7003 | pConfig->persona = pHostapdAdapter->device_mode; |
| 7004 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7005 | psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams)); |
| 7006 | if ( NULL != psmeConfig) |
| 7007 | { |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 7008 | vos_mem_zero(psmeConfig, sizeof (tSmeConfigParams)); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7009 | sme_GetConfigParam(hHal, psmeConfig); |
| 7010 | pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference; |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 7011 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 7012 | if (((pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 7013 | || (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 7014 | && pHddCtx->cfg_ini->apHT40_24GEnabled) |
| 7015 | { |
| 7016 | psmeConfig->csrConfig.apHT40_24GEnabled = 1; |
| 7017 | sme_UpdateConfig (hHal, psmeConfig); |
| 7018 | } |
| 7019 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7020 | vos_mem_free(psmeConfig); |
| 7021 | } |
Peng Xu | afc34e3 | 2014-09-25 13:23:55 +0530 | [diff] [blame] | 7022 | pConfig->acsBandSwitchThreshold = iniConfig->acsBandSwitchThreshold; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7023 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7024 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 7025 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 7026 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 7027 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7028 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7029 | return -EINVAL; |
| 7030 | } |
| 7031 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7032 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7033 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 7034 | |
| 7035 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7036 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7037 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7038 | { |
| 7039 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7040 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 7041 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7042 | VOS_ASSERT(0); |
| 7043 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7044 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7045 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Kaushik, Sushant | f607080 | 2014-10-15 15:09:23 +0530 | [diff] [blame] | 7046 | /* Initialize WMM configuation */ |
| 7047 | hdd_wmm_init(pHostapdAdapter); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7048 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7049 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7050 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7051 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 7052 | { |
| 7053 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 7054 | { |
| 7055 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 7056 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 7057 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7058 | } |
| 7059 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 7060 | { |
| 7061 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 7062 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 7063 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7064 | } |
| 7065 | } |
| 7066 | #endif |
| 7067 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7068 | pHostapdState->bCommit = TRUE; |
| 7069 | EXIT(); |
| 7070 | |
| 7071 | return 0; |
| 7072 | } |
| 7073 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7074 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7075 | static int __wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7076 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7077 | struct beacon_parameters *params) |
| 7078 | { |
| 7079 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7080 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7081 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7082 | |
| 7083 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7084 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7085 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7086 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 7087 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7088 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 7089 | hdd_device_modetoString(pAdapter->device_mode), |
| 7090 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7091 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7092 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7093 | status = wlan_hdd_validate_context(pHddCtx); |
| 7094 | |
| 7095 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7096 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7097 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7098 | "%s: HDD context is not valid", __func__); |
| 7099 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7100 | } |
| 7101 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7102 | if (vos_max_concurrent_connections_reached()) { |
| 7103 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7104 | return -EINVAL; |
| 7105 | } |
| 7106 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7107 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7108 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7109 | ) |
| 7110 | { |
| 7111 | beacon_data_t *old,*new; |
| 7112 | |
| 7113 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7114 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7115 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7116 | { |
| 7117 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 7118 | FL("already beacon info added to session(%d)"), |
| 7119 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7120 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7121 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7122 | |
| 7123 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 7124 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7125 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7126 | { |
| 7127 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7128 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7129 | return -EINVAL; |
| 7130 | } |
| 7131 | |
| 7132 | pAdapter->sessionCtx.ap.beacon = new; |
| 7133 | |
| 7134 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 7135 | } |
| 7136 | |
| 7137 | EXIT(); |
| 7138 | return status; |
| 7139 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7140 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7141 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 7142 | struct net_device *dev, |
| 7143 | struct beacon_parameters *params) |
| 7144 | { |
| 7145 | int ret; |
| 7146 | |
| 7147 | vos_ssr_protect(__func__); |
| 7148 | ret = __wlan_hdd_cfg80211_add_beacon(wiphy, dev, params); |
| 7149 | vos_ssr_unprotect(__func__); |
| 7150 | |
| 7151 | return ret; |
| 7152 | } |
| 7153 | |
| 7154 | static int __wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7155 | struct net_device *dev, |
| 7156 | struct beacon_parameters *params) |
| 7157 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7158 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7159 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7160 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7161 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7162 | |
| 7163 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7164 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7165 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 7166 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 7167 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7168 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7169 | pAdapter->device_mode); |
| 7170 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7171 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7172 | status = wlan_hdd_validate_context(pHddCtx); |
| 7173 | |
| 7174 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7175 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7176 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7177 | "%s: HDD context is not valid", __func__); |
| 7178 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7179 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7180 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7181 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7182 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7183 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7184 | { |
| 7185 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7186 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7187 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7188 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7189 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7190 | { |
| 7191 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7192 | FL("session(%d) old and new heads points to NULL"), |
| 7193 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7194 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7195 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7196 | |
| 7197 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 7198 | |
| 7199 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7200 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7201 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7202 | return -EINVAL; |
| 7203 | } |
| 7204 | |
| 7205 | pAdapter->sessionCtx.ap.beacon = new; |
| 7206 | |
| 7207 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 7208 | } |
| 7209 | |
| 7210 | EXIT(); |
| 7211 | return status; |
| 7212 | } |
| 7213 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7214 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
| 7215 | struct net_device *dev, |
| 7216 | struct beacon_parameters *params) |
| 7217 | { |
| 7218 | int ret; |
| 7219 | |
| 7220 | vos_ssr_protect(__func__); |
| 7221 | ret = __wlan_hdd_cfg80211_set_beacon(wiphy, dev, params); |
| 7222 | vos_ssr_unprotect(__func__); |
| 7223 | |
| 7224 | return ret; |
| 7225 | } |
| 7226 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7227 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7228 | |
| 7229 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7230 | static int __wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7231 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7232 | #else |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7233 | static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7234 | struct net_device *dev) |
| 7235 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7236 | { |
| 7237 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7238 | hdd_context_t *pHddCtx = NULL; |
| 7239 | hdd_scaninfo_t *pScanInfo = NULL; |
| 7240 | hdd_adapter_t *staAdapter = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7241 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7242 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7243 | |
| 7244 | ENTER(); |
| 7245 | |
| 7246 | if (NULL == pAdapter) |
| 7247 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7248 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7249 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7250 | return -ENODEV; |
| 7251 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7252 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7253 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7254 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 7255 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7256 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7257 | status = wlan_hdd_validate_context(pHddCtx); |
| 7258 | |
| 7259 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7260 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7261 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7262 | "%s: HDD context is not valid", __func__); |
| 7263 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7264 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7265 | |
| 7266 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_INFRA_STATION); |
| 7267 | if (NULL == staAdapter) |
| 7268 | { |
| 7269 | staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_CLIENT); |
| 7270 | if (NULL == staAdapter) |
| 7271 | { |
Rajesh Chauhan | 52d885b | 2013-11-01 10:54:25 -0700 | [diff] [blame] | 7272 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 7273 | "%s: HDD adapter context for STA/P2P-CLI is Null", |
| 7274 | __func__); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7275 | } |
| 7276 | } |
| 7277 | |
| 7278 | pScanInfo = &pHddCtx->scan_info; |
| 7279 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7280 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7281 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7282 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7283 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7284 | ret = wlan_hdd_scan_abort(pAdapter); |
| 7285 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 7286 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7287 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7288 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7289 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7290 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7291 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7292 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7293 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7294 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 7295 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7296 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7297 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7298 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7299 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7300 | } |
| 7301 | |
Rashmi Ramanna | 1f0948d | 2014-08-28 15:33:48 +0530 | [diff] [blame] | 7302 | /* Delete all associated STAs before stopping AP/P2P GO */ |
| 7303 | hdd_del_all_sta(pAdapter); |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 7304 | hdd_hostapd_stop(dev); |
| 7305 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7306 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7307 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7308 | ) |
| 7309 | { |
| 7310 | beacon_data_t *old; |
| 7311 | |
| 7312 | old = pAdapter->sessionCtx.ap.beacon; |
| 7313 | |
| 7314 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7315 | { |
| 7316 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7317 | FL("session(%d) beacon data points to NULL"), |
| 7318 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7319 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7320 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7321 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7322 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7323 | |
| 7324 | mutex_lock(&pHddCtx->sap_lock); |
| 7325 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 7326 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7327 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7328 | { |
| 7329 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 7330 | |
| 7331 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 7332 | |
| 7333 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 7334 | { |
| 7335 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7336 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7337 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7338 | } |
| 7339 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7340 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7341 | /* BSS stopped, clear the active sessions for this device mode */ |
| 7342 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7343 | } |
| 7344 | mutex_unlock(&pHddCtx->sap_lock); |
| 7345 | |
| 7346 | if(status != VOS_STATUS_SUCCESS) |
| 7347 | { |
| 7348 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7349 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7350 | return -EINVAL; |
| 7351 | } |
| 7352 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7353 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7354 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 7355 | ==eHAL_STATUS_FAILURE) |
| 7356 | { |
| 7357 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7358 | "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] | 7359 | } |
| 7360 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7361 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7362 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 7363 | eANI_BOOLEAN_FALSE) ) |
| 7364 | { |
| 7365 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7366 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7367 | } |
| 7368 | |
| 7369 | // Reset WNI_CFG_PROBE_RSP Flags |
| 7370 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 7371 | |
| 7372 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 7373 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7374 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7375 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 7376 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 7377 | { |
| 7378 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 7379 | "GO got removed"); |
| 7380 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 7381 | } |
| 7382 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7383 | } |
| 7384 | EXIT(); |
| 7385 | return status; |
| 7386 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7387 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7388 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7389 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 7390 | struct net_device *dev) |
| 7391 | { |
| 7392 | int ret; |
| 7393 | |
| 7394 | vos_ssr_protect(__func__); |
| 7395 | ret = __wlan_hdd_cfg80211_del_beacon(wiphy, dev); |
| 7396 | vos_ssr_unprotect(__func__); |
| 7397 | |
| 7398 | return ret; |
| 7399 | } |
| 7400 | #else |
| 7401 | static int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, |
| 7402 | struct net_device *dev) |
| 7403 | { |
| 7404 | int ret; |
| 7405 | |
| 7406 | vos_ssr_protect(__func__); |
| 7407 | ret = __wlan_hdd_cfg80211_stop_ap(wiphy, dev); |
| 7408 | vos_ssr_unprotect(__func__); |
| 7409 | |
| 7410 | return ret; |
| 7411 | } |
| 7412 | #endif |
| 7413 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7414 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 7415 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7416 | static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7417 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7418 | struct cfg80211_ap_settings *params) |
| 7419 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7420 | hdd_adapter_t *pAdapter; |
| 7421 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7422 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7423 | |
| 7424 | ENTER(); |
| 7425 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7426 | if (NULL == dev) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7427 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7428 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7429 | "%s: Device is Null", __func__); |
| 7430 | return -ENODEV; |
| 7431 | } |
| 7432 | |
| 7433 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7434 | if (NULL == pAdapter) |
| 7435 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7436 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7437 | "%s: HDD adapter is Null", __func__); |
| 7438 | return -ENODEV; |
| 7439 | } |
| 7440 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7441 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7442 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 7443 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7444 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 7445 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7446 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7447 | "%s: HDD adapter magic is invalid", __func__); |
| 7448 | return -ENODEV; |
| 7449 | } |
| 7450 | |
| 7451 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7452 | status = wlan_hdd_validate_context(pHddCtx); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7453 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7454 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7455 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7456 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7457 | "%s: HDD context is not valid", __func__); |
| 7458 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7459 | } |
| 7460 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7461 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 7462 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7463 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7464 | |
| 7465 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7466 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7467 | ) |
| 7468 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7469 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7470 | |
| 7471 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7472 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7473 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7474 | { |
| 7475 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 7476 | FL("already beacon info added to session(%d)"), |
| 7477 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7478 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7479 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7480 | |
| 7481 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, ¶ms->beacon, params->dtim_period); |
| 7482 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7483 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7484 | { |
| 7485 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7486 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7487 | return -EINVAL; |
| 7488 | } |
| 7489 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7490 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 7491 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 7492 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 7493 | params->channel, params->channel_type); |
| 7494 | #else |
| 7495 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 7496 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7497 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7498 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
| 7499 | params->ssid_len, params->hidden_ssid); |
| 7500 | } |
| 7501 | |
| 7502 | EXIT(); |
| 7503 | return status; |
| 7504 | } |
| 7505 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7506 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 7507 | struct net_device *dev, |
| 7508 | struct cfg80211_ap_settings *params) |
| 7509 | { |
| 7510 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7511 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7512 | vos_ssr_protect(__func__); |
| 7513 | ret = __wlan_hdd_cfg80211_start_ap(wiphy, dev, params); |
| 7514 | vos_ssr_unprotect(__func__); |
| 7515 | |
| 7516 | return ret; |
| 7517 | } |
| 7518 | |
| 7519 | static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7520 | struct net_device *dev, |
| 7521 | struct cfg80211_beacon_data *params) |
| 7522 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7523 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7524 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7525 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7526 | |
| 7527 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7528 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7529 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7530 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 7531 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7532 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7533 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7534 | |
| 7535 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7536 | status = wlan_hdd_validate_context(pHddCtx); |
| 7537 | |
| 7538 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7539 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7540 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7541 | "%s: HDD context is not valid", __func__); |
| 7542 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7543 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7544 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7545 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7546 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7547 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7548 | { |
| 7549 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7550 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7551 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7552 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7553 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7554 | { |
| 7555 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7556 | FL("session(%d) beacon data points to NULL"), |
| 7557 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7558 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7559 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7560 | |
| 7561 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 7562 | |
| 7563 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7564 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7565 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7566 | return -EINVAL; |
| 7567 | } |
| 7568 | |
| 7569 | pAdapter->sessionCtx.ap.beacon = new; |
| 7570 | |
| 7571 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0); |
| 7572 | } |
| 7573 | |
| 7574 | EXIT(); |
| 7575 | return status; |
| 7576 | } |
| 7577 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7578 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
| 7579 | struct net_device *dev, |
| 7580 | struct cfg80211_beacon_data *params) |
| 7581 | { |
| 7582 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7583 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7584 | vos_ssr_protect(__func__); |
| 7585 | ret = __wlan_hdd_cfg80211_change_beacon(wiphy, dev, params); |
| 7586 | vos_ssr_unprotect(__func__); |
| 7587 | |
| 7588 | return ret; |
| 7589 | } |
| 7590 | |
| 7591 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7592 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 7593 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7594 | struct net_device *dev, |
| 7595 | struct bss_parameters *params) |
| 7596 | { |
| 7597 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7598 | hdd_context_t *pHddCtx; |
| 7599 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7600 | |
| 7601 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7602 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7603 | if (NULL == pAdapter) |
| 7604 | { |
| 7605 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7606 | "%s: HDD adapter is Null", __func__); |
| 7607 | return -ENODEV; |
| 7608 | } |
| 7609 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7610 | |
| 7611 | ret = wlan_hdd_validate_context(pHddCtx); |
| 7612 | if (0 != ret) |
| 7613 | { |
| 7614 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7615 | "%s: HDD context is not valid", __func__); |
| 7616 | return ret; |
| 7617 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7618 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7619 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 7620 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7621 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7622 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7623 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7624 | |
| 7625 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7626 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7627 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7628 | { |
| 7629 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 7630 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7631 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7632 | { |
| 7633 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7634 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7635 | } |
| 7636 | |
| 7637 | EXIT(); |
| 7638 | return 0; |
| 7639 | } |
| 7640 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 7641 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 7642 | struct net_device *dev, |
| 7643 | struct bss_parameters *params) |
| 7644 | { |
| 7645 | int ret; |
| 7646 | |
| 7647 | vos_ssr_protect(__func__); |
| 7648 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 7649 | vos_ssr_unprotect(__func__); |
| 7650 | |
| 7651 | return ret; |
| 7652 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7653 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 7654 | * to wait for contry code completion |
| 7655 | */ |
| 7656 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 7657 | { |
| 7658 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 7659 | complete(&call_back_pAdapter->change_country_code); |
| 7660 | return NULL; |
| 7661 | } |
| 7662 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7663 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7664 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7665 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 7666 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7667 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7668 | struct net_device *ndev, |
| 7669 | enum nl80211_iftype type, |
| 7670 | u32 *flags, |
| 7671 | struct vif_params *params |
| 7672 | ) |
| 7673 | { |
| 7674 | struct wireless_dev *wdev; |
| 7675 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7676 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7677 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7678 | tCsrRoamProfile *pRoamProfile = NULL; |
| 7679 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7680 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7681 | eMib_dot11DesiredBssType connectedBssType; |
| 7682 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7683 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7684 | |
| 7685 | ENTER(); |
| 7686 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7687 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7688 | { |
| 7689 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7690 | "%s: Adapter context is null", __func__); |
| 7691 | return VOS_STATUS_E_FAILURE; |
| 7692 | } |
| 7693 | |
| 7694 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7695 | if (!pHddCtx) |
| 7696 | { |
| 7697 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7698 | "%s: HDD context is null", __func__); |
| 7699 | return VOS_STATUS_E_FAILURE; |
| 7700 | } |
| 7701 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7702 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7703 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 7704 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7705 | status = wlan_hdd_validate_context(pHddCtx); |
| 7706 | |
| 7707 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7708 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7709 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7710 | "%s: HDD context is not valid", __func__); |
| 7711 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7712 | } |
| 7713 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7714 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7715 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7716 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7717 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7718 | if (vos_max_concurrent_connections_reached()) { |
| 7719 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7720 | return -EINVAL; |
| 7721 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7722 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7723 | wdev = ndev->ieee80211_ptr; |
| 7724 | |
| 7725 | #ifdef WLAN_BTAMP_FEATURE |
| 7726 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 7727 | (NL80211_IFTYPE_ADHOC == type)|| |
| 7728 | (NL80211_IFTYPE_AP == type)|| |
| 7729 | (NL80211_IFTYPE_P2P_GO == type)) |
| 7730 | { |
| 7731 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 7732 | // stop AMP traffic |
| 7733 | status = WLANBAP_StopAmp(); |
| 7734 | if(VOS_STATUS_SUCCESS != status ) |
| 7735 | { |
| 7736 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 7737 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 7738 | "%s: Failed to stop AMP", __func__); |
| 7739 | return -EINVAL; |
| 7740 | } |
| 7741 | } |
| 7742 | #endif //WLAN_BTAMP_FEATURE |
| 7743 | /* Reset the current device mode bit mask*/ |
| 7744 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 7745 | |
| 7746 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7747 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7748 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7749 | ) |
| 7750 | { |
| 7751 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7752 | if (!pWextState) |
| 7753 | { |
| 7754 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7755 | "%s: pWextState is null", __func__); |
| 7756 | return VOS_STATUS_E_FAILURE; |
| 7757 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7758 | pRoamProfile = &pWextState->roamProfile; |
| 7759 | LastBSSType = pRoamProfile->BSSType; |
| 7760 | |
| 7761 | switch (type) |
| 7762 | { |
| 7763 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7764 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7765 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7766 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 7767 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7768 | #ifdef WLAN_FEATURE_11AC |
| 7769 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 7770 | { |
| 7771 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 7772 | } |
| 7773 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7774 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7775 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7776 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 7777 | //Check for sub-string p2p to confirm its a p2p interface |
| 7778 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7779 | { |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 7780 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 7781 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 7782 | } |
| 7783 | else |
| 7784 | { |
| 7785 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7786 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 7787 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7788 | break; |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 7789 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7790 | case NL80211_IFTYPE_ADHOC: |
| 7791 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7792 | "%s: setting interface Type to ADHOC", __func__); |
| 7793 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 7794 | pRoamProfile->phyMode = |
| 7795 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 7796 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7797 | wdev->iftype = type; |
| 7798 | break; |
| 7799 | |
| 7800 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7801 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7802 | { |
| 7803 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 7804 | "%s: setting interface Type to %s", __func__, |
| 7805 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 7806 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 7807 | //Cancel any remain on channel for GO mode |
| 7808 | if (NL80211_IFTYPE_P2P_GO == type) |
| 7809 | { |
| 7810 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 7811 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7812 | if (NL80211_IFTYPE_AP == type) |
| 7813 | { |
| 7814 | /* As Loading WLAN Driver one interface being created for p2p device |
| 7815 | * address. This will take one HW STA and the max number of clients |
| 7816 | * that can connect to softAP will be reduced by one. so while changing |
| 7817 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 7818 | * interface as it is not required in SoftAP mode. |
| 7819 | */ |
| 7820 | |
| 7821 | // Get P2P Adapter |
| 7822 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 7823 | |
| 7824 | if (pP2pAdapter) |
| 7825 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 7826 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 7827 | hdd_deinit_adapter(pHddCtx, pP2pAdapter, TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7828 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 7829 | } |
| 7830 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 7831 | //Disable IMPS & BMPS for SAP/GO |
| 7832 | if(VOS_STATUS_E_FAILURE == |
| 7833 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 7834 | { |
| 7835 | //Fail to Exit BMPS |
| 7836 | VOS_ASSERT(0); |
| 7837 | } |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 7838 | |
| 7839 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
| 7840 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7841 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7842 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7843 | /* A Mutex Lock is introduced while changing the mode to |
| 7844 | * protect the concurrent access for the Adapters by TDLS |
| 7845 | * module. |
| 7846 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7847 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7848 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7849 | //De-init the adapter. |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 7850 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7851 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7852 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 7853 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7854 | #ifdef FEATURE_WLAN_TDLS |
| 7855 | mutex_unlock(&pHddCtx->tdls_lock); |
| 7856 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 7857 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 7858 | (pConfig->apRandomBssidEnabled)) |
| 7859 | { |
| 7860 | /* To meet Android requirements create a randomized |
| 7861 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 7862 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 7863 | ndev->dev_addr[0] = 0x02; |
| 7864 | ndev->dev_addr[1] = 0x1A; |
| 7865 | ndev->dev_addr[2] = 0x11; |
| 7866 | ndev->dev_addr[3] |= 0xF0; |
| 7867 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 7868 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7869 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 7870 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 7871 | } |
| 7872 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7873 | hdd_set_ap_ops( pAdapter->dev ); |
| 7874 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7875 | /* This is for only SAP mode where users can |
| 7876 | * control country through ini. |
| 7877 | * P2P GO follows station country code |
| 7878 | * acquired during the STA scanning. */ |
| 7879 | if((NL80211_IFTYPE_AP == type) && |
| 7880 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 7881 | { |
| 7882 | int status = 0; |
| 7883 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 7884 | "%s: setting country code from INI ", __func__); |
| 7885 | init_completion(&pAdapter->change_country_code); |
| 7886 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 7887 | (void *)(tSmeChangeCountryCallback) |
| 7888 | wlan_hdd_change_country_code_cb, |
| 7889 | pConfig->apCntryCode, pAdapter, |
| 7890 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 7891 | eSIR_FALSE, |
| 7892 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7893 | if (eHAL_STATUS_SUCCESS == status) |
| 7894 | { |
| 7895 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7896 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7897 | &pAdapter->change_country_code, |
| 7898 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7899 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7900 | { |
| 7901 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7902 | FL("SME Timed out while setting country code %ld"), |
| 7903 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 7904 | |
| 7905 | if (pHddCtx->isLogpInProgress) |
| 7906 | { |
| 7907 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7908 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 7909 | return -EAGAIN; |
| 7910 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7911 | } |
| 7912 | } |
| 7913 | else |
| 7914 | { |
| 7915 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7916 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7917 | return -EINVAL; |
| 7918 | } |
| 7919 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7920 | status = hdd_init_ap_mode(pAdapter); |
| 7921 | if(status != VOS_STATUS_SUCCESS) |
| 7922 | { |
| 7923 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 7924 | "%s: Error initializing the ap mode", __func__); |
| 7925 | return -EINVAL; |
| 7926 | } |
| 7927 | hdd_set_conparam(1); |
| 7928 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7929 | /*interface type changed update in wiphy structure*/ |
| 7930 | if(wdev) |
| 7931 | { |
| 7932 | wdev->iftype = type; |
| 7933 | pHddCtx->change_iface = type; |
| 7934 | } |
| 7935 | else |
| 7936 | { |
| 7937 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7938 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 7939 | return -EINVAL; |
| 7940 | } |
| 7941 | goto done; |
| 7942 | } |
| 7943 | |
| 7944 | default: |
| 7945 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 7946 | __func__); |
| 7947 | return -EOPNOTSUPP; |
| 7948 | } |
| 7949 | } |
| 7950 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7951 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7952 | ) |
| 7953 | { |
| 7954 | switch(type) |
| 7955 | { |
| 7956 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7957 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7958 | case NL80211_IFTYPE_ADHOC: |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 7959 | |
| 7960 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7961 | #ifdef FEATURE_WLAN_TDLS |
| 7962 | |
| 7963 | /* A Mutex Lock is introduced while changing the mode to |
| 7964 | * protect the concurrent access for the Adapters by TDLS |
| 7965 | * module. |
| 7966 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7967 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7968 | #endif |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 7969 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7970 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 7971 | //Check for sub-string p2p to confirm its a p2p interface |
| 7972 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 7973 | { |
| 7974 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 7975 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 7976 | } |
| 7977 | else |
| 7978 | { |
| 7979 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7980 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 7981 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7982 | hdd_set_conparam(0); |
| 7983 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7984 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 7985 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7986 | #ifdef FEATURE_WLAN_TDLS |
| 7987 | mutex_unlock(&pHddCtx->tdls_lock); |
| 7988 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 7989 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7990 | if( VOS_STATUS_SUCCESS != status ) |
| 7991 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7992 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 7993 | * This is the right place to enable back bmps_imps() |
| 7994 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 7995 | if (pHddCtx->hdd_wlan_suspended) |
| 7996 | { |
| 7997 | hdd_set_pwrparams(pHddCtx); |
| 7998 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7999 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8000 | goto done; |
| 8001 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8002 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8003 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8004 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 8005 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8006 | goto done; |
| 8007 | default: |
| 8008 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 8009 | __func__); |
| 8010 | return -EOPNOTSUPP; |
| 8011 | |
| 8012 | } |
| 8013 | |
| 8014 | } |
| 8015 | else |
| 8016 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8017 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 8018 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8019 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8020 | return -EOPNOTSUPP; |
| 8021 | } |
| 8022 | |
| 8023 | |
| 8024 | if(pRoamProfile) |
| 8025 | { |
| 8026 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 8027 | { |
| 8028 | /*interface type changed update in wiphy structure*/ |
| 8029 | wdev->iftype = type; |
| 8030 | |
| 8031 | /*the BSS mode changed, We need to issue disconnect |
| 8032 | if connected or in IBSS disconnect state*/ |
| 8033 | if ( hdd_connGetConnectedBssType( |
| 8034 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 8035 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 8036 | { |
| 8037 | /*need to issue a disconnect to CSR.*/ |
| 8038 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 8039 | if( eHAL_STATUS_SUCCESS == |
| 8040 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8041 | pAdapter->sessionId, |
| 8042 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 8043 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8044 | ret = wait_for_completion_interruptible_timeout( |
| 8045 | &pAdapter->disconnect_comp_var, |
| 8046 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 8047 | if (ret <= 0) |
| 8048 | { |
| 8049 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8050 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 8051 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8052 | } |
| 8053 | } |
| 8054 | } |
| 8055 | } |
| 8056 | |
| 8057 | done: |
| 8058 | /*set bitmask based on updated value*/ |
| 8059 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 8060 | |
| 8061 | /* Only STA mode support TM now |
| 8062 | * all other mode, TM feature should be disabled */ |
| 8063 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 8064 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 8065 | { |
| 8066 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 8067 | } |
| 8068 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8069 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8070 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 8071 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8072 | { |
| 8073 | //we are ok to do AMP |
| 8074 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 8075 | } |
| 8076 | #endif //WLAN_BTAMP_FEATURE |
| 8077 | EXIT(); |
| 8078 | return 0; |
| 8079 | } |
| 8080 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 8081 | /* |
| 8082 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 8083 | * wrapper function to protect the actual implementation from SSR. |
| 8084 | */ |
| 8085 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 8086 | struct net_device *ndev, |
| 8087 | enum nl80211_iftype type, |
| 8088 | u32 *flags, |
| 8089 | struct vif_params *params |
| 8090 | ) |
| 8091 | { |
| 8092 | int ret; |
| 8093 | |
| 8094 | vos_ssr_protect(__func__); |
| 8095 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 8096 | vos_ssr_unprotect(__func__); |
| 8097 | |
| 8098 | return ret; |
| 8099 | } |
| 8100 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8101 | #ifdef FEATURE_WLAN_TDLS |
| 8102 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
| 8103 | struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams) |
| 8104 | { |
| 8105 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8106 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 8107 | VOS_STATUS status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8108 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8109 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8110 | tANI_U16 numCurrTdlsPeers; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8111 | |
| 8112 | ENTER(); |
| 8113 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8114 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8115 | { |
| 8116 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8117 | "Invalid arguments"); |
| 8118 | return -EINVAL; |
| 8119 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8120 | |
| 8121 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 8122 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 8123 | { |
| 8124 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 8125 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 8126 | MAC_ADDRESS_STR " Request declined.", |
| 8127 | __func__, MAC_ADDR_ARRAY(mac)); |
| 8128 | return -ENOTSUPP; |
| 8129 | } |
| 8130 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8131 | if (pHddCtx->isLogpInProgress) |
| 8132 | { |
| 8133 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8134 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8135 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8136 | mac, |
| 8137 | eTDLS_LINK_IDLE, |
| 8138 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8139 | return -EBUSY; |
| 8140 | } |
| 8141 | |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 8142 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8143 | |
| 8144 | if ( NULL == pTdlsPeer ) { |
| 8145 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 8146 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 8147 | __func__, MAC_ADDR_ARRAY(mac), update); |
| 8148 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8149 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8150 | |
| 8151 | /* in add station, we accept existing valid staId if there is */ |
| 8152 | if ((0 == update) && |
| 8153 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 8154 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8155 | { |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8156 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8157 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8158 | " link_status %d. staId %d. add station ignored.", |
| 8159 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 8160 | return 0; |
| 8161 | } |
| 8162 | /* in change station, we accept only when staId is valid */ |
| 8163 | if ((1 == update) && |
| 8164 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 8165 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 8166 | { |
| 8167 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 8168 | "%s: " MAC_ADDRESS_STR |
| 8169 | " link status %d. staId %d. change station %s.", |
| 8170 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 8171 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 8172 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8173 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8174 | |
| 8175 | /* 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] | 8176 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8177 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8178 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8179 | "%s: " MAC_ADDRESS_STR |
| 8180 | " TDLS setup is ongoing. Request declined.", |
| 8181 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8182 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8183 | } |
| 8184 | |
| 8185 | /* first to check if we reached to maximum supported TDLS peer. |
| 8186 | TODO: for now, return -EPERM looks working fine, |
| 8187 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8188 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 8189 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8190 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8191 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8192 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8193 | " TDLS Max peer already connected. Request declined." |
| 8194 | " Num of peers (%d), Max allowed (%d).", |
| 8195 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 8196 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8197 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8198 | } |
| 8199 | else |
| 8200 | { |
| 8201 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8202 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8203 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8204 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8205 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8206 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 8207 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8208 | return -EPERM; |
| 8209 | } |
| 8210 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8211 | if (0 == update) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8212 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8213 | mac, |
| 8214 | eTDLS_LINK_CONNECTING, |
| 8215 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8216 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 8217 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8218 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8219 | { |
| 8220 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 8221 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8222 | if(StaParams->htcap_present) |
| 8223 | { |
| 8224 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 8225 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
| 8226 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 8227 | "ht_capa->extended_capabilities: %0x", |
| 8228 | StaParams->HTCap.extendedHtCapInfo); |
| 8229 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8230 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 8231 | "params->capability: %0x",StaParams->capability); |
| 8232 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8233 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8234 | if(StaParams->vhtcap_present) |
| 8235 | { |
| 8236 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 8237 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 8238 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 8239 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 8240 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8241 | { |
| 8242 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8243 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8244 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
| 8245 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 8246 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 8247 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 8248 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8249 | else if ((1 == update) && (NULL == StaParams)) |
| 8250 | { |
| 8251 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8252 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 8253 | return -EPERM; |
| 8254 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8255 | |
| 8256 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 8257 | |
| 8258 | if (!update) |
| 8259 | { |
| 8260 | status = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8261 | pAdapter->sessionId, mac); |
| 8262 | } |
| 8263 | else |
| 8264 | { |
| 8265 | status = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8266 | pAdapter->sessionId, mac, StaParams); |
| 8267 | } |
| 8268 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8269 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8270 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 8271 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8272 | if (ret <= 0) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8273 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8274 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8275 | "%s: timeout waiting for tdls add station indication %ld", |
| 8276 | __func__, ret); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8277 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8278 | } |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8279 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8280 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 8281 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8282 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8283 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8284 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8285 | } |
| 8286 | |
| 8287 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8288 | |
| 8289 | error: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8290 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8291 | mac, |
| 8292 | eTDLS_LINK_IDLE, |
| 8293 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8294 | return -EPERM; |
| 8295 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8296 | } |
| 8297 | #endif |
| 8298 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8299 | static int __wlan_hdd_change_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8300 | struct net_device *dev, |
| 8301 | u8 *mac, |
| 8302 | struct station_parameters *params) |
| 8303 | { |
| 8304 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8305 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8306 | hdd_context_t *pHddCtx; |
| 8307 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8308 | v_MACADDR_t STAMacAddress; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8309 | int ret = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8310 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8311 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8312 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8313 | tANI_U8 isOffChannelSupported = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8314 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8315 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8316 | ENTER(); |
| 8317 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8318 | if ((NULL == pAdapter)) |
| 8319 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8320 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8321 | "invalid adapter "); |
| 8322 | return -EINVAL; |
| 8323 | } |
| 8324 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8325 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8326 | TRACE_CODE_HDD_CHANGE_STATION, |
| 8327 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8328 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8329 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8330 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8331 | if (0 != ret) |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8332 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8333 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8334 | "%s: HDD context is not valid", __func__); |
| 8335 | return ret; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8336 | } |
| 8337 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8338 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8339 | |
| 8340 | if (NULL == pHddStaCtx) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8341 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8342 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8343 | "invalid HDD station context"); |
| 8344 | return -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8345 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8346 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 8347 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8348 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 8349 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8350 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8351 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8352 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8353 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8354 | WLANTL_STA_AUTHENTICATED); |
| 8355 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8356 | if (status != VOS_STATUS_SUCCESS) |
| 8357 | { |
| 8358 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8359 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 8360 | return -EINVAL; |
| 8361 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8362 | } |
| 8363 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 8364 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 8365 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8366 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8367 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 8368 | StaParams.capability = params->capability; |
| 8369 | StaParams.uapsd_queues = params->uapsd_queues; |
| 8370 | StaParams.max_sp = params->max_sp; |
| 8371 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8372 | /* Convert (first channel , number of channels) tuple to |
| 8373 | * the total list of channels. This goes with the assumption |
| 8374 | * that if the first channel is < 14, then the next channels |
| 8375 | * are an incremental of 1 else an incremental of 4 till the number |
| 8376 | * of channels. |
| 8377 | */ |
| 8378 | if (0 != params->supported_channels_len) { |
| 8379 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 8380 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 8381 | { |
| 8382 | int wifi_chan_index; |
| 8383 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 8384 | wifi_chan_index = |
| 8385 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 8386 | no_of_channels = params->supported_channels[i+1]; |
| 8387 | for(k=1; k <= no_of_channels; k++) |
| 8388 | { |
| 8389 | StaParams.supported_channels[j+1] = |
| 8390 | StaParams.supported_channels[j] + wifi_chan_index; |
| 8391 | j+=1; |
| 8392 | } |
| 8393 | } |
| 8394 | StaParams.supported_channels_len = j; |
| 8395 | } |
| 8396 | vos_mem_copy(StaParams.supported_oper_classes, |
| 8397 | params->supported_oper_classes, |
| 8398 | params->supported_oper_classes_len); |
| 8399 | StaParams.supported_oper_classes_len = |
| 8400 | params->supported_oper_classes_len; |
| 8401 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8402 | if (0 != params->ext_capab_len) |
| 8403 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 8404 | sizeof(StaParams.extn_capability)); |
| 8405 | |
| 8406 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8407 | { |
| 8408 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8409 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8410 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8411 | |
| 8412 | StaParams.supported_rates_len = params->supported_rates_len; |
| 8413 | |
| 8414 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 8415 | * The supported_rates array , for all the structures propogating till Add Sta |
| 8416 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 8417 | * modified to send more rates. |
| 8418 | */ |
| 8419 | |
| 8420 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 8421 | */ |
| 8422 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 8423 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 8424 | |
| 8425 | if (0 != StaParams.supported_rates_len) { |
| 8426 | int i = 0; |
| 8427 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 8428 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8429 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8430 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 8431 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8432 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8433 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 8434 | } |
| 8435 | |
| 8436 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8437 | { |
| 8438 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8439 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8440 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8441 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8442 | if (0 != params->ext_capab_len ) { |
| 8443 | /*Define A Macro : TODO Sunil*/ |
| 8444 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 8445 | isBufSta = 1; |
| 8446 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8447 | /* TDLS Channel Switching Support */ |
| 8448 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 8449 | isOffChannelSupported = 1; |
| 8450 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8451 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8452 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 8453 | &StaParams, isBufSta, |
| 8454 | isOffChannelSupported); |
| 8455 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8456 | if (VOS_STATUS_SUCCESS != status) { |
| 8457 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8458 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 8459 | return -EINVAL; |
| 8460 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8461 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 8462 | |
| 8463 | if (VOS_STATUS_SUCCESS != status) { |
| 8464 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8465 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 8466 | return -EINVAL; |
| 8467 | } |
| 8468 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8469 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 8470 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8471 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8472 | return status; |
| 8473 | } |
| 8474 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8475 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 8476 | struct net_device *dev, |
| 8477 | u8 *mac, |
| 8478 | struct station_parameters *params) |
| 8479 | { |
| 8480 | int ret; |
| 8481 | |
| 8482 | vos_ssr_protect(__func__); |
| 8483 | ret = __wlan_hdd_change_station(wiphy, dev, mac, params); |
| 8484 | vos_ssr_unprotect(__func__); |
| 8485 | |
| 8486 | return ret; |
| 8487 | } |
| 8488 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8489 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8490 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8491 | * This function is used to initialize the key information |
| 8492 | */ |
| 8493 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8494 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8495 | struct net_device *ndev, |
| 8496 | u8 key_index, bool pairwise, |
| 8497 | const u8 *mac_addr, |
| 8498 | struct key_params *params |
| 8499 | ) |
| 8500 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8501 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8502 | struct net_device *ndev, |
| 8503 | u8 key_index, const u8 *mac_addr, |
| 8504 | struct key_params *params |
| 8505 | ) |
| 8506 | #endif |
| 8507 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8508 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8509 | tCsrRoamSetKey setKey; |
| 8510 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8511 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8512 | v_U32_t roamId= 0xFF; |
| 8513 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8514 | hdd_hostapd_state_t *pHostapdState; |
| 8515 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8516 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8517 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8518 | |
| 8519 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8520 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8521 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8522 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 8523 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8524 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8525 | status = wlan_hdd_validate_context(pHddCtx); |
| 8526 | |
| 8527 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8528 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8529 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8530 | "%s: HDD context is not valid", __func__); |
| 8531 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8532 | } |
| 8533 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8534 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8535 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8536 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8537 | |
| 8538 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8539 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8540 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8541 | key_index); |
| 8542 | |
| 8543 | return -EINVAL; |
| 8544 | } |
| 8545 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8546 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 8547 | { |
| 8548 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 8549 | params->key_len); |
| 8550 | |
| 8551 | return -EINVAL; |
| 8552 | } |
| 8553 | |
| 8554 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8555 | "%s: called with key index = %d & key length %d", |
| 8556 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8557 | |
| 8558 | /*extract key idx, key len and key*/ |
| 8559 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8560 | setKey.keyId = key_index; |
| 8561 | setKey.keyLength = params->key_len; |
| 8562 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 8563 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8564 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8565 | { |
| 8566 | case WLAN_CIPHER_SUITE_WEP40: |
| 8567 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 8568 | break; |
| 8569 | |
| 8570 | case WLAN_CIPHER_SUITE_WEP104: |
| 8571 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 8572 | break; |
| 8573 | |
| 8574 | case WLAN_CIPHER_SUITE_TKIP: |
| 8575 | { |
| 8576 | u8 *pKey = &setKey.Key[0]; |
| 8577 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 8578 | |
| 8579 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 8580 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8581 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8582 | |
| 8583 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8584 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8585 | |--------------|----------|----------| |
| 8586 | <---16bytes---><--8bytes--><--8bytes--> |
| 8587 | |
| 8588 | */ |
| 8589 | /*Sme expects the 32 bytes key to be in the below order |
| 8590 | |
| 8591 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8592 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8593 | |--------------|----------|----------| |
| 8594 | <---16bytes---><--8bytes--><--8bytes--> |
| 8595 | */ |
| 8596 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8597 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8598 | |
| 8599 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8600 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8601 | |
| 8602 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8603 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8604 | |
| 8605 | |
| 8606 | break; |
| 8607 | } |
| 8608 | |
| 8609 | case WLAN_CIPHER_SUITE_CCMP: |
| 8610 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 8611 | break; |
| 8612 | |
| 8613 | #ifdef FEATURE_WLAN_WAPI |
| 8614 | case WLAN_CIPHER_SUITE_SMS4: |
| 8615 | { |
| 8616 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8617 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 8618 | params->key, params->key_len); |
| 8619 | return 0; |
| 8620 | } |
| 8621 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8622 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8623 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8624 | case WLAN_CIPHER_SUITE_KRK: |
| 8625 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 8626 | break; |
| 8627 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8628 | |
| 8629 | #ifdef WLAN_FEATURE_11W |
| 8630 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 8631 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 8632 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8633 | #endif |
| 8634 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8635 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8636 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8637 | __func__, params->cipher); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8638 | status = -EOPNOTSUPP; |
| 8639 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8640 | } |
| 8641 | |
| 8642 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 8643 | __func__, setKey.encType); |
| 8644 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8645 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8646 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8647 | (!pairwise) |
| 8648 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8649 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8650 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8651 | ) |
| 8652 | { |
| 8653 | /* set group key*/ |
| 8654 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8655 | "%s- %d: setting Broadcast key", |
| 8656 | __func__, __LINE__); |
| 8657 | setKey.keyDirection = eSIR_RX_ONLY; |
| 8658 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 8659 | } |
| 8660 | else |
| 8661 | { |
| 8662 | /* set pairwise key*/ |
| 8663 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8664 | "%s- %d: setting pairwise key", |
| 8665 | __func__, __LINE__); |
| 8666 | setKey.keyDirection = eSIR_TX_RX; |
| 8667 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 8668 | } |
| 8669 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 8670 | { |
| 8671 | setKey.keyDirection = eSIR_TX_RX; |
| 8672 | /*Set the group key*/ |
| 8673 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8674 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8675 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8676 | if ( 0 != status ) |
| 8677 | { |
| 8678 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8679 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8680 | status = -EINVAL; |
| 8681 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8682 | } |
| 8683 | /*Save the keys here and call sme_RoamSetKey for setting |
| 8684 | the PTK after peer joins the IBSS network*/ |
| 8685 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 8686 | &setKey, sizeof(tCsrRoamSetKey)); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8687 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8688 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8689 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 8690 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 8691 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8692 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8693 | if( pHostapdState->bssState == BSS_START ) |
| 8694 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8695 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 8696 | |
| 8697 | if ( status != eHAL_STATUS_SUCCESS ) |
| 8698 | { |
| 8699 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8700 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 8701 | __LINE__, status ); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8702 | status = -EINVAL; |
| 8703 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8704 | } |
| 8705 | } |
| 8706 | |
| 8707 | /* Saving WEP keys */ |
| 8708 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 8709 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 8710 | { |
| 8711 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 8712 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 8713 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 8714 | } |
| 8715 | else |
| 8716 | { |
| 8717 | //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] | 8718 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8719 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 8720 | } |
| 8721 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8722 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 8723 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8724 | { |
| 8725 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 8726 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8727 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8728 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8729 | if (!pairwise) |
| 8730 | #else |
| 8731 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 8732 | #endif |
| 8733 | { |
| 8734 | /* set group key*/ |
| 8735 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 8736 | { |
| 8737 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8738 | "%s- %d: Perform Set key Complete", |
| 8739 | __func__, __LINE__); |
| 8740 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 8741 | } |
| 8742 | } |
| 8743 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8744 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 8745 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 8746 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 8747 | |
| 8748 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8749 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8750 | params->key, params->key_len); |
| 8751 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8752 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8753 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 8754 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8755 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8756 | "%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] | 8757 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 8758 | setKey.peerMac[2], setKey.peerMac[3], |
| 8759 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8760 | setKey.keyDirection); |
| 8761 | |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 8762 | /* Wait for EAPOL M4 before setting key. |
| 8763 | * No need to consider Dynamic WEP as we will receive M8. |
| 8764 | */ |
| 8765 | if ( (setKey.encType == eCSR_ENCRYPT_TYPE_AES || |
| 8766 | setKey.encType == eCSR_ENCRYPT_TYPE_TKIP) && |
| 8767 | ( 1 |
| 8768 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 8769 | && pHddStaCtx->conn_info.authType != eCSR_AUTH_TYPE_FT_RSN |
| 8770 | && pHddStaCtx->conn_info.authType != eCSR_AUTH_TYPE_FT_RSN_PSK |
| 8771 | #endif |
| 8772 | #ifdef FEATURE_WLAN_ESE |
| 8773 | && pHddStaCtx->conn_info.authType != eCSR_AUTH_TYPE_CCKM_WPA |
| 8774 | && pHddStaCtx->conn_info.authType != eCSR_AUTH_TYPE_CCKM_RSN |
| 8775 | #endif |
| 8776 | )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8777 | { |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 8778 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 8779 | |
| 8780 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 8781 | { |
| 8782 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8783 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 8784 | __LINE__, vos_status ); |
| 8785 | |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 8786 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8787 | |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 8788 | status = -EINVAL; |
| 8789 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8790 | |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 8791 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8792 | } |
| 8793 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8794 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8795 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 8796 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 8797 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8798 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8799 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8800 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8801 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 8802 | "%s: Update PreAuth Key success", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8803 | status = 0; |
| 8804 | goto end; |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8805 | } |
| 8806 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 8807 | { |
| 8808 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8809 | "%s: Update PreAuth Key failed", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8810 | status = -EINVAL; |
| 8811 | goto end; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8812 | } |
| 8813 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8814 | |
| 8815 | /* issue set key request to SME*/ |
| 8816 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8817 | pAdapter->sessionId, &setKey, &roamId ); |
| 8818 | |
| 8819 | if ( 0 != status ) |
| 8820 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8821 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8822 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 8823 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8824 | status = -EINVAL; |
| 8825 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8826 | } |
| 8827 | |
| 8828 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8829 | /* in case of IBSS as there was no information available about WEP keys during |
| 8830 | * 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] | 8831 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8832 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 8833 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 8834 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8835 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 8836 | ) |
| 8837 | && |
| 8838 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 8839 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 8840 | ) |
| 8841 | ) |
| 8842 | { |
| 8843 | setKey.keyDirection = eSIR_RX_ONLY; |
| 8844 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 8845 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8846 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8847 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8848 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 8849 | setKey.peerMac[2], setKey.peerMac[3], |
| 8850 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8851 | setKey.keyDirection); |
| 8852 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8853 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8854 | pAdapter->sessionId, &setKey, &roamId ); |
| 8855 | |
| 8856 | if ( 0 != status ) |
| 8857 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8858 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8859 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8860 | __func__, status); |
| 8861 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8862 | status = -EINVAL; |
| 8863 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8864 | } |
| 8865 | } |
| 8866 | } |
| 8867 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8868 | end: |
| 8869 | /* Need to clear any trace of key value in the memory. |
| 8870 | * Thus zero out the memory even though it is local |
| 8871 | * variable. |
| 8872 | */ |
| 8873 | vos_mem_zero(&setKey, sizeof(setKey)); |
| 8874 | |
| 8875 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8876 | } |
| 8877 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8878 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8879 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 8880 | struct net_device *ndev, |
| 8881 | u8 key_index, bool pairwise, |
| 8882 | const u8 *mac_addr, |
| 8883 | struct key_params *params |
| 8884 | ) |
| 8885 | #else |
| 8886 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 8887 | struct net_device *ndev, |
| 8888 | u8 key_index, const u8 *mac_addr, |
| 8889 | struct key_params *params |
| 8890 | ) |
| 8891 | #endif |
| 8892 | { |
| 8893 | int ret; |
| 8894 | vos_ssr_protect(__func__); |
| 8895 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8896 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 8897 | mac_addr, params); |
| 8898 | #else |
| 8899 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 8900 | params); |
| 8901 | #endif |
| 8902 | vos_ssr_unprotect(__func__); |
| 8903 | |
| 8904 | return ret; |
| 8905 | } |
| 8906 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8907 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8908 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8909 | * This function is used to get the key information |
| 8910 | */ |
| 8911 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8912 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8913 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8914 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8915 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8916 | const u8 *mac_addr, void *cookie, |
| 8917 | void (*callback)(void *cookie, struct key_params*) |
| 8918 | ) |
| 8919 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8920 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8921 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8922 | struct net_device *ndev, |
| 8923 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 8924 | void (*callback)(void *cookie, struct key_params*) |
| 8925 | ) |
| 8926 | #endif |
| 8927 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8928 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8929 | hdd_wext_state_t *pWextState = NULL; |
| 8930 | tCsrRoamProfile *pRoamProfile = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8931 | struct key_params params; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8932 | hdd_context_t *pHddCtx; |
| 8933 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8934 | |
| 8935 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8936 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8937 | if (NULL == pAdapter) |
| 8938 | { |
| 8939 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8940 | "%s: HDD adapter is Null", __func__); |
| 8941 | return -ENODEV; |
| 8942 | } |
| 8943 | |
| 8944 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8945 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8946 | if (0 != ret) |
| 8947 | { |
| 8948 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8949 | "%s: HDD context is not valid", __func__); |
| 8950 | return ret; |
| 8951 | } |
| 8952 | |
| 8953 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 8954 | pRoamProfile = &(pWextState->roamProfile); |
| 8955 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8956 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8957 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8958 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8959 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8960 | memset(¶ms, 0, sizeof(params)); |
| 8961 | |
| 8962 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8963 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8964 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8965 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8966 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8967 | |
| 8968 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 8969 | { |
| 8970 | case eCSR_ENCRYPT_TYPE_NONE: |
| 8971 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 8972 | break; |
| 8973 | |
| 8974 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 8975 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 8976 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 8977 | break; |
| 8978 | |
| 8979 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 8980 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 8981 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 8982 | break; |
| 8983 | |
| 8984 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 8985 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 8986 | break; |
| 8987 | |
| 8988 | case eCSR_ENCRYPT_TYPE_AES: |
| 8989 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 8990 | break; |
| 8991 | |
| 8992 | default: |
| 8993 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 8994 | break; |
| 8995 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8996 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 8997 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8998 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 8999 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9000 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9001 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 9002 | params.seq_len = 0; |
| 9003 | params.seq = NULL; |
| 9004 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 9005 | callback(cookie, ¶ms); |
| 9006 | return 0; |
| 9007 | } |
| 9008 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9009 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9010 | static int wlan_hdd_cfg80211_get_key( |
| 9011 | struct wiphy *wiphy, |
| 9012 | struct net_device *ndev, |
| 9013 | u8 key_index, bool pairwise, |
| 9014 | const u8 *mac_addr, void *cookie, |
| 9015 | void (*callback)(void *cookie, struct key_params*) |
| 9016 | ) |
| 9017 | #else |
| 9018 | static int wlan_hdd_cfg80211_get_key( |
| 9019 | struct wiphy *wiphy, |
| 9020 | struct net_device *ndev, |
| 9021 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 9022 | void (*callback)(void *cookie, struct key_params*) |
| 9023 | ) |
| 9024 | #endif |
| 9025 | { |
| 9026 | int ret; |
| 9027 | |
| 9028 | vos_ssr_protect(__func__); |
| 9029 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9030 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 9031 | mac_addr, cookie, callback); |
| 9032 | #else |
| 9033 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 9034 | callback); |
| 9035 | #endif |
| 9036 | vos_ssr_unprotect(__func__); |
| 9037 | |
| 9038 | return ret; |
| 9039 | } |
| 9040 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9041 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9042 | * FUNCTION: __wlan_hdd_cfg80211_del_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9043 | * This function is used to delete the key information |
| 9044 | */ |
| 9045 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9046 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9047 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9048 | u8 key_index, |
| 9049 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9050 | const u8 *mac_addr |
| 9051 | ) |
| 9052 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9053 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9054 | struct net_device *ndev, |
| 9055 | u8 key_index, |
| 9056 | const u8 *mac_addr |
| 9057 | ) |
| 9058 | #endif |
| 9059 | { |
| 9060 | int status = 0; |
| 9061 | |
| 9062 | //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] | 9063 | //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] | 9064 | //it is observed that this is invalidating peer |
| 9065 | //key index whenever re-key is done. This is affecting data link. |
| 9066 | //It should be ok to ignore del_key. |
| 9067 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9068 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 9069 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9070 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 9071 | tCsrRoamSetKey setKey; |
| 9072 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9073 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9074 | ENTER(); |
| 9075 | |
| 9076 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 9077 | __func__,pAdapter->device_mode); |
| 9078 | |
| 9079 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9080 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9081 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9082 | key_index); |
| 9083 | |
| 9084 | return -EINVAL; |
| 9085 | } |
| 9086 | |
| 9087 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9088 | setKey.keyId = key_index; |
| 9089 | |
| 9090 | if (mac_addr) |
| 9091 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 9092 | else |
| 9093 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 9094 | |
| 9095 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 9096 | |
| 9097 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9098 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9099 | ) |
| 9100 | { |
| 9101 | |
| 9102 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9103 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 9104 | if( pHostapdState->bssState == BSS_START) |
| 9105 | { |
| 9106 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9107 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9108 | if ( status != eHAL_STATUS_SUCCESS ) |
| 9109 | { |
| 9110 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9111 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 9112 | __LINE__, status ); |
| 9113 | } |
| 9114 | } |
| 9115 | } |
| 9116 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9117 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9118 | ) |
| 9119 | { |
| 9120 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9121 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9122 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 9123 | |
| 9124 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9125 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9126 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9127 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9128 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9129 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 9130 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9131 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9132 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9133 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9134 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9135 | if ( 0 != status ) |
| 9136 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9137 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9138 | "%s: sme_RoamSetKey failure, returned %d", |
| 9139 | __func__, status); |
| 9140 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 9141 | return -EINVAL; |
| 9142 | } |
| 9143 | } |
| 9144 | } |
| 9145 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9146 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9147 | return status; |
| 9148 | } |
| 9149 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9150 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9151 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 9152 | struct net_device *ndev, |
| 9153 | u8 key_index, |
| 9154 | bool pairwise, |
| 9155 | const u8 *mac_addr |
| 9156 | ) |
| 9157 | #else |
| 9158 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 9159 | struct net_device *ndev, |
| 9160 | u8 key_index, |
| 9161 | const u8 *mac_addr |
| 9162 | ) |
| 9163 | #endif |
| 9164 | { |
| 9165 | int ret; |
| 9166 | |
| 9167 | vos_ssr_protect(__func__); |
| 9168 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9169 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, pairwise, |
| 9170 | mac_addr); |
| 9171 | #else |
| 9172 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, mac_addr); |
| 9173 | #endif |
| 9174 | vos_ssr_unprotect(__func__); |
| 9175 | |
| 9176 | return ret; |
| 9177 | } |
| 9178 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9179 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9180 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9181 | * This function is used to set the default tx key index |
| 9182 | */ |
| 9183 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9184 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9185 | struct net_device *ndev, |
| 9186 | u8 key_index, |
| 9187 | bool unicast, bool multicast) |
| 9188 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9189 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9190 | struct net_device *ndev, |
| 9191 | u8 key_index) |
| 9192 | #endif |
| 9193 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9194 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9195 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9196 | hdd_wext_state_t *pWextState; |
| 9197 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9198 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9199 | |
| 9200 | ENTER(); |
| 9201 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9202 | if ((NULL == pAdapter)) |
| 9203 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9204 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9205 | "invalid adapter"); |
| 9206 | return -EINVAL; |
| 9207 | } |
| 9208 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9209 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9210 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 9211 | pAdapter->sessionId, key_index)); |
| 9212 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9213 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9214 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9215 | |
| 9216 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 9217 | { |
| 9218 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9219 | "invalid Wext state or HDD context"); |
| 9220 | return -EINVAL; |
| 9221 | } |
| 9222 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9223 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9224 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9225 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9226 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9227 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9228 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9229 | key_index); |
| 9230 | |
| 9231 | return -EINVAL; |
| 9232 | } |
| 9233 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9234 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9235 | status = wlan_hdd_validate_context(pHddCtx); |
| 9236 | |
| 9237 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9238 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9239 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9240 | "%s: HDD context is not valid", __func__); |
| 9241 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9242 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9243 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9244 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9245 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9246 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9247 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9248 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 9249 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9250 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 9251 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9252 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9253 | { |
| 9254 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9255 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9256 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9257 | tCsrRoamSetKey setKey; |
| 9258 | v_U32_t roamId= 0xFF; |
| 9259 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9260 | |
| 9261 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9262 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9263 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9264 | Keys->defaultIndex = (u8)key_index; |
| 9265 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9266 | setKey.keyId = key_index; |
| 9267 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9268 | |
| 9269 | vos_mem_copy(&setKey.Key[0], |
| 9270 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9271 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9272 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9273 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9274 | |
| 9275 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9276 | &pHddStaCtx->conn_info.bssId[0], |
| 9277 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9278 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9279 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 9280 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 9281 | eCSR_ENCRYPT_TYPE_WEP104) |
| 9282 | { |
| 9283 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 9284 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 9285 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 9286 | type(104) and switching encryption type to 40*/ |
| 9287 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 9288 | eCSR_ENCRYPT_TYPE_WEP40; |
| 9289 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 9290 | eCSR_ENCRYPT_TYPE_WEP40; |
| 9291 | } |
| 9292 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9293 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9294 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9295 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9296 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9297 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9298 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9299 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9300 | if ( 0 != status ) |
| 9301 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9302 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9303 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9304 | status); |
| 9305 | return -EINVAL; |
| 9306 | } |
| 9307 | } |
| 9308 | } |
| 9309 | |
| 9310 | /* In SoftAp mode setting key direction for default mode */ |
| 9311 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 9312 | { |
| 9313 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 9314 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 9315 | (eCSR_ENCRYPT_TYPE_AES != |
| 9316 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 9317 | ) |
| 9318 | { |
| 9319 | /* Saving key direction for default key index to TX default */ |
| 9320 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 9321 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 9322 | } |
| 9323 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9324 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9325 | return status; |
| 9326 | } |
| 9327 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9328 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9329 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 9330 | struct net_device *ndev, |
| 9331 | u8 key_index, |
| 9332 | bool unicast, bool multicast) |
| 9333 | #else |
| 9334 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 9335 | struct net_device *ndev, |
| 9336 | u8 key_index) |
| 9337 | #endif |
| 9338 | { |
| 9339 | int ret; |
| 9340 | vos_ssr_protect(__func__); |
| 9341 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9342 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 9343 | multicast); |
| 9344 | #else |
| 9345 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 9346 | #endif |
| 9347 | vos_ssr_unprotect(__func__); |
| 9348 | |
| 9349 | return ret; |
| 9350 | } |
| 9351 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9352 | /* |
| 9353 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 9354 | * This function is used to inform the BSS details to nl80211 interface. |
| 9355 | */ |
| 9356 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 9357 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 9358 | { |
| 9359 | struct net_device *dev = pAdapter->dev; |
| 9360 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 9361 | struct wiphy *wiphy = wdev->wiphy; |
| 9362 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 9363 | int chan_no; |
| 9364 | int ie_length; |
| 9365 | const char *ie; |
| 9366 | unsigned int freq; |
| 9367 | struct ieee80211_channel *chan; |
| 9368 | int rssi = 0; |
| 9369 | struct cfg80211_bss *bss = NULL; |
| 9370 | |
| 9371 | ENTER(); |
| 9372 | |
| 9373 | if( NULL == pBssDesc ) |
| 9374 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9375 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9376 | return bss; |
| 9377 | } |
| 9378 | |
| 9379 | chan_no = pBssDesc->channelId; |
| 9380 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 9381 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 9382 | |
| 9383 | if( NULL == ie ) |
| 9384 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9385 | 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] | 9386 | return bss; |
| 9387 | } |
| 9388 | |
| 9389 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 9390 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 9391 | { |
| 9392 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9393 | } |
| 9394 | else |
| 9395 | { |
| 9396 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9397 | } |
| 9398 | #else |
| 9399 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9400 | #endif |
| 9401 | |
| 9402 | chan = __ieee80211_get_channel(wiphy, freq); |
| 9403 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 9404 | if (!chan) { |
| 9405 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 9406 | return NULL; |
| 9407 | } |
| 9408 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9409 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9410 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9411 | return cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9412 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9413 | pBssDesc->capabilityInfo, |
| 9414 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9415 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9416 | } |
| 9417 | |
| 9418 | |
| 9419 | |
| 9420 | /* |
| 9421 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 9422 | * This function is used to inform the BSS details to nl80211 interface. |
| 9423 | */ |
| 9424 | struct cfg80211_bss* |
| 9425 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 9426 | tSirBssDescription *bss_desc |
| 9427 | ) |
| 9428 | { |
| 9429 | /* |
| 9430 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 9431 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 9432 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 9433 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 9434 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 9435 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 9436 | cfg80211_inform_bss_frame. |
| 9437 | */ |
| 9438 | struct net_device *dev = pAdapter->dev; |
| 9439 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 9440 | struct wiphy *wiphy = wdev->wiphy; |
| 9441 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 9442 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 9443 | qcom_ie_age *qie_age = NULL; |
| 9444 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 9445 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9446 | 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] | 9447 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9448 | const char *ie = |
| 9449 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 9450 | unsigned int freq; |
| 9451 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 9452 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9453 | struct cfg80211_bss *bss_status = NULL; |
| 9454 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 9455 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9456 | hdd_context_t *pHddCtx; |
| 9457 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9458 | #ifdef WLAN_OPEN_SOURCE |
| 9459 | struct timespec ts; |
| 9460 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9461 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9462 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9463 | status = wlan_hdd_validate_context(pHddCtx); |
| 9464 | |
| 9465 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 9466 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9467 | { |
| 9468 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9469 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 9470 | return NULL; |
| 9471 | } |
| 9472 | |
| 9473 | |
| 9474 | if (0 != status) |
| 9475 | { |
| 9476 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9477 | "%s: HDD context is not valid", __func__); |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 9478 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9479 | } |
| 9480 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 9481 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9482 | if (!mgmt) |
| 9483 | { |
| 9484 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9485 | "%s: memory allocation failed ", __func__); |
| 9486 | return NULL; |
| 9487 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 9488 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9489 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9490 | |
| 9491 | #ifdef WLAN_OPEN_SOURCE |
| 9492 | /* Android does not want the timestamp from the frame. |
| 9493 | Instead it wants a monotonic increasing value */ |
| 9494 | get_monotonic_boottime(&ts); |
| 9495 | mgmt->u.probe_resp.timestamp = |
| 9496 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 9497 | #else |
| 9498 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9499 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 9500 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9501 | |
| 9502 | #endif |
| 9503 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9504 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 9505 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 9506 | |
| 9507 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 9508 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 9509 | /* Assuming this is the last IE, copy at the end */ |
| 9510 | ie_length -=sizeof(qcom_ie_age); |
| 9511 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 9512 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 9513 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 9514 | qie_age->oui_1 = QCOM_OUI1; |
| 9515 | qie_age->oui_2 = QCOM_OUI2; |
| 9516 | qie_age->oui_3 = QCOM_OUI3; |
| 9517 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 9518 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 9519 | #endif |
| 9520 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9521 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 9522 | if (bss_desc->fProbeRsp) |
| 9523 | { |
| 9524 | mgmt->frame_control |= |
| 9525 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 9526 | } |
| 9527 | else |
| 9528 | { |
| 9529 | mgmt->frame_control |= |
| 9530 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 9531 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9532 | |
| 9533 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9534 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9535 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 9536 | { |
| 9537 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9538 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9539 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9540 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 9541 | |
| 9542 | { |
| 9543 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9544 | } |
| 9545 | else |
| 9546 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9547 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 9548 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9549 | kfree(mgmt); |
| 9550 | return NULL; |
| 9551 | } |
| 9552 | #else |
| 9553 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9554 | #endif |
| 9555 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 9556 | /*when the band is changed on the fly using the GUI, three things are done |
| 9557 | * 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) |
| 9558 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 9559 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 9560 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 9561 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 9562 | * 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 |
| 9563 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 9564 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 9565 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 9566 | * So drop the bss and continue to next bss. |
| 9567 | */ |
| 9568 | if(chan == NULL) |
| 9569 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9570 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 9571 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 9572 | return NULL; |
| 9573 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9574 | /*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] | 9575 | *and the rssi icon of the wireless networks in sync |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9576 | * */ |
| 9577 | if (( eConnectionState_Associated == |
| 9578 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 9579 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 9580 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 9581 | WNI_CFG_BSSID_LEN))) |
| 9582 | { |
| 9583 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 9584 | rssi = (pAdapter->rssi * 100); |
| 9585 | } |
| 9586 | else |
| 9587 | { |
| 9588 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 9589 | } |
| 9590 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9591 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
| 9592 | "RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 9593 | chan->center_freq, (int)(rssi/100)); |
| 9594 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9595 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 9596 | frame_len, rssi, GFP_KERNEL); |
| 9597 | kfree(mgmt); |
| 9598 | return bss_status; |
| 9599 | } |
| 9600 | |
| 9601 | /* |
| 9602 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 9603 | * This function is used to update the BSS data base of CFG8011 |
| 9604 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9605 | 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] | 9606 | tCsrRoamInfo *pRoamInfo |
| 9607 | ) |
| 9608 | { |
| 9609 | tCsrRoamConnectedProfile roamProfile; |
| 9610 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9611 | struct cfg80211_bss *bss = NULL; |
| 9612 | |
| 9613 | ENTER(); |
| 9614 | |
| 9615 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 9616 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 9617 | |
| 9618 | if (NULL != roamProfile.pBssDesc) |
| 9619 | { |
Girish Gowli | f4b6802 | 2014-08-28 23:18:57 +0530 | [diff] [blame] | 9620 | bss = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 9621 | roamProfile.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9622 | |
| 9623 | if (NULL == bss) |
| 9624 | { |
| 9625 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 9626 | __func__); |
| 9627 | } |
| 9628 | |
| 9629 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 9630 | } |
| 9631 | else |
| 9632 | { |
| 9633 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 9634 | __func__); |
| 9635 | } |
| 9636 | return bss; |
| 9637 | } |
| 9638 | |
| 9639 | /* |
| 9640 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 9641 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9642 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 9643 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9644 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9645 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9646 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9647 | tCsrScanResultInfo *pScanResult; |
| 9648 | eHalStatus status = 0; |
| 9649 | tScanResultHandle pResult; |
| 9650 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9651 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9652 | |
| 9653 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9654 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9655 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9656 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 9657 | NO_SESSION, pAdapter->sessionId)); |
| 9658 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9659 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9660 | |
| 9661 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9662 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9663 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9664 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 9665 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9666 | } |
| 9667 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9668 | |
| 9669 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 9670 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9671 | { |
| 9672 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9673 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 9674 | return VOS_STATUS_E_PERM; |
| 9675 | } |
| 9676 | |
| 9677 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9678 | /* |
| 9679 | * start getting scan results and populate cgf80211 BSS database |
| 9680 | */ |
| 9681 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 9682 | |
| 9683 | /* no scan results */ |
| 9684 | if (NULL == pResult) |
| 9685 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9686 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 9687 | __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9688 | return status; |
| 9689 | } |
| 9690 | |
| 9691 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 9692 | |
| 9693 | while (pScanResult) |
| 9694 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9695 | /* |
| 9696 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 9697 | * entry already exists in bss data base of cfg80211 for that |
| 9698 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 9699 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 9700 | * mgmt packet as input. As of now there is no possibility to get |
| 9701 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9702 | * ieee80211_mgmt(probe response) and passing to c |
| 9703 | * fg80211_inform_bss_frame. |
| 9704 | * */ |
| 9705 | |
| 9706 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 9707 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9708 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9709 | |
| 9710 | if (NULL == bss_status) |
| 9711 | { |
| 9712 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9713 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9714 | } |
| 9715 | else |
| 9716 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 9717 | cfg80211_put_bss( |
| 9718 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 9719 | wiphy, |
| 9720 | #endif |
| 9721 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9722 | } |
| 9723 | |
| 9724 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 9725 | } |
| 9726 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9727 | sme_ScanResultPurge(hHal, pResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9728 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9729 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9730 | } |
| 9731 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9732 | void |
| 9733 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 9734 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9735 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 9736 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9737 | } /****** end hddPrintMacAddr() ******/ |
| 9738 | |
| 9739 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 9740 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9741 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9742 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9743 | "%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] | 9744 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 9745 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 9746 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9747 | } /****** end hddPrintPmkId() ******/ |
| 9748 | |
| 9749 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 9750 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 9751 | |
| 9752 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 9753 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 9754 | |
| 9755 | #define dump_bssid(bssid) \ |
| 9756 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9757 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 9758 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9759 | } |
| 9760 | |
| 9761 | #define dump_pmkid(pMac, pmkid) \ |
| 9762 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9763 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 9764 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9765 | } |
| 9766 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 9767 | #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] | 9768 | /* |
| 9769 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 9770 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 9771 | */ |
| 9772 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9773 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9774 | int index, bool preauth ) |
| 9775 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9776 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9777 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 9778 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9779 | |
| 9780 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9781 | 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] | 9782 | |
| 9783 | if( NULL == pRoamInfo ) |
| 9784 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9785 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9786 | return -EINVAL; |
| 9787 | } |
| 9788 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 9789 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 9790 | { |
| 9791 | dump_bssid(pRoamInfo->bssid); |
| 9792 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9793 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 9794 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9795 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9796 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9797 | } |
| 9798 | #endif //FEATURE_WLAN_LFR |
| 9799 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 9800 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 9801 | /* |
| 9802 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 9803 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 9804 | * |
| 9805 | */ |
| 9806 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 9807 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 9808 | tCsrRoamInfo *pRoamInfo) |
| 9809 | { |
| 9810 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 9811 | union iwreq_data wrqu; |
| 9812 | |
| 9813 | ENTER(); |
| 9814 | |
| 9815 | if (NULL == pAdapter) |
| 9816 | { |
| 9817 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 9818 | return VOS_STATUS_E_FAILURE; |
| 9819 | } |
| 9820 | |
| 9821 | /* create the event */ |
| 9822 | memset(&wrqu, 0, sizeof(wrqu)); |
| 9823 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 9824 | |
| 9825 | wrqu.data.pointer = metrics_notification; |
| 9826 | wrqu.data.length = scnprintf(metrics_notification, |
| 9827 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 9828 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 9829 | |
| 9830 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 9831 | |
| 9832 | EXIT(); |
| 9833 | |
| 9834 | return VOS_STATUS_SUCCESS; |
| 9835 | } |
| 9836 | |
| 9837 | /* |
| 9838 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 9839 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 9840 | * or failure |
| 9841 | */ |
| 9842 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 9843 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 9844 | { |
| 9845 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 9846 | union iwreq_data wrqu; |
| 9847 | |
| 9848 | ENTER(); |
| 9849 | |
| 9850 | if (NULL == pAdapter) |
| 9851 | { |
| 9852 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 9853 | return VOS_STATUS_E_FAILURE; |
| 9854 | } |
| 9855 | |
| 9856 | /* create the event */ |
| 9857 | memset(&wrqu, 0, sizeof(wrqu)); |
| 9858 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 9859 | |
| 9860 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 9861 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 9862 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 9863 | |
| 9864 | if (1 == preauth_status) |
| 9865 | strncat(metrics_notification, " TRUE", 5); |
| 9866 | else |
| 9867 | strncat(metrics_notification, " FALSE", 6); |
| 9868 | |
| 9869 | wrqu.data.pointer = metrics_notification; |
| 9870 | wrqu.data.length = strlen(metrics_notification); |
| 9871 | |
| 9872 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 9873 | |
| 9874 | EXIT(); |
| 9875 | |
| 9876 | return VOS_STATUS_SUCCESS; |
| 9877 | } |
| 9878 | |
| 9879 | /* |
| 9880 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 9881 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 9882 | * |
| 9883 | */ |
| 9884 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 9885 | tCsrRoamInfo *pRoamInfo) |
| 9886 | { |
| 9887 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 9888 | union iwreq_data wrqu; |
| 9889 | |
| 9890 | ENTER(); |
| 9891 | |
| 9892 | if (NULL == pAdapter) |
| 9893 | { |
| 9894 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 9895 | return VOS_STATUS_E_FAILURE; |
| 9896 | } |
| 9897 | |
| 9898 | /* create the event */ |
| 9899 | memset(&wrqu, 0, sizeof(wrqu)); |
| 9900 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 9901 | |
| 9902 | wrqu.data.pointer = metrics_notification; |
| 9903 | wrqu.data.length = scnprintf(metrics_notification, |
| 9904 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 9905 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 9906 | |
| 9907 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 9908 | |
| 9909 | EXIT(); |
| 9910 | |
| 9911 | return VOS_STATUS_SUCCESS; |
| 9912 | } |
| 9913 | #endif |
| 9914 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9915 | /* |
| 9916 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 9917 | * scanning callback function, called after finishing scan |
| 9918 | * |
| 9919 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9920 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9921 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 9922 | { |
| 9923 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9924 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9925 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9926 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9927 | hdd_scaninfo_t *pScanInfo = &pHddCtx->scan_info; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9928 | struct cfg80211_scan_request *req = NULL; |
| 9929 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 9930 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9931 | long waitRet = 0; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 9932 | tANI_U8 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9933 | |
| 9934 | ENTER(); |
| 9935 | |
| 9936 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9937 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9938 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9939 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 9940 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 9941 | pScanInfo->mScanPendingCounter = 0; |
| 9942 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9943 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9944 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9945 | &pScanInfo->scan_req_completion_event, |
| 9946 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9947 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9948 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9949 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9950 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9951 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9952 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9953 | } |
| 9954 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 9955 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9956 | { |
| 9957 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9958 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9959 | } |
| 9960 | |
| 9961 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9962 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9963 | { |
| 9964 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9965 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9966 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9967 | (int) scanId); |
| 9968 | } |
| 9969 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9970 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9971 | pAdapter); |
| 9972 | |
| 9973 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9974 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9975 | |
| 9976 | |
| 9977 | /* If any client wait scan result through WEXT |
| 9978 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9979 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9980 | { |
| 9981 | /* The other scan request waiting for current scan finish |
| 9982 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9983 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9984 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9985 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9986 | } |
| 9987 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9988 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9989 | { |
| 9990 | struct net_device *dev = pAdapter->dev; |
| 9991 | union iwreq_data wrqu; |
| 9992 | int we_event; |
| 9993 | char *msg; |
| 9994 | |
| 9995 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 9996 | we_event = SIOCGIWSCAN; |
| 9997 | msg = NULL; |
| 9998 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 9999 | } |
| 10000 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10001 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10002 | |
| 10003 | /* Get the Scan Req */ |
| 10004 | req = pAdapter->request; |
| 10005 | |
| 10006 | if (!req) |
| 10007 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10008 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10009 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10010 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10011 | } |
| 10012 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10013 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10014 | /* Scan is no longer pending */ |
| 10015 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10016 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10017 | /* last_scan_timestamp is used to decide if new scan |
| 10018 | * is needed or not on station interface. If last station |
| 10019 | * scan time and new station scan time is less then |
| 10020 | * last_scan_timestamp ; driver will return cached scan. |
| 10021 | */ |
| 10022 | if (req->no_cck == FALSE && status == eCSR_SCAN_SUCCESS) // no_cck will be set during p2p find |
| 10023 | { |
| 10024 | pScanInfo->last_scan_timestamp = vos_timer_get_system_time(); |
| 10025 | |
| 10026 | if ( req->n_channels ) |
| 10027 | { |
| 10028 | for (i = 0; i < req->n_channels ; i++ ) |
| 10029 | { |
| 10030 | pHddCtx->scan_info.last_scan_channelList[i] = req->channels[i]->hw_value; |
| 10031 | } |
| 10032 | /* store no of channel scanned */ |
| 10033 | pHddCtx->scan_info.last_scan_numChannels= req->n_channels; |
| 10034 | } |
| 10035 | |
| 10036 | } |
| 10037 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 10038 | /* |
| 10039 | * cfg80211_scan_done informing NL80211 about completion |
| 10040 | * of scanning |
| 10041 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10042 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 10043 | { |
| 10044 | aborted = true; |
| 10045 | } |
| 10046 | cfg80211_scan_done(req, aborted); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 10047 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10048 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10049 | if (pHddCtx->spoofMacAddr.isEnabled || pHddCtx->spoofMacAddr.isReqDeferred) { |
| 10050 | /* Generate new random mac addr for next scan */ |
| 10051 | hddLog(VOS_TRACE_LEVEL_INFO, "scan completed - generate new spoof mac addr"); |
| 10052 | hdd_processSpoofMacAddrRequest(pHddCtx); |
| 10053 | } |
| 10054 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10055 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10056 | /* release the wake lock at the end of the scan*/ |
| 10057 | hdd_allow_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10058 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 10059 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 10060 | * immediatly after the driver gets connect request(i.e after scan) |
| 10061 | * from supplicant, this result in app's is suspending and not able |
| 10062 | * to process the connect request to AP */ |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 10063 | hdd_prevent_suspend_timeout(1000); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 10064 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 10065 | #ifdef FEATURE_WLAN_TDLS |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10066 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 10067 | #endif |
| 10068 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10069 | EXIT(); |
| 10070 | return 0; |
| 10071 | } |
| 10072 | |
| 10073 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10074 | * FUNCTION: hdd_isConnectionInProgress |
| 10075 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10076 | * |
| 10077 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10078 | v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10079 | { |
| 10080 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 10081 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 10082 | hdd_adapter_t *pAdapter = NULL; |
| 10083 | VOS_STATUS status = 0; |
| 10084 | v_U8_t staId = 0; |
| 10085 | v_U8_t *staMac = NULL; |
| 10086 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 10087 | if (TRUE == pHddCtx->btCoexModeSet) |
| 10088 | { |
| 10089 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10090 | FL("BTCoex Mode operation in progress")); |
| 10091 | return VOS_TRUE; |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 10092 | } |
| 10093 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10094 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 10095 | |
| 10096 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 10097 | { |
| 10098 | pAdapter = pAdapterNode->pAdapter; |
| 10099 | |
| 10100 | if( pAdapter ) |
| 10101 | { |
| 10102 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10103 | "%s: Adapter with device mode %s (%d) exists", |
| 10104 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10105 | pAdapter->device_mode); |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10106 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10107 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10108 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 10109 | (eConnectionState_Connecting == |
| 10110 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 10111 | { |
| 10112 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10113 | "%s: %p(%d) Connection is in progress", __func__, |
| 10114 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 10115 | return VOS_TRUE; |
| 10116 | } |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10117 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Padma, Santhosh Kumar | 3b9657d | 2015-02-04 19:37:32 +0530 | [diff] [blame] | 10118 | smeNeighborMiddleOfRoaming(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10119 | { |
| 10120 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10121 | "%s: %p(%d) Reassociation is in progress", __func__, |
| 10122 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 10123 | return VOS_TRUE; |
| 10124 | } |
| 10125 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10126 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10127 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10128 | { |
| 10129 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10130 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10131 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10132 | { |
| 10133 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 10134 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10135 | "%s: client " MAC_ADDRESS_STR |
| 10136 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 10137 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10138 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10139 | } |
| 10140 | } |
| 10141 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 10142 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 10143 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10144 | v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 10145 | ptSapContext pSapCtx = NULL; |
| 10146 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 10147 | if(pSapCtx == NULL){ |
| 10148 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10149 | FL("psapCtx is NULL")); |
| 10150 | return VOS_FALSE; |
| 10151 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10152 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 10153 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10154 | if ((pSapCtx->aStaInfo[staId].isUsed) && |
| 10155 | (WLANTL_STA_CONNECTED == pSapCtx->aStaInfo[staId].tlSTAState)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10156 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10157 | staMac = (v_U8_t *) &(pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10158 | |
| 10159 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10160 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 10161 | "middle of WPS/EAPOL exchange.", __func__, |
| 10162 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10163 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10164 | } |
| 10165 | } |
| 10166 | } |
| 10167 | } |
| 10168 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 10169 | pAdapterNode = pNext; |
| 10170 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10171 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10172 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10173 | |
| 10174 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10175 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10176 | * this scan respond to scan trigger and update cfg80211 scan database |
| 10177 | * later, scan dump command can be used to recieve scan results |
| 10178 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10179 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 10180 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10181 | struct net_device *dev, |
| 10182 | #endif |
| 10183 | struct cfg80211_scan_request *request) |
| 10184 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10185 | hdd_adapter_t *pAdapter = NULL; |
| 10186 | hdd_context_t *pHddCtx = NULL; |
| 10187 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10188 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10189 | tCsrScanRequest scanRequest; |
| 10190 | tANI_U8 *channelList = NULL, i; |
| 10191 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10192 | int status; |
| 10193 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10194 | v_U8_t* pP2pIe = NULL; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10195 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10196 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10197 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 10198 | struct net_device *dev = NULL; |
| 10199 | if (NULL == request) |
| 10200 | { |
| 10201 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10202 | "%s: scan req param null", __func__); |
| 10203 | return -EINVAL; |
| 10204 | } |
| 10205 | dev = request->wdev->netdev; |
| 10206 | #endif |
| 10207 | |
| 10208 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 10209 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 10210 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10211 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10212 | ENTER(); |
| 10213 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10214 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10215 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 10216 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10217 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10218 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10219 | status = wlan_hdd_validate_context(pHddCtx); |
| 10220 | |
| 10221 | if (0 != status) |
| 10222 | { |
| 10223 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10224 | "%s: HDD context is not valid", __func__); |
| 10225 | return status; |
| 10226 | } |
| 10227 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10228 | if (NULL == pwextBuf) |
| 10229 | { |
| 10230 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 10231 | __func__); |
| 10232 | return -EIO; |
| 10233 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10234 | cfg_param = pHddCtx->cfg_ini; |
| 10235 | pScanInfo = &pHddCtx->scan_info; |
| 10236 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10237 | #ifdef WLAN_BTAMP_FEATURE |
| 10238 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10239 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10240 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 10241 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10242 | "%s: No scanning when AMP is on", __func__); |
| 10243 | return -EOPNOTSUPP; |
| 10244 | } |
| 10245 | #endif |
| 10246 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10247 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10248 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10249 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10250 | "%s: Not scanning on device_mode = %s (%d)", |
| 10251 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10252 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10253 | return -EOPNOTSUPP; |
| 10254 | } |
| 10255 | |
| 10256 | if (TRUE == pScanInfo->mScanPending) |
| 10257 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10258 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 10259 | { |
| 10260 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 10261 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10262 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10263 | } |
| 10264 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10265 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10266 | //Channel and action frame is pending |
| 10267 | //Otherwise Cancel Remain On Channel and allow Scan |
| 10268 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10269 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10270 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10271 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10272 | return -EBUSY; |
| 10273 | } |
| 10274 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10275 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 10276 | { |
| 10277 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 10278 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10279 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10280 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10281 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 10282 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10283 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10284 | "%s: MAX TM Level Scan not allowed", __func__); |
| 10285 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10286 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10287 | } |
| 10288 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 10289 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10290 | /* Check if scan is allowed at this point of time. |
| 10291 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10292 | if (hdd_isConnectionInProgress(pHddCtx)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10293 | { |
| 10294 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 10295 | return -EBUSY; |
| 10296 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10297 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10298 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 10299 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10300 | hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d", |
| 10301 | (int)request->n_ssids); |
| 10302 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10303 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10304 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 10305 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 10306 | * is not aging out the scan results. |
| 10307 | */ |
| 10308 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10309 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10310 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10311 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10312 | |
| 10313 | if ((request->ssids) && (0 < request->n_ssids)) |
| 10314 | { |
| 10315 | tCsrSSIDInfo *SsidInfo; |
| 10316 | int j; |
| 10317 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 10318 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 10319 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 10320 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 10321 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 10322 | |
| 10323 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 10324 | { |
| 10325 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10326 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 10327 | return -ENOMEM; |
| 10328 | } |
| 10329 | |
| 10330 | /* copy all the ssid's and their length */ |
| 10331 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 10332 | { |
| 10333 | /* get the ssid length */ |
| 10334 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 10335 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 10336 | SsidInfo->SSID.length); |
| 10337 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 10338 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 10339 | j, SsidInfo->SSID.ssId); |
| 10340 | } |
| 10341 | /* set the scan type to active */ |
| 10342 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 10343 | } |
| 10344 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10345 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10346 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10347 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 10348 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10349 | /* set the scan type to active */ |
| 10350 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10351 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10352 | else |
| 10353 | { |
| 10354 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 10355 | scanRequest.scanType = pScanInfo->scan_mode; |
| 10356 | } |
| 10357 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 10358 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10359 | |
| 10360 | /* set BSSType to default type */ |
| 10361 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 10362 | |
| 10363 | /*TODO: scan the requested channels only*/ |
| 10364 | |
| 10365 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10366 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10367 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10368 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10369 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 10370 | request->n_channels = MAX_CHANNEL; |
| 10371 | } |
| 10372 | |
| 10373 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10374 | "No of Scan Channels: %d", request->n_channels); |
| 10375 | |
| 10376 | |
| 10377 | if( request->n_channels ) |
| 10378 | { |
| 10379 | char chList [(request->n_channels*5)+1]; |
| 10380 | int len; |
| 10381 | channelList = vos_mem_malloc( request->n_channels ); |
| 10382 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10383 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10384 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10385 | "%s: memory alloc failed channelList", __func__); |
| 10386 | status = -ENOMEM; |
| 10387 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10388 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10389 | |
| 10390 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 10391 | { |
| 10392 | channelList[i] = request->channels[i]->hw_value; |
| 10393 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 10394 | } |
| 10395 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10396 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10397 | "Channel-List: %s ", chList); |
| 10398 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10399 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10400 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 10401 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 10402 | |
| 10403 | /* set requestType to full scan */ |
| 10404 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 10405 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10406 | /* if there is back to back scan happening in driver with in |
| 10407 | * nDeferScanTimeInterval interval driver should defer new scan request |
| 10408 | * and should provide last cached scan results instead of new channel list. |
| 10409 | * This rule is not applicable if scan is p2p scan. |
| 10410 | * This condition will work only in case when last request no of channels |
| 10411 | * and channels are exactly same as new request. |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10412 | * This should be done only in connected state |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10413 | */ |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10414 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10415 | if ((VOS_STATUS_SUCCESS == hdd_is_any_session_connected(pHddCtx))) |
| 10416 | { |
| 10417 | if ( pScanInfo->last_scan_timestamp !=0 && |
| 10418 | ((vos_timer_get_system_time() - pScanInfo->last_scan_timestamp ) < pHddCtx->cfg_ini->nDeferScanTimeInterval)) |
| 10419 | { |
| 10420 | if ( request->no_cck == FALSE && scanRequest.ChannelInfo.numOfChannels != 1 && |
| 10421 | (pScanInfo->last_scan_numChannels == scanRequest.ChannelInfo.numOfChannels) && |
| 10422 | vos_mem_compare(pScanInfo->last_scan_channelList, |
| 10423 | channelList, pScanInfo->last_scan_numChannels)) |
| 10424 | { |
| 10425 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10426 | " New and old station scan time differ is less then %u", |
| 10427 | pHddCtx->cfg_ini->nDeferScanTimeInterval); |
| 10428 | |
| 10429 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10430 | pAdapter); |
| 10431 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10432 | hddLog(VOS_TRACE_LEVEL_WARN, |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 10433 | "Return old cached scan as all channels and no of channels are same"); |
| 10434 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10435 | if (0 > ret) |
| 10436 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10437 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10438 | cfg80211_scan_done(request, eCSR_SCAN_SUCCESS); |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 10439 | |
| 10440 | status = eHAL_STATUS_SUCCESS; |
| 10441 | goto free_mem; |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10442 | } |
| 10443 | } |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10444 | } |
| 10445 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10446 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 10447 | * search (Flush on both full scan and social scan but not on single |
| 10448 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 10449 | */ |
| 10450 | |
| 10451 | /* Supplicant does single channel scan after 8-way handshake |
| 10452 | * and in that case driver shoudnt flush scan results. If |
| 10453 | * driver flushes the scan results here and unfortunately if |
| 10454 | * the AP doesnt respond to our probe req then association |
| 10455 | * fails which is not desired |
| 10456 | */ |
| 10457 | |
| 10458 | if( request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN ) |
| 10459 | { |
| 10460 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 10461 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10462 | pAdapter->sessionId ); |
| 10463 | } |
| 10464 | |
| 10465 | if( request->ie_len ) |
| 10466 | { |
| 10467 | /* save this for future association (join requires this) */ |
| 10468 | /*TODO: Array needs to be converted to dynamic allocation, |
| 10469 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 10470 | * CR 597966 |
| 10471 | */ |
| 10472 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 10473 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 10474 | pScanInfo->scanAddIE.length = request->ie_len; |
| 10475 | |
| 10476 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 10477 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10478 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10479 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10480 | if ( request->ie_len <= SIR_MAC_MAX_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10481 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10482 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 10483 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 10484 | request->ie, request->ie_len); |
| 10485 | } |
| 10486 | else |
| 10487 | { |
| 10488 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 10489 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10490 | } |
| 10491 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10492 | } |
| 10493 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 10494 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 10495 | |
| 10496 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 10497 | request->ie_len); |
| 10498 | if (pP2pIe != NULL) |
| 10499 | { |
| 10500 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 10501 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 10502 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 10503 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10504 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10505 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 10506 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 10507 | "Go nego completed to Connection is started"); |
| 10508 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 10509 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10510 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10511 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 10512 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10513 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10514 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 10515 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 10516 | "Disconnected state to Connection is started"); |
| 10517 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 10518 | "for 4way Handshake"); |
| 10519 | } |
| 10520 | #endif |
| 10521 | |
| 10522 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 10523 | if(TRUE == request->no_cck) |
| 10524 | { |
| 10525 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10526 | "%s: This is a P2P Search", __func__); |
| 10527 | scanRequest.p2pSearch = 1; |
| 10528 | |
| 10529 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10530 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10531 | /* set requestType to P2P Discovery */ |
| 10532 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 10533 | } |
| 10534 | |
| 10535 | /* |
| 10536 | Skip Dfs Channel in case of P2P Search |
| 10537 | if it is set in ini file |
| 10538 | */ |
| 10539 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 10540 | { |
| 10541 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10542 | } |
| 10543 | else |
| 10544 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10545 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10546 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10547 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10548 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10549 | } |
| 10550 | } |
| 10551 | |
| 10552 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 10553 | |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10554 | #ifdef FEATURE_WLAN_TDLS |
| 10555 | /* if tdls disagree scan right now, return immediately. |
| 10556 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 10557 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 10558 | */ |
| 10559 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 10560 | wiphy, |
| 10561 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10562 | dev, |
| 10563 | #endif |
| 10564 | request); |
| 10565 | if(status <= 0) |
| 10566 | { |
| 10567 | if(!status) |
| 10568 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 10569 | "scan rejected %d", __func__, status); |
| 10570 | else |
| 10571 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 10572 | __func__, status); |
| 10573 | |
| 10574 | return status; |
| 10575 | } |
| 10576 | #endif |
| 10577 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10578 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 10579 | * address the following issues. |
| 10580 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 10581 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 10582 | * for long time, this result in apps running at full power for long time. |
| 10583 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 10584 | * be stuck in full power because of resume BMPS |
| 10585 | */ |
| 10586 | hdd_prevent_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10587 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10588 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 10589 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10590 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 10591 | scanRequest.requestType, scanRequest.scanType, |
| 10592 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10593 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 10594 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10595 | if (pHddCtx->spoofMacAddr.isEnabled) |
| 10596 | { |
| 10597 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10598 | "%s: MAC Spoofing enabled for current scan", __func__); |
| 10599 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 10600 | * to fill TxBds for probe request during current scan |
| 10601 | */ |
| 10602 | WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
| 10603 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
| 10604 | } |
| 10605 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10606 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10607 | pAdapter->sessionId, &scanRequest, &scanId, |
| 10608 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10609 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10610 | if (eHAL_STATUS_SUCCESS != status) |
| 10611 | { |
| 10612 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10613 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 10614 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 10615 | if(eHAL_STATUS_RESOURCES == status) |
| 10616 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10617 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 10618 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 10619 | status = -EBUSY; |
| 10620 | } else { |
| 10621 | status = -EIO; |
| 10622 | } |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10623 | hdd_allow_suspend(); |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10624 | |
| 10625 | #ifdef FEATURE_WLAN_TDLS |
| 10626 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 10627 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10628 | goto free_mem; |
| 10629 | } |
| 10630 | |
| 10631 | pScanInfo->mScanPending = TRUE; |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 10632 | pScanInfo->sessionId = pAdapter->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10633 | pAdapter->request = request; |
| 10634 | pScanInfo->scanId = scanId; |
| 10635 | |
| 10636 | complete(&pScanInfo->scan_req_completion_event); |
| 10637 | |
| 10638 | free_mem: |
| 10639 | if( scanRequest.SSIDs.SSIDList ) |
| 10640 | { |
| 10641 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 10642 | } |
| 10643 | |
| 10644 | if( channelList ) |
| 10645 | vos_mem_free( channelList ); |
| 10646 | |
| 10647 | EXIT(); |
| 10648 | |
| 10649 | return status; |
| 10650 | } |
| 10651 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10652 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 10653 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10654 | struct net_device *dev, |
| 10655 | #endif |
| 10656 | struct cfg80211_scan_request *request) |
| 10657 | { |
| 10658 | int ret; |
| 10659 | |
| 10660 | vos_ssr_protect(__func__); |
| 10661 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 10662 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10663 | dev, |
| 10664 | #endif |
| 10665 | request); |
| 10666 | vos_ssr_unprotect(__func__); |
| 10667 | |
| 10668 | return ret; |
| 10669 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10670 | |
| 10671 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 10672 | { |
| 10673 | v_U8_t iniDot11Mode = |
| 10674 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 10675 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 10676 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10677 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 10678 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10679 | switch ( iniDot11Mode ) |
| 10680 | { |
| 10681 | case eHDD_DOT11_MODE_AUTO: |
| 10682 | case eHDD_DOT11_MODE_11ac: |
| 10683 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 10684 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 4b1d235 | 2014-08-01 21:59:28 +0530 | [diff] [blame] | 10685 | if ( sme_IsFeatureSupportedByDriver(DOT11AC) && |
| 10686 | sme_IsFeatureSupportedByFW(DOT11AC) ) |
| 10687 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 10688 | else |
| 10689 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10690 | #else |
| 10691 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 10692 | #endif |
| 10693 | break; |
| 10694 | case eHDD_DOT11_MODE_11n: |
| 10695 | case eHDD_DOT11_MODE_11n_ONLY: |
| 10696 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 10697 | break; |
| 10698 | default: |
| 10699 | hddDot11Mode = iniDot11Mode; |
| 10700 | break; |
| 10701 | } |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 10702 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 10703 | if (operationChannel > SIR_11B_CHANNEL_END) |
| 10704 | #endif |
| 10705 | { |
| 10706 | /* This call decides required channel bonding mode */ |
| 10707 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10708 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 10709 | operationChannel); |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 10710 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10711 | } |
| 10712 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10713 | /* |
| 10714 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10715 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10716 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10717 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10718 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10719 | { |
| 10720 | int status = 0; |
| 10721 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 10722 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10723 | v_U32_t roamId; |
| 10724 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10725 | eCsrAuthType RSNAuthType; |
| 10726 | |
| 10727 | ENTER(); |
| 10728 | |
| 10729 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 10730 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10731 | |
| 10732 | status = wlan_hdd_validate_context(pHddCtx); |
| 10733 | if (status) |
| 10734 | { |
| 10735 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10736 | "%s: HDD context is not valid!", __func__); |
| 10737 | return status; |
| 10738 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10739 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10740 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 10741 | { |
| 10742 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 10743 | return -EINVAL; |
| 10744 | } |
| 10745 | |
| 10746 | pRoamProfile = &pWextState->roamProfile; |
| 10747 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10748 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10749 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10750 | hdd_station_ctx_t *pHddStaCtx; |
| 10751 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10752 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10753 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10754 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 10755 | { |
| 10756 | /*QoS not enabled in cfg file*/ |
| 10757 | pRoamProfile->uapsd_mask = 0; |
| 10758 | } |
| 10759 | else |
| 10760 | { |
| 10761 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10762 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10763 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 10764 | } |
| 10765 | |
| 10766 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 10767 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 10768 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10769 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10770 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 10771 | ssid, ssid_len); |
| 10772 | |
| 10773 | if (bssid) |
| 10774 | { |
| 10775 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 10776 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 10777 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10778 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 10779 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10780 | case of join failure we should send valid BSSID to supplicant |
| 10781 | */ |
| 10782 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 10783 | WNI_CFG_BSSID_LEN); |
| 10784 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 10785 | else |
| 10786 | { |
| 10787 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 10788 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10789 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10790 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 10791 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10792 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 10793 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10794 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10795 | /*set gen ie*/ |
| 10796 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 10797 | /*set auth*/ |
| 10798 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 10799 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10800 | #ifdef FEATURE_WLAN_WAPI |
| 10801 | if (pAdapter->wapi_info.nWapiMode) |
| 10802 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10803 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10804 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 10805 | { |
| 10806 | case WAPI_AUTH_MODE_PSK: |
| 10807 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10808 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10809 | pAdapter->wapi_info.wapiAuthMode); |
| 10810 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 10811 | break; |
| 10812 | } |
| 10813 | case WAPI_AUTH_MODE_CERT: |
| 10814 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10815 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10816 | pAdapter->wapi_info.wapiAuthMode); |
| 10817 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 10818 | break; |
| 10819 | } |
| 10820 | } // End of switch |
| 10821 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 10822 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 10823 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10824 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10825 | pRoamProfile->AuthType.numEntries = 1; |
| 10826 | pRoamProfile->EncryptionType.numEntries = 1; |
| 10827 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 10828 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 10829 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 10830 | } |
| 10831 | } |
| 10832 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 10833 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 10834 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 10835 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 10836 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 10837 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 10838 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 10839 | sizeof (tSirGtkOffloadParams)); |
| 10840 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 10841 | } |
| 10842 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10843 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 10844 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10845 | if( operatingChannel ) |
| 10846 | { |
| 10847 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 10848 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 10849 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 10850 | else |
| 10851 | { |
| 10852 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 10853 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 10854 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10855 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 10856 | { |
| 10857 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 10858 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10859 | |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 10860 | /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect() |
| 10861 | * 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] | 10862 | * 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] | 10863 | * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback() |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 10864 | * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. |
| 10865 | */ |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 10866 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 10867 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 10868 | { |
| 10869 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10870 | "%s: Set HDD connState to eConnectionState_Connecting", |
| 10871 | __func__); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 10872 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 10873 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 10874 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10875 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10876 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 10877 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 10878 | if ((eHAL_STATUS_SUCCESS != status) && |
| 10879 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 10880 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 10881 | |
| 10882 | { |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 10883 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with " |
| 10884 | "status %d. -> NotConnected", __func__, pAdapter->sessionId, status); |
| 10885 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 10886 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 10887 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 10888 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 10889 | |
| 10890 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 10891 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 10892 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10893 | } |
| 10894 | else |
| 10895 | { |
| 10896 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 10897 | return -EINVAL; |
| 10898 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 10899 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10900 | return status; |
| 10901 | } |
| 10902 | |
| 10903 | /* |
| 10904 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 10905 | * This function is used to set the authentication type (OPEN/SHARED). |
| 10906 | * |
| 10907 | */ |
| 10908 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 10909 | enum nl80211_auth_type auth_type) |
| 10910 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10911 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10912 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10913 | |
| 10914 | ENTER(); |
| 10915 | |
| 10916 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10917 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10918 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10919 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10920 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10921 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 10922 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 10923 | break; |
| 10924 | |
| 10925 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 10926 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10927 | case NL80211_AUTHTYPE_FT: |
| 10928 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10929 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10930 | "%s: set authentication type to OPEN", __func__); |
| 10931 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 10932 | break; |
| 10933 | |
| 10934 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10935 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10936 | "%s: set authentication type to SHARED", __func__); |
| 10937 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 10938 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10939 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10940 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10941 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10942 | "%s: set authentication type to CCKM WPA", __func__); |
| 10943 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 10944 | break; |
| 10945 | #endif |
| 10946 | |
| 10947 | |
| 10948 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10949 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10950 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10951 | auth_type); |
| 10952 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 10953 | return -EINVAL; |
| 10954 | } |
| 10955 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10956 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10957 | pHddStaCtx->conn_info.authType; |
| 10958 | return 0; |
| 10959 | } |
| 10960 | |
| 10961 | /* |
| 10962 | * FUNCTION: wlan_hdd_set_akm_suite |
| 10963 | * This function is used to set the key mgmt type(PSK/8021x). |
| 10964 | * |
| 10965 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10966 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10967 | u32 key_mgmt |
| 10968 | ) |
| 10969 | { |
| 10970 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10971 | ENTER(); |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 10972 | /* Should be in ieee802_11_defs.h */ |
| 10973 | #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05 |
| 10974 | #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10975 | /*set key mgmt type*/ |
| 10976 | switch(key_mgmt) |
| 10977 | { |
| 10978 | case WLAN_AKM_SUITE_PSK: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 10979 | case WLAN_AKM_SUITE_PSK_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 10980 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10981 | case WLAN_AKM_SUITE_FT_PSK: |
| 10982 | #endif |
| 10983 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10984 | __func__); |
| 10985 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 10986 | break; |
| 10987 | |
| 10988 | case WLAN_AKM_SUITE_8021X: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 10989 | case WLAN_AKM_SUITE_8021X_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 10990 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10991 | case WLAN_AKM_SUITE_FT_8021X: |
| 10992 | #endif |
| 10993 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10994 | __func__); |
| 10995 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 10996 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10997 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10998 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 10999 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 11000 | case WLAN_AKM_SUITE_CCKM: |
| 11001 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 11002 | __func__); |
| 11003 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 11004 | break; |
| 11005 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 11006 | #ifndef WLAN_AKM_SUITE_OSEN |
| 11007 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 11008 | case WLAN_AKM_SUITE_OSEN: |
| 11009 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 11010 | __func__); |
| 11011 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 11012 | break; |
| 11013 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11014 | |
| 11015 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11016 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11017 | __func__, key_mgmt); |
| 11018 | return -EINVAL; |
| 11019 | |
| 11020 | } |
| 11021 | return 0; |
| 11022 | } |
| 11023 | |
| 11024 | /* |
| 11025 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11026 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11027 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 11028 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11029 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 11030 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11031 | bool ucast |
| 11032 | ) |
| 11033 | { |
| 11034 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11035 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11036 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11037 | |
| 11038 | ENTER(); |
| 11039 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11040 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11041 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11042 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11043 | __func__, cipher); |
| 11044 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11045 | } |
| 11046 | else |
| 11047 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11048 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11049 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11050 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11051 | { |
| 11052 | case IW_AUTH_CIPHER_NONE: |
| 11053 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11054 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11055 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11056 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11057 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11058 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11059 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11060 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11061 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11062 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11063 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11064 | case WLAN_CIPHER_SUITE_TKIP: |
| 11065 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 11066 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11067 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11068 | case WLAN_CIPHER_SUITE_CCMP: |
| 11069 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 11070 | break; |
| 11071 | #ifdef FEATURE_WLAN_WAPI |
| 11072 | case WLAN_CIPHER_SUITE_SMS4: |
| 11073 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 11074 | break; |
| 11075 | #endif |
| 11076 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11077 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11078 | case WLAN_CIPHER_SUITE_KRK: |
| 11079 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 11080 | break; |
| 11081 | #endif |
| 11082 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11083 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11084 | __func__, cipher); |
| 11085 | return -EOPNOTSUPP; |
| 11086 | } |
| 11087 | } |
| 11088 | |
| 11089 | if (ucast) |
| 11090 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11091 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11092 | __func__, encryptionType); |
| 11093 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 11094 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11095 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11096 | encryptionType; |
| 11097 | } |
| 11098 | else |
| 11099 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11100 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11101 | __func__, encryptionType); |
| 11102 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 11103 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 11104 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 11105 | } |
| 11106 | |
| 11107 | return 0; |
| 11108 | } |
| 11109 | |
| 11110 | |
| 11111 | /* |
| 11112 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 11113 | * This function is used to parse WPA/RSN IE's. |
| 11114 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11115 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
| 11116 | u8 *ie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11117 | size_t ie_len |
| 11118 | ) |
| 11119 | { |
| 11120 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11121 | u8 *genie = ie; |
| 11122 | v_U16_t remLen = ie_len; |
| 11123 | #ifdef FEATURE_WLAN_WAPI |
| 11124 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 11125 | u16 *tmp; |
| 11126 | v_U16_t akmsuiteCount; |
| 11127 | int *akmlist; |
| 11128 | #endif |
| 11129 | ENTER(); |
| 11130 | |
| 11131 | /* clear previous assocAddIE */ |
| 11132 | pWextState->assocAddIE.length = 0; |
| 11133 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11134 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11135 | |
| 11136 | while (remLen >= 2) |
| 11137 | { |
| 11138 | v_U16_t eLen = 0; |
| 11139 | v_U8_t elementId; |
| 11140 | elementId = *genie++; |
| 11141 | eLen = *genie++; |
| 11142 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11143 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11144 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11145 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11146 | |
| 11147 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11148 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11149 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11150 | 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] | 11151 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11152 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11153 | "%s: Invalid WPA IE", __func__); |
| 11154 | return -EINVAL; |
| 11155 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11156 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11157 | { |
| 11158 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11159 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11160 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11161 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11162 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 11163 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11164 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 11165 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11166 | VOS_ASSERT(0); |
| 11167 | return -ENOMEM; |
| 11168 | } |
| 11169 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 11170 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11171 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11172 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11173 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 11174 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11175 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11176 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11177 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 11178 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11179 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 11180 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 11181 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 11182 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 11183 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 11184 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11185 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 11186 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11187 | { |
| 11188 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11189 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11190 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11191 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11192 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 11193 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11194 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11195 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11196 | VOS_ASSERT(0); |
| 11197 | return -ENOMEM; |
| 11198 | } |
| 11199 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 11200 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11201 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11202 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11203 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11204 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11205 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11206 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11207 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 11208 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11209 | /*Consider WFD IE, only for P2P Client */ |
| 11210 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 11211 | { |
| 11212 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11213 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11214 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11215 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11216 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 11217 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11218 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11219 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11220 | VOS_ASSERT(0); |
| 11221 | return -ENOMEM; |
| 11222 | } |
| 11223 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 11224 | // WPS IE + P2P IE + WFD IE |
| 11225 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11226 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11227 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11228 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11229 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11230 | } |
| 11231 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11232 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11233 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11234 | HS20_OUI_TYPE_SIZE)) ) |
| 11235 | { |
| 11236 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11237 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11238 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11239 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11240 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 11241 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11242 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11243 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11244 | VOS_ASSERT(0); |
| 11245 | return -ENOMEM; |
| 11246 | } |
| 11247 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11248 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11249 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11250 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11251 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11252 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11253 | /* Appending OSEN Information Element in Assiciation Request */ |
| 11254 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 11255 | OSEN_OUI_TYPE_SIZE)) ) |
| 11256 | { |
| 11257 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 11258 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 11259 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11260 | |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11261 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 11262 | { |
| 11263 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11264 | "Need bigger buffer space"); |
| 11265 | VOS_ASSERT(0); |
| 11266 | return -ENOMEM; |
| 11267 | } |
| 11268 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11269 | pWextState->assocAddIE.length += eLen + 2; |
| 11270 | |
| 11271 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 11272 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11273 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11274 | } |
| 11275 | |
| 11276 | break; |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 11277 | if (WLAN_HDD_IBSS == pAdapter->device_mode) { |
| 11278 | |
| 11279 | /* populating as ADDIE in beacon frames */ |
| 11280 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11281 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie - 2, eLen + 2, |
| 11282 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 11283 | { |
| 11284 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11285 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 11286 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 11287 | { |
| 11288 | hddLog(LOGE, |
| 11289 | "Coldn't pass " |
| 11290 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 11291 | } |
| 11292 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 11293 | else |
| 11294 | hddLog(LOGE, |
| 11295 | "Could not pass on " |
| 11296 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 11297 | |
| 11298 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 11299 | beaconIE's need to be populated in probe response frames */ |
| 11300 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 11301 | { |
| 11302 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 11303 | u8 probe_rsp_ie_len[3] = {0}; |
| 11304 | u8 counter = 0; |
| 11305 | |
| 11306 | /* Check Probe Resp Length if it is greater then 255 then |
| 11307 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 11308 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 11309 | not able Store More then 255 bytes into One Variable */ |
| 11310 | |
| 11311 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 11312 | { |
| 11313 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 11314 | { |
| 11315 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 11316 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 11317 | } |
| 11318 | else |
| 11319 | { |
| 11320 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 11321 | rem_probe_resp_ie_len = 0; |
| 11322 | } |
| 11323 | } |
| 11324 | |
| 11325 | rem_probe_resp_ie_len = 0; |
| 11326 | |
| 11327 | if (probe_rsp_ie_len[0] > 0) |
| 11328 | { |
| 11329 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11330 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 11331 | (tANI_U8*)(genie - 2), |
| 11332 | probe_rsp_ie_len[0], NULL, |
| 11333 | eANI_BOOLEAN_FALSE) |
| 11334 | == eHAL_STATUS_FAILURE) |
| 11335 | { |
| 11336 | hddLog(LOGE, |
| 11337 | "Could not pass" |
| 11338 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 11339 | } |
| 11340 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 11341 | } |
| 11342 | |
| 11343 | if (probe_rsp_ie_len[1] > 0) |
| 11344 | { |
| 11345 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11346 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 11347 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 11348 | probe_rsp_ie_len[1], NULL, |
| 11349 | eANI_BOOLEAN_FALSE) |
| 11350 | == eHAL_STATUS_FAILURE) |
| 11351 | { |
| 11352 | hddLog(LOGE, |
| 11353 | "Could not pass" |
| 11354 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 11355 | } |
| 11356 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 11357 | } |
| 11358 | |
| 11359 | if (probe_rsp_ie_len[2] > 0) |
| 11360 | { |
| 11361 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11362 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 11363 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 11364 | probe_rsp_ie_len[2], NULL, |
| 11365 | eANI_BOOLEAN_FALSE) |
| 11366 | == eHAL_STATUS_FAILURE) |
| 11367 | { |
| 11368 | hddLog(LOGE, |
| 11369 | "Could not pass" |
| 11370 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 11371 | } |
| 11372 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 11373 | } |
| 11374 | |
| 11375 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11376 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 11377 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 11378 | { |
| 11379 | hddLog(LOGE, |
| 11380 | "Could not pass" |
| 11381 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 11382 | } |
| 11383 | } |
| 11384 | else |
| 11385 | { |
| 11386 | // Reset WNI_CFG_PROBE_RSP Flags |
| 11387 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 11388 | |
| 11389 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11390 | "%s: No Probe Response IE received in set beacon", |
| 11391 | __func__); |
| 11392 | } |
| 11393 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11394 | break; |
| 11395 | case DOT11F_EID_RSN: |
| 11396 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 11397 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 11398 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 11399 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 11400 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 11401 | break; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11402 | /* Appending Extended Capabilities with Interworking bit set in Assoc Req */ |
| 11403 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11404 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11405 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11406 | 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] | 11407 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11408 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11409 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 11410 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11411 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11412 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11413 | VOS_ASSERT(0); |
| 11414 | return -ENOMEM; |
| 11415 | } |
| 11416 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11417 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11418 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11419 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11420 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11421 | break; |
| 11422 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11423 | #ifdef FEATURE_WLAN_WAPI |
| 11424 | case WLAN_EID_WAPI: |
| 11425 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 11426 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11427 | pAdapter->wapi_info.nWapiMode); |
| 11428 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11429 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11430 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 11431 | tmp = tmp + 1; |
| 11432 | akmlist = (int *)(tmp); |
| 11433 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 11434 | { |
| 11435 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 11436 | } |
| 11437 | else |
| 11438 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11439 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11440 | VOS_ASSERT(0); |
| 11441 | return -EINVAL; |
| 11442 | } |
| 11443 | |
| 11444 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 11445 | { |
| 11446 | 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] | 11447 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11448 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11449 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11450 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11451 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11452 | 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] | 11453 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11454 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 11455 | } |
| 11456 | break; |
| 11457 | #endif |
| 11458 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11459 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11460 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11461 | /* when Unknown IE is received we should break and continue |
| 11462 | * to the next IE in the buffer instead we were returning |
| 11463 | * so changing this to break */ |
| 11464 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11465 | } |
| 11466 | genie += eLen; |
| 11467 | remLen -= eLen; |
| 11468 | } |
| 11469 | EXIT(); |
| 11470 | return 0; |
| 11471 | } |
| 11472 | |
| 11473 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 11474 | * FUNCTION: hdd_isWPAIEPresent |
| 11475 | * Parse the received IE to find the WPA IE |
| 11476 | * |
| 11477 | */ |
| 11478 | static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len) |
| 11479 | { |
| 11480 | v_U8_t eLen = 0; |
| 11481 | v_U16_t remLen = ie_len; |
| 11482 | v_U8_t elementId = 0; |
| 11483 | |
| 11484 | while (remLen >= 2) |
| 11485 | { |
| 11486 | elementId = *ie++; |
| 11487 | eLen = *ie++; |
| 11488 | remLen -= 2; |
| 11489 | if (eLen > remLen) |
| 11490 | { |
| 11491 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11492 | "%s: IE length is wrong %d", __func__, eLen); |
| 11493 | return FALSE; |
| 11494 | } |
| 11495 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 11496 | { |
| 11497 | /* OUI - 0x00 0X50 0XF2 |
| 11498 | WPA Information Element - 0x01 |
| 11499 | WPA version - 0x01*/ |
| 11500 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 11501 | return TRUE; |
| 11502 | } |
| 11503 | ie += eLen; |
| 11504 | remLen -= eLen; |
| 11505 | } |
| 11506 | return FALSE; |
| 11507 | } |
| 11508 | |
| 11509 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11510 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11511 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11512 | * parameters during connect operation. |
| 11513 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11514 | int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11515 | struct cfg80211_connect_params *req |
| 11516 | ) |
| 11517 | { |
| 11518 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11519 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11520 | ENTER(); |
| 11521 | |
| 11522 | /*set wpa version*/ |
| 11523 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 11524 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11525 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11526 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 11527 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11528 | { |
| 11529 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 11530 | } |
| 11531 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 11532 | { |
| 11533 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 11534 | } |
| 11535 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11536 | |
| 11537 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11538 | pWextState->wpaVersion); |
| 11539 | |
| 11540 | /*set authentication type*/ |
| 11541 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 11542 | |
| 11543 | if (0 > status) |
| 11544 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11545 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11546 | "%s: failed to set authentication type ", __func__); |
| 11547 | return status; |
| 11548 | } |
| 11549 | |
| 11550 | /*set key mgmt type*/ |
| 11551 | if (req->crypto.n_akm_suites) |
| 11552 | { |
| 11553 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 11554 | if (0 > status) |
| 11555 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11556 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11557 | __func__); |
| 11558 | return status; |
| 11559 | } |
| 11560 | } |
| 11561 | |
| 11562 | /*set pairwise cipher type*/ |
| 11563 | if (req->crypto.n_ciphers_pairwise) |
| 11564 | { |
| 11565 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 11566 | req->crypto.ciphers_pairwise[0], true); |
| 11567 | if (0 > status) |
| 11568 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11569 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11570 | "%s: failed to set unicast cipher type", __func__); |
| 11571 | return status; |
| 11572 | } |
| 11573 | } |
| 11574 | else |
| 11575 | { |
| 11576 | /*Reset previous cipher suite to none*/ |
| 11577 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 11578 | if (0 > status) |
| 11579 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11580 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11581 | "%s: failed to set unicast cipher type", __func__); |
| 11582 | return status; |
| 11583 | } |
| 11584 | } |
| 11585 | |
| 11586 | /*set group cipher type*/ |
| 11587 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 11588 | false); |
| 11589 | |
| 11590 | if (0 > status) |
| 11591 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11592 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11593 | __func__); |
| 11594 | return status; |
| 11595 | } |
| 11596 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11597 | #ifdef WLAN_FEATURE_11W |
| 11598 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 11599 | #endif |
| 11600 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11601 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 11602 | if (req->ie_len) |
| 11603 | { |
| 11604 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 11605 | if ( 0 > status) |
| 11606 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11607 | 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] | 11608 | __func__); |
| 11609 | return status; |
| 11610 | } |
| 11611 | } |
| 11612 | |
| 11613 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11614 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11615 | { |
| 11616 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 11617 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 11618 | ) |
| 11619 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11620 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11621 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 11622 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11623 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11624 | __func__); |
| 11625 | return -EOPNOTSUPP; |
| 11626 | } |
| 11627 | else |
| 11628 | { |
| 11629 | u8 key_len = req->key_len; |
| 11630 | u8 key_idx = req->key_idx; |
| 11631 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11632 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11633 | && (CSR_MAX_NUM_KEY > key_idx) |
| 11634 | ) |
| 11635 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11636 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11637 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11638 | __func__, key_idx, key_len); |
| 11639 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11640 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11641 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11642 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11643 | (u8)key_len; |
| 11644 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 11645 | } |
| 11646 | } |
| 11647 | } |
| 11648 | } |
| 11649 | |
| 11650 | return status; |
| 11651 | } |
| 11652 | |
| 11653 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 11654 | * FUNCTION: wlan_hdd_try_disconnect |
| 11655 | * This function is used to disconnect from previous |
| 11656 | * connection |
| 11657 | */ |
| 11658 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 11659 | { |
| 11660 | long ret = 0; |
| 11661 | hdd_station_ctx_t *pHddStaCtx; |
| 11662 | eMib_dot11DesiredBssType connectedBssType; |
| 11663 | |
| 11664 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11665 | |
| 11666 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 11667 | |
| 11668 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 11669 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 11670 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 11671 | { |
| 11672 | /* Issue disconnect to CSR */ |
| 11673 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 11674 | if( eHAL_STATUS_SUCCESS == |
| 11675 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11676 | pAdapter->sessionId, |
| 11677 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 11678 | { |
| 11679 | ret = wait_for_completion_interruptible_timeout( |
| 11680 | &pAdapter->disconnect_comp_var, |
| 11681 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 11682 | if (0 >= ret) |
| 11683 | { |
| 11684 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 11685 | return -EALREADY; |
| 11686 | } |
| 11687 | } |
| 11688 | } |
| 11689 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 11690 | { |
| 11691 | ret = wait_for_completion_interruptible_timeout( |
| 11692 | &pAdapter->disconnect_comp_var, |
| 11693 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 11694 | if (0 >= ret) |
| 11695 | { |
| 11696 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 11697 | return -EALREADY; |
| 11698 | } |
| 11699 | } |
| 11700 | |
| 11701 | return 0; |
| 11702 | } |
| 11703 | |
| 11704 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11705 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 11706 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11707 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11708 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11709 | struct net_device *ndev, |
| 11710 | struct cfg80211_connect_params *req |
| 11711 | ) |
| 11712 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11713 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11714 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11715 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 11716 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11717 | |
| 11718 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11719 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11720 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11721 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 11722 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11723 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11724 | "%s: device_mode = %s (%d)", __func__, |
| 11725 | hdd_device_modetoString(pAdapter->device_mode), |
| 11726 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11727 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11728 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 11729 | if (!pHddCtx) |
| 11730 | { |
| 11731 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11732 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11733 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 11734 | } |
| 11735 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11736 | status = wlan_hdd_validate_context(pHddCtx); |
| 11737 | |
| 11738 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11739 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11740 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11741 | "%s: HDD context is not valid", __func__); |
| 11742 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11743 | } |
| 11744 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11745 | if (vos_max_concurrent_connections_reached()) { |
| 11746 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 11747 | return -ECONNREFUSED; |
| 11748 | } |
| 11749 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11750 | #ifdef WLAN_BTAMP_FEATURE |
| 11751 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11752 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11753 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11754 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11755 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 11756 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11757 | } |
| 11758 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 11759 | |
| 11760 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 11761 | //P2P Mode will be taken care in Open/close adapter |
| 11762 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11763 | (vos_concurrent_open_sessions_running())) { |
| 11764 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 11765 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 11766 | } |
| 11767 | |
| 11768 | /*Try disconnecting if already in connected state*/ |
| 11769 | status = wlan_hdd_try_disconnect(pAdapter); |
| 11770 | if ( 0 > status) |
| 11771 | { |
| 11772 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 11773 | " connection")); |
| 11774 | return -EALREADY; |
| 11775 | } |
| 11776 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11777 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11778 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11779 | |
| 11780 | if ( 0 > status) |
| 11781 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11782 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11783 | __func__); |
| 11784 | return status; |
| 11785 | } |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 11786 | if ( req->channel ) |
| 11787 | { |
| 11788 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 11789 | req->ssid_len, req->bssid, |
| 11790 | req->channel->hw_value); |
| 11791 | } |
| 11792 | else |
| 11793 | { |
| 11794 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11795 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 11796 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11797 | |
| 11798 | if (0 > status) |
| 11799 | { |
| 11800 | //ReEnable BMPS if disabled |
| 11801 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 11802 | (NULL != pHddCtx)) |
| 11803 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 11804 | if (pHddCtx->hdd_wlan_suspended) |
| 11805 | { |
| 11806 | hdd_set_pwrparams(pHddCtx); |
| 11807 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11808 | //ReEnable Bmps and Imps back |
| 11809 | hdd_enable_bmps_imps(pHddCtx); |
| 11810 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11811 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11812 | return status; |
| 11813 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11814 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11815 | EXIT(); |
| 11816 | return status; |
| 11817 | } |
| 11818 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11819 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 11820 | struct net_device *ndev, |
| 11821 | struct cfg80211_connect_params *req) |
| 11822 | { |
| 11823 | int ret; |
| 11824 | vos_ssr_protect(__func__); |
| 11825 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 11826 | vos_ssr_unprotect(__func__); |
| 11827 | |
| 11828 | return ret; |
| 11829 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11830 | |
| 11831 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11832 | * FUNCTION: wlan_hdd_disconnect |
| 11833 | * This function is used to issue a disconnect request to SME |
| 11834 | */ |
| 11835 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 11836 | { |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 11837 | int status, result = 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11838 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11839 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11840 | long ret; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11841 | |
| 11842 | status = wlan_hdd_validate_context(pHddCtx); |
| 11843 | |
| 11844 | if (0 != status) |
| 11845 | { |
| 11846 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11847 | "%s: HDD context is not valid", __func__); |
| 11848 | return status; |
| 11849 | } |
| 11850 | |
| 11851 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 11852 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 11853 | /* Need to apply spin lock before decreasing active sessions |
| 11854 | * as there can be chance for double decrement if context switch |
| 11855 | * Calls hdd_DisConnectHandler. |
| 11856 | */ |
| 11857 | |
| 11858 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 11859 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 11860 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 11861 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 11862 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 11863 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 11864 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 11865 | |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 11866 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 11867 | FL( "Set HDD connState to eConnectionState_Disconnecting" )); |
| 11868 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11869 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11870 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 11871 | /* |
| 11872 | * stop tx queues before deleting STA/BSS context from the firmware. |
| 11873 | * tx has to be disabled because the firmware can get busy dropping |
| 11874 | * the tx frames after BSS/STA has been deleted and will not send |
| 11875 | * back a response resulting in WDI timeout |
| 11876 | */ |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 11877 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 11878 | netif_tx_disable(pAdapter->dev); |
| 11879 | netif_carrier_off(pAdapter->dev); |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11880 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 11881 | /*issue disconnect*/ |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11882 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11883 | pAdapter->sessionId, reason); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11884 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
| 11885 | { |
| 11886 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11887 | FL("status = %d, already disconnected"), |
| 11888 | (int)status ); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11889 | |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11890 | } |
| 11891 | else if ( 0 != status ) |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11892 | { |
| 11893 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11894 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11895 | __func__, (int)status ); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 11896 | result = -EINVAL; |
| 11897 | goto disconnected; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11898 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11899 | ret = wait_for_completion_interruptible_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11900 | &pAdapter->disconnect_comp_var, |
| 11901 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11902 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status )) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11903 | { |
| 11904 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 11905 | "%s: Failed to disconnect, timed out", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 11906 | result = -ETIMEDOUT; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 11907 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11908 | else if (ret == -ERESTARTSYS) |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 11909 | { |
| 11910 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11911 | "%s: Failed to disconnect, wait interrupted", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 11912 | result = -ERESTARTSYS; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11913 | } |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 11914 | disconnected: |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11915 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11916 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 11917 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 11918 | |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 11919 | return result; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11920 | } |
| 11921 | |
| 11922 | |
| 11923 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11924 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11925 | * This function is used to issue a disconnect request to SME |
| 11926 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11927 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11928 | struct net_device *dev, |
| 11929 | u16 reason |
| 11930 | ) |
| 11931 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11932 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11933 | tCsrRoamProfile *pRoamProfile = |
| 11934 | &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11935 | int status; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11936 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11937 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 11938 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 11939 | tANI_U8 staIdx; |
| 11940 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11941 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11942 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11943 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11944 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11945 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 11946 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11947 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 11948 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 11949 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11950 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11951 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 11952 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11953 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11954 | status = wlan_hdd_validate_context(pHddCtx); |
| 11955 | |
| 11956 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11957 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11958 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11959 | "%s: HDD context is not valid", __func__); |
| 11960 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11961 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11962 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11963 | if (NULL != pRoamProfile) |
| 11964 | { |
| 11965 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 11966 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 11967 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11968 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11969 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11970 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 11971 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11972 | switch(reason) |
| 11973 | { |
| 11974 | case WLAN_REASON_MIC_FAILURE: |
| 11975 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 11976 | break; |
| 11977 | |
| 11978 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 11979 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 11980 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 11981 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 11982 | break; |
| 11983 | |
| 11984 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 11985 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 11986 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11987 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 11988 | break; |
| 11989 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11990 | default: |
| 11991 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 11992 | break; |
| 11993 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 11994 | pScanInfo = &pHddCtx->scan_info; |
| 11995 | if (pScanInfo->mScanPending) |
| 11996 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 11997 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 11998 | "Aborting Scan"); |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 11999 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 12000 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12001 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12002 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12003 | #ifdef FEATURE_WLAN_TDLS |
| 12004 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12005 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12006 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12007 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 12008 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12009 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12010 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12011 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12012 | VOS_TRACE(VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12013 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12014 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12015 | MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12016 | sme_DeleteTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12017 | pAdapter->sessionId, |
| 12018 | mac); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12019 | } |
| 12020 | } |
| 12021 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 12022 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12023 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 12024 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12025 | { |
| 12026 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12027 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12028 | __func__, (int)status ); |
| 12029 | return -EINVAL; |
| 12030 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12031 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 12032 | else |
| 12033 | { |
| 12034 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 12035 | "called while in %d state", __func__, |
| 12036 | pHddStaCtx->conn_info.connState); |
| 12037 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12038 | } |
| 12039 | else |
| 12040 | { |
| 12041 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 12042 | } |
| 12043 | |
| 12044 | return status; |
| 12045 | } |
| 12046 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12047 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 12048 | struct net_device *dev, |
| 12049 | u16 reason |
| 12050 | ) |
| 12051 | { |
| 12052 | int ret; |
| 12053 | vos_ssr_protect(__func__); |
| 12054 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 12055 | vos_ssr_unprotect(__func__); |
| 12056 | |
| 12057 | return ret; |
| 12058 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12059 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12060 | /* |
| 12061 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12062 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12063 | * settings in IBSS mode. |
| 12064 | */ |
| 12065 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12066 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12067 | struct cfg80211_ibss_params *params |
| 12068 | ) |
| 12069 | { |
| 12070 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12071 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12072 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 12073 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12074 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12075 | ENTER(); |
| 12076 | |
| 12077 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 12078 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12079 | |
| 12080 | if (params->ie_len && ( NULL != params->ie) ) |
| 12081 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12082 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 12083 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12084 | { |
| 12085 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 12086 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 12087 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12088 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12089 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12090 | tDot11fIEWPA dot11WPAIE; |
| 12091 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12092 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12093 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 12094 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12095 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 12096 | params->ie_len, DOT11F_EID_WPA); |
| 12097 | if ( NULL != ie ) |
| 12098 | { |
| 12099 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 12100 | // Unpack the WPA IE |
| 12101 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 12102 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 12103 | &ie[2+4], |
| 12104 | ie[1] - 4, |
| 12105 | &dot11WPAIE); |
| 12106 | /*Extract the multicast cipher, the encType for unicast |
| 12107 | cipher for wpa-none is none*/ |
| 12108 | encryptionType = |
| 12109 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 12110 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12111 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12112 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12113 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 12114 | |
| 12115 | if (0 > status) |
| 12116 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12117 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12118 | __func__); |
| 12119 | return status; |
| 12120 | } |
| 12121 | } |
| 12122 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12123 | pWextState->roamProfile.AuthType.authType[0] = |
| 12124 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12125 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 12126 | |
| 12127 | if (params->privacy) |
| 12128 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12129 | /* Security enabled IBSS, At this time there is no information available |
| 12130 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12131 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12132 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12133 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12134 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12135 | *enable privacy bit in beacons */ |
| 12136 | |
| 12137 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 12138 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12139 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 12140 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12141 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 12142 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 12143 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12144 | return status; |
| 12145 | } |
| 12146 | |
| 12147 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12148 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12149 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12150 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12151 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12152 | struct net_device *dev, |
| 12153 | struct cfg80211_ibss_params *params |
| 12154 | ) |
| 12155 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12156 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12157 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12158 | tCsrRoamProfile *pRoamProfile; |
| 12159 | int status; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12160 | bool alloc_bssid = VOS_FALSE; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12161 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12162 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12163 | |
| 12164 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12165 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12166 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12167 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 12168 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12169 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12170 | "%s: device_mode = %s (%d)", __func__, |
| 12171 | hdd_device_modetoString(pAdapter->device_mode), |
| 12172 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12173 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12174 | status = wlan_hdd_validate_context(pHddCtx); |
| 12175 | |
| 12176 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12177 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12178 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12179 | "%s: HDD context is not valid", __func__); |
| 12180 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12181 | } |
| 12182 | |
| 12183 | if (NULL == pWextState) |
| 12184 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12185 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12186 | __func__); |
| 12187 | return -EIO; |
| 12188 | } |
| 12189 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12190 | if (vos_max_concurrent_connections_reached()) { |
| 12191 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 12192 | return -ECONNREFUSED; |
| 12193 | } |
| 12194 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12195 | /*Try disconnecting if already in connected state*/ |
| 12196 | status = wlan_hdd_try_disconnect(pAdapter); |
| 12197 | if ( 0 > status) |
| 12198 | { |
| 12199 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 12200 | " IBSS connection")); |
| 12201 | return -EALREADY; |
| 12202 | } |
| 12203 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12204 | pRoamProfile = &pWextState->roamProfile; |
| 12205 | |
| 12206 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 12207 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12208 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12209 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12210 | return -EINVAL; |
| 12211 | } |
| 12212 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12213 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 12214 | if (NULL != params->bssid) { |
| 12215 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 12216 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 12217 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12218 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 12219 | return -EIO; |
| 12220 | } |
| 12221 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12222 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 12223 | { |
| 12224 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 12225 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 12226 | { |
| 12227 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12228 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 12229 | return -EIO; |
| 12230 | } |
| 12231 | params->bssid = vos_mem_malloc(sizeof(VOS_MAC_ADDR_SIZE)); |
| 12232 | if (!params->bssid) |
| 12233 | { |
| 12234 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12235 | "%s:Failed memory allocation", __func__); |
| 12236 | return -EIO; |
| 12237 | } |
| 12238 | vos_mem_copy((v_U8_t *)params->bssid, |
| 12239 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
| 12240 | VOS_MAC_ADDR_SIZE); |
| 12241 | alloc_bssid = VOS_TRUE; |
| 12242 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12243 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12244 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12245 | if (NULL != |
| 12246 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 12247 | params->chandef.chan) |
| 12248 | #else |
| 12249 | params->channel) |
| 12250 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12251 | { |
| 12252 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12253 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 12254 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 12255 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12256 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12257 | |
| 12258 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12259 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12260 | ieee80211_frequency_to_channel( |
| 12261 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 12262 | params->chandef.chan->center_freq); |
| 12263 | #else |
| 12264 | params->channel->center_freq); |
| 12265 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12266 | |
| 12267 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 12268 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12269 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12270 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 12271 | __func__); |
| 12272 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12273 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12274 | |
| 12275 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12276 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12277 | if (channelNum == validChan[indx]) |
| 12278 | { |
| 12279 | break; |
| 12280 | } |
| 12281 | } |
| 12282 | if (indx >= numChans) |
| 12283 | { |
| 12284 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12285 | __func__, channelNum); |
| 12286 | return -EINVAL; |
| 12287 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12288 | /* Set the Operational Channel */ |
| 12289 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 12290 | channelNum); |
| 12291 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 12292 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 12293 | pRoamProfile->ChannelInfo.ChannelList = |
| 12294 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12295 | } |
| 12296 | |
| 12297 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12298 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12299 | if (status < 0) |
| 12300 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12301 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12302 | __func__); |
| 12303 | return status; |
| 12304 | } |
| 12305 | |
| 12306 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12307 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12308 | params->ssid_len, params->bssid, |
| 12309 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12310 | |
| 12311 | if (0 > status) |
| 12312 | { |
| 12313 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 12314 | return status; |
| 12315 | } |
| 12316 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12317 | if (NULL != params->bssid && |
| 12318 | pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0 && |
| 12319 | alloc_bssid == VOS_TRUE) |
| 12320 | { |
| 12321 | vos_mem_free(params->bssid); |
| 12322 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12323 | return 0; |
| 12324 | } |
| 12325 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12326 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 12327 | struct net_device *dev, |
| 12328 | struct cfg80211_ibss_params *params |
| 12329 | ) |
| 12330 | { |
| 12331 | int ret = 0; |
| 12332 | |
| 12333 | vos_ssr_protect(__func__); |
| 12334 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 12335 | vos_ssr_unprotect(__func__); |
| 12336 | |
| 12337 | return ret; |
| 12338 | } |
| 12339 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12340 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12341 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12342 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12343 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12344 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12345 | struct net_device *dev |
| 12346 | ) |
| 12347 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12348 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12349 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12350 | tCsrRoamProfile *pRoamProfile; |
| 12351 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12352 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12353 | |
| 12354 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12355 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12356 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12357 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 12358 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12359 | status = wlan_hdd_validate_context(pHddCtx); |
| 12360 | |
| 12361 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12362 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12363 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12364 | "%s: HDD context is not valid", __func__); |
| 12365 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12366 | } |
| 12367 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12368 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 12369 | hdd_device_modetoString(pAdapter->device_mode), |
| 12370 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12371 | if (NULL == pWextState) |
| 12372 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12373 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12374 | __func__); |
| 12375 | return -EIO; |
| 12376 | } |
| 12377 | |
| 12378 | pRoamProfile = &pWextState->roamProfile; |
| 12379 | |
| 12380 | /* Issue disconnect only if interface type is set to IBSS */ |
| 12381 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 12382 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12383 | 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] | 12384 | __func__); |
| 12385 | return -EINVAL; |
| 12386 | } |
| 12387 | |
| 12388 | /* Issue Disconnect request */ |
| 12389 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 12390 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 12391 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 12392 | |
| 12393 | return 0; |
| 12394 | } |
| 12395 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12396 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 12397 | struct net_device *dev |
| 12398 | ) |
| 12399 | { |
| 12400 | int ret = 0; |
| 12401 | |
| 12402 | vos_ssr_protect(__func__); |
| 12403 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 12404 | vos_ssr_unprotect(__func__); |
| 12405 | |
| 12406 | return ret; |
| 12407 | } |
| 12408 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12409 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12410 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12411 | * This function is used to set the phy parameters |
| 12412 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 12413 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12414 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12415 | u32 changed) |
| 12416 | { |
| 12417 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 12418 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12419 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12420 | |
| 12421 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12422 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12423 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 12424 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12425 | status = wlan_hdd_validate_context(pHddCtx); |
| 12426 | |
| 12427 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12428 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12429 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12430 | "%s: HDD context is not valid", __func__); |
| 12431 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12432 | } |
| 12433 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12434 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 12435 | { |
| 12436 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 12437 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 12438 | wiphy->rts_threshold; |
| 12439 | |
| 12440 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12441 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12442 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12443 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12444 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12445 | __func__, rts_threshold); |
| 12446 | return -EINVAL; |
| 12447 | } |
| 12448 | |
| 12449 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 12450 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12451 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12452 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12453 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12454 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12455 | __func__, rts_threshold); |
| 12456 | return -EIO; |
| 12457 | } |
| 12458 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12459 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12460 | rts_threshold); |
| 12461 | } |
| 12462 | |
| 12463 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 12464 | { |
| 12465 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 12466 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 12467 | wiphy->frag_threshold; |
| 12468 | |
| 12469 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12470 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12471 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12472 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12473 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12474 | frag_threshold); |
| 12475 | return -EINVAL; |
| 12476 | } |
| 12477 | |
| 12478 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 12479 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12480 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12481 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12482 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12483 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12484 | __func__, frag_threshold); |
| 12485 | return -EIO; |
| 12486 | } |
| 12487 | |
| 12488 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 12489 | frag_threshold); |
| 12490 | } |
| 12491 | |
| 12492 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 12493 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 12494 | { |
| 12495 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 12496 | wiphy->retry_short : |
| 12497 | wiphy->retry_long; |
| 12498 | |
| 12499 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 12500 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 12501 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12502 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12503 | __func__, retry_value); |
| 12504 | return -EINVAL; |
| 12505 | } |
| 12506 | |
| 12507 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 12508 | { |
| 12509 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 12510 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12511 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12512 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12513 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12514 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12515 | __func__, retry_value); |
| 12516 | return -EIO; |
| 12517 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12518 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12519 | __func__, retry_value); |
| 12520 | } |
| 12521 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 12522 | { |
| 12523 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 12524 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12525 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12526 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12527 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12528 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12529 | __func__, retry_value); |
| 12530 | return -EIO; |
| 12531 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12532 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12533 | __func__, retry_value); |
| 12534 | } |
| 12535 | } |
| 12536 | |
| 12537 | return 0; |
| 12538 | } |
| 12539 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12540 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 12541 | u32 changed) |
| 12542 | { |
| 12543 | int ret; |
| 12544 | |
| 12545 | vos_ssr_protect(__func__); |
| 12546 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 12547 | vos_ssr_unprotect(__func__); |
| 12548 | |
| 12549 | return ret; |
| 12550 | } |
| 12551 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12552 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12553 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12554 | * This function is used to set the txpower |
| 12555 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12556 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12557 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12558 | struct wireless_dev *wdev, |
| 12559 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12560 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12561 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12562 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12563 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12564 | #endif |
| 12565 | int dbm) |
| 12566 | { |
| 12567 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12568 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12569 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 12570 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12571 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12572 | |
| 12573 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12574 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12575 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 12576 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12577 | status = wlan_hdd_validate_context(pHddCtx); |
| 12578 | |
| 12579 | if (0 != status) |
| 12580 | { |
| 12581 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12582 | "%s: HDD context is not valid", __func__); |
| 12583 | return status; |
| 12584 | } |
| 12585 | |
| 12586 | hHal = pHddCtx->hHal; |
| 12587 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12588 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 12589 | dbm, ccmCfgSetCallback, |
| 12590 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12591 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12592 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12593 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 12594 | return -EIO; |
| 12595 | } |
| 12596 | |
| 12597 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 12598 | dbm); |
| 12599 | |
| 12600 | switch(type) |
| 12601 | { |
| 12602 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 12603 | /* Fall through */ |
| 12604 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 12605 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 12606 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12607 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 12608 | __func__); |
| 12609 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12610 | } |
| 12611 | break; |
| 12612 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12613 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12614 | __func__); |
| 12615 | return -EOPNOTSUPP; |
| 12616 | break; |
| 12617 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12618 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 12619 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12620 | return -EIO; |
| 12621 | } |
| 12622 | |
| 12623 | return 0; |
| 12624 | } |
| 12625 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12626 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 12627 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12628 | struct wireless_dev *wdev, |
| 12629 | #endif |
| 12630 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 12631 | enum tx_power_setting type, |
| 12632 | #else |
| 12633 | enum nl80211_tx_power_setting type, |
| 12634 | #endif |
| 12635 | int dbm) |
| 12636 | { |
| 12637 | int ret; |
| 12638 | vos_ssr_protect(__func__); |
| 12639 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 12640 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12641 | wdev, |
| 12642 | #endif |
| 12643 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 12644 | type, |
| 12645 | #else |
| 12646 | type, |
| 12647 | #endif |
| 12648 | dbm); |
| 12649 | vos_ssr_unprotect(__func__); |
| 12650 | |
| 12651 | return ret; |
| 12652 | } |
| 12653 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12654 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12655 | * FUNCTION: __wlan_hdd_cfg80211_get_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12656 | * This function is used to read the txpower |
| 12657 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12658 | static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12659 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12660 | struct wireless_dev *wdev, |
| 12661 | #endif |
| 12662 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12663 | { |
| 12664 | |
| 12665 | hdd_adapter_t *pAdapter; |
| 12666 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12667 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12668 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12669 | ENTER(); |
| 12670 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12671 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12672 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12673 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12674 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12675 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12676 | "%s: HDD context is not valid", __func__); |
| 12677 | *dbm = 0; |
| 12678 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12679 | } |
| 12680 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12681 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 12682 | if (NULL == pAdapter) |
| 12683 | { |
| 12684 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 12685 | return -ENOENT; |
| 12686 | } |
| 12687 | |
| 12688 | wlan_hdd_get_classAstats(pAdapter); |
| 12689 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 12690 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12691 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12692 | return 0; |
| 12693 | } |
| 12694 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12695 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 12696 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12697 | struct wireless_dev *wdev, |
| 12698 | #endif |
| 12699 | int *dbm) |
| 12700 | { |
| 12701 | int ret; |
| 12702 | |
| 12703 | vos_ssr_protect(__func__); |
| 12704 | ret = __wlan_hdd_cfg80211_get_txpower(wiphy, |
| 12705 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12706 | wdev, |
| 12707 | #endif |
| 12708 | dbm); |
| 12709 | vos_ssr_unprotect(__func__); |
| 12710 | |
| 12711 | return ret; |
| 12712 | } |
| 12713 | |
| 12714 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12715 | 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] | 12716 | u8* mac, struct station_info *sinfo) |
| 12717 | { |
| 12718 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 12719 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12720 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 12721 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12722 | |
| 12723 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 12724 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12725 | |
| 12726 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 12727 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 12728 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 12729 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 12730 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 12731 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 12732 | tANI_U16 maxRate = 0; |
| 12733 | tANI_U16 myRate; |
| 12734 | tANI_U16 currentRate = 0; |
| 12735 | tANI_U8 maxSpeedMCS = 0; |
| 12736 | tANI_U8 maxMCSIdx = 0; |
| 12737 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12738 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 12739 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12740 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12741 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12742 | #ifdef WLAN_FEATURE_11AC |
| 12743 | tANI_U32 vht_mcs_map; |
| 12744 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 12745 | #endif /* WLAN_FEATURE_11AC */ |
| 12746 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12747 | ENTER(); |
| 12748 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12749 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 12750 | (0 == ssidlen)) |
| 12751 | { |
| 12752 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 12753 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 12754 | /*To keep GUI happy*/ |
| 12755 | return 0; |
| 12756 | } |
| 12757 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 12758 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 12759 | { |
| 12760 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12761 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 12762 | return 0; |
| 12763 | } |
| 12764 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12765 | status = wlan_hdd_validate_context(pHddCtx); |
| 12766 | |
| 12767 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12768 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12769 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12770 | "%s: HDD context is not valid", __func__); |
| 12771 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12772 | } |
| 12773 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12774 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 12775 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 12776 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 12777 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 12778 | wlan_hdd_get_station_stats(pAdapter); |
| 12779 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
| 12780 | |
| 12781 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 12782 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 12783 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12784 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 12785 | { |
| 12786 | rate_flags = pAdapter->maxRateFlags; |
| 12787 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 12788 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12789 | //convert to the UI units of 100kbps |
| 12790 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 12791 | |
| 12792 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12793 | 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] | 12794 | sinfo->signal, |
| 12795 | pCfg->reportMaxLinkSpeed, |
| 12796 | myRate, |
| 12797 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 12798 | (int) pCfg->linkSpeedRssiMid, |
| 12799 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12800 | (int) rate_flags, |
| 12801 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12802 | #endif //LINKSPEED_DEBUG_ENABLED |
| 12803 | |
| 12804 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 12805 | { |
| 12806 | // we do not want to necessarily report the current speed |
| 12807 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 12808 | { |
| 12809 | // report the max possible speed |
| 12810 | rssidx = 0; |
| 12811 | } |
| 12812 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 12813 | { |
| 12814 | // report the max possible speed with RSSI scaling |
| 12815 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 12816 | { |
| 12817 | // report the max possible speed |
| 12818 | rssidx = 0; |
| 12819 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 12820 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12821 | { |
| 12822 | // report middle speed |
| 12823 | rssidx = 1; |
| 12824 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 12825 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 12826 | { |
| 12827 | // report middle speed |
| 12828 | rssidx = 2; |
| 12829 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12830 | else |
| 12831 | { |
| 12832 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 12833 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12834 | } |
| 12835 | } |
| 12836 | else |
| 12837 | { |
| 12838 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 12839 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12840 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 12841 | __func__, pCfg->reportMaxLinkSpeed); |
| 12842 | rssidx = 0; |
| 12843 | } |
| 12844 | |
| 12845 | maxRate = 0; |
| 12846 | |
| 12847 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 12848 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 12849 | OperationalRates, &ORLeng)) |
| 12850 | { |
| 12851 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 12852 | /*To keep GUI happy*/ |
| 12853 | return 0; |
| 12854 | } |
| 12855 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12856 | for (i = 0; i < ORLeng; i++) |
| 12857 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12858 | 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] | 12859 | { |
| 12860 | /* Validate Rate Set */ |
| 12861 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 12862 | { |
| 12863 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 12864 | break; |
| 12865 | } |
| 12866 | } |
| 12867 | /* Update MAX rate */ |
| 12868 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 12869 | } |
| 12870 | |
| 12871 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 12872 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 12873 | ExtendedRates, &ERLeng)) |
| 12874 | { |
| 12875 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 12876 | /*To keep GUI happy*/ |
| 12877 | return 0; |
| 12878 | } |
| 12879 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12880 | for (i = 0; i < ERLeng; i++) |
| 12881 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12882 | 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] | 12883 | { |
| 12884 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 12885 | { |
| 12886 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 12887 | break; |
| 12888 | } |
| 12889 | } |
| 12890 | /* Update MAX rate */ |
| 12891 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 12892 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12893 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 12894 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 12895 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 12896 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12897 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12898 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12899 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 12900 | mode = 2; |
| 12901 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 12902 | mode = 1; |
| 12903 | else |
| 12904 | mode = 0; |
| 12905 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 12906 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 12907 | MCSRates, &MCSLeng)) |
| 12908 | { |
| 12909 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 12910 | /*To keep GUI happy*/ |
| 12911 | return 0; |
| 12912 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12913 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12914 | #ifdef WLAN_FEATURE_11AC |
| 12915 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12916 | 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] | 12917 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12918 | 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] | 12919 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12920 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12921 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12922 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12923 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12924 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12925 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12926 | maxMCSIdx = 7; |
| 12927 | } |
| 12928 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 12929 | { |
| 12930 | maxMCSIdx = 8; |
| 12931 | } |
| 12932 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 12933 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12934 | //VHT20 is supporting 0~8 |
| 12935 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 12936 | maxMCSIdx = 8; |
| 12937 | else |
| 12938 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12939 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12940 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12941 | if (0 != rssidx)/*check for scaled */ |
| 12942 | { |
| 12943 | //get middle rate MCS index if rssi=1/2 |
| 12944 | for (i=0; i <= maxMCSIdx; i++) |
| 12945 | { |
| 12946 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 12947 | { |
| 12948 | maxMCSIdx = i; |
| 12949 | break; |
| 12950 | } |
| 12951 | } |
| 12952 | } |
| 12953 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12954 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 12955 | { |
| 12956 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 12957 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 12958 | } |
| 12959 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 12960 | { |
| 12961 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 12962 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 12963 | } |
| 12964 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 12965 | { |
| 12966 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 12967 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 12968 | } |
| 12969 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12970 | maxSpeedMCS = 1; |
| 12971 | if (currentRate > maxRate) |
| 12972 | { |
| 12973 | maxRate = currentRate; |
| 12974 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 12975 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12976 | } |
| 12977 | else |
| 12978 | #endif /* WLAN_FEATURE_11AC */ |
| 12979 | { |
| 12980 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 12981 | { |
| 12982 | rateFlag |= 1; |
| 12983 | } |
| 12984 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 12985 | { |
| 12986 | rateFlag |= 2; |
| 12987 | } |
| 12988 | |
Girish Gowli | 01abcee | 2014-07-31 20:18:55 +0530 | [diff] [blame] | 12989 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12990 | if (rssidx == 1 || rssidx == 2) |
| 12991 | { |
| 12992 | //get middle rate MCS index if rssi=1/2 |
| 12993 | for (i=0; i <= 7; i++) |
| 12994 | { |
| 12995 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 12996 | { |
| 12997 | temp = i+1; |
| 12998 | break; |
| 12999 | } |
| 13000 | } |
| 13001 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13002 | |
| 13003 | for (i = 0; i < MCSLeng; i++) |
| 13004 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13005 | for (j = 0; j < temp; j++) |
| 13006 | { |
| 13007 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 13008 | { |
| 13009 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
| 13010 | break; |
| 13011 | } |
| 13012 | } |
| 13013 | if ((j < temp) && (currentRate > maxRate)) |
| 13014 | { |
| 13015 | maxRate = currentRate; |
| 13016 | maxSpeedMCS = 1; |
| 13017 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
| 13018 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13019 | } |
| 13020 | } |
| 13021 | } |
| 13022 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13023 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 13024 | { |
| 13025 | maxRate = myRate; |
| 13026 | maxSpeedMCS = 1; |
| 13027 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 13028 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13029 | // 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] | 13030 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13031 | { |
| 13032 | maxRate = myRate; |
| 13033 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 13034 | { |
| 13035 | maxSpeedMCS = 0; |
| 13036 | } |
| 13037 | else |
| 13038 | { |
| 13039 | maxSpeedMCS = 1; |
| 13040 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 13041 | } |
| 13042 | } |
| 13043 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13044 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13045 | { |
| 13046 | sinfo->txrate.legacy = maxRate; |
| 13047 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13048 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 13049 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13050 | } |
| 13051 | else |
| 13052 | { |
| 13053 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13054 | #ifdef WLAN_FEATURE_11AC |
| 13055 | sinfo->txrate.nss = 1; |
| 13056 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13057 | { |
| 13058 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13059 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13060 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13061 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13062 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13063 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13064 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13065 | } |
| 13066 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13067 | { |
| 13068 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13069 | } |
| 13070 | #endif /* WLAN_FEATURE_11AC */ |
| 13071 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 13072 | { |
| 13073 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 13074 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13075 | { |
| 13076 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13077 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13078 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13079 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13080 | { |
| 13081 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 13082 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13083 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13084 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13085 | pr_info("Reporting MCS rate %d flags %x\n", |
| 13086 | sinfo->txrate.mcs, |
| 13087 | sinfo->txrate.flags ); |
| 13088 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13089 | } |
| 13090 | } |
| 13091 | else |
| 13092 | { |
| 13093 | // report current rate instead of max rate |
| 13094 | |
| 13095 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 13096 | { |
| 13097 | //provide to the UI in units of 100kbps |
| 13098 | sinfo->txrate.legacy = myRate; |
| 13099 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13100 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 13101 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13102 | } |
| 13103 | else |
| 13104 | { |
| 13105 | //must be MCS |
| 13106 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13107 | #ifdef WLAN_FEATURE_11AC |
| 13108 | sinfo->txrate.nss = 1; |
| 13109 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13110 | { |
| 13111 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13112 | } |
| 13113 | else |
| 13114 | #endif /* WLAN_FEATURE_11AC */ |
| 13115 | { |
| 13116 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 13117 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13118 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13119 | { |
| 13120 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 13121 | } |
| 13122 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13123 | { |
| 13124 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13125 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13126 | #ifdef WLAN_FEATURE_11AC |
| 13127 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13128 | { |
| 13129 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 13130 | } |
| 13131 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13132 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13133 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 13134 | sinfo->txrate.mcs, |
| 13135 | sinfo->txrate.flags ); |
| 13136 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13137 | } |
| 13138 | } |
| 13139 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 13140 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 13141 | sinfo->tx_packets = |
| 13142 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 13143 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 13144 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 13145 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 13146 | |
| 13147 | sinfo->tx_retries = |
| 13148 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 13149 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 13150 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 13151 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 13152 | |
| 13153 | sinfo->tx_failed = |
| 13154 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 13155 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 13156 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 13157 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 13158 | |
| 13159 | sinfo->filled |= |
| 13160 | STATION_INFO_TX_PACKETS | |
| 13161 | STATION_INFO_TX_RETRIES | |
| 13162 | STATION_INFO_TX_FAILED; |
| 13163 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13164 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13165 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 13166 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 13167 | EXIT(); |
| 13168 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13169 | } |
| 13170 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13171 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 13172 | u8* mac, struct station_info *sinfo) |
| 13173 | { |
| 13174 | int ret; |
| 13175 | |
| 13176 | vos_ssr_protect(__func__); |
| 13177 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 13178 | vos_ssr_unprotect(__func__); |
| 13179 | |
| 13180 | return ret; |
| 13181 | } |
| 13182 | |
| 13183 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 13184 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13185 | { |
| 13186 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13187 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13188 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13189 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13190 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13191 | ENTER(); |
| 13192 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13193 | if (NULL == pAdapter) |
| 13194 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13195 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13196 | return -ENODEV; |
| 13197 | } |
| 13198 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13199 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13200 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 13201 | pAdapter->sessionId, timeout)); |
| 13202 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13203 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13204 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13205 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13206 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13207 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13208 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13209 | "%s: HDD context is not valid", __func__); |
| 13210 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13211 | } |
| 13212 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13213 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 13214 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 13215 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 13216 | (eConnectionState_Associated == |
| 13217 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 13218 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 13219 | |
| 13220 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13221 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 13222 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13223 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13224 | { |
| 13225 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13226 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13227 | __func__, vos_status); |
| 13228 | } |
| 13229 | } |
| 13230 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13231 | /**The get power cmd from the supplicant gets updated by the nl only |
| 13232 | *on successful execution of the function call |
| 13233 | *we are oppositely mapped w.r.t mode in the driver |
| 13234 | **/ |
| 13235 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 13236 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13237 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13238 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 13239 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13240 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13241 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13242 | return -EINVAL; |
| 13243 | } |
| 13244 | return 0; |
| 13245 | } |
| 13246 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13247 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 13248 | struct net_device *dev, bool mode, int timeout) |
| 13249 | { |
| 13250 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13251 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13252 | vos_ssr_protect(__func__); |
| 13253 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 13254 | vos_ssr_unprotect(__func__); |
| 13255 | |
| 13256 | return ret; |
| 13257 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13258 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13259 | static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 13260 | struct net_device *netdev, |
| 13261 | u8 key_index) |
| 13262 | { |
| 13263 | ENTER(); |
| 13264 | return 0; |
| 13265 | } |
| 13266 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13267 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13268 | struct net_device *netdev, |
| 13269 | u8 key_index) |
| 13270 | { |
| 13271 | int ret; |
| 13272 | vos_ssr_protect(__func__); |
| 13273 | ret = __wlan_hdd_set_default_mgmt_key(wiphy, netdev, key_index); |
| 13274 | vos_ssr_unprotect(__func__); |
| 13275 | return ret; |
| 13276 | } |
| 13277 | #endif //LINUX_VERSION_CODE |
| 13278 | |
| 13279 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 13280 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13281 | struct net_device *dev, |
| 13282 | struct ieee80211_txq_params *params) |
| 13283 | { |
| 13284 | ENTER(); |
| 13285 | return 0; |
| 13286 | } |
| 13287 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13288 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13289 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13290 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13291 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13292 | return 0; |
| 13293 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13294 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13295 | |
| 13296 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 13297 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13298 | struct net_device *dev, |
| 13299 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13300 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13301 | int ret; |
| 13302 | |
| 13303 | vos_ssr_protect(__func__); |
| 13304 | ret = __wlan_hdd_set_txq_params(wiphy, dev, params); |
| 13305 | vos_ssr_unprotect(__func__); |
| 13306 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13307 | } |
| 13308 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13309 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13310 | struct ieee80211_txq_params *params) |
| 13311 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13312 | int ret; |
| 13313 | |
| 13314 | vos_ssr_protect(__func__); |
| 13315 | ret = __wlan_hdd_set_txq_params(wiphy, params); |
| 13316 | vos_ssr_unprotect(__func__); |
| 13317 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13318 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13319 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13320 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13321 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13322 | struct net_device *dev, |
| 13323 | struct tagCsrDelStaParams *pDelStaParams) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13324 | { |
| 13325 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13326 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13327 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13328 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13329 | v_U8_t staId; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13330 | v_CONTEXT_t pVosContext = NULL; |
| 13331 | ptSapContext pSapCtx = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13332 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13333 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13334 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13335 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13336 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13337 | return -EINVAL; |
| 13338 | } |
| 13339 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13340 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13341 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 13342 | pAdapter->sessionId, pAdapter->device_mode)); |
| 13343 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13344 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13345 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13346 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13347 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13348 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13349 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13350 | "%s: HDD context is not valid", __func__); |
| 13351 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13352 | } |
| 13353 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13354 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13355 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13356 | ) |
| 13357 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13358 | pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 13359 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 13360 | if(pSapCtx == NULL){ |
| 13361 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13362 | FL("psapCtx is NULL")); |
| 13363 | return -ENOENT; |
| 13364 | } |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13365 | if (vos_is_macaddr_broadcast((v_MACADDR_t *)pDelStaParams->peerMacAddr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13366 | { |
| 13367 | v_U16_t i; |
| 13368 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 13369 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13370 | if ((pSapCtx->aStaInfo[i].isUsed) && |
| 13371 | (!pSapCtx->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13372 | { |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13373 | vos_mem_copy(pDelStaParams->peerMacAddr, |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13374 | pSapCtx->aStaInfo[i].macAddrSTA.bytes, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13375 | ETHER_ADDR_LEN); |
| 13376 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13377 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13378 | "%s: Delete STA with MAC::" |
| 13379 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13380 | __func__, |
| 13381 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
| 13382 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 13383 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13384 | pSapCtx->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13385 | } |
| 13386 | } |
| 13387 | } |
| 13388 | else |
| 13389 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13390 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13391 | vos_status = hdd_softap_GetStaId(pAdapter, |
| 13392 | (v_MACADDR_t *)pDelStaParams->peerMacAddr, &staId); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13393 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13394 | { |
| 13395 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13396 | "%s: Skip this DEL STA as this is not used::" |
| 13397 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13398 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13399 | return -ENOENT; |
| 13400 | } |
| 13401 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13402 | if( pSapCtx->aStaInfo[staId].isDeauthInProgress == TRUE) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13403 | { |
| 13404 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13405 | "%s: Skip this DEL STA as deauth is in progress::" |
| 13406 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13407 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13408 | return -ENOENT; |
| 13409 | } |
| 13410 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13411 | pSapCtx->aStaInfo[staId].isDeauthInProgress = TRUE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13412 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13413 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13414 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13415 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13416 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13417 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13418 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13419 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13420 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13421 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13422 | pSapCtx->aStaInfo[staId].isDeauthInProgress = FALSE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13423 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13424 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13425 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13426 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13427 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13428 | return -ENOENT; |
| 13429 | } |
| 13430 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13431 | } |
| 13432 | } |
| 13433 | |
| 13434 | EXIT(); |
| 13435 | |
| 13436 | return 0; |
| 13437 | } |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13438 | |
| 13439 | #ifdef CFG80211_DEL_STA_V2 |
| 13440 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 13441 | struct net_device *dev, |
| 13442 | struct station_del_parameters *param) |
| 13443 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13444 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 13445 | struct net_device *dev, u8 *mac) |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13446 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13447 | { |
| 13448 | int ret; |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13449 | struct tagCsrDelStaParams delStaParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13450 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13451 | vos_ssr_protect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13452 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13453 | #ifdef CFG80211_DEL_STA_V2 |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13454 | if (NULL == param) { |
| 13455 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid argumet passed", __func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13456 | vos_ssr_unprotect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13457 | return -EINVAL; |
| 13458 | } |
| 13459 | |
| 13460 | WLANSAP_PopulateDelStaParams(param->mac, param->reason_code, |
| 13461 | param->subtype, &delStaParams); |
| 13462 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13463 | #else |
Sushant Kaushik | 4cd28f6 | 2014-12-26 14:23:50 +0530 | [diff] [blame] | 13464 | WLANSAP_PopulateDelStaParams(mac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13465 | (SIR_MAC_MGMT_DEAUTH >> 4), &delStaParams); |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13466 | #endif |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13467 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, &delStaParams); |
| 13468 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13469 | vos_ssr_unprotect(__func__); |
| 13470 | |
| 13471 | return ret; |
| 13472 | } |
| 13473 | |
| 13474 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13475 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 13476 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13477 | hdd_adapter_t *pAdapter; |
| 13478 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13479 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13480 | #ifdef FEATURE_WLAN_TDLS |
| 13481 | u32 mask, set; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13482 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13483 | ENTER(); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13484 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13485 | if (NULL == pAdapter) |
| 13486 | { |
| 13487 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13488 | "%s: Adapter is NULL",__func__); |
| 13489 | return -EINVAL; |
| 13490 | } |
| 13491 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13492 | status = wlan_hdd_validate_context(pHddCtx); |
| 13493 | if (0 != status) |
| 13494 | { |
| 13495 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13496 | "%s: HDD context is not valid",__func__); |
| 13497 | return status; |
| 13498 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13499 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13500 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13501 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 13502 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13503 | mask = params->sta_flags_mask; |
| 13504 | |
| 13505 | set = params->sta_flags_set; |
| 13506 | |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13507 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 13508 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13509 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 13510 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
| 13511 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13512 | |
| 13513 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 13514 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13515 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13516 | } |
| 13517 | } |
| 13518 | #endif |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13519 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13520 | } |
| 13521 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13522 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 13523 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 13524 | { |
| 13525 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13526 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13527 | vos_ssr_protect(__func__); |
| 13528 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 13529 | vos_ssr_unprotect(__func__); |
| 13530 | |
| 13531 | return ret; |
| 13532 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13533 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13534 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13535 | 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] | 13536 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13537 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13538 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13539 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13540 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13541 | int status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13542 | hdd_context_t *pHddCtx; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13543 | tPmkidCacheInfo pmk_id; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13544 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13545 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13546 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13547 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13548 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13549 | return -EINVAL; |
| 13550 | } |
| 13551 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13552 | if (!pmksa) { |
| 13553 | hddLog(LOGE, FL("pmksa is NULL")); |
| 13554 | return -EINVAL; |
| 13555 | } |
| 13556 | |
| 13557 | if (!pmksa->bssid || !pmksa->pmkid) { |
| 13558 | hddLog(LOGE, FL("pmksa->bssid(%p) or pmksa->pmkid(%p) is NULL"), |
| 13559 | pmksa->bssid, pmksa->pmkid); |
| 13560 | return -EINVAL; |
| 13561 | } |
| 13562 | |
| 13563 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 13564 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13565 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13566 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13567 | status = wlan_hdd_validate_context(pHddCtx); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13568 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13569 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13570 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13571 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13572 | "%s: HDD context is not valid", __func__); |
| 13573 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13574 | } |
| 13575 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13576 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13577 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13578 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13579 | vos_mem_copy(pmk_id.BSSID, pmksa->bssid, ETHER_ADDR_LEN); |
| 13580 | vos_mem_copy(pmk_id.PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13581 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13582 | /* Add to the PMKSA ID Cache in CSR */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13583 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13584 | &pmk_id, 1, FALSE); |
| 13585 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13586 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13587 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 13588 | pAdapter->sessionId, result)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13589 | |
| 13590 | return HAL_STATUS_SUCCESS(result) ? 0 : -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13591 | } |
| 13592 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13593 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 13594 | struct cfg80211_pmksa *pmksa) |
| 13595 | { |
| 13596 | int ret; |
| 13597 | |
| 13598 | vos_ssr_protect(__func__); |
| 13599 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 13600 | vos_ssr_unprotect(__func__); |
| 13601 | |
| 13602 | return ret; |
| 13603 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13604 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13605 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13606 | 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] | 13607 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13608 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13609 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13610 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13611 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13612 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13613 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13614 | /* Validate pAdapter */ |
| 13615 | if (NULL == pAdapter) |
| 13616 | { |
| 13617 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 13618 | return -EINVAL; |
| 13619 | } |
| 13620 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13621 | if (!pmksa) { |
| 13622 | hddLog(LOGE, FL("pmksa is NULL")); |
| 13623 | return -EINVAL; |
| 13624 | } |
| 13625 | |
| 13626 | if (!pmksa->bssid) { |
| 13627 | hddLog(LOGE, FL("pmksa->bssid is NULL")); |
| 13628 | return -EINVAL; |
| 13629 | } |
| 13630 | |
Kiet Lam | 98c46a1 | 2014-10-31 15:34:57 -0700 | [diff] [blame] | 13631 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 13632 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13633 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13634 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13635 | status = wlan_hdd_validate_context(pHddCtx); |
| 13636 | |
| 13637 | if (0 != status) |
| 13638 | { |
| 13639 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13640 | "%s: HDD context is not valid", __func__); |
| 13641 | return status; |
| 13642 | } |
| 13643 | |
| 13644 | /*Retrieve halHandle*/ |
| 13645 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13646 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13647 | /* Delete the PMKID CSR cache */ |
| 13648 | if (eHAL_STATUS_SUCCESS != |
| 13649 | sme_RoamDelPMKIDfromCache(halHandle, |
| 13650 | pAdapter->sessionId, pmksa->bssid, FALSE)) { |
| 13651 | hddLog(LOGE, FL("Failed to delete PMKSA for "MAC_ADDRESS_STR), |
| 13652 | MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13653 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13654 | } |
| 13655 | |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13656 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13657 | } |
| 13658 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13659 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13660 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 13661 | struct cfg80211_pmksa *pmksa) |
| 13662 | { |
| 13663 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13664 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13665 | vos_ssr_protect(__func__); |
| 13666 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 13667 | vos_ssr_unprotect(__func__); |
| 13668 | |
| 13669 | return ret; |
| 13670 | |
| 13671 | } |
| 13672 | |
| 13673 | 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] | 13674 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13675 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13676 | tHalHandle halHandle; |
| 13677 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13678 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13679 | |
| 13680 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: flushing PMKSA ",__func__); |
| 13681 | |
| 13682 | /* Validate pAdapter */ |
| 13683 | if (NULL == pAdapter) |
| 13684 | { |
| 13685 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13686 | "%s: Invalid Adapter" ,__func__); |
| 13687 | return -EINVAL; |
| 13688 | } |
| 13689 | |
| 13690 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13691 | status = wlan_hdd_validate_context(pHddCtx); |
| 13692 | |
| 13693 | if (0 != status) |
| 13694 | { |
| 13695 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13696 | "%s: HDD context is not valid", __func__); |
| 13697 | return status; |
| 13698 | } |
| 13699 | |
| 13700 | /*Retrieve halHandle*/ |
| 13701 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13702 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13703 | /* Flush the PMKID cache in CSR */ |
| 13704 | if (eHAL_STATUS_SUCCESS != |
| 13705 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, NULL, TRUE)) { |
| 13706 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Cannot flush PMKIDCache")); |
| 13707 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13708 | } |
| 13709 | |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13710 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13711 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13712 | |
| 13713 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 13714 | { |
| 13715 | int ret; |
| 13716 | |
| 13717 | vos_ssr_protect(__func__); |
| 13718 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 13719 | vos_ssr_unprotect(__func__); |
| 13720 | |
| 13721 | return ret; |
| 13722 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13723 | #endif |
| 13724 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13725 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13726 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 13727 | struct net_device *dev, |
| 13728 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13729 | { |
| 13730 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13731 | hdd_station_ctx_t *pHddStaCtx; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 13732 | hdd_context_t *pHddCtx; |
| 13733 | int ret = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13734 | |
| 13735 | if (NULL == pAdapter) |
| 13736 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13737 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13738 | return -ENODEV; |
| 13739 | } |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 13740 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13741 | ret = wlan_hdd_validate_context(pHddCtx); |
| 13742 | if (0 != ret) |
| 13743 | { |
| 13744 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13745 | "%s: HDD context is not valid", __func__); |
| 13746 | return ret; |
| 13747 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13748 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13749 | if (NULL == pHddStaCtx) |
| 13750 | { |
| 13751 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: STA Context is NULL", __func__); |
| 13752 | return -EINVAL; |
| 13753 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13754 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13755 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13756 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 13757 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13758 | // Added for debug on reception of Re-assoc Req. |
| 13759 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 13760 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13761 | 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] | 13762 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13763 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13764 | } |
| 13765 | |
| 13766 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13767 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13768 | ftie->ie_len); |
| 13769 | #endif |
| 13770 | |
| 13771 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 13772 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 13773 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13774 | ftie->ie_len); |
| 13775 | return 0; |
| 13776 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13777 | |
| 13778 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 13779 | struct net_device *dev, |
| 13780 | struct cfg80211_update_ft_ies_params *ftie) |
| 13781 | { |
| 13782 | int ret; |
| 13783 | |
| 13784 | vos_ssr_protect(__func__); |
| 13785 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 13786 | vos_ssr_unprotect(__func__); |
| 13787 | |
| 13788 | return ret; |
| 13789 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13790 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13791 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13792 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 13793 | |
| 13794 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 13795 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 13796 | { |
| 13797 | int ret; |
| 13798 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 13799 | hdd_context_t *pHddCtx; |
| 13800 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13801 | ENTER(); |
| 13802 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13803 | if (NULL == pAdapter) |
| 13804 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 13805 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13806 | "%s: HDD adapter is Null", __func__); |
| 13807 | return ; |
| 13808 | } |
| 13809 | |
| 13810 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13811 | if (NULL == pHddCtx) |
| 13812 | { |
| 13813 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13814 | "%s: HDD context is Null!!!", __func__); |
| 13815 | return ; |
| 13816 | } |
| 13817 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13818 | spin_lock(&pHddCtx->schedScan_lock); |
| 13819 | if (TRUE == pHddCtx->isWiphySuspended) |
| 13820 | { |
| 13821 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 13822 | spin_unlock(&pHddCtx->schedScan_lock); |
| 13823 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13824 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 13825 | return ; |
| 13826 | } |
| 13827 | spin_unlock(&pHddCtx->schedScan_lock); |
| 13828 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13829 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 13830 | |
| 13831 | if (0 > ret) |
| 13832 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 13833 | |
| 13834 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13835 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13836 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13837 | } |
| 13838 | |
| 13839 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13840 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 13841 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13842 | */ |
| 13843 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 13844 | { |
| 13845 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 13846 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13847 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13848 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13849 | int status = 0; |
| 13850 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 13851 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 13852 | /* The current firmware design does not allow PNO during any |
| 13853 | * active sessions. Hence, determine the active sessions |
| 13854 | * and return a failure. |
| 13855 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13856 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 13857 | { |
| 13858 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13859 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13860 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13861 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 13862 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 13863 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 13864 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 13865 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
Siddharth Bhal | 63a19a7 | 2014-11-07 14:31:56 +0530 | [diff] [blame] | 13866 | || (WLAN_HDD_TM_LEVEL_4 == pHddCtx->tmInfo.currentTmLevel) |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13867 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13868 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13869 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13870 | } |
| 13871 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 13872 | pAdapterNode = pNext; |
| 13873 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13874 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13875 | } |
| 13876 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13877 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 13878 | { |
| 13879 | hdd_adapter_t *pAdapter = callbackContext; |
| 13880 | hdd_context_t *pHddCtx; |
| 13881 | |
| 13882 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 13883 | { |
| 13884 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13885 | FL("Invalid adapter or adapter has invalid magic")); |
| 13886 | return; |
| 13887 | } |
| 13888 | |
| 13889 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13890 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 13891 | { |
| 13892 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13893 | FL("HDD context is not valid")); |
| 13894 | return; |
| 13895 | } |
| 13896 | |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 13897 | if (VOS_STATUS_SUCCESS != status) |
| 13898 | { |
| 13899 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13900 | FL("PNO enable response status = %d"), status); |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 13901 | pHddCtx->isPnoEnable = FALSE; |
| 13902 | } |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 13903 | |
| 13904 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 13905 | complete(&pAdapter->pno_comp_var); |
| 13906 | } |
| 13907 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13908 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 13909 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 13910 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13911 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 13912 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13913 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 13914 | { |
| 13915 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 13916 | tSirPNOScanReq pnoRequest = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13917 | hdd_context_t *pHddCtx; |
| 13918 | tHalHandle hHal; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 13919 | v_U32_t i, indx, num_ch, tempInterval, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 13920 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 13921 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13922 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 13923 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13924 | int ret = 0; |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 13925 | hdd_config_t *pConfig = NULL; |
| 13926 | v_U32_t num_ignore_dfs_ch = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13927 | |
| 13928 | if (NULL == pAdapter) |
| 13929 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13930 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13931 | "%s: HDD adapter is Null", __func__); |
| 13932 | return -ENODEV; |
| 13933 | } |
| 13934 | |
| 13935 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13936 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13937 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13938 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13939 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 13940 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13941 | "%s: HDD context is not valid", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13942 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13943 | } |
| 13944 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 13945 | pConfig = pHddCtx->cfg_ini; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13946 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13947 | if (NULL == hHal) |
| 13948 | { |
| 13949 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13950 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13951 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13952 | } |
Sushant Kaushik | 2fe8993 | 2014-09-03 10:58:09 +0530 | [diff] [blame] | 13953 | sme_ScanFlushResult(hHal, pAdapter->sessionId); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 13954 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 13955 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 13956 | { |
| 13957 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13958 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 13959 | return -EBUSY; |
| 13960 | } |
| 13961 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13962 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13963 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 13964 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13965 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13966 | return -EBUSY; |
| 13967 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13968 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 13969 | if (TRUE == pHddCtx->isPnoEnable) |
| 13970 | { |
| 13971 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 13972 | FL("already PNO is enabled")); |
| 13973 | return -EBUSY; |
| 13974 | } |
c_hpothu | 225aa7c | 2014-10-22 17:45:13 +0530 | [diff] [blame] | 13975 | |
| 13976 | if (VOS_STATUS_SUCCESS != wlan_hdd_cancel_remain_on_channel(pHddCtx)) |
| 13977 | { |
| 13978 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13979 | "%s: abort ROC failed ", __func__); |
| 13980 | return -EBUSY; |
| 13981 | } |
| 13982 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 13983 | pHddCtx->isPnoEnable = TRUE; |
| 13984 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 13985 | pnoRequest.enable = 1; /*Enable PNO */ |
| 13986 | pnoRequest.ucNetworksCount = request->n_match_sets; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13987 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 13988 | if (( !pnoRequest.ucNetworksCount ) || |
| 13989 | ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13990 | { |
| 13991 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 13992 | "%s: Network input is not correct %d Max Network supported is %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 13993 | __func__, pnoRequest.ucNetworksCount, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 13994 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 13995 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13996 | goto error; |
| 13997 | } |
| 13998 | |
| 13999 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 14000 | { |
| 14001 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14002 | "%s: Incorrect number of channels %d", |
| 14003 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14004 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14005 | goto error; |
| 14006 | } |
| 14007 | |
| 14008 | /* Framework provides one set of channels(all) |
| 14009 | * common for all saved profile */ |
| 14010 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 14011 | channels_allowed, &num_channels_allowed)) |
| 14012 | { |
| 14013 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14014 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14015 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14016 | goto error; |
| 14017 | } |
| 14018 | /* Checking each channel against allowed channel list */ |
| 14019 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14020 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14021 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14022 | char chList [(request->n_channels*5)+1]; |
| 14023 | int len; |
| 14024 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14025 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14026 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14027 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14028 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 14029 | { |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14030 | if ((!pConfig->enableDFSPnoChnlScan) && |
| 14031 | (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channels_allowed[indx]))) |
| 14032 | { |
| 14033 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14034 | "%s : Dropping DFS channel : %d", |
| 14035 | __func__,channels_allowed[indx]); |
| 14036 | num_ignore_dfs_ch++; |
| 14037 | break; |
| 14038 | } |
| 14039 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14040 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 14041 | len += snprintf(chList+len, 5, "%d ", |
| 14042 | request->channels[i]->hw_value); |
| 14043 | break ; |
| 14044 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14045 | } |
| 14046 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14047 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14048 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14049 | /*If all channels are DFS and dropped, then ignore the PNO request*/ |
| 14050 | if (num_ignore_dfs_ch == request->n_channels) |
| 14051 | { |
| 14052 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14053 | "%s : All requested channels are DFS channels", __func__); |
| 14054 | ret = -EINVAL; |
| 14055 | goto error; |
| 14056 | } |
| 14057 | } |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14058 | |
| 14059 | pnoRequest.aNetworks = |
| 14060 | vos_mem_malloc(sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14061 | if (pnoRequest.aNetworks == NULL) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14062 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14063 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14064 | FL("failed to allocate memory aNetworks %u"), |
| 14065 | (uint32)sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14066 | goto error; |
| 14067 | } |
| 14068 | vos_mem_zero(pnoRequest.aNetworks, |
| 14069 | sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14070 | |
| 14071 | /* Filling per profile params */ |
| 14072 | for (i = 0; i < pnoRequest.ucNetworksCount; i++) |
| 14073 | { |
| 14074 | pnoRequest.aNetworks[i].ssId.length = |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14075 | request->match_sets[i].ssid.ssid_len; |
| 14076 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14077 | if (( 0 == pnoRequest.aNetworks[i].ssId.length ) || |
| 14078 | ( pnoRequest.aNetworks[i].ssId.length > 32 ) ) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14079 | { |
| 14080 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14081 | "%s: SSID Len %d is not correct for network %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14082 | __func__, pnoRequest.aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14083 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14084 | goto error; |
| 14085 | } |
| 14086 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14087 | memcpy(pnoRequest.aNetworks[i].ssId.ssId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14088 | request->match_sets[i].ssid.ssid, |
| 14089 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14090 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14091 | "%s: SSID of network %d is %s ", __func__, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14092 | i, pnoRequest.aNetworks[i].ssId.ssId); |
| 14093 | pnoRequest.aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 14094 | pnoRequest.aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 14095 | pnoRequest.aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14096 | |
| 14097 | /*Copying list of valid channel into request */ |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14098 | memcpy(pnoRequest.aNetworks[i].aChannels, valid_ch, num_ch); |
| 14099 | pnoRequest.aNetworks[i].ucChannelCount = num_ch; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14100 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14101 | pnoRequest.aNetworks[i].rssiThreshold = 0; //Default value |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14102 | } |
| 14103 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14104 | for (i = 0; i < request->n_ssids; i++) |
| 14105 | { |
| 14106 | j = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14107 | while (j < pnoRequest.ucNetworksCount) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14108 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14109 | if ((pnoRequest.aNetworks[j].ssId.length == |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14110 | request->ssids[i].ssid_len) && |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14111 | (0 == memcmp(pnoRequest.aNetworks[j].ssId.ssId, |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14112 | request->ssids[i].ssid, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14113 | pnoRequest.aNetworks[j].ssId.length))) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14114 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14115 | pnoRequest.aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14116 | break; |
| 14117 | } |
| 14118 | j++; |
| 14119 | } |
| 14120 | } |
| 14121 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14122 | "Number of hidden networks being Configured = %d", |
| 14123 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14124 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 14125 | "request->ie_len = %zu", request->ie_len); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14126 | |
| 14127 | pnoRequest.p24GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 14128 | if (pnoRequest.p24GProbeTemplate == NULL) |
| 14129 | { |
| 14130 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14131 | FL("failed to allocate memory p24GProbeTemplate %u"), |
| 14132 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 14133 | goto error; |
| 14134 | } |
| 14135 | |
| 14136 | pnoRequest.p5GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 14137 | if (pnoRequest.p5GProbeTemplate == NULL) |
| 14138 | { |
| 14139 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14140 | FL("failed to allocate memory p5GProbeTemplate %u"), |
| 14141 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 14142 | goto error; |
| 14143 | } |
| 14144 | |
| 14145 | vos_mem_zero(pnoRequest.p24GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 14146 | vos_mem_zero(pnoRequest.p5GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 14147 | |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14148 | if ((0 < request->ie_len) && (NULL != request->ie)) |
| 14149 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14150 | pnoRequest.us24GProbeTemplateLen = request->ie_len; |
| 14151 | memcpy(pnoRequest.p24GProbeTemplate, request->ie, |
| 14152 | pnoRequest.us24GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14153 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14154 | pnoRequest.us5GProbeTemplateLen = request->ie_len; |
| 14155 | memcpy(pnoRequest.p5GProbeTemplate, request->ie, |
| 14156 | pnoRequest.us5GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14157 | } |
| 14158 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14159 | /* Driver gets only one time interval which is hardcoded in |
| 14160 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 14161 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 14162 | * 80,160,320 secs. And number of scan cycle for each timer |
| 14163 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 14164 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 14165 | * will be repeated after each interval specified by supplicant |
| 14166 | * till PNO is disabled. |
| 14167 | */ |
| 14168 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14169 | pnoRequest.scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14170 | else |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14171 | pnoRequest.scanTimers.ucScanTimersCount = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14172 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 14173 | |
| 14174 | tempInterval = (request->interval)/1000; |
| 14175 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14176 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 14177 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14178 | for ( i = 0; i < pnoRequest.scanTimers.ucScanTimersCount; i++) |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14179 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14180 | pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14181 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14182 | pnoRequest.scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14183 | tempInterval *= 2; |
| 14184 | } |
| 14185 | //Repeat last timer until pno disabled. |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14186 | pnoRequest.scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14187 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14188 | pnoRequest.modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14189 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14190 | INIT_COMPLETION(pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14191 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 14192 | pnoRequest.callbackContext = pAdapter; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14193 | pAdapter->pno_req_status = 0; |
| 14194 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14195 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14196 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14197 | pAdapter->sessionId, pnoRequest.enable, pnoRequest.modePNO, |
| 14198 | pnoRequest.scanTimers.ucScanTimersCount); |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14199 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14200 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14201 | &pnoRequest, pAdapter->sessionId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14202 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 14203 | if (eHAL_STATUS_SUCCESS != status) |
| 14204 | { |
| 14205 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14206 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14207 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14208 | goto error; |
| 14209 | } |
| 14210 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14211 | ret = wait_for_completion_timeout( |
| 14212 | &pAdapter->pno_comp_var, |
| 14213 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 14214 | if (0 >= ret) |
| 14215 | { |
| 14216 | // Did not receive the response for PNO enable in time. |
| 14217 | // Assuming the PNO enable was success. |
| 14218 | // Returning error from here, because we timeout, results |
| 14219 | // in side effect of Wifi (Wifi Setting) not to work. |
| 14220 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14221 | FL("Timed out waiting for PNO to be Enabled")); |
| 14222 | ret = 0; |
| 14223 | goto error; |
| 14224 | } |
| 14225 | |
| 14226 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14227 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14228 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14229 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14230 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14231 | FL("PNO scanRequest offloaded ret = %d"), ret); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14232 | pHddCtx->isPnoEnable = FALSE; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14233 | if (pnoRequest.aNetworks) |
| 14234 | vos_mem_free(pnoRequest.aNetworks); |
| 14235 | if (pnoRequest.p24GProbeTemplate) |
| 14236 | vos_mem_free(pnoRequest.p24GProbeTemplate); |
| 14237 | if (pnoRequest.p5GProbeTemplate) |
| 14238 | vos_mem_free(pnoRequest.p5GProbeTemplate); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14239 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14240 | } |
| 14241 | |
| 14242 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14243 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 14244 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14245 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14246 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 14247 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 14248 | { |
| 14249 | int ret; |
| 14250 | |
| 14251 | vos_ssr_protect(__func__); |
| 14252 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 14253 | vos_ssr_unprotect(__func__); |
| 14254 | |
| 14255 | return ret; |
| 14256 | } |
| 14257 | |
| 14258 | /* |
| 14259 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 14260 | * Function to disable PNO |
| 14261 | */ |
| 14262 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14263 | struct net_device *dev) |
| 14264 | { |
| 14265 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14266 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14267 | hdd_context_t *pHddCtx; |
| 14268 | tHalHandle hHal; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14269 | tSirPNOScanReq pnoRequest = {0}; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14270 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14271 | |
| 14272 | ENTER(); |
| 14273 | |
| 14274 | if (NULL == pAdapter) |
| 14275 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14276 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14277 | "%s: HDD adapter is Null", __func__); |
| 14278 | return -ENODEV; |
| 14279 | } |
| 14280 | |
| 14281 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14282 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14283 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14284 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14285 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14286 | "%s: HDD context is Null", __func__); |
| 14287 | return -ENODEV; |
| 14288 | } |
| 14289 | |
| 14290 | /* The return 0 is intentional when isLogpInProgress and |
| 14291 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 14292 | * failure in sched_scan_stop , especially for a case where the unload |
| 14293 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 14294 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 14295 | * success. If it returns a failure , then its next invocation due to the |
| 14296 | * clean up of the second interface will have the dev pointer corresponding |
| 14297 | * to the first one leading to a crash. |
| 14298 | */ |
| 14299 | if (pHddCtx->isLogpInProgress) |
| 14300 | { |
| 14301 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14302 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14303 | return ret; |
| 14304 | } |
| 14305 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 14306 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14307 | { |
| 14308 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14309 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14310 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14311 | } |
| 14312 | |
| 14313 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14314 | if (NULL == hHal) |
| 14315 | { |
| 14316 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14317 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14318 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14319 | } |
| 14320 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14321 | pnoRequest.enable = 0; /* Disable PNO */ |
| 14322 | pnoRequest.ucNetworksCount = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14323 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14324 | status = sme_SetPreferredNetworkList(hHal, &pnoRequest, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14325 | pAdapter->sessionId, |
| 14326 | NULL, pAdapter); |
| 14327 | if (eHAL_STATUS_SUCCESS != status) |
| 14328 | { |
| 14329 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14330 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14331 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14332 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14333 | } |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14334 | pHddCtx->isPnoEnable = FALSE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14335 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14336 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14337 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14338 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14339 | |
| 14340 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14341 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14342 | } |
| 14343 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14344 | /* |
| 14345 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 14346 | * NL interface to disable PNO |
| 14347 | */ |
| 14348 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 14349 | struct net_device *dev) |
| 14350 | { |
| 14351 | int ret; |
| 14352 | |
| 14353 | vos_ssr_protect(__func__); |
| 14354 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 14355 | vos_ssr_unprotect(__func__); |
| 14356 | |
| 14357 | return ret; |
| 14358 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14359 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 14360 | |
| 14361 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14362 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14363 | #if TDLS_MGMT_VERSION2 |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14364 | 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] | 14365 | u8 *peer, u8 action_code, u8 dialog_token, |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14366 | u16 status_code, u32 peer_capability, const u8 *buf, size_t len) |
| 14367 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14368 | 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] | 14369 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14370 | u16 status_code, const u8 *buf, size_t len) |
| 14371 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14372 | { |
| 14373 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14374 | hdd_adapter_t *pAdapter; |
| 14375 | hdd_context_t *pHddCtx; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14376 | u8 peerMac[6]; |
| 14377 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14378 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14379 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14380 | long rc; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14381 | int ret; |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14382 | #if !(TDLS_MGMT_VERSION2) |
| 14383 | u32 peer_capability = 0; |
| 14384 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14385 | tANI_U16 numCurrTdlsPeers; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14386 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14387 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14388 | if (NULL == pAdapter) |
| 14389 | { |
| 14390 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14391 | "%s: Adapter is NULL",__func__); |
| 14392 | return -EINVAL; |
| 14393 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14394 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14395 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 14396 | pAdapter->sessionId, action_code)); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14397 | pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14398 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14399 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14400 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14401 | "Invalid arguments"); |
| 14402 | return -EINVAL; |
| 14403 | } |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14404 | if (pHddCtx->isLogpInProgress) |
| 14405 | { |
| 14406 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14407 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14408 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 14409 | peer, |
| 14410 | eTDLS_LINK_IDLE, |
| 14411 | eTDLS_LINK_UNSPECIFIED); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14412 | return -EBUSY; |
| 14413 | } |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14414 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
| 14415 | { |
| 14416 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14417 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14418 | return -EAGAIN; |
| 14419 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14420 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14421 | { |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14422 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 14423 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 14424 | MAC_ADDRESS_STR " action %d declined.", |
| 14425 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14426 | return -ENOTSUPP; |
| 14427 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14428 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14429 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 14430 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 14431 | { |
| 14432 | /* if tdls_mode is disabled to respond to peer's request */ |
| 14433 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 14434 | { |
| 14435 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
| 14436 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14437 | " TDLS mode is disabled. action %d declined.", |
| 14438 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14439 | |
| 14440 | return -ENOTSUPP; |
| 14441 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 14442 | |
| 14443 | if (vos_max_concurrent_connections_reached()) |
| 14444 | { |
| 14445 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 14446 | return -EINVAL; |
| 14447 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14448 | } |
| 14449 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14450 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 14451 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14452 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14453 | { |
| 14454 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14455 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14456 | " TDLS setup is ongoing. action %d declined.", |
| 14457 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 14458 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14459 | } |
| 14460 | } |
| 14461 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14462 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 14463 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14464 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14465 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 14466 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14467 | { |
| 14468 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 14469 | we return error code at 'add_station()'. Hence we have this |
| 14470 | check again in addtion to add_station(). |
| 14471 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14472 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14473 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14474 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14475 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14476 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 14477 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 14478 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 14479 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14480 | } |
| 14481 | else |
| 14482 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14483 | /* maximum reached. tweak to send error code to peer and return |
| 14484 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14485 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
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: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14488 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 14489 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 14490 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14491 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14492 | /* fall through to send setup resp with failure status |
| 14493 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14494 | } |
| 14495 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14496 | else |
| 14497 | { |
| 14498 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14499 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 14500 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14501 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14502 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14503 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 14504 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14505 | return -EPERM; |
| 14506 | } |
| 14507 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14508 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14509 | vos_mem_copy(peerMac, peer, 6); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14510 | |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 14511 | #ifdef WLAN_FEATURE_TDLS_DEBUG |
| 14512 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 14513 | "%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] | 14514 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 14515 | action_code, dialog_token, status_code, len); |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 14516 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14517 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14518 | /*Except teardown responder will not be used so just make 0*/ |
| 14519 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14520 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14521 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14522 | |
| 14523 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14524 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14525 | |
| 14526 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 14527 | responder = pTdlsPeer->is_responder; |
| 14528 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14529 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14530 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 14531 | "%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] | 14532 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 14533 | dialog_token, status_code, len); |
| 14534 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14535 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14536 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14537 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14538 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 14539 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14540 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14541 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 14542 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14543 | { |
| 14544 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 14545 | { |
| 14546 | VOS_TRACE( VOS_MODULE_ID_HDD, TDLS_LOG_LEVEL, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14547 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14548 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 14549 | } |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14550 | if (SIR_MAC_TDLS_DIS_REQ != action_code) |
| 14551 | wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14552 | } |
| 14553 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14554 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 14555 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 14556 | { |
| 14557 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14558 | "%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] | 14559 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14560 | ret = -EBUSY; |
| 14561 | goto tx_failed; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14562 | } |
| 14563 | |
| 14564 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14565 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 14566 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14567 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 14568 | 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] | 14569 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14570 | if (VOS_STATUS_SUCCESS != status) |
| 14571 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14572 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14573 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14574 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14575 | ret = -EINVAL; |
| 14576 | goto tx_failed; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14577 | } |
| 14578 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14579 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 14580 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 14581 | |
| 14582 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14583 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14584 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 14585 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14586 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14587 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 14588 | |
| 14589 | if (pHddCtx->isLogpInProgress) |
| 14590 | { |
| 14591 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14592 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14593 | return -EAGAIN; |
| 14594 | } |
| 14595 | |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14596 | ret = -EINVAL; |
| 14597 | goto tx_failed; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14598 | } |
| 14599 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14600 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14601 | { |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14602 | ret = max_sta_failed; |
| 14603 | goto tx_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14604 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14605 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14606 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 14607 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 14608 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14609 | } |
| 14610 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 14611 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 14612 | wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE); |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14613 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14614 | |
| 14615 | return 0; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14616 | |
| 14617 | tx_failed: |
| 14618 | /* add_station will be called before sending TDLS_SETUP_REQ and |
| 14619 | * TDLS_SETUP_RSP and as part of add_station driver will enable |
| 14620 | * BMPS. NL80211_TDLS_DISABLE_LINK will be called if the tx of |
| 14621 | * TDLS_SETUP_REQ or TDLS_SETUP_RSP fails. BMPS will be enabled |
| 14622 | * as part of processing NL80211_TDLS_DISABLE_LINK. So need to |
| 14623 | * enable BMPS for TDLS_SETUP_REQ and TDLS_SETUP_RSP if tx fails. |
| 14624 | */ |
| 14625 | |
| 14626 | if ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 14627 | (SIR_MAC_TDLS_SETUP_RSP == action_code)) |
| 14628 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 14629 | return ret; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14630 | } |
| 14631 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14632 | #if TDLS_MGMT_VERSION2 |
| 14633 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 14634 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14635 | u16 status_code, u32 peer_capability, |
| 14636 | const u8 *buf, size_t len) |
| 14637 | #else |
| 14638 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 14639 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14640 | u16 status_code, const u8 *buf, size_t len) |
| 14641 | #endif |
| 14642 | { |
| 14643 | int ret; |
| 14644 | |
| 14645 | vos_ssr_protect(__func__); |
| 14646 | #if TDLS_MGMT_VERSION2 |
| 14647 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token, |
| 14648 | status_code, peer_capability, buf, len); |
| 14649 | #else |
| 14650 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token, |
| 14651 | status_code, buf, len); |
| 14652 | #endif |
| 14653 | vos_ssr_unprotect(__func__); |
| 14654 | |
| 14655 | return ret; |
| 14656 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14657 | |
| 14658 | int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter, |
| 14659 | u8 *peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14660 | tdls_req_params_t *tdls_peer_params, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14661 | cfg80211_exttdls_callback callback) |
| 14662 | { |
| 14663 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14664 | hddTdlsPeer_t *pTdlsPeer = NULL; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14665 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 14666 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14667 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14668 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 14669 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14670 | |
| 14671 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 14672 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 14673 | |
| 14674 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14675 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 14676 | __func__); |
| 14677 | return -ENOTSUPP; |
| 14678 | } |
| 14679 | |
| 14680 | /* To cater the requirement of establishing the TDLS link |
| 14681 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 14682 | */ |
| 14683 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 14684 | if (pTdlsPeer == NULL) { |
| 14685 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14686 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 14687 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14688 | return -EINVAL; |
| 14689 | } |
| 14690 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14691 | if (NULL != tdls_peer_params) |
| 14692 | { |
| 14693 | pTdlsPeer->peerParams.channel = tdls_peer_params->channel; |
| 14694 | pTdlsPeer->peerParams.global_operating_class = |
| 14695 | tdls_peer_params->global_operating_class; |
| 14696 | pTdlsPeer->peerParams.max_latency_ms = tdls_peer_params->max_latency_ms; |
| 14697 | pTdlsPeer->peerParams.min_bandwidth_kbps = |
| 14698 | tdls_peer_params->min_bandwidth_kbps; |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 14699 | /* check configured channel is valid, non dfs and |
| 14700 | * not current operating channel */ |
| 14701 | if ((sme_IsTdlsOffChannelValid(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14702 | tdls_peer_params->channel)) && |
| 14703 | (pHddStaCtx) && |
| 14704 | (tdls_peer_params->channel != |
| 14705 | pHddStaCtx->conn_info.operationChannel)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14706 | { |
| 14707 | pTdlsPeer->isOffChannelConfigured = TRUE; |
| 14708 | } |
| 14709 | else |
| 14710 | { |
| 14711 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 14712 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14713 | "%s: Configured Tdls Off Channel is not valid", __func__); |
| 14714 | |
| 14715 | } |
| 14716 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 14717 | "%s: tdls_off_channel %d isOffChannelConfigured %d " |
| 14718 | "current operating channel %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14719 | __func__, pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 14720 | pTdlsPeer->isOffChannelConfigured, |
| 14721 | (pHddStaCtx ? pHddStaCtx->conn_info.operationChannel : 0)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14722 | } |
| 14723 | else |
| 14724 | { |
| 14725 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14726 | "%s: Invalid TDLS Peer Params", __func__); |
| 14727 | } |
| 14728 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14729 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 14730 | |
| 14731 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14732 | " %s TDLS Add Force Peer Failed", |
| 14733 | __func__); |
| 14734 | return -EINVAL; |
| 14735 | } |
| 14736 | /*EXT TDLS*/ |
| 14737 | |
| 14738 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) { |
| 14739 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14740 | " %s TDLS set callback Failed", |
| 14741 | __func__); |
| 14742 | return -EINVAL; |
| 14743 | } |
| 14744 | |
| 14745 | return(0); |
| 14746 | |
| 14747 | } |
| 14748 | |
| 14749 | int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, u8 *peer) |
| 14750 | { |
| 14751 | |
| 14752 | hddTdlsPeer_t *pTdlsPeer; |
| 14753 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14754 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14755 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 14756 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14757 | |
| 14758 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 14759 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 14760 | |
| 14761 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14762 | " %s TDLS External control and Implicit Trigger not enabled ", |
| 14763 | __func__); |
| 14764 | return -ENOTSUPP; |
| 14765 | } |
| 14766 | |
| 14767 | |
| 14768 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 14769 | |
| 14770 | if ( NULL == pTdlsPeer ) { |
| 14771 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
| 14772 | " peer not exsting", |
| 14773 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14774 | return -EINVAL; |
| 14775 | } |
| 14776 | else { |
| 14777 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 14778 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14779 | /* if channel switch is configured, reset |
| 14780 | the channel for this peer */ |
| 14781 | if (TRUE == pTdlsPeer->isOffChannelConfigured) |
| 14782 | { |
| 14783 | pTdlsPeer->peerParams.channel = 0; |
| 14784 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 14785 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14786 | } |
| 14787 | |
| 14788 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) |
| 14789 | return -EINVAL; |
| 14790 | |
| 14791 | /*EXT TDLS*/ |
| 14792 | |
| 14793 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) { |
| 14794 | |
| 14795 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14796 | " %s TDLS set callback Failed", |
| 14797 | __func__); |
| 14798 | return -EINVAL; |
| 14799 | } |
| 14800 | return(0); |
| 14801 | |
| 14802 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14803 | 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] | 14804 | u8 *peer, enum nl80211_tdls_operation oper) |
| 14805 | { |
| 14806 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14807 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14808 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14809 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14810 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14811 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14812 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 14813 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14814 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14815 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14816 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 14817 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14818 | return -EINVAL; |
| 14819 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 14820 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14821 | status = wlan_hdd_validate_context(pHddCtx); |
| 14822 | |
| 14823 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14824 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14825 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14826 | "%s: HDD context is not valid", __func__); |
| 14827 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14828 | } |
| 14829 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14830 | |
| 14831 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 14832 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14833 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 14834 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 14835 | "TDLS Disabled in INI OR not enabled in FW. " |
| 14836 | "Cannot process TDLS commands"); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14837 | return -ENOTSUPP; |
| 14838 | } |
| 14839 | |
| 14840 | switch (oper) { |
| 14841 | case NL80211_TDLS_ENABLE_LINK: |
| 14842 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14843 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 14844 | long ret; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 14845 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 14846 | WLAN_STADescType staDesc; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14847 | tANI_U16 numCurrTdlsPeers = 0; |
| 14848 | hddTdlsPeer_t *connPeer = NULL; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14849 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 14850 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 14851 | memset(&staDesc, 0, sizeof(staDesc)); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 14852 | if ( NULL == pTdlsPeer ) { |
| 14853 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 14854 | " (oper %d) not exsting. ignored", |
| 14855 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 14856 | return -EINVAL; |
| 14857 | } |
| 14858 | |
| 14859 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14860 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 14861 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 14862 | "NL80211_TDLS_ENABLE_LINK"); |
| 14863 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 14864 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 14865 | { |
| 14866 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 14867 | MAC_ADDRESS_STR " failed", |
| 14868 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 14869 | return -EINVAL; |
| 14870 | } |
| 14871 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14872 | /* TDLS Off Channel, Disable tdls channel switch, |
| 14873 | when there are more than one tdls link */ |
| 14874 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 14875 | if (numCurrTdlsPeers == 1) |
| 14876 | { |
| 14877 | /* get connected peer and send disable tdls off chan */ |
| 14878 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
| 14879 | if (connPeer && (connPeer->isOffChannelConfigured == TRUE)) |
| 14880 | { |
| 14881 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14882 | "%s: More then one peer connected, Disable " |
| 14883 | "TDLS channel switch", __func__); |
| 14884 | |
| 14885 | sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14886 | pAdapter->sessionId, |
| 14887 | connPeer->peerMac, |
| 14888 | connPeer->peerParams.channel, |
| 14889 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 14890 | TDLS_CHANNEL_SWITCH_DISABLE); |
| 14891 | } |
| 14892 | else |
| 14893 | { |
| 14894 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14895 | "%s: No TDLS Connected Peer or " |
| 14896 | "isOffChannelConfigured %d", |
| 14897 | __func__, |
| 14898 | (connPeer ? connPeer->isOffChannelConfigured : -1)); |
| 14899 | } |
| 14900 | } |
| 14901 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14902 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14903 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 14904 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 14905 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 14906 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 14907 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
| 14908 | return -EINVAL; |
| 14909 | } |
| 14910 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 14911 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 14912 | sme_SendTdlsLinkEstablishParams(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14913 | pAdapter->sessionId, peer, &tdlsLinkEstablishParams); |
| 14914 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 14915 | * register with the TL on after the response for this operation |
| 14916 | * is received . |
| 14917 | */ |
| 14918 | ret = wait_for_completion_interruptible_timeout( |
| 14919 | &pAdapter->tdls_link_establish_req_comp, |
| 14920 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 14921 | if (ret <= 0) |
| 14922 | { |
| 14923 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14924 | "%s: Link Establish Request Faled Status %ld", |
| 14925 | __func__, ret); |
| 14926 | return -EINVAL; |
| 14927 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 14928 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14929 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 14930 | eTDLS_LINK_CONNECTED, |
| 14931 | eTDLS_LINK_SUCCESS); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 14932 | staDesc.ucSTAId = pTdlsPeer->staId; |
| 14933 | staDesc.ucQosEnabled = tdlsLinkEstablishParams.qos; |
| 14934 | WLANTL_UpdateTdlsSTAClient(pHddCtx->pvosContext, |
| 14935 | &staDesc); |
| 14936 | |
| 14937 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 14938 | /* Mark TDLS client Authenticated .*/ |
| 14939 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 14940 | pTdlsPeer->staId, |
| 14941 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 14942 | if (VOS_STATUS_SUCCESS == status) |
| 14943 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14944 | if (pTdlsPeer->is_responder == 0) |
| 14945 | { |
| 14946 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 14947 | |
| 14948 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 14949 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 14950 | WAIT_TIME_TDLS_INITIATOR); |
| 14951 | /* suspend initiator TX until it receives direct packet from the |
| 14952 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
| 14953 | WLANTL_SuspendDataTx( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 14954 | &staId, NULL); |
| 14955 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 14956 | wlan_hdd_tdls_increment_peer_count(pAdapter); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14957 | |
| 14958 | /* TDLS Off Channel, Enable tdls channel switch, |
| 14959 | when their is only one tdls link and it supports */ |
| 14960 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 14961 | if ((numCurrTdlsPeers == 1) && |
| 14962 | (TRUE == pTdlsPeer->isOffChannelSupported) && |
| 14963 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
| 14964 | { |
| 14965 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14966 | "%s: Send TDLS channel switch request for channel %d", |
| 14967 | __func__, pTdlsPeer->peerParams.channel); |
| 14968 | ret = sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14969 | pAdapter->sessionId, |
| 14970 | pTdlsPeer->peerMac, |
| 14971 | pTdlsPeer->peerParams.channel, |
| 14972 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 14973 | TDLS_CHANNEL_SWITCH_ENABLE); |
| 14974 | } |
| 14975 | else |
| 14976 | { |
| 14977 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14978 | "%s: TDLS channel switch request not sent" |
| 14979 | " numCurrTdlsPeers %d " |
| 14980 | "isOffChannelSupported %d " |
| 14981 | "isOffChannelConfigured %d", |
| 14982 | __func__, numCurrTdlsPeers, |
| 14983 | pTdlsPeer->isOffChannelSupported, |
| 14984 | pTdlsPeer->isOffChannelConfigured); |
| 14985 | } |
| 14986 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 14987 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14988 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 14989 | |
| 14990 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 14991 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 14992 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 14993 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 14994 | int ac; |
| 14995 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 14996 | WLANTL_AC_VI, |
| 14997 | WLANTL_AC_BK, |
| 14998 | WLANTL_AC_BE }; |
| 14999 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 15000 | for(ac=0; ac < 4; ac++) |
| 15001 | { |
| 15002 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 15003 | pTdlsPeer->staId, ucAc[ac], |
| 15004 | tlTid[ac], tlTid[ac], 0, 0, |
| 15005 | WLANTL_BI_DIR ); |
| 15006 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15007 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15008 | } |
| 15009 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15010 | } |
| 15011 | break; |
| 15012 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15013 | { |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15014 | tANI_U16 numCurrTdlsPeers = 0; |
| 15015 | hddTdlsPeer_t *connPeer = NULL; |
| 15016 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15017 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 15018 | |
| 15019 | if ( NULL == pTdlsPeer ) { |
| 15020 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 15021 | " (oper %d) not exsting. ignored", |
| 15022 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 15023 | return -EINVAL; |
| 15024 | } |
| 15025 | |
| 15026 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15027 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 15028 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 15029 | "NL80211_TDLS_DISABLE_LINK"); |
| 15030 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15031 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15032 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15033 | long status; |
| 15034 | |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 15035 | |
| 15036 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 15037 | eTDLS_LINK_TEARING, |
| 15038 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 15039 | eTDLS_LINK_UNSPECIFIED: |
| 15040 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15041 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 15042 | |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15043 | sme_DeleteTdlsPeerSta( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15044 | pAdapter->sessionId, peer ); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15045 | |
| 15046 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 15047 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 15048 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
Atul Mittal | 454664b | 2014-10-10 11:03:46 +0530 | [diff] [blame] | 15049 | eTDLS_LINK_IDLE, |
| 15050 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15051 | if (status <= 0) |
| 15052 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15053 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15054 | "%s: Del station failed status %ld", |
| 15055 | __func__, status); |
| 15056 | return -EPERM; |
| 15057 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15058 | |
| 15059 | /* TDLS Off Channel, Enable tdls channel switch, |
| 15060 | when their is only one tdls link and it supports */ |
| 15061 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15062 | if (numCurrTdlsPeers == 1) |
| 15063 | { |
| 15064 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
| 15065 | if ((connPeer) && |
| 15066 | (connPeer->isOffChannelSupported == TRUE) && |
| 15067 | (connPeer->isOffChannelConfigured == TRUE)) |
| 15068 | { |
| 15069 | sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15070 | pAdapter->sessionId, |
| 15071 | connPeer->peerMac, |
| 15072 | connPeer->peerParams.channel, |
| 15073 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15074 | TDLS_CHANNEL_SWITCH_ENABLE); |
| 15075 | } |
| 15076 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15077 | "%s: TDLS channel switch " |
| 15078 | "isOffChannelSupported %d " |
| 15079 | "isOffChannelConfigured %d", |
| 15080 | __func__, |
| 15081 | (connPeer ? connPeer->isOffChannelSupported : -1), |
| 15082 | (connPeer ? connPeer->isOffChannelConfigured : -1)); |
| 15083 | } |
| 15084 | else |
| 15085 | { |
| 15086 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15087 | "%s: TDLS channel switch request not sent " |
| 15088 | "numCurrTdlsPeers %d ", |
| 15089 | __func__, numCurrTdlsPeers); |
| 15090 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15091 | } |
| 15092 | else |
| 15093 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15094 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15095 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15096 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15097 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15098 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15099 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15100 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15101 | status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15102 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15103 | if (0 != status) |
| 15104 | { |
| 15105 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15106 | "%s: Error in TDLS Teardown", __func__); |
| 15107 | return status; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15108 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15109 | break; |
| 15110 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15111 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15112 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15113 | status = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 15114 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15115 | NULL, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15116 | NULL); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15117 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15118 | if (0 != status) |
| 15119 | { |
| 15120 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15121 | "%s: Error in TDLS Setup", __func__); |
| 15122 | return status; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 15123 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 15124 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15125 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15126 | case NL80211_TDLS_DISCOVERY_REQ: |
| 15127 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15128 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 15129 | "%s: We don't support in-driver setup/teardown/discovery " |
| 15130 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15131 | return -ENOTSUPP; |
| 15132 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15133 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15134 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15135 | return -ENOTSUPP; |
| 15136 | } |
| 15137 | return 0; |
| 15138 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15139 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15140 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
| 15141 | u8 *peer, enum nl80211_tdls_operation oper) |
| 15142 | { |
| 15143 | int ret; |
| 15144 | |
| 15145 | vos_ssr_protect(__func__); |
| 15146 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 15147 | vos_ssr_unprotect(__func__); |
| 15148 | |
| 15149 | return ret; |
| 15150 | } |
| 15151 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15152 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 15153 | struct net_device *dev, u8 *peer) |
| 15154 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 15155 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 15156 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 15157 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15158 | |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15159 | #if TDLS_MGMT_VERSION2 |
| 15160 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 15161 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 15162 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15163 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 15164 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15165 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15166 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15167 | #endif |
| 15168 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15169 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 15170 | /* |
| 15171 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 15172 | * Callback rountine called upon receiving response for |
| 15173 | * get offload info |
| 15174 | */ |
| 15175 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 15176 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 15177 | { |
| 15178 | |
| 15179 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15180 | tANI_U8 tempReplayCounter[8]; |
| 15181 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15182 | |
| 15183 | ENTER(); |
| 15184 | |
| 15185 | if (NULL == pAdapter) |
| 15186 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 15187 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15188 | "%s: HDD adapter is Null", __func__); |
| 15189 | return ; |
| 15190 | } |
| 15191 | |
| 15192 | if (NULL == pGtkOffloadGetInfoRsp) |
| 15193 | { |
| 15194 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15195 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 15196 | return ; |
| 15197 | } |
| 15198 | |
| 15199 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 15200 | { |
| 15201 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15202 | "%s: wlan Failed to get replay counter value", |
| 15203 | __func__); |
| 15204 | return ; |
| 15205 | } |
| 15206 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15207 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15208 | /* Update replay counter */ |
| 15209 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 15210 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 15211 | |
| 15212 | { |
| 15213 | /* changing from little to big endian since supplicant |
| 15214 | * works on big endian format |
| 15215 | */ |
| 15216 | int i; |
| 15217 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 15218 | |
| 15219 | for (i = 0; i < 8; i++) |
| 15220 | { |
| 15221 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 15222 | } |
| 15223 | } |
| 15224 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15225 | /* Update replay counter to NL */ |
| 15226 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15227 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15228 | } |
| 15229 | |
| 15230 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15231 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15232 | * This function is used to offload GTK rekeying job to the firmware. |
| 15233 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15234 | 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] | 15235 | struct cfg80211_gtk_rekey_data *data) |
| 15236 | { |
| 15237 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15238 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 15239 | hdd_station_ctx_t *pHddStaCtx; |
| 15240 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15241 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15242 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15243 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 15244 | |
| 15245 | ENTER(); |
| 15246 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15247 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15248 | if (NULL == pAdapter) |
| 15249 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15250 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15251 | "%s: HDD adapter is Null", __func__); |
| 15252 | return -ENODEV; |
| 15253 | } |
| 15254 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15255 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15256 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 15257 | pAdapter->sessionId, pAdapter->device_mode)); |
| 15258 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15259 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15260 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15261 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15262 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15263 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15264 | "%s: HDD context is not valid", __func__); |
| 15265 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15266 | } |
| 15267 | |
| 15268 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15269 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 15270 | if (NULL == hHal) |
| 15271 | { |
| 15272 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15273 | "%s: HAL context is Null!!!", __func__); |
| 15274 | return -EAGAIN; |
| 15275 | } |
| 15276 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15277 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 15278 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 15279 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 15280 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15281 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15282 | { |
| 15283 | /* changing from big to little endian since driver |
| 15284 | * works on little endian format |
| 15285 | */ |
| 15286 | tANI_U8 *p = |
| 15287 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 15288 | int i; |
| 15289 | |
| 15290 | for (i = 0; i < 8; i++) |
| 15291 | { |
| 15292 | p[7-i] = data->replay_ctr[i]; |
| 15293 | } |
| 15294 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15295 | |
| 15296 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 15297 | { |
| 15298 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15299 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 15300 | sizeof (tSirGtkOffloadParams)); |
| 15301 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15302 | pAdapter->sessionId); |
| 15303 | |
| 15304 | if (eHAL_STATUS_SUCCESS != status) |
| 15305 | { |
| 15306 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15307 | "%s: sme_SetGTKOffload failed, returned %d", |
| 15308 | __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 15309 | |
| 15310 | /* Need to clear any trace of key value in the memory. |
| 15311 | * Thus zero out the memory even though it is local |
| 15312 | * variable. |
| 15313 | */ |
| 15314 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 15315 | sizeof(hddGtkOffloadReqParams)); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15316 | return status; |
| 15317 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15318 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15319 | "%s: sme_SetGTKOffload successfull", __func__); |
| 15320 | } |
| 15321 | else |
| 15322 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15323 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15324 | "%s: wlan not suspended GTKOffload request is stored", |
| 15325 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15326 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15327 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 15328 | /* Need to clear any trace of key value in the memory. |
| 15329 | * Thus zero out the memory even though it is local |
| 15330 | * variable. |
| 15331 | */ |
| 15332 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 15333 | sizeof(hddGtkOffloadReqParams)); |
| 15334 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15335 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15336 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15337 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15338 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 15339 | struct cfg80211_gtk_rekey_data *data) |
| 15340 | { |
| 15341 | int ret; |
| 15342 | |
| 15343 | vos_ssr_protect(__func__); |
| 15344 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 15345 | vos_ssr_unprotect(__func__); |
| 15346 | |
| 15347 | return ret; |
| 15348 | } |
| 15349 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15350 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15351 | * FUNCTION: __wlan_hdd_cfg80211_set_mac_acl |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15352 | * This function is used to set access control policy |
| 15353 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15354 | static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 15355 | struct net_device *dev, |
| 15356 | const struct cfg80211_acl_data *params) |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15357 | { |
| 15358 | int i; |
| 15359 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15360 | hdd_hostapd_state_t *pHostapdState; |
| 15361 | tsap_Config_t *pConfig; |
| 15362 | v_CONTEXT_t pVosContext = NULL; |
| 15363 | hdd_context_t *pHddCtx; |
| 15364 | int status; |
| 15365 | |
| 15366 | ENTER(); |
| 15367 | |
| 15368 | if (NULL == pAdapter) |
| 15369 | { |
| 15370 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15371 | "%s: HDD adapter is Null", __func__); |
| 15372 | return -ENODEV; |
| 15373 | } |
| 15374 | |
| 15375 | if (NULL == params) |
| 15376 | { |
| 15377 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15378 | "%s: params is Null", __func__); |
| 15379 | return -EINVAL; |
| 15380 | } |
| 15381 | |
| 15382 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15383 | status = wlan_hdd_validate_context(pHddCtx); |
| 15384 | |
| 15385 | if (0 != status) |
| 15386 | { |
| 15387 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15388 | "%s: HDD context is not valid", __func__); |
| 15389 | return status; |
| 15390 | } |
| 15391 | |
| 15392 | pVosContext = pHddCtx->pvosContext; |
| 15393 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 15394 | |
| 15395 | if (NULL == pHostapdState) |
| 15396 | { |
| 15397 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15398 | "%s: pHostapdState is Null", __func__); |
| 15399 | return -EINVAL; |
| 15400 | } |
| 15401 | |
| 15402 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 15403 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
| 15404 | |
| 15405 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 15406 | { |
| 15407 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 15408 | |
| 15409 | /* default value */ |
| 15410 | pConfig->num_accept_mac = 0; |
| 15411 | pConfig->num_deny_mac = 0; |
| 15412 | |
| 15413 | /** |
| 15414 | * access control policy |
| 15415 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 15416 | * listed in hostapd.deny file. |
| 15417 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 15418 | * listed in hostapd.accept file. |
| 15419 | */ |
| 15420 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 15421 | { |
| 15422 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 15423 | } |
| 15424 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 15425 | { |
| 15426 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 15427 | } |
| 15428 | else |
| 15429 | { |
| 15430 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15431 | "%s:Acl Policy : %d is not supported", |
| 15432 | __func__, params->acl_policy); |
| 15433 | return -ENOTSUPP; |
| 15434 | } |
| 15435 | |
| 15436 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 15437 | { |
| 15438 | pConfig->num_accept_mac = params->n_acl_entries; |
| 15439 | for (i = 0; i < params->n_acl_entries; i++) |
| 15440 | { |
| 15441 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15442 | "** Add ACL MAC entry %i in WhiletList :" |
| 15443 | MAC_ADDRESS_STR, i, |
| 15444 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 15445 | |
| 15446 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 15447 | sizeof(qcmacaddr)); |
| 15448 | } |
| 15449 | } |
| 15450 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 15451 | { |
| 15452 | pConfig->num_deny_mac = params->n_acl_entries; |
| 15453 | for (i = 0; i < params->n_acl_entries; i++) |
| 15454 | { |
| 15455 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15456 | "** Add ACL MAC entry %i in BlackList :" |
| 15457 | MAC_ADDRESS_STR, i, |
| 15458 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 15459 | |
| 15460 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 15461 | sizeof(qcmacaddr)); |
| 15462 | } |
| 15463 | } |
| 15464 | |
| 15465 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 15466 | { |
| 15467 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15468 | "%s: SAP Set Mac Acl fail", __func__); |
| 15469 | return -EINVAL; |
| 15470 | } |
| 15471 | } |
| 15472 | else |
| 15473 | { |
| 15474 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15475 | "%s: Invalid device_mode = %s (%d)", |
| 15476 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 15477 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15478 | return -EINVAL; |
| 15479 | } |
| 15480 | |
| 15481 | return 0; |
| 15482 | } |
| 15483 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15484 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 15485 | struct net_device *dev, |
| 15486 | const struct cfg80211_acl_data *params) |
| 15487 | { |
| 15488 | int ret; |
| 15489 | vos_ssr_protect(__func__); |
| 15490 | ret = __wlan_hdd_cfg80211_set_mac_acl(wiphy, dev, params); |
| 15491 | vos_ssr_unprotect(__func__); |
| 15492 | |
| 15493 | return ret; |
| 15494 | } |
| 15495 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15496 | #ifdef WLAN_NL80211_TESTMODE |
| 15497 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15498 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15499 | ( |
| 15500 | void *pAdapter, |
| 15501 | void *indCont |
| 15502 | ) |
| 15503 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15504 | tSirLPHBInd *lphbInd; |
| 15505 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15506 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15507 | |
| 15508 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15509 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15510 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15511 | if (pAdapter == NULL) |
| 15512 | { |
| 15513 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15514 | "%s: pAdapter is NULL\n",__func__); |
| 15515 | return; |
| 15516 | } |
| 15517 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15518 | if (NULL == indCont) |
| 15519 | { |
| 15520 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15521 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15522 | return; |
| 15523 | } |
| 15524 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15525 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15526 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15527 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15528 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15529 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15530 | GFP_ATOMIC); |
| 15531 | if (!skb) |
| 15532 | { |
| 15533 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15534 | "LPHB timeout, NL buffer alloc fail"); |
| 15535 | return; |
| 15536 | } |
| 15537 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15538 | 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] | 15539 | { |
| 15540 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15541 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 15542 | goto nla_put_failure; |
| 15543 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15544 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15545 | { |
| 15546 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15547 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 15548 | goto nla_put_failure; |
| 15549 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15550 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15551 | sizeof(tSirLPHBInd), lphbInd)) |
| 15552 | { |
| 15553 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15554 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 15555 | goto nla_put_failure; |
| 15556 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15557 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 15558 | return; |
| 15559 | |
| 15560 | nla_put_failure: |
| 15561 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15562 | "NLA Put fail"); |
| 15563 | kfree_skb(skb); |
| 15564 | |
| 15565 | return; |
| 15566 | } |
| 15567 | #endif /* FEATURE_WLAN_LPHB */ |
| 15568 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15569 | 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] | 15570 | { |
| 15571 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 15572 | int err = 0; |
| 15573 | #ifdef FEATURE_WLAN_LPHB |
| 15574 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15575 | eHalStatus smeStatus; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 15576 | err = wlan_hdd_validate_context(pHddCtx); |
| 15577 | if (0 != err) |
| 15578 | { |
| 15579 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15580 | "%s: HDD context is not valid", __func__); |
| 15581 | return err; |
| 15582 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15583 | #endif /* FEATURE_WLAN_LPHB */ |
| 15584 | |
| 15585 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 15586 | if (err) |
| 15587 | { |
| 15588 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15589 | "%s Testmode INV ATTR", __func__); |
| 15590 | return err; |
| 15591 | } |
| 15592 | |
| 15593 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 15594 | { |
| 15595 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15596 | "%s Testmode INV CMD", __func__); |
| 15597 | return -EINVAL; |
| 15598 | } |
| 15599 | |
| 15600 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 15601 | { |
| 15602 | #ifdef FEATURE_WLAN_LPHB |
| 15603 | /* Low Power Heartbeat configuration request */ |
| 15604 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 15605 | { |
| 15606 | int buf_len; |
| 15607 | void *buf; |
| 15608 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 15609 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15610 | |
| 15611 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 15612 | { |
| 15613 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15614 | "%s Testmode INV DATA", __func__); |
| 15615 | return -EINVAL; |
| 15616 | } |
| 15617 | |
| 15618 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 15619 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 15620 | |
| 15621 | hb_params_temp =(tSirLPHBReq *)buf; |
| 15622 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 15623 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 15624 | return -EINVAL; |
| 15625 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15626 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 15627 | if (NULL == hb_params) |
| 15628 | { |
| 15629 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15630 | "%s Request Buffer Alloc Fail", __func__); |
| 15631 | return -EINVAL; |
| 15632 | } |
| 15633 | |
| 15634 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15635 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 15636 | hb_params, |
| 15637 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 15638 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15639 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15640 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15641 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15642 | vos_mem_free(hb_params); |
| 15643 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15644 | return 0; |
| 15645 | } |
| 15646 | #endif /* FEATURE_WLAN_LPHB */ |
| 15647 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15648 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15649 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15650 | return -EOPNOTSUPP; |
| 15651 | } |
| 15652 | |
| 15653 | return err; |
| 15654 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15655 | |
| 15656 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) |
| 15657 | { |
| 15658 | int ret; |
| 15659 | |
| 15660 | vos_ssr_protect(__func__); |
| 15661 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 15662 | vos_ssr_unprotect(__func__); |
| 15663 | |
| 15664 | return ret; |
| 15665 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15666 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 15667 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15668 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15669 | struct net_device *dev, |
| 15670 | int idx, struct survey_info *survey) |
| 15671 | { |
| 15672 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15673 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 15674 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15675 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 15676 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15677 | v_S7_t snr,rssi; |
| 15678 | int status, i, j, filled = 0; |
| 15679 | |
| 15680 | ENTER(); |
| 15681 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15682 | if (NULL == pAdapter) |
| 15683 | { |
| 15684 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15685 | "%s: HDD adapter is Null", __func__); |
| 15686 | return -ENODEV; |
| 15687 | } |
| 15688 | |
| 15689 | if (NULL == wiphy) |
| 15690 | { |
| 15691 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15692 | "%s: wiphy is Null", __func__); |
| 15693 | return -ENODEV; |
| 15694 | } |
| 15695 | |
| 15696 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15697 | status = wlan_hdd_validate_context(pHddCtx); |
| 15698 | |
| 15699 | if (0 != status) |
| 15700 | { |
| 15701 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15702 | "%s: HDD context is not valid", __func__); |
| 15703 | return status; |
| 15704 | } |
| 15705 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 15706 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15707 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15708 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 15709 | 0 != pAdapter->survey_idx || |
| 15710 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15711 | { |
| 15712 | /* The survey dump ops when implemented completely is expected to |
| 15713 | * return a survey of all channels and the ops is called by the |
| 15714 | * kernel with incremental values of the argument 'idx' till it |
| 15715 | * returns -ENONET. But we can only support the survey for the |
| 15716 | * operating channel for now. survey_idx is used to track |
| 15717 | * that the ops is called only once and then return -ENONET for |
| 15718 | * the next iteration |
| 15719 | */ |
| 15720 | pAdapter->survey_idx = 0; |
| 15721 | return -ENONET; |
| 15722 | } |
| 15723 | |
| 15724 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 15725 | |
| 15726 | wlan_hdd_get_snr(pAdapter, &snr); |
| 15727 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 15728 | |
| 15729 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 15730 | hdd_wlan_get_freq(channel, &freq); |
| 15731 | |
| 15732 | |
| 15733 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 15734 | { |
| 15735 | if (NULL == wiphy->bands[i]) |
| 15736 | { |
| 15737 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 15738 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 15739 | continue; |
| 15740 | } |
| 15741 | |
| 15742 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 15743 | { |
| 15744 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 15745 | |
| 15746 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 15747 | { |
| 15748 | survey->channel = &band->channels[j]; |
| 15749 | /* The Rx BDs contain SNR values in dB for the received frames |
| 15750 | * while the supplicant expects noise. So we calculate and |
| 15751 | * return the value of noise (dBm) |
| 15752 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 15753 | */ |
| 15754 | survey->noise = rssi - snr; |
| 15755 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 15756 | filled = 1; |
| 15757 | } |
| 15758 | } |
| 15759 | } |
| 15760 | |
| 15761 | if (filled) |
| 15762 | pAdapter->survey_idx = 1; |
| 15763 | else |
| 15764 | { |
| 15765 | pAdapter->survey_idx = 0; |
| 15766 | return -ENONET; |
| 15767 | } |
| 15768 | |
| 15769 | return 0; |
| 15770 | } |
| 15771 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15772 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 15773 | struct net_device *dev, |
| 15774 | int idx, struct survey_info *survey) |
| 15775 | { |
| 15776 | int ret; |
| 15777 | |
| 15778 | vos_ssr_protect(__func__); |
| 15779 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 15780 | vos_ssr_unprotect(__func__); |
| 15781 | |
| 15782 | return ret; |
| 15783 | } |
| 15784 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15785 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 15786 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15787 | * this is called when cfg80211 driver resume |
| 15788 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 15789 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 15790 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15791 | { |
| 15792 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 15793 | hdd_adapter_t *pAdapter; |
| 15794 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 15795 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 15796 | |
| 15797 | ENTER(); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 15798 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15799 | { |
| 15800 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 15801 | "%s: Hdd Context is invalid", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15802 | return 0; |
| 15803 | } |
| 15804 | |
| 15805 | spin_lock(&pHddCtx->schedScan_lock); |
| 15806 | pHddCtx->isWiphySuspended = FALSE; |
| 15807 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 15808 | { |
| 15809 | spin_unlock(&pHddCtx->schedScan_lock); |
| 15810 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15811 | "%s: Return resume is not due to PNO indication", __func__); |
| 15812 | return 0; |
| 15813 | } |
| 15814 | // Reset flag to avoid updatating cfg80211 data old results again |
| 15815 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 15816 | spin_unlock(&pHddCtx->schedScan_lock); |
| 15817 | |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 15818 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15819 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 15820 | |
| 15821 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 15822 | { |
| 15823 | pAdapter = pAdapterNode->pAdapter; |
| 15824 | if ( (NULL != pAdapter) && |
| 15825 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 15826 | { |
| 15827 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 15828 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15829 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 15830 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 15831 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15832 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 15833 | { |
| 15834 | /* Acquire wakelock to handle the case where APP's tries to |
| 15835 | * suspend immediately after updating the scan results. Whis |
| 15836 | * results in app's is in suspended state and not able to |
| 15837 | * process the connect request to AP |
| 15838 | */ |
| 15839 | hdd_prevent_suspend_timeout(2000); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15840 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 15841 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15842 | |
| 15843 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15844 | "%s : cfg80211 scan result database updated", __func__); |
| 15845 | |
| 15846 | return 0; |
| 15847 | |
| 15848 | } |
| 15849 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 15850 | pAdapterNode = pNext; |
| 15851 | } |
| 15852 | |
| 15853 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15854 | "%s: Failed to find Adapter", __func__); |
| 15855 | return 0; |
| 15856 | } |
| 15857 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 15858 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 15859 | { |
| 15860 | int ret; |
| 15861 | |
| 15862 | vos_ssr_protect(__func__); |
| 15863 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 15864 | vos_ssr_unprotect(__func__); |
| 15865 | |
| 15866 | return ret; |
| 15867 | } |
| 15868 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15869 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 15870 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15871 | * this is called when cfg80211 driver suspends |
| 15872 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 15873 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15874 | struct cfg80211_wowlan *wow) |
| 15875 | { |
| 15876 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 15877 | int ret = 0; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15878 | |
| 15879 | ENTER(); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 15880 | ret = wlan_hdd_validate_context(pHddCtx); |
| 15881 | if (0 != ret) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15882 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 15883 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15884 | "%s: HDD context is not valid", __func__); |
| 15885 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15886 | } |
| 15887 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 15888 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15889 | pHddCtx->isWiphySuspended = TRUE; |
| 15890 | |
| 15891 | EXIT(); |
| 15892 | |
| 15893 | return 0; |
| 15894 | } |
| 15895 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 15896 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 15897 | struct cfg80211_wowlan *wow) |
| 15898 | { |
| 15899 | int ret; |
| 15900 | |
| 15901 | vos_ssr_protect(__func__); |
| 15902 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 15903 | vos_ssr_unprotect(__func__); |
| 15904 | |
| 15905 | return ret; |
| 15906 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15907 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15908 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15909 | { |
| 15910 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 15911 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 15912 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 15913 | .change_station = wlan_hdd_change_station, |
| 15914 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 15915 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 15916 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 15917 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15918 | #else |
| 15919 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 15920 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 15921 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15922 | #endif |
| 15923 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 15924 | .add_key = wlan_hdd_cfg80211_add_key, |
| 15925 | .get_key = wlan_hdd_cfg80211_get_key, |
| 15926 | .del_key = wlan_hdd_cfg80211_del_key, |
| 15927 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 15928 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15929 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 15930 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15931 | .scan = wlan_hdd_cfg80211_scan, |
| 15932 | .connect = wlan_hdd_cfg80211_connect, |
| 15933 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 15934 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 15935 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 15936 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 15937 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 15938 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15939 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 15940 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 15941 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15942 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 15943 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 15944 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 15945 | .set_txq_params = wlan_hdd_set_txq_params, |
| 15946 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15947 | .get_station = wlan_hdd_cfg80211_get_station, |
| 15948 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 15949 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15950 | .add_station = wlan_hdd_cfg80211_add_station, |
| 15951 | #ifdef FEATURE_WLAN_LFR |
| 15952 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 15953 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 15954 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 15955 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 15956 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 15957 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 15958 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15959 | #ifdef FEATURE_WLAN_TDLS |
| 15960 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 15961 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 15962 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15963 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 15964 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 15965 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 15966 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 15967 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 15968 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 15969 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15970 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 15971 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15972 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15973 | #ifdef WLAN_NL80211_TESTMODE |
| 15974 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 15975 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15976 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15977 | }; |
| 15978 | |