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 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 135 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 136 | #define WLAN_AKM_SUITE_FT_8021X 0x000FAC03 |
| 137 | #define WLAN_AKM_SUITE_FT_PSK 0x000FAC04 |
| 138 | #endif |
| 139 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 140 | #define HDD_CHANNEL_14 14 |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 141 | #define WLAN_HDD_MAX_FEATURE_SET 8 |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 142 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 143 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 144 | /* |
| 145 | * Used to allocate the size of 4096 for the link layer stats. |
| 146 | * The size of 4096 is considered assuming that all data per |
| 147 | * respective event fit with in the limit.Please take a call |
| 148 | * on the limit based on the data requirements on link layer |
| 149 | * statistics. |
| 150 | */ |
| 151 | #define LL_STATS_EVENT_BUF_SIZE 4096 |
| 152 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 153 | #ifdef WLAN_FEATURE_EXTSCAN |
| 154 | /* |
| 155 | * Used to allocate the size of 4096 for the EXTScan NL data. |
| 156 | * The size of 4096 is considered assuming that all data per |
| 157 | * respective event fit with in the limit.Please take a call |
| 158 | * on the limit based on the data requirements. |
| 159 | */ |
| 160 | |
| 161 | #define EXTSCAN_EVENT_BUF_SIZE 4096 |
| 162 | #define EXTSCAN_MAX_CACHED_RESULTS_PER_IND 32 |
| 163 | #endif |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 164 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 165 | /*EXT TDLS*/ |
| 166 | /* |
| 167 | * Used to allocate the size of 4096 for the TDLS. |
| 168 | * The size of 4096 is considered assuming that all data per |
| 169 | * respective event fit with in the limit.Please take a call |
| 170 | * on the limit based on the data requirements on link layer |
| 171 | * statistics. |
| 172 | */ |
| 173 | #define EXTTDLS_EVENT_BUF_SIZE 4096 |
| 174 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 175 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 176 | { |
| 177 | WLAN_CIPHER_SUITE_WEP40, |
| 178 | WLAN_CIPHER_SUITE_WEP104, |
| 179 | WLAN_CIPHER_SUITE_TKIP, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 180 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 181 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 182 | WLAN_CIPHER_SUITE_KRK, |
| 183 | WLAN_CIPHER_SUITE_CCMP, |
| 184 | #else |
| 185 | WLAN_CIPHER_SUITE_CCMP, |
| 186 | #endif |
| 187 | #ifdef FEATURE_WLAN_WAPI |
| 188 | WLAN_CIPHER_SUITE_SMS4, |
| 189 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 190 | #ifdef WLAN_FEATURE_11W |
| 191 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 192 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 193 | }; |
| 194 | |
| 195 | static inline int is_broadcast_ether_addr(const u8 *addr) |
| 196 | { |
| 197 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && |
| 198 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 199 | } |
| 200 | |
| 201 | static struct ieee80211_channel hdd_channels_2_4_GHZ[] = |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 202 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 203 | HDD2GHZCHAN(2412, 1, 0) , |
| 204 | HDD2GHZCHAN(2417, 2, 0) , |
| 205 | HDD2GHZCHAN(2422, 3, 0) , |
| 206 | HDD2GHZCHAN(2427, 4, 0) , |
| 207 | HDD2GHZCHAN(2432, 5, 0) , |
| 208 | HDD2GHZCHAN(2437, 6, 0) , |
| 209 | HDD2GHZCHAN(2442, 7, 0) , |
| 210 | HDD2GHZCHAN(2447, 8, 0) , |
| 211 | HDD2GHZCHAN(2452, 9, 0) , |
| 212 | HDD2GHZCHAN(2457, 10, 0) , |
| 213 | HDD2GHZCHAN(2462, 11, 0) , |
| 214 | HDD2GHZCHAN(2467, 12, 0) , |
| 215 | HDD2GHZCHAN(2472, 13, 0) , |
| 216 | HDD2GHZCHAN(2484, 14, 0) , |
| 217 | }; |
| 218 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 219 | static struct ieee80211_channel hdd_social_channels_2_4_GHZ[] = |
| 220 | { |
| 221 | HDD2GHZCHAN(2412, 1, 0) , |
| 222 | HDD2GHZCHAN(2437, 6, 0) , |
| 223 | HDD2GHZCHAN(2462, 11, 0) , |
| 224 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 225 | |
| 226 | static struct ieee80211_channel hdd_channels_5_GHZ[] = |
| 227 | { |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 228 | HDD5GHZCHAN(4920, 240, 0) , |
| 229 | HDD5GHZCHAN(4940, 244, 0) , |
| 230 | HDD5GHZCHAN(4960, 248, 0) , |
| 231 | HDD5GHZCHAN(4980, 252, 0) , |
| 232 | HDD5GHZCHAN(5040, 208, 0) , |
| 233 | HDD5GHZCHAN(5060, 212, 0) , |
| 234 | HDD5GHZCHAN(5080, 216, 0) , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 235 | HDD5GHZCHAN(5180, 36, 0) , |
| 236 | HDD5GHZCHAN(5200, 40, 0) , |
| 237 | HDD5GHZCHAN(5220, 44, 0) , |
| 238 | HDD5GHZCHAN(5240, 48, 0) , |
| 239 | HDD5GHZCHAN(5260, 52, 0) , |
| 240 | HDD5GHZCHAN(5280, 56, 0) , |
| 241 | HDD5GHZCHAN(5300, 60, 0) , |
| 242 | HDD5GHZCHAN(5320, 64, 0) , |
| 243 | HDD5GHZCHAN(5500,100, 0) , |
| 244 | HDD5GHZCHAN(5520,104, 0) , |
| 245 | HDD5GHZCHAN(5540,108, 0) , |
| 246 | HDD5GHZCHAN(5560,112, 0) , |
| 247 | HDD5GHZCHAN(5580,116, 0) , |
| 248 | HDD5GHZCHAN(5600,120, 0) , |
| 249 | HDD5GHZCHAN(5620,124, 0) , |
| 250 | HDD5GHZCHAN(5640,128, 0) , |
| 251 | HDD5GHZCHAN(5660,132, 0) , |
| 252 | HDD5GHZCHAN(5680,136, 0) , |
| 253 | HDD5GHZCHAN(5700,140, 0) , |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 254 | #ifdef FEATURE_WLAN_CH144 |
| 255 | HDD5GHZCHAN(5720,144, 0) , |
| 256 | #endif /* FEATURE_WLAN_CH144 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 257 | HDD5GHZCHAN(5745,149, 0) , |
| 258 | HDD5GHZCHAN(5765,153, 0) , |
| 259 | HDD5GHZCHAN(5785,157, 0) , |
| 260 | HDD5GHZCHAN(5805,161, 0) , |
| 261 | HDD5GHZCHAN(5825,165, 0) , |
| 262 | }; |
| 263 | |
| 264 | static struct ieee80211_rate g_mode_rates[] = |
| 265 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 266 | HDD_G_MODE_RATETAB(10, 0x1, 0), |
| 267 | HDD_G_MODE_RATETAB(20, 0x2, 0), |
| 268 | HDD_G_MODE_RATETAB(55, 0x4, 0), |
| 269 | HDD_G_MODE_RATETAB(110, 0x8, 0), |
| 270 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 271 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 272 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 273 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 274 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 275 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 276 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 277 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 278 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 279 | |
| 280 | static struct ieee80211_rate a_mode_rates[] = |
| 281 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 282 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 283 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 284 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 285 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 286 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 287 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 288 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 289 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
| 290 | }; |
| 291 | |
| 292 | static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ = |
| 293 | { |
| 294 | .channels = hdd_channels_2_4_GHZ, |
| 295 | .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ), |
| 296 | .band = IEEE80211_BAND_2GHZ, |
| 297 | .bitrates = g_mode_rates, |
| 298 | .n_bitrates = g_mode_rates_size, |
| 299 | .ht_cap.ht_supported = 1, |
| 300 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 301 | | IEEE80211_HT_CAP_GRN_FLD |
| 302 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 303 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 304 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 305 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 306 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 307 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 308 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 309 | }; |
| 310 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 311 | static struct ieee80211_supported_band wlan_hdd_band_p2p_2_4_GHZ = |
| 312 | { |
| 313 | .channels = hdd_social_channels_2_4_GHZ, |
| 314 | .n_channels = ARRAY_SIZE(hdd_social_channels_2_4_GHZ), |
| 315 | .band = IEEE80211_BAND_2GHZ, |
| 316 | .bitrates = g_mode_rates, |
| 317 | .n_bitrates = g_mode_rates_size, |
| 318 | .ht_cap.ht_supported = 1, |
| 319 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 320 | | IEEE80211_HT_CAP_GRN_FLD |
| 321 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 322 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 323 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 324 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 325 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 326 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 327 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 328 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 329 | |
| 330 | static struct ieee80211_supported_band wlan_hdd_band_5_GHZ = |
| 331 | { |
| 332 | .channels = hdd_channels_5_GHZ, |
| 333 | .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ), |
| 334 | .band = IEEE80211_BAND_5GHZ, |
| 335 | .bitrates = a_mode_rates, |
| 336 | .n_bitrates = a_mode_rates_size, |
| 337 | .ht_cap.ht_supported = 1, |
| 338 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 339 | | IEEE80211_HT_CAP_GRN_FLD |
| 340 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 341 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT |
| 342 | | IEEE80211_HT_CAP_SGI_40 |
| 343 | | IEEE80211_HT_CAP_SUP_WIDTH_20_40, |
| 344 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 345 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 346 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 347 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 348 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 349 | }; |
| 350 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 351 | /* This structure contain information what kind of frame are expected in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 352 | TX/RX direction for each kind of interface */ |
| 353 | static const struct ieee80211_txrx_stypes |
| 354 | wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = { |
| 355 | [NL80211_IFTYPE_STATION] = { |
| 356 | .tx = 0xffff, |
| 357 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 358 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 359 | }, |
| 360 | [NL80211_IFTYPE_AP] = { |
| 361 | .tx = 0xffff, |
| 362 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 363 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 364 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 365 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 366 | BIT(SIR_MAC_MGMT_AUTH) | |
| 367 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 368 | BIT(SIR_MAC_MGMT_ACTION), |
| 369 | }, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 370 | [NL80211_IFTYPE_ADHOC] = { |
| 371 | .tx = 0xffff, |
| 372 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 373 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 374 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 375 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 376 | BIT(SIR_MAC_MGMT_AUTH) | |
| 377 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 378 | BIT(SIR_MAC_MGMT_ACTION), |
| 379 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 380 | [NL80211_IFTYPE_P2P_CLIENT] = { |
| 381 | .tx = 0xffff, |
| 382 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 383 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 384 | }, |
| 385 | [NL80211_IFTYPE_P2P_GO] = { |
| 386 | /* This is also same as for SoftAP */ |
| 387 | .tx = 0xffff, |
| 388 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 389 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 390 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 391 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 392 | BIT(SIR_MAC_MGMT_AUTH) | |
| 393 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 394 | BIT(SIR_MAC_MGMT_ACTION), |
| 395 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 396 | }; |
| 397 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 398 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 399 | static const struct ieee80211_iface_limit |
| 400 | wlan_hdd_iface_limit[] = { |
| 401 | { |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 402 | /* max = 3 ; Our driver create two interfaces during driver init |
| 403 | * wlan0 and p2p0 interfaces. p2p0 is considered as station |
| 404 | * interface until a group is formed. In JB architecture, once the |
| 405 | * group is formed, interface type of p2p0 is changed to P2P GO or |
| 406 | * Client. |
| 407 | * When supplicant remove the group, it first issue a set interface |
| 408 | * cmd to change the mode back to Station. In JB this works fine as |
| 409 | * we advertize two station type interface during driver init. |
| 410 | * Some vendors create separate interface for P2P GO/Client, |
| 411 | * after group formation(Third one). But while group remove |
| 412 | * supplicant first tries to change the mode(3rd interface) to STATION |
| 413 | * But as we advertized only two sta type interfaces nl80211 was |
| 414 | * returning error for the third one which was leading to failure in |
| 415 | * delete interface. Ideally while removing the group, supplicant |
| 416 | * should not try to change the 3rd interface mode to Station type. |
| 417 | * Till we get a fix in wpa_supplicant, we advertize max STA |
| 418 | * interface type to 3 |
| 419 | */ |
| 420 | .max = 3, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 421 | .types = BIT(NL80211_IFTYPE_STATION), |
| 422 | }, |
| 423 | { |
| 424 | .max = 1, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 425 | .types = BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP), |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 426 | }, |
| 427 | { |
| 428 | .max = 1, |
| 429 | .types = BIT(NL80211_IFTYPE_P2P_GO) | |
| 430 | BIT(NL80211_IFTYPE_P2P_CLIENT), |
| 431 | }, |
| 432 | }; |
| 433 | |
| 434 | /* By default, only single channel concurrency is allowed */ |
| 435 | static struct ieee80211_iface_combination |
| 436 | wlan_hdd_iface_combination = { |
| 437 | .limits = wlan_hdd_iface_limit, |
| 438 | .num_different_channels = 1, |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 439 | /* |
| 440 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 441 | * and p2p0 interfaces during driver init |
| 442 | * Some vendors create separate interface for P2P operations. |
| 443 | * wlan0: STA interface |
| 444 | * p2p0: P2P Device interface, action frames goes |
| 445 | * through this interface. |
| 446 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 447 | * created for p2p operations(GO/CLIENT interface). |
| 448 | */ |
| 449 | .max_interfaces = WLAN_MAX_INTERFACES, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 450 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 451 | .beacon_int_infra_match = false, |
| 452 | }; |
| 453 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 454 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 455 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 456 | |
| 457 | /* Data rate 100KBPS based on IE Index */ |
| 458 | struct index_data_rate_type |
| 459 | { |
| 460 | v_U8_t beacon_rate_index; |
| 461 | v_U16_t supported_rate[4]; |
| 462 | }; |
| 463 | |
| 464 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 465 | The IDX field is the rate index |
| 466 | The HI field is the rate when RSSI is strong or being ignored |
| 467 | (in this case we report actual rate) |
| 468 | The MID field is the rate when RSSI is moderate |
| 469 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 470 | The LO field is the rate when RSSI is low |
| 471 | (in this case we don't report rates, actual current rate used) |
| 472 | */ |
| 473 | static const struct |
| 474 | { |
| 475 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 476 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 477 | } supported_data_rate[] = |
| 478 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 479 | /* IDX HI HM LM LO (RSSI-based index */ |
| 480 | {2, { 10, 10, 10, 0}}, |
| 481 | {4, { 20, 20, 10, 0}}, |
| 482 | {11, { 55, 20, 10, 0}}, |
| 483 | {12, { 60, 55, 20, 0}}, |
| 484 | {18, { 90, 55, 20, 0}}, |
| 485 | {22, {110, 55, 20, 0}}, |
| 486 | {24, {120, 90, 60, 0}}, |
| 487 | {36, {180, 120, 60, 0}}, |
| 488 | {44, {220, 180, 60, 0}}, |
| 489 | {48, {240, 180, 90, 0}}, |
| 490 | {66, {330, 180, 90, 0}}, |
| 491 | {72, {360, 240, 90, 0}}, |
| 492 | {96, {480, 240, 120, 0}}, |
| 493 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 494 | }; |
| 495 | |
| 496 | /* MCS Based rate table */ |
| 497 | static struct index_data_rate_type supported_mcs_rate[] = |
| 498 | { |
| 499 | /* MCS L20 L40 S20 S40 */ |
| 500 | {0, {65, 135, 72, 150}}, |
| 501 | {1, {130, 270, 144, 300}}, |
| 502 | {2, {195, 405, 217, 450}}, |
| 503 | {3, {260, 540, 289, 600}}, |
| 504 | {4, {390, 810, 433, 900}}, |
| 505 | {5, {520, 1080, 578, 1200}}, |
| 506 | {6, {585, 1215, 650, 1350}}, |
| 507 | {7, {650, 1350, 722, 1500}} |
| 508 | }; |
| 509 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 510 | #ifdef WLAN_FEATURE_11AC |
| 511 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 512 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 513 | |
| 514 | struct index_vht_data_rate_type |
| 515 | { |
| 516 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 517 | v_U16_t supported_VHT80_rate[2]; |
| 518 | v_U16_t supported_VHT40_rate[2]; |
| 519 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 520 | }; |
| 521 | |
| 522 | typedef enum |
| 523 | { |
| 524 | DATA_RATE_11AC_MAX_MCS_7, |
| 525 | DATA_RATE_11AC_MAX_MCS_8, |
| 526 | DATA_RATE_11AC_MAX_MCS_9, |
| 527 | DATA_RATE_11AC_MAX_MCS_NA |
| 528 | } eDataRate11ACMaxMcs; |
| 529 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 530 | /* SSID broadcast type */ |
| 531 | typedef enum eSSIDBcastType |
| 532 | { |
| 533 | eBCAST_UNKNOWN = 0, |
| 534 | eBCAST_NORMAL = 1, |
| 535 | eBCAST_HIDDEN = 2, |
| 536 | } tSSIDBcastType; |
| 537 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 538 | /* MCS Based VHT rate table */ |
| 539 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 540 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 541 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 542 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 543 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 544 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 545 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 546 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 547 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 548 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 549 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 550 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 551 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 552 | }; |
| 553 | #endif /* WLAN_FEATURE_11AC */ |
| 554 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 555 | /*array index points to MCS and array value points respective rssi*/ |
| 556 | static int rssiMcsTbl[][10] = |
| 557 | { |
| 558 | /*MCS 0 1 2 3 4 5 6 7 8 9*/ |
| 559 | {-82, -79, -77, -74, -70, -66, -65, -64, -59, -57}, //20 |
| 560 | {-79, -76, -74, -71, -67, -63, -62, -61, -56, -54}, //40 |
| 561 | {-76, -73, -71, -68, -64, -60, -59, -58, -53, -51} //80 |
| 562 | }; |
| 563 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 564 | extern struct net_device_ops net_ops_struct; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 565 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 566 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter); |
| 567 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 568 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 569 | #ifdef WLAN_NL80211_TESTMODE |
| 570 | enum wlan_hdd_tm_attr |
| 571 | { |
| 572 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 573 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 574 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 575 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 576 | /* keep last */ |
| 577 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 578 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 579 | }; |
| 580 | |
| 581 | enum wlan_hdd_tm_cmd |
| 582 | { |
| 583 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 584 | }; |
| 585 | |
| 586 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 587 | |
| 588 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 589 | { |
| 590 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 591 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 592 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 593 | }; |
| 594 | #endif /* WLAN_NL80211_TESTMODE */ |
| 595 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 596 | #ifdef FEATURE_WLAN_CH_AVOID |
| 597 | /* |
| 598 | * FUNCTION: wlan_hdd_send_avoid_freq_event |
| 599 | * This is called when wlan driver needs to send vendor specific |
| 600 | * avoid frequency range event to userspace |
| 601 | */ |
| 602 | int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx, |
| 603 | tHddAvoidFreqList *pAvoidFreqList) |
| 604 | { |
| 605 | struct sk_buff *vendor_event; |
| 606 | |
| 607 | ENTER(); |
| 608 | |
| 609 | if (!pHddCtx) |
| 610 | { |
| 611 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 612 | "%s: HDD context is null", __func__); |
| 613 | return -1; |
| 614 | } |
| 615 | |
| 616 | if (!pAvoidFreqList) |
| 617 | { |
| 618 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 619 | "%s: pAvoidFreqList is null", __func__); |
| 620 | return -1; |
| 621 | } |
| 622 | |
| 623 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 624 | sizeof(tHddAvoidFreqList), |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 625 | QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 626 | GFP_KERNEL); |
| 627 | if (!vendor_event) |
| 628 | { |
| 629 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 630 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 631 | return -1; |
| 632 | } |
| 633 | |
| 634 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 635 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 636 | |
| 637 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 638 | |
| 639 | EXIT(); |
| 640 | return 0; |
| 641 | } |
| 642 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 643 | |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 644 | /* |
| 645 | * FUNCTION: __wlan_hdd_cfg80211_nan_request |
| 646 | * This is called when wlan driver needs to send vendor specific |
| 647 | * nan request event. |
| 648 | */ |
| 649 | static int __wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 650 | struct wireless_dev *wdev, |
| 651 | const void *data, int data_len) |
| 652 | { |
| 653 | tNanRequestReq nan_req; |
| 654 | VOS_STATUS status; |
| 655 | int ret_val = -1; |
Srinivas Dasari | a3f11c0 | 2015-03-20 13:15:20 +0530 | [diff] [blame] | 656 | struct net_device *dev = wdev->netdev; |
| 657 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 658 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 659 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 660 | |
| 661 | if (0 == data_len) |
| 662 | { |
| 663 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 664 | FL("NAN - Invalid Request, length = 0")); |
| 665 | return ret_val; |
| 666 | } |
| 667 | |
| 668 | if (NULL == data) |
| 669 | { |
| 670 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 671 | FL("NAN - Invalid Request, data is NULL")); |
| 672 | return ret_val; |
| 673 | } |
| 674 | |
| 675 | status = wlan_hdd_validate_context(pHddCtx); |
| 676 | if (0 != status) |
| 677 | { |
| 678 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 679 | FL("HDD context is not valid")); |
| 680 | return -EINVAL; |
| 681 | } |
| 682 | |
| 683 | hddLog(LOG1, FL("Received NAN command")); |
| 684 | vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 685 | (tANI_U8 *)data, data_len); |
| 686 | |
| 687 | /* check the NAN Capability */ |
| 688 | if (TRUE != sme_IsFeatureSupportedByFW(NAN)) |
| 689 | { |
| 690 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 691 | FL("NAN is not supported by Firmware")); |
| 692 | return -EINVAL; |
| 693 | } |
| 694 | |
| 695 | nan_req.request_data_len = data_len; |
| 696 | nan_req.request_data = data; |
| 697 | |
Srinivas Dasari | a3f11c0 | 2015-03-20 13:15:20 +0530 | [diff] [blame] | 698 | status = sme_NanRequest(hHal, &nan_req, pAdapter->sessionId); |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 699 | if (VOS_STATUS_SUCCESS == status) |
| 700 | { |
| 701 | ret_val = 0; |
| 702 | } |
| 703 | return ret_val; |
| 704 | } |
| 705 | |
| 706 | /* |
| 707 | * FUNCTION: wlan_hdd_cfg80211_nan_request |
| 708 | * Wrapper to protect the nan vendor command from ssr |
| 709 | */ |
| 710 | static int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 711 | struct wireless_dev *wdev, |
| 712 | const void *data, int data_len) |
| 713 | { |
| 714 | int ret; |
| 715 | |
| 716 | vos_ssr_protect(__func__); |
| 717 | ret = __wlan_hdd_cfg80211_nan_request(wiphy, wdev, data, data_len); |
| 718 | vos_ssr_unprotect(__func__); |
| 719 | |
| 720 | return ret; |
| 721 | } |
| 722 | |
| 723 | /* |
| 724 | * FUNCTION: wlan_hdd_cfg80211_nan_callback |
| 725 | * This is a callback function and it gets called |
| 726 | * when we need to report nan response event to |
| 727 | * upper layers. |
| 728 | */ |
| 729 | static void wlan_hdd_cfg80211_nan_callback(void* ctx, tSirNanEvent* msg) |
| 730 | { |
| 731 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 732 | struct sk_buff *vendor_event; |
| 733 | int status; |
| 734 | tSirNanEvent *data; |
| 735 | |
| 736 | ENTER(); |
| 737 | if (NULL == msg) |
| 738 | { |
| 739 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 740 | FL(" msg received here is null")); |
| 741 | return; |
| 742 | } |
| 743 | data = msg; |
| 744 | |
| 745 | status = wlan_hdd_validate_context(pHddCtx); |
| 746 | |
| 747 | if (0 != status) |
| 748 | { |
| 749 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 750 | FL("HDD context is not valid")); |
| 751 | return; |
| 752 | } |
| 753 | |
| 754 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 755 | data->event_data_len + |
| 756 | NLMSG_HDRLEN, |
| 757 | QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX, |
| 758 | GFP_KERNEL); |
| 759 | |
| 760 | if (!vendor_event) |
| 761 | { |
| 762 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 763 | FL("cfg80211_vendor_event_alloc failed")); |
| 764 | return; |
| 765 | } |
| 766 | if (nla_put(vendor_event, QCA_WLAN_VENDOR_ATTR_NAN, |
| 767 | data->event_data_len, data->event_data)) |
| 768 | { |
| 769 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 770 | FL("QCA_WLAN_VENDOR_ATTR_NAN put fail")); |
| 771 | kfree_skb(vendor_event); |
| 772 | return; |
| 773 | } |
| 774 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 775 | EXIT(); |
| 776 | } |
| 777 | |
| 778 | /* |
| 779 | * FUNCTION: wlan_hdd_cfg80211_nan_init |
| 780 | * This function is called to register the callback to sme layer |
| 781 | */ |
| 782 | inline void wlan_hdd_cfg80211_nan_init(hdd_context_t *pHddCtx) |
| 783 | { |
| 784 | sme_NanRegisterCallback(pHddCtx->hHal, wlan_hdd_cfg80211_nan_callback); |
| 785 | } |
| 786 | |
| 787 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 788 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 789 | |
| 790 | static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats, |
| 791 | struct sk_buff *vendor_event) |
| 792 | { |
| 793 | if (nla_put_u8(vendor_event, |
| 794 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_PREAMBLE, |
| 795 | stats->rate.preamble) || |
| 796 | nla_put_u8(vendor_event, |
| 797 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_NSS, |
| 798 | stats->rate.nss) || |
| 799 | nla_put_u8(vendor_event, |
| 800 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BW, |
| 801 | stats->rate.bw) || |
| 802 | nla_put_u8(vendor_event, |
| 803 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX, |
| 804 | stats->rate.rateMcsIdx) || |
| 805 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE, |
| 806 | stats->rate.bitrate ) || |
| 807 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU, |
| 808 | stats->txMpdu ) || |
| 809 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU, |
| 810 | stats->rxMpdu ) || |
| 811 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST, |
| 812 | stats->mpduLost ) || |
| 813 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES, |
| 814 | stats->retries) || |
| 815 | nla_put_u32(vendor_event, |
| 816 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT, |
| 817 | stats->retriesShort ) || |
| 818 | nla_put_u32(vendor_event, |
| 819 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG, |
| 820 | stats->retriesLong)) |
| 821 | { |
| 822 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 823 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 824 | return FALSE; |
| 825 | } |
| 826 | return TRUE; |
| 827 | } |
| 828 | |
| 829 | static v_BOOL_t put_wifi_peer_info( tpSirWifiPeerInfo stats, |
| 830 | struct sk_buff *vendor_event) |
| 831 | { |
| 832 | u32 i = 0; |
| 833 | struct nlattr *rateInfo; |
| 834 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE, |
| 835 | stats->type) || |
| 836 | nla_put(vendor_event, |
| 837 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS, |
| 838 | VOS_MAC_ADDR_SIZE, &stats->peerMacAddress[0]) || |
| 839 | nla_put_u32(vendor_event, |
| 840 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES, |
| 841 | stats->capabilities) || |
| 842 | nla_put_u32(vendor_event, |
| 843 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES, |
| 844 | stats->numRate)) |
| 845 | { |
| 846 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 847 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 848 | goto error; |
| 849 | } |
| 850 | |
| 851 | rateInfo = nla_nest_start(vendor_event, |
| 852 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 853 | if(!rateInfo) |
| 854 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 855 | for (i = 0; i < stats->numRate; i++) |
| 856 | { |
| 857 | struct nlattr *rates; |
| 858 | tpSirWifiRateStat pRateStats = (tpSirWifiRateStat )((uint8 *) |
| 859 | stats->rateStats + |
| 860 | (i * sizeof(tSirWifiRateStat))); |
| 861 | rates = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 862 | if(!rates) |
| 863 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 864 | |
| 865 | if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event)) |
| 866 | { |
| 867 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 868 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 869 | return FALSE; |
| 870 | } |
| 871 | nla_nest_end(vendor_event, rates); |
| 872 | } |
| 873 | nla_nest_end(vendor_event, rateInfo); |
| 874 | |
| 875 | return TRUE; |
| 876 | error: |
| 877 | return FALSE; |
| 878 | } |
| 879 | |
| 880 | static v_BOOL_t put_wifi_wmm_ac_stat( tpSirWifiWmmAcStat stats, |
| 881 | struct sk_buff *vendor_event) |
| 882 | { |
| 883 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_AC, |
| 884 | stats->ac ) || |
| 885 | nla_put_u32(vendor_event, |
| 886 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MPDU, |
| 887 | stats->txMpdu ) || |
| 888 | nla_put_u32(vendor_event, |
| 889 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MPDU, |
| 890 | stats->rxMpdu ) || |
| 891 | nla_put_u32(vendor_event, |
| 892 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MCAST, |
| 893 | stats->txMcast ) || |
| 894 | nla_put_u32(vendor_event, |
| 895 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MCAST, |
| 896 | stats->rxMcast ) || |
| 897 | nla_put_u32(vendor_event, |
| 898 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_AMPDU, |
| 899 | stats->rxAmpdu ) || |
| 900 | nla_put_u32(vendor_event, |
| 901 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_AMPDU, |
| 902 | stats->txAmpdu ) || |
| 903 | nla_put_u32(vendor_event, |
| 904 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_MPDU_LOST, |
| 905 | stats->mpduLost )|| |
| 906 | nla_put_u32(vendor_event, |
| 907 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES, |
| 908 | stats->retries ) || |
| 909 | nla_put_u32(vendor_event, |
| 910 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_SHORT, |
| 911 | stats->retriesShort ) || |
| 912 | nla_put_u32(vendor_event, |
| 913 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_LONG, |
| 914 | stats->retriesLong ) || |
| 915 | nla_put_u32(vendor_event, |
| 916 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MIN, |
| 917 | stats->contentionTimeMin ) || |
| 918 | nla_put_u32(vendor_event, |
| 919 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MAX, |
| 920 | stats->contentionTimeMax ) || |
| 921 | nla_put_u32(vendor_event, |
| 922 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_AVG, |
| 923 | stats->contentionTimeAvg ) || |
| 924 | nla_put_u32(vendor_event, |
| 925 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_NUM_SAMPLES, |
| 926 | stats->contentionNumSamples )) |
| 927 | { |
| 928 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 929 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 930 | return FALSE; |
| 931 | } |
| 932 | return TRUE; |
| 933 | } |
| 934 | |
| 935 | static v_BOOL_t put_wifi_interface_info(tpSirWifiInterfaceInfo stats, |
| 936 | struct sk_buff *vendor_event) |
| 937 | { |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 938 | if (nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 939 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE, stats->mode ) || |
| 940 | nla_put(vendor_event, |
| 941 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MAC_ADDR, |
| 942 | VOS_MAC_ADDR_SIZE, stats->macAddr) || |
| 943 | nla_put_u32(vendor_event, |
| 944 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_STATE, |
| 945 | stats->state ) || |
| 946 | nla_put_u32(vendor_event, |
| 947 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_ROAMING, |
| 948 | stats->roaming ) || |
| 949 | nla_put_u32(vendor_event, |
| 950 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_CAPABILITIES, |
| 951 | stats->capabilities ) || |
| 952 | nla_put(vendor_event, |
| 953 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_SSID, |
| 954 | strlen(stats->ssid), stats->ssid) || |
| 955 | nla_put(vendor_event, |
| 956 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_BSSID, |
| 957 | WNI_CFG_BSSID_LEN, stats->bssid) || |
| 958 | nla_put(vendor_event, |
| 959 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_AP_COUNTRY_STR, |
| 960 | WNI_CFG_COUNTRY_CODE_LEN, stats->apCountryStr) || |
| 961 | nla_put(vendor_event, |
| 962 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_COUNTRY_STR, |
| 963 | WNI_CFG_COUNTRY_CODE_LEN, stats->countryStr) |
| 964 | ) |
| 965 | { |
| 966 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 967 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 968 | return FALSE; |
| 969 | } |
| 970 | return TRUE; |
| 971 | } |
| 972 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 973 | static v_BOOL_t put_wifi_iface_stats(hdd_adapter_t *pAdapter, |
| 974 | tpSirWifiIfaceStat pWifiIfaceStat, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 975 | struct sk_buff *vendor_event) |
| 976 | { |
| 977 | int i = 0; |
| 978 | struct nlattr *wmmInfo; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 979 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 980 | WLANTL_InterfaceStatsType *pWifiIfaceStatTL = NULL; |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 981 | tSirWifiWmmAcStat accessclassStats; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 982 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 983 | if (FALSE == put_wifi_interface_info( |
| 984 | &pWifiIfaceStat->info, |
| 985 | vendor_event)) |
| 986 | { |
| 987 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 988 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 989 | return FALSE; |
| 990 | |
| 991 | } |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 992 | pWifiIfaceStatTL = (WLANTL_InterfaceStatsType *) |
| 993 | vos_mem_malloc(sizeof(WLANTL_InterfaceStatsType)); |
| 994 | if (NULL == pWifiIfaceStatTL) |
| 995 | { |
| 996 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 997 | return FALSE; |
| 998 | } |
| 999 | |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 1000 | accessclassStats = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK]; |
| 1001 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK] = |
| 1002 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE]; |
| 1003 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE] = accessclassStats; |
| 1004 | |
| 1005 | accessclassStats.ac = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac; |
| 1006 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac = |
| 1007 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac; |
| 1008 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac = accessclassStats.ac; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1009 | |
| 1010 | if ( pWifiIfaceStat->info.state == WIFI_ASSOCIATED) |
| 1011 | { |
| 1012 | if (VOS_STATUS_SUCCESS == |
| 1013 | WLANTL_CollectInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1014 | pHddStaCtx->conn_info.staId[0], pWifiIfaceStatTL)) |
| 1015 | { |
| 1016 | /* mgmtRx, MgmtActionRx, rxMcast, rxMpdu, rxAmpdu, rssiData are |
| 1017 | * obtained from TL structure |
| 1018 | */ |
| 1019 | |
| 1020 | pWifiIfaceStat->mgmtRx = pWifiIfaceStat->beaconRx + |
| 1021 | pWifiIfaceStatTL->mgmtRx; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1022 | pWifiIfaceStat->rssiData = pWifiIfaceStatTL->rssiData; |
| 1023 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1024 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMcast |
| 1025 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMcast; |
| 1026 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMcast |
| 1027 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMcast; |
| 1028 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMcast |
| 1029 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMcast; |
| 1030 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMcast |
| 1031 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMcast; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1032 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1033 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMpdu |
| 1034 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMpdu; |
| 1035 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMpdu |
| 1036 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMpdu; |
| 1037 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMpdu |
| 1038 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMpdu; |
| 1039 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMpdu |
| 1040 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1041 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1042 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxAmpdu |
| 1043 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxAmpdu; |
| 1044 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxAmpdu |
| 1045 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxAmpdu; |
| 1046 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxAmpdu |
| 1047 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxAmpdu; |
| 1048 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxAmpdu |
| 1049 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxAmpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1050 | } |
| 1051 | else |
| 1052 | { |
| 1053 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in getting stats from TL")); |
| 1054 | } |
| 1055 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1056 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].txMcast = |
| 1057 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO]; |
| 1058 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].txMcast = |
| 1059 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI]; |
| 1060 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].txMcast = |
| 1061 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE]; |
| 1062 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].txMcast = |
| 1063 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK]; |
| 1064 | } |
| 1065 | else |
| 1066 | { |
| 1067 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Interface not Associated")); |
| 1068 | } |
| 1069 | |
| 1070 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1071 | |
| 1072 | if (nla_put_u32(vendor_event, |
| 1073 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX, |
| 1074 | pWifiIfaceStat->beaconRx) || |
| 1075 | nla_put_u32(vendor_event, |
| 1076 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_RX, |
| 1077 | pWifiIfaceStat->mgmtRx) || |
| 1078 | nla_put_u32(vendor_event, |
| 1079 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_RX, |
| 1080 | pWifiIfaceStat->mgmtActionRx) || |
| 1081 | nla_put_u32(vendor_event, |
| 1082 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_TX, |
| 1083 | pWifiIfaceStat->mgmtActionTx) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1084 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1085 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_MGMT, |
| 1086 | pWifiIfaceStat->rssiMgmt) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1087 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1088 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_DATA, |
| 1089 | pWifiIfaceStat->rssiData) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1090 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1091 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_ACK, |
| 1092 | pWifiIfaceStat->rssiAck)) |
| 1093 | { |
| 1094 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1095 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1096 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1097 | return FALSE; |
| 1098 | } |
| 1099 | |
| 1100 | wmmInfo = nla_nest_start(vendor_event, |
| 1101 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1102 | if(!wmmInfo) |
| 1103 | { |
| 1104 | vos_mem_free(pWifiIfaceStatTL); |
| 1105 | return FALSE; |
| 1106 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1107 | for (i = 0; i < WIFI_AC_MAX; i++) |
| 1108 | { |
| 1109 | struct nlattr *wmmStats; |
| 1110 | wmmStats = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1111 | if(!wmmStats) |
| 1112 | { |
| 1113 | vos_mem_free(pWifiIfaceStatTL); |
| 1114 | return FALSE; |
| 1115 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1116 | if (FALSE == put_wifi_wmm_ac_stat( |
| 1117 | &pWifiIfaceStat->AccessclassStats[i], |
| 1118 | vendor_event)) |
| 1119 | { |
| 1120 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1121 | FL("QCA_WLAN_VENDOR_ATTR put Fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1122 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1123 | return FALSE; |
| 1124 | } |
| 1125 | |
| 1126 | nla_nest_end(vendor_event, wmmStats); |
| 1127 | } |
| 1128 | nla_nest_end(vendor_event, wmmInfo); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1129 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1130 | return TRUE; |
| 1131 | } |
| 1132 | |
| 1133 | static tSirWifiInterfaceMode |
| 1134 | hdd_map_device_to_ll_iface_mode ( int deviceMode ) |
| 1135 | { |
| 1136 | switch (deviceMode) |
| 1137 | { |
| 1138 | case WLAN_HDD_INFRA_STATION: |
| 1139 | return WIFI_INTERFACE_STA; |
| 1140 | case WLAN_HDD_SOFTAP: |
| 1141 | return WIFI_INTERFACE_SOFTAP; |
| 1142 | case WLAN_HDD_P2P_CLIENT: |
| 1143 | return WIFI_INTERFACE_P2P_CLIENT; |
| 1144 | case WLAN_HDD_P2P_GO: |
| 1145 | return WIFI_INTERFACE_P2P_GO; |
| 1146 | case WLAN_HDD_IBSS: |
| 1147 | return WIFI_INTERFACE_IBSS; |
| 1148 | default: |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 1149 | return WIFI_INTERFACE_UNKNOWN; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1150 | } |
| 1151 | } |
| 1152 | |
| 1153 | static v_BOOL_t hdd_get_interface_info(hdd_adapter_t *pAdapter, |
| 1154 | tpSirWifiInterfaceInfo pInfo) |
| 1155 | { |
| 1156 | v_U8_t *staMac = NULL; |
| 1157 | hdd_station_ctx_t *pHddStaCtx; |
| 1158 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1159 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1160 | |
| 1161 | pInfo->mode = hdd_map_device_to_ll_iface_mode(pAdapter->device_mode); |
| 1162 | |
| 1163 | vos_mem_copy(pInfo->macAddr, |
| 1164 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 1165 | |
| 1166 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1167 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 1168 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))) |
| 1169 | { |
| 1170 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1171 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) |
| 1172 | { |
| 1173 | pInfo->state = WIFI_DISCONNECTED; |
| 1174 | } |
| 1175 | if (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) |
| 1176 | { |
| 1177 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1178 | "%s: Session ID %d, Connection is in progress", __func__, |
| 1179 | pAdapter->sessionId); |
| 1180 | pInfo->state = WIFI_ASSOCIATING; |
| 1181 | } |
| 1182 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 1183 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 1184 | { |
| 1185 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 1186 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1187 | "%s: client " MAC_ADDRESS_STR |
| 1188 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 1189 | MAC_ADDR_ARRAY(staMac)); |
| 1190 | pInfo->state = WIFI_AUTHENTICATING; |
| 1191 | } |
| 1192 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 1193 | { |
| 1194 | pInfo->state = WIFI_ASSOCIATED; |
| 1195 | vos_mem_copy(pInfo->bssid, |
| 1196 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 1197 | vos_mem_copy(pInfo->ssid, |
| 1198 | pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 1199 | pHddStaCtx->conn_info.SSID.SSID.length); |
| 1200 | //NULL Terminate the string. |
| 1201 | pInfo->ssid[pHddStaCtx->conn_info.SSID.SSID.length] = 0; |
| 1202 | } |
| 1203 | } |
| 1204 | vos_mem_copy(pInfo->countryStr, |
| 1205 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1206 | |
| 1207 | vos_mem_copy(pInfo->apCountryStr, |
| 1208 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1209 | |
| 1210 | return TRUE; |
| 1211 | } |
| 1212 | |
| 1213 | /* |
| 1214 | * hdd_link_layer_process_peer_stats () - This function is called after |
| 1215 | * receiving Link Layer Peer statistics from FW.This function converts |
| 1216 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1217 | * layers. |
| 1218 | */ |
| 1219 | static v_VOID_t hdd_link_layer_process_peer_stats(hdd_adapter_t *pAdapter, |
| 1220 | v_VOID_t *pData) |
| 1221 | { |
| 1222 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1223 | tpSirWifiRateStat pWifiRateStat; |
| 1224 | tpSirWifiPeerStat pWifiPeerStat; |
| 1225 | tpSirWifiPeerInfo pWifiPeerInfo; |
| 1226 | struct nlattr *peerInfo; |
| 1227 | struct sk_buff *vendor_event; |
| 1228 | int status, i; |
| 1229 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1230 | ENTER(); |
| 1231 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1232 | status = wlan_hdd_validate_context(pHddCtx); |
| 1233 | if (0 != status) |
| 1234 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1235 | return; |
| 1236 | } |
| 1237 | |
| 1238 | pWifiPeerStat = (tpSirWifiPeerStat) pData; |
| 1239 | |
| 1240 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1241 | "LL_STATS_PEER_ALL : numPeers %u", |
| 1242 | pWifiPeerStat->numPeers); |
| 1243 | { |
| 1244 | for (i = 0; i < pWifiPeerStat->numPeers; i++) |
| 1245 | { |
| 1246 | pWifiPeerInfo = (tpSirWifiPeerInfo) |
| 1247 | ((uint8 *)pWifiPeerStat->peerInfo + |
| 1248 | ( i * sizeof(tSirWifiPeerInfo))); |
| 1249 | |
Dasari Srinivas | 1be0c4e | 2014-10-19 13:03:41 +0530 | [diff] [blame] | 1250 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) { |
| 1251 | pWifiPeerInfo->type = WIFI_PEER_AP; |
| 1252 | } |
| 1253 | if (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) { |
| 1254 | pWifiPeerInfo->type = WIFI_PEER_P2P_GO; |
| 1255 | } |
| 1256 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1257 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1258 | " %d) LL_STATS Channel Stats " |
| 1259 | " Peer Type %u " |
| 1260 | " peerMacAddress %pM " |
| 1261 | " capabilities 0x%x " |
| 1262 | " numRate %u ", |
| 1263 | i, |
| 1264 | pWifiPeerInfo->type, |
| 1265 | pWifiPeerInfo->peerMacAddress, |
| 1266 | pWifiPeerInfo->capabilities, |
| 1267 | pWifiPeerInfo->numRate); |
| 1268 | { |
| 1269 | int j; |
| 1270 | for (j = 0; j < pWifiPeerInfo->numRate; j++) |
| 1271 | { |
| 1272 | pWifiRateStat = (tpSirWifiRateStat) |
| 1273 | ((tANI_U8 *) pWifiPeerInfo->rateStats + |
| 1274 | ( j * sizeof(tSirWifiRateStat))); |
| 1275 | |
| 1276 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1277 | " peer Rate Stats " |
| 1278 | " preamble %u " |
| 1279 | " nss %u " |
| 1280 | " bw %u " |
| 1281 | " rateMcsIdx %u " |
| 1282 | " reserved %u " |
| 1283 | " bitrate %u " |
| 1284 | " txMpdu %u " |
| 1285 | " rxMpdu %u " |
| 1286 | " mpduLost %u " |
| 1287 | " retries %u " |
| 1288 | " retriesShort %u " |
| 1289 | " retriesLong %u", |
| 1290 | pWifiRateStat->rate.preamble, |
| 1291 | pWifiRateStat->rate.nss, |
| 1292 | pWifiRateStat->rate.bw, |
| 1293 | pWifiRateStat->rate.rateMcsIdx, |
| 1294 | pWifiRateStat->rate.reserved, |
| 1295 | pWifiRateStat->rate.bitrate, |
| 1296 | pWifiRateStat->txMpdu, |
| 1297 | pWifiRateStat->rxMpdu, |
| 1298 | pWifiRateStat->mpduLost, |
| 1299 | pWifiRateStat->retries, |
| 1300 | pWifiRateStat->retriesShort, |
| 1301 | pWifiRateStat->retriesLong); |
| 1302 | } |
| 1303 | } |
| 1304 | } |
| 1305 | } |
| 1306 | |
| 1307 | /* |
| 1308 | * Allocate a size of 4096 for the peer stats comprising |
| 1309 | * each of size = sizeof (tSirWifiPeerInfo) + numRate * |
| 1310 | * sizeof (tSirWifiRateStat).Each field is put with an |
| 1311 | * NL attribute.The size of 4096 is considered assuming |
| 1312 | * that number of rates shall not exceed beyond 50 with |
| 1313 | * the sizeof (tSirWifiRateStat) being 32. |
| 1314 | */ |
| 1315 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1316 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1317 | QCA_NL80211_VENDOR_SUBCMD_LL_PEER_INFO_STATS_INDEX, |
| 1318 | GFP_KERNEL); |
| 1319 | if (!vendor_event) |
| 1320 | { |
| 1321 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1322 | "%s: cfg80211_vendor_event_alloc failed", |
| 1323 | __func__); |
| 1324 | return; |
| 1325 | } |
| 1326 | if (nla_put_u32(vendor_event, |
| 1327 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS, |
| 1328 | pWifiPeerStat->numPeers)) |
| 1329 | { |
| 1330 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1331 | "%s: QCA_WLAN_VENDOR_ATTR put fail", __func__); |
| 1332 | kfree_skb(vendor_event); |
| 1333 | return; |
| 1334 | } |
| 1335 | |
| 1336 | peerInfo = nla_nest_start(vendor_event, |
| 1337 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1338 | if(!peerInfo) |
| 1339 | { |
| 1340 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1341 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO put fail", |
| 1342 | __func__); |
| 1343 | kfree_skb(vendor_event); |
| 1344 | return; |
| 1345 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1346 | |
| 1347 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1348 | pWifiPeerStat->peerInfo); |
| 1349 | |
| 1350 | for (i = 1; i <= pWifiPeerStat->numPeers; i++) |
| 1351 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1352 | int numRate = pWifiPeerInfo->numRate; |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1353 | struct nlattr *peers = nla_nest_start(vendor_event, i); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1354 | |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1355 | if(!peers) |
| 1356 | { |
| 1357 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1358 | "%s: peer stats put fail", |
| 1359 | __func__); |
| 1360 | kfree_skb(vendor_event); |
| 1361 | return; |
| 1362 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1363 | if (FALSE == put_wifi_peer_info( |
| 1364 | pWifiPeerInfo, vendor_event)) |
| 1365 | { |
| 1366 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1367 | "%s: put_wifi_peer_info put fail", __func__); |
| 1368 | kfree_skb(vendor_event); |
| 1369 | return; |
| 1370 | } |
| 1371 | |
| 1372 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1373 | pWifiPeerStat->peerInfo + |
| 1374 | (i * sizeof(tSirWifiPeerInfo)) + |
| 1375 | (numRate * sizeof (tSirWifiRateStat))); |
| 1376 | nla_nest_end(vendor_event, peers); |
| 1377 | } |
| 1378 | nla_nest_end(vendor_event, peerInfo); |
| 1379 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1380 | |
| 1381 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1382 | } |
| 1383 | |
| 1384 | /* |
| 1385 | * hdd_link_layer_process_iface_stats () - This function is called after |
| 1386 | * receiving Link Layer Interface statistics from FW.This function converts |
| 1387 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1388 | * layers. |
| 1389 | */ |
| 1390 | static v_VOID_t hdd_link_layer_process_iface_stats(hdd_adapter_t *pAdapter, |
| 1391 | v_VOID_t *pData) |
| 1392 | { |
| 1393 | tpSirWifiIfaceStat pWifiIfaceStat; |
| 1394 | struct sk_buff *vendor_event; |
| 1395 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1396 | int status; |
| 1397 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1398 | ENTER(); |
| 1399 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1400 | status = wlan_hdd_validate_context(pHddCtx); |
| 1401 | if (0 != status) |
| 1402 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1403 | return; |
| 1404 | } |
| 1405 | /* |
| 1406 | * Allocate a size of 4096 for the interface stats comprising |
| 1407 | * sizeof (tpSirWifiIfaceStat).The size of 4096 is considered |
| 1408 | * assuming that all these fit with in the limit.Please take |
| 1409 | * a call on the limit based on the data requirements on |
| 1410 | * interface statistics. |
| 1411 | */ |
| 1412 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1413 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1414 | QCA_NL80211_VENDOR_SUBCMD_LL_IFACE_STATS_INDEX, |
| 1415 | GFP_KERNEL); |
| 1416 | if (!vendor_event) |
| 1417 | { |
| 1418 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1419 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1420 | return; |
| 1421 | } |
| 1422 | |
| 1423 | pWifiIfaceStat = (tpSirWifiIfaceStat) pData; |
| 1424 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1425 | |
| 1426 | if (FALSE == hdd_get_interface_info( pAdapter, |
| 1427 | &pWifiIfaceStat->info)) |
| 1428 | { |
| 1429 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1430 | FL("hdd_get_interface_info get fail") ); |
| 1431 | kfree_skb(vendor_event); |
| 1432 | return; |
| 1433 | } |
| 1434 | |
| 1435 | if (FALSE == put_wifi_iface_stats( pAdapter, pWifiIfaceStat, |
| 1436 | vendor_event)) |
| 1437 | { |
| 1438 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1439 | FL("put_wifi_iface_stats fail") ); |
| 1440 | kfree_skb(vendor_event); |
| 1441 | return; |
| 1442 | } |
| 1443 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1444 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1445 | "WMI_LINK_STATS_IFACE Data"); |
| 1446 | |
| 1447 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1448 | "LL_STATS_IFACE: " |
| 1449 | " Mode %u " |
| 1450 | " MAC %pM " |
| 1451 | " State %u " |
| 1452 | " Roaming %u " |
| 1453 | " capabilities 0x%x " |
| 1454 | " SSID %s " |
| 1455 | " BSSID %pM", |
| 1456 | pWifiIfaceStat->info.mode, |
| 1457 | pWifiIfaceStat->info.macAddr, |
| 1458 | pWifiIfaceStat->info.state, |
| 1459 | pWifiIfaceStat->info.roaming, |
| 1460 | pWifiIfaceStat->info.capabilities, |
| 1461 | pWifiIfaceStat->info.ssid, |
| 1462 | pWifiIfaceStat->info.bssid); |
| 1463 | |
| 1464 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1465 | " AP country str: %c%c%c", |
| 1466 | pWifiIfaceStat->info.apCountryStr[0], |
| 1467 | pWifiIfaceStat->info.apCountryStr[1], |
| 1468 | pWifiIfaceStat->info.apCountryStr[2]); |
| 1469 | |
| 1470 | |
| 1471 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1472 | " Country Str Association: %c%c%c", |
| 1473 | pWifiIfaceStat->info.countryStr[0], |
| 1474 | pWifiIfaceStat->info.countryStr[1], |
| 1475 | pWifiIfaceStat->info.countryStr[2]); |
| 1476 | |
| 1477 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1478 | " beaconRx %u " |
| 1479 | " mgmtRx %u " |
| 1480 | " mgmtActionRx %u " |
| 1481 | " mgmtActionTx %u " |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1482 | " rssiMgmt %d " |
| 1483 | " rssiData %d " |
| 1484 | " rssiAck %d", |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1485 | pWifiIfaceStat->beaconRx, |
| 1486 | pWifiIfaceStat->mgmtRx, |
| 1487 | pWifiIfaceStat->mgmtActionRx, |
| 1488 | pWifiIfaceStat->mgmtActionTx, |
| 1489 | pWifiIfaceStat->rssiMgmt, |
| 1490 | pWifiIfaceStat->rssiData, |
| 1491 | pWifiIfaceStat->rssiAck ); |
| 1492 | |
| 1493 | |
| 1494 | { |
| 1495 | int i; |
| 1496 | for (i = 0 ; i < WIFI_AC_MAX; i ++) |
| 1497 | { |
| 1498 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1499 | |
| 1500 | " %d) LL_STATS IFACE: " |
| 1501 | " ac: %u txMpdu: %u " |
| 1502 | " rxMpdu: %u txMcast: %u " |
| 1503 | " rxMcast: %u rxAmpdu: %u " |
| 1504 | " txAmpdu: %u mpduLost: %u " |
| 1505 | " retries: %u retriesShort: %u " |
| 1506 | " retriesLong: %u contentionTimeMin: %u " |
| 1507 | " contentionTimeMax: %u contentionTimeAvg: %u " |
| 1508 | " contentionNumSamples: %u", |
| 1509 | i, |
| 1510 | pWifiIfaceStat->AccessclassStats[i].ac, |
| 1511 | pWifiIfaceStat->AccessclassStats[i].txMpdu, |
| 1512 | pWifiIfaceStat->AccessclassStats[i].rxMpdu, |
| 1513 | pWifiIfaceStat->AccessclassStats[i].txMcast, |
| 1514 | pWifiIfaceStat->AccessclassStats[i].rxMcast, |
| 1515 | pWifiIfaceStat->AccessclassStats[i].rxAmpdu, |
| 1516 | pWifiIfaceStat->AccessclassStats[i].txAmpdu, |
| 1517 | pWifiIfaceStat->AccessclassStats[i].mpduLost, |
| 1518 | pWifiIfaceStat->AccessclassStats[i].retries, |
| 1519 | pWifiIfaceStat-> |
| 1520 | AccessclassStats[i].retriesShort, |
| 1521 | pWifiIfaceStat->AccessclassStats[i].retriesLong, |
| 1522 | pWifiIfaceStat-> |
| 1523 | AccessclassStats[i].contentionTimeMin, |
| 1524 | pWifiIfaceStat-> |
| 1525 | AccessclassStats[i].contentionTimeMax, |
| 1526 | pWifiIfaceStat-> |
| 1527 | AccessclassStats[i].contentionTimeAvg, |
| 1528 | pWifiIfaceStat-> |
| 1529 | AccessclassStats[i].contentionNumSamples); |
| 1530 | |
| 1531 | } |
| 1532 | } |
| 1533 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1534 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1535 | |
| 1536 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1537 | } |
| 1538 | |
| 1539 | /* |
| 1540 | * hdd_link_layer_process_radio_stats () - This function is called after |
| 1541 | * receiving Link Layer Radio statistics from FW.This function converts |
| 1542 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1543 | * layers. |
| 1544 | */ |
| 1545 | static v_VOID_t hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, |
| 1546 | v_VOID_t *pData) |
| 1547 | { |
| 1548 | int status, i; |
| 1549 | tpSirWifiRadioStat pWifiRadioStat; |
| 1550 | tpSirWifiChannelStats pWifiChannelStats; |
| 1551 | struct sk_buff *vendor_event; |
| 1552 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1553 | struct nlattr *chList; |
| 1554 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1555 | ENTER(); |
| 1556 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1557 | status = wlan_hdd_validate_context(pHddCtx); |
| 1558 | if (0 != status) |
| 1559 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1560 | return; |
| 1561 | } |
| 1562 | pWifiRadioStat = (tpSirWifiRadioStat) pData; |
| 1563 | |
| 1564 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1565 | "LL_STATS_RADIO" |
| 1566 | " radio is %d onTime is %u " |
| 1567 | " txTime is %u rxTime is %u " |
| 1568 | " onTimeScan is %u onTimeNbd is %u " |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1569 | " onTimeEXTScan is %u onTimeRoamScan is %u " |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1570 | " onTimePnoScan is %u onTimeHs20 is %u " |
| 1571 | " numChannels is %u", |
| 1572 | pWifiRadioStat->radio, pWifiRadioStat->onTime, |
| 1573 | pWifiRadioStat->txTime, pWifiRadioStat->rxTime, |
| 1574 | pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1575 | pWifiRadioStat->onTimeEXTScan, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1576 | pWifiRadioStat->onTimeRoamScan, |
| 1577 | pWifiRadioStat->onTimePnoScan, |
| 1578 | pWifiRadioStat->onTimeHs20, |
| 1579 | pWifiRadioStat->numChannels); |
| 1580 | /* |
| 1581 | * Allocate a size of 4096 for the Radio stats comprising |
| 1582 | * sizeof (tSirWifiRadioStat) + numChannels * sizeof |
| 1583 | * (tSirWifiChannelStats).Each channel data is put with an |
| 1584 | * NL attribute.The size of 4096 is considered assuming that |
| 1585 | * number of channels shall not exceed beyond 60 with the |
| 1586 | * sizeof (tSirWifiChannelStats) being 24 bytes. |
| 1587 | */ |
| 1588 | |
| 1589 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1590 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN , |
| 1591 | QCA_NL80211_VENDOR_SUBCMD_LL_RADIO_STATS_INDEX, |
| 1592 | GFP_KERNEL); |
| 1593 | |
| 1594 | if (!vendor_event) |
| 1595 | { |
| 1596 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1597 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1598 | return; |
| 1599 | } |
| 1600 | |
| 1601 | if (nla_put_u32(vendor_event, |
| 1602 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID, |
| 1603 | pWifiRadioStat->radio) || |
| 1604 | nla_put_u32(vendor_event, |
| 1605 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME, |
| 1606 | pWifiRadioStat->onTime) || |
| 1607 | nla_put_u32(vendor_event, |
| 1608 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME, |
| 1609 | pWifiRadioStat->txTime) || |
| 1610 | nla_put_u32(vendor_event, |
| 1611 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME, |
| 1612 | pWifiRadioStat->rxTime) || |
| 1613 | nla_put_u32(vendor_event, |
| 1614 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN, |
| 1615 | pWifiRadioStat->onTimeScan) || |
| 1616 | nla_put_u32(vendor_event, |
| 1617 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD, |
| 1618 | pWifiRadioStat->onTimeNbd) || |
| 1619 | nla_put_u32(vendor_event, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1620 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_EXTSCAN, |
| 1621 | pWifiRadioStat->onTimeEXTScan)|| |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1622 | nla_put_u32(vendor_event, |
| 1623 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN, |
| 1624 | pWifiRadioStat->onTimeRoamScan) || |
| 1625 | nla_put_u32(vendor_event, |
| 1626 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN, |
| 1627 | pWifiRadioStat->onTimePnoScan) || |
| 1628 | nla_put_u32(vendor_event, |
| 1629 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20, |
| 1630 | pWifiRadioStat->onTimeHs20) || |
| 1631 | nla_put_u32(vendor_event, |
| 1632 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS, |
| 1633 | pWifiRadioStat->numChannels)) |
| 1634 | { |
| 1635 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1636 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1637 | kfree_skb(vendor_event); |
| 1638 | return ; |
| 1639 | } |
| 1640 | |
| 1641 | chList = nla_nest_start(vendor_event, |
| 1642 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1643 | if(!chList) |
| 1644 | { |
| 1645 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1646 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO put fail", |
| 1647 | __func__); |
| 1648 | kfree_skb(vendor_event); |
| 1649 | return; |
| 1650 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1651 | for (i = 0; i < pWifiRadioStat->numChannels; i++) |
| 1652 | { |
| 1653 | struct nlattr *chInfo; |
| 1654 | |
| 1655 | pWifiChannelStats = (tpSirWifiChannelStats) ((uint8*) |
| 1656 | pWifiRadioStat->channels + |
| 1657 | (i * sizeof(tSirWifiChannelStats))); |
| 1658 | |
| 1659 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1660 | " %d) Channel Info" |
| 1661 | " width is %u " |
| 1662 | " CenterFreq %u " |
| 1663 | " CenterFreq0 %u " |
| 1664 | " CenterFreq1 %u " |
| 1665 | " onTime %u " |
| 1666 | " ccaBusyTime %u", |
| 1667 | i, |
| 1668 | pWifiChannelStats->channel.width, |
| 1669 | pWifiChannelStats->channel.centerFreq, |
| 1670 | pWifiChannelStats->channel.centerFreq0, |
| 1671 | pWifiChannelStats->channel.centerFreq1, |
| 1672 | pWifiChannelStats->onTime, |
| 1673 | pWifiChannelStats->ccaBusyTime); |
| 1674 | |
| 1675 | |
| 1676 | chInfo = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1677 | if(!chInfo) |
| 1678 | { |
| 1679 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1680 | "%s: failed to put chInfo", |
| 1681 | __func__); |
| 1682 | kfree_skb(vendor_event); |
| 1683 | return; |
| 1684 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1685 | |
| 1686 | if (nla_put_u32(vendor_event, |
| 1687 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH, |
| 1688 | pWifiChannelStats->channel.width) || |
| 1689 | nla_put_u32(vendor_event, |
| 1690 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ, |
| 1691 | pWifiChannelStats->channel.centerFreq) || |
| 1692 | nla_put_u32(vendor_event, |
| 1693 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ0, |
| 1694 | pWifiChannelStats->channel.centerFreq0) || |
| 1695 | nla_put_u32(vendor_event, |
| 1696 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ1, |
| 1697 | pWifiChannelStats->channel.centerFreq1) || |
| 1698 | nla_put_u32(vendor_event, |
| 1699 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME, |
| 1700 | pWifiChannelStats->onTime) || |
| 1701 | nla_put_u32(vendor_event, |
| 1702 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME, |
| 1703 | pWifiChannelStats->ccaBusyTime)) |
| 1704 | { |
| 1705 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1706 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1707 | kfree_skb(vendor_event); |
| 1708 | return ; |
| 1709 | } |
| 1710 | nla_nest_end(vendor_event, chInfo); |
| 1711 | } |
| 1712 | nla_nest_end(vendor_event, chList); |
| 1713 | |
| 1714 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1715 | |
| 1716 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1717 | return; |
| 1718 | } |
| 1719 | |
| 1720 | /* |
| 1721 | * hdd_link_layer_stats_ind_callback () - This function is called after |
| 1722 | * receiving Link Layer indications from FW.This callback converts the firmware |
| 1723 | * data to the NL data and send the same to the kernel/upper layers. |
| 1724 | */ |
| 1725 | static void hdd_link_layer_stats_ind_callback ( void *pCtx, |
| 1726 | int indType, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1727 | void *pRsp, u8 *macAddr) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1728 | { |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1729 | hdd_context_t *pHddCtx = (hdd_context_t *)pCtx; |
| 1730 | hdd_adapter_t *pAdapter = NULL; |
| 1731 | tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults)pRsp; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1732 | int status; |
| 1733 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1734 | ENTER(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1735 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1736 | status = wlan_hdd_validate_context(pHddCtx); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1737 | if (0 != status) |
| 1738 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1739 | return; |
| 1740 | } |
| 1741 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1742 | pAdapter = hdd_get_adapter_by_macaddr(pHddCtx, macAddr); |
| 1743 | if (NULL == pAdapter) |
| 1744 | { |
| 1745 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1746 | FL(" MAC address %pM does not exist with host"), |
| 1747 | macAddr); |
| 1748 | return; |
| 1749 | } |
| 1750 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1751 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1752 | "%s: Interface: %s LLStats indType: %d", __func__, |
| 1753 | pAdapter->dev->name, indType); |
| 1754 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1755 | switch (indType) |
| 1756 | { |
| 1757 | case SIR_HAL_LL_STATS_RESULTS_RSP: |
| 1758 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1759 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1760 | FL("RESPONSE SIR_HAL_LL_STATS_RESULTS_RSP") ); |
| 1761 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1762 | "LL_STATS RESULTS RESPONSE paramID = 0x%x", |
| 1763 | linkLayerStatsResults->paramId); |
| 1764 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1765 | "LL_STATS RESULTS RESPONSE ifaceId = %u MAC: %pM", |
| 1766 | linkLayerStatsResults->ifaceId, macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1767 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1768 | "LL_STATS RESULTS RESPONSE respId = %u", |
| 1769 | linkLayerStatsResults->respId); |
| 1770 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1771 | "LL_STATS RESULTS RESPONSE moreResultToFollow = %u", |
| 1772 | linkLayerStatsResults->moreResultToFollow); |
| 1773 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1774 | "LL_STATS RESULTS RESPONSE result = %p", |
| 1775 | linkLayerStatsResults->result); |
| 1776 | if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO ) |
| 1777 | { |
| 1778 | hdd_link_layer_process_radio_stats(pAdapter, |
| 1779 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1780 | } |
| 1781 | else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE ) |
| 1782 | { |
| 1783 | hdd_link_layer_process_iface_stats(pAdapter, |
| 1784 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1785 | } |
| 1786 | else if ( linkLayerStatsResults->paramId & |
| 1787 | WMI_LINK_STATS_ALL_PEER ) |
| 1788 | { |
| 1789 | hdd_link_layer_process_peer_stats(pAdapter, |
| 1790 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1791 | } /* WMI_LINK_STATS_ALL_PEER */ |
| 1792 | else |
| 1793 | { |
| 1794 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1795 | FL("INVALID LL_STATS_NOTIFY RESPONSE ***********")); |
| 1796 | } |
| 1797 | |
| 1798 | break; |
| 1799 | } |
| 1800 | default: |
| 1801 | hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType); |
| 1802 | break; |
| 1803 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1804 | |
| 1805 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1806 | return; |
| 1807 | } |
| 1808 | |
| 1809 | const struct |
| 1810 | nla_policy |
| 1811 | qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX +1] = |
| 1812 | { |
| 1813 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = |
| 1814 | { .type = NLA_U32 }, |
| 1815 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = |
| 1816 | { .type = NLA_U32 }, |
| 1817 | }; |
| 1818 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1819 | static int __wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1820 | struct wireless_dev *wdev, |
| 1821 | const void *data, |
| 1822 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1823 | { |
| 1824 | int status; |
| 1825 | 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] | 1826 | tSirLLStatsSetReq linkLayerStatsSetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1827 | struct net_device *dev = wdev->netdev; |
| 1828 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1829 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1830 | hdd_station_ctx_t *pHddStaCtx; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1831 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1832 | ENTER(); |
| 1833 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1834 | status = wlan_hdd_validate_context(pHddCtx); |
| 1835 | if (0 != status) |
| 1836 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1837 | return -EINVAL; |
| 1838 | } |
| 1839 | |
| 1840 | if (NULL == pAdapter) |
| 1841 | { |
| 1842 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1843 | FL("HDD adapter is Null")); |
| 1844 | return -ENODEV; |
| 1845 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1846 | /* check the LLStats Capability */ |
| 1847 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1848 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1849 | { |
| 1850 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1851 | FL("Link Layer Statistics not supported by Firmware")); |
| 1852 | return -EINVAL; |
| 1853 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1854 | |
| 1855 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, |
| 1856 | (struct nlattr *)data, |
| 1857 | data_len, qca_wlan_vendor_ll_set_policy)) |
| 1858 | { |
| 1859 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1860 | return -EINVAL; |
| 1861 | } |
| 1862 | if (!tb_vendor |
| 1863 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]) |
| 1864 | { |
| 1865 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MPDU size Not present")); |
| 1866 | return -EINVAL; |
| 1867 | } |
| 1868 | if (!tb_vendor[ |
| 1869 | QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]) |
| 1870 | { |
| 1871 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Stats Gathering Not Present")); |
| 1872 | return -EINVAL; |
| 1873 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1874 | // 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] | 1875 | linkLayerStatsSetReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1876 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1877 | linkLayerStatsSetReq.mpduSizeThreshold = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1878 | nla_get_u32( |
| 1879 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]); |
| 1880 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1881 | linkLayerStatsSetReq.aggressiveStatisticsGathering = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1882 | nla_get_u32( |
| 1883 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]); |
| 1884 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1885 | vos_mem_copy(linkLayerStatsSetReq.macAddr, |
| 1886 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1887 | |
| 1888 | |
| 1889 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1890 | "LL_STATS_SET reqId = %d", linkLayerStatsSetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1891 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1892 | "LL_STATS_SET MAC = %pM", linkLayerStatsSetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1893 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1894 | "LL_STATS_SET mpduSizeThreshold = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1895 | linkLayerStatsSetReq.mpduSizeThreshold); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1896 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1897 | "LL_STATS_SET aggressive Statistics Gathering = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1898 | linkLayerStatsSetReq.aggressiveStatisticsGathering); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1899 | |
| 1900 | if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB( |
| 1901 | pHddCtx->hHal, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1902 | hdd_link_layer_stats_ind_callback)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1903 | { |
| 1904 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1905 | "sme_SetLinkLayerStatsIndCB Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1906 | return -EINVAL; |
| 1907 | |
| 1908 | } |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1909 | |
| 1910 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1911 | if (VOS_STATUS_SUCCESS != |
| 1912 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1913 | pHddStaCtx->conn_info.staId[0], WIFI_STATS_IFACE)) |
| 1914 | { |
| 1915 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1916 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 1917 | return -EINVAL; |
| 1918 | } |
| 1919 | |
| 1920 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 1921 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 1922 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 1923 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 1924 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1925 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1926 | &linkLayerStatsSetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1927 | { |
| 1928 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1929 | "sme_LLStatsSetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1930 | return -EINVAL; |
| 1931 | } |
| 1932 | |
| 1933 | pAdapter->isLinkLayerStatsSet = 1; |
| 1934 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1935 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1936 | return 0; |
| 1937 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1938 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1939 | struct wireless_dev *wdev, |
| 1940 | const void *data, |
| 1941 | int data_len) |
| 1942 | { |
| 1943 | int ret = 0; |
| 1944 | |
| 1945 | vos_ssr_protect(__func__); |
| 1946 | ret = __wlan_hdd_cfg80211_ll_stats_set(wiphy, wdev, data, data_len); |
| 1947 | vos_ssr_unprotect(__func__); |
| 1948 | |
| 1949 | return ret; |
| 1950 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1951 | |
| 1952 | const struct |
| 1953 | nla_policy |
| 1954 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 1955 | { |
| 1956 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 1957 | * command. When reporting |
| 1958 | * the stats results, the driver uses the same value to indicate |
| 1959 | * which GET request the results |
| 1960 | * correspond to. |
| 1961 | */ |
| 1962 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 1963 | |
| 1964 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 1965 | requested for retrieval */ |
| 1966 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 1967 | }; |
| 1968 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1969 | static int __wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1970 | struct wireless_dev *wdev, |
| 1971 | const void *data, |
| 1972 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1973 | { |
| 1974 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1975 | 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] | 1976 | tSirLLStatsGetReq linkLayerStatsGetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1977 | struct net_device *dev = wdev->netdev; |
| 1978 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1979 | int status; |
| 1980 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1981 | ENTER(); |
| 1982 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1983 | status = wlan_hdd_validate_context(pHddCtx); |
| 1984 | if (0 != status) |
| 1985 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1986 | return -EINVAL ; |
| 1987 | } |
| 1988 | |
| 1989 | if (NULL == pAdapter) |
| 1990 | { |
| 1991 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1992 | "%s: HDD adapter is Null", __func__); |
| 1993 | return -ENODEV; |
| 1994 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1995 | /* check the LLStats Capability */ |
| 1996 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1997 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1998 | { |
| 1999 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2000 | FL("Link Layer Statistics not supported by Firmware")); |
| 2001 | return -EINVAL; |
| 2002 | } |
| 2003 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2004 | |
| 2005 | if (!pAdapter->isLinkLayerStatsSet) |
| 2006 | { |
| 2007 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2008 | "%s: isLinkLayerStatsSet : %d", |
| 2009 | __func__, pAdapter->isLinkLayerStatsSet); |
| 2010 | return -EINVAL; |
| 2011 | } |
| 2012 | |
| 2013 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 2014 | (struct nlattr *)data, |
| 2015 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 2016 | { |
| 2017 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 2018 | return -EINVAL; |
| 2019 | } |
| 2020 | |
| 2021 | if (!tb_vendor |
| 2022 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 2023 | { |
| 2024 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 2025 | return -EINVAL; |
| 2026 | } |
| 2027 | |
| 2028 | if (!tb_vendor |
| 2029 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 2030 | { |
| 2031 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 2032 | return -EINVAL; |
| 2033 | } |
| 2034 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2035 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2036 | linkLayerStatsGetReq.reqId = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2037 | nla_get_u32( tb_vendor[ |
| 2038 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2039 | linkLayerStatsGetReq.paramIdMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2040 | nla_get_u32( tb_vendor[ |
| 2041 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 2042 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2043 | vos_mem_copy(linkLayerStatsGetReq.macAddr, |
| 2044 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2045 | |
| 2046 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2047 | "LL_STATS_GET reqId = %d", linkLayerStatsGetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2048 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2049 | "LL_STATS_GET MAC = %pM", linkLayerStatsGetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2050 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2051 | "LL_STATS_GET paramIdMask = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2052 | linkLayerStatsGetReq.paramIdMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2053 | |
| 2054 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2055 | &linkLayerStatsGetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2056 | { |
| 2057 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2058 | "sme_LLStatsGetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2059 | return -EINVAL; |
| 2060 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2061 | |
| 2062 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2063 | return 0; |
| 2064 | } |
| 2065 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2066 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 2067 | struct wireless_dev *wdev, |
| 2068 | const void *data, |
| 2069 | int data_len) |
| 2070 | { |
| 2071 | int ret = 0; |
| 2072 | |
| 2073 | vos_ssr_protect(__func__); |
| 2074 | ret = __wlan_hdd_cfg80211_ll_stats_get(wiphy, wdev, data, data_len); |
| 2075 | vos_ssr_unprotect(__func__); |
| 2076 | |
| 2077 | return ret; |
| 2078 | } |
| 2079 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2080 | const struct |
| 2081 | nla_policy |
| 2082 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 2083 | { |
| 2084 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 2085 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 2086 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 2087 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 2088 | }; |
| 2089 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2090 | static int __wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 2091 | struct wireless_dev *wdev, |
| 2092 | const void *data, |
| 2093 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2094 | { |
| 2095 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 2096 | 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] | 2097 | tSirLLStatsClearReq linkLayerStatsClearReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2098 | struct net_device *dev = wdev->netdev; |
| 2099 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2100 | u32 statsClearReqMask; |
| 2101 | u8 stopReq; |
| 2102 | int status; |
| 2103 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2104 | ENTER(); |
| 2105 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2106 | status = wlan_hdd_validate_context(pHddCtx); |
| 2107 | if (0 != status) |
| 2108 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2109 | return -EINVAL; |
| 2110 | } |
| 2111 | |
| 2112 | if (NULL == pAdapter) |
| 2113 | { |
| 2114 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2115 | "%s: HDD adapter is Null", __func__); |
| 2116 | return -ENODEV; |
| 2117 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2118 | /* check the LLStats Capability */ |
| 2119 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 2120 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 2121 | { |
| 2122 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2123 | FL("Enable LLStats Capability")); |
| 2124 | return -EINVAL; |
| 2125 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2126 | |
| 2127 | if (!pAdapter->isLinkLayerStatsSet) |
| 2128 | { |
| 2129 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2130 | "%s: isLinkLayerStatsSet : %d", |
| 2131 | __func__, pAdapter->isLinkLayerStatsSet); |
| 2132 | return -EINVAL; |
| 2133 | } |
| 2134 | |
| 2135 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 2136 | (struct nlattr *)data, |
| 2137 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 2138 | { |
| 2139 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 2140 | return -EINVAL; |
| 2141 | } |
| 2142 | |
| 2143 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 2144 | |
| 2145 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 2146 | { |
| 2147 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 2148 | return -EINVAL; |
| 2149 | |
| 2150 | } |
| 2151 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2152 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2153 | statsClearReqMask = linkLayerStatsClearReq.statsClearReqMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2154 | nla_get_u32( |
| 2155 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 2156 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2157 | stopReq = linkLayerStatsClearReq.stopReq = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2158 | nla_get_u8( |
| 2159 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 2160 | |
| 2161 | // 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] | 2162 | linkLayerStatsClearReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2163 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2164 | vos_mem_copy(linkLayerStatsClearReq.macAddr, |
| 2165 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2166 | |
| 2167 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2168 | "LL_STATS_CLEAR reqId = %d", linkLayerStatsClearReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2169 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2170 | "LL_STATS_CLEAR MAC = %pM", linkLayerStatsClearReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2171 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2172 | "LL_STATS_CLEAR statsClearReqMask = 0x%X", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2173 | linkLayerStatsClearReq.statsClearReqMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2174 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2175 | "LL_STATS_CLEAR stopReq = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2176 | linkLayerStatsClearReq.stopReq); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2177 | |
| 2178 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2179 | &linkLayerStatsClearReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2180 | { |
| 2181 | struct sk_buff *temp_skbuff; |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 2182 | hdd_station_ctx_t *pHddStaCtx; |
| 2183 | |
| 2184 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2185 | if (VOS_STATUS_SUCCESS != |
| 2186 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 2187 | pHddStaCtx->conn_info.staId[0], statsClearReqMask)) |
| 2188 | { |
| 2189 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2190 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 2191 | return -EINVAL; |
| 2192 | } |
| 2193 | if ((statsClearReqMask & WIFI_STATS_IFACE_AC) || |
| 2194 | (statsClearReqMask & WIFI_STATS_IFACE)) { |
| 2195 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 2196 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 2197 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 2198 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 2199 | } |
| 2200 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2201 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 2202 | 2 * sizeof(u32) + |
| 2203 | NLMSG_HDRLEN); |
| 2204 | |
| 2205 | if (temp_skbuff != NULL) |
| 2206 | { |
| 2207 | |
| 2208 | if (nla_put_u32(temp_skbuff, |
| 2209 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 2210 | statsClearReqMask) || |
| 2211 | nla_put_u32(temp_skbuff, |
| 2212 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 2213 | stopReq)) |
| 2214 | { |
| 2215 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 2216 | kfree_skb(temp_skbuff); |
| 2217 | return -EINVAL; |
| 2218 | } |
| 2219 | /* If the ask is to stop the stats collection as part of clear |
| 2220 | * (stopReq = 1) , ensure that no further requests of get |
| 2221 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 2222 | * However it the stopReq as part of the clear request is 0 , |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2223 | * the request to get the statistics are honoured as in this |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2224 | * case the firmware is just asked to clear the statistics. |
| 2225 | */ |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2226 | if (linkLayerStatsClearReq.stopReq == 1) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2227 | pAdapter->isLinkLayerStatsSet = 0; |
| 2228 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 2229 | } |
| 2230 | return -ENOMEM; |
| 2231 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2232 | |
| 2233 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2234 | return -EINVAL; |
| 2235 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2236 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 2237 | struct wireless_dev *wdev, |
| 2238 | const void *data, |
| 2239 | int data_len) |
| 2240 | { |
| 2241 | int ret = 0; |
| 2242 | |
| 2243 | vos_ssr_protect(__func__); |
| 2244 | ret = __wlan_hdd_cfg80211_ll_stats_clear(wiphy, wdev, data, data_len); |
| 2245 | vos_ssr_unprotect(__func__); |
| 2246 | |
| 2247 | return ret; |
| 2248 | |
| 2249 | |
| 2250 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2251 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 2252 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2253 | #ifdef WLAN_FEATURE_EXTSCAN |
| 2254 | static const struct nla_policy |
| 2255 | wlan_hdd_extscan_config_policy |
| 2256 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = |
| 2257 | { |
| 2258 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = |
| 2259 | { .type = NLA_U32 }, |
| 2260 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = |
| 2261 | { .type = NLA_U32 }, |
| 2262 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 }, |
| 2263 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = |
| 2264 | { .type = NLA_U32 }, |
| 2265 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = { .type = NLA_U8 }, |
| 2266 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = { .type = NLA_U8 }, |
| 2267 | |
| 2268 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = { .type = NLA_U8 }, |
| 2269 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = { .type = NLA_U8 }, |
| 2270 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 }, |
| 2271 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = |
| 2272 | { .type = NLA_U8 }, |
| 2273 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = |
| 2274 | { .type = NLA_U32 }, |
| 2275 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = |
| 2276 | { .type = NLA_U32 }, |
| 2277 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = |
| 2278 | { .type = NLA_U32 }, |
| 2279 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD] = |
| 2280 | { .type = NLA_U8 }, |
| 2281 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = |
| 2282 | { .type = NLA_U8 }, |
| 2283 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = |
| 2284 | { .type = NLA_U8 }, |
| 2285 | |
| 2286 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = |
| 2287 | { .type = NLA_U32 }, |
| 2288 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = |
| 2289 | { .type = NLA_UNSPEC }, |
| 2290 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = |
| 2291 | { .type = NLA_S32 }, |
| 2292 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = |
| 2293 | { .type = NLA_S32 }, |
| 2294 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = |
| 2295 | { .type = NLA_U32 }, |
| 2296 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = |
| 2297 | { .type = NLA_U32 }, |
| 2298 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE] = |
| 2299 | { .type = NLA_U32 }, |
| 2300 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE] |
| 2301 | = { .type = NLA_U32 }, |
| 2302 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING] = |
| 2303 | { .type = NLA_U32 }, |
| 2304 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP] = { .type = |
| 2305 | NLA_U32 }, |
| 2306 | }; |
| 2307 | |
| 2308 | static void wlan_hdd_cfg80211_extscan_get_capabilities_ind(void *ctx, void *pMsg) |
| 2309 | { |
| 2310 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2311 | struct sk_buff *skb = NULL; |
| 2312 | tpSirEXTScanCapabilitiesEvent pData = |
| 2313 | (tpSirEXTScanCapabilitiesEvent) pMsg; |
| 2314 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2315 | ENTER(); |
| 2316 | |
| 2317 | if (wlan_hdd_validate_context(pHddCtx)) |
| 2318 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2319 | return; |
| 2320 | } |
| 2321 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2322 | if (!pMsg) |
| 2323 | { |
| 2324 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2325 | return; |
| 2326 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2327 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2328 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2329 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES_INDEX, |
| 2330 | GFP_KERNEL); |
| 2331 | |
| 2332 | if (!skb) { |
| 2333 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2334 | FL("cfg80211_vendor_event_alloc failed")); |
| 2335 | return; |
| 2336 | } |
| 2337 | |
| 2338 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2339 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan cache size (%u)", pData->scanCacheSize); |
| 2340 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan buckets (%u)", pData->scanBuckets); |
| 2341 | hddLog(VOS_TRACE_LEVEL_INFO, "Max AP per scan (%u)", pData->maxApPerScan); |
| 2342 | hddLog(VOS_TRACE_LEVEL_INFO, "maxRssiSampleSize (%u)", |
| 2343 | pData->maxRssiSampleSize); |
| 2344 | hddLog(VOS_TRACE_LEVEL_INFO, "maxScanReportingThreshold (%u)", |
| 2345 | pData->maxScanReportingThreshold); |
| 2346 | hddLog(VOS_TRACE_LEVEL_INFO, "maxHotlistAPs (%u)", pData->maxHotlistAPs); |
| 2347 | hddLog(VOS_TRACE_LEVEL_INFO, "maxSignificantWifiChangeAPs (%u)", |
| 2348 | pData->maxSignificantWifiChangeAPs); |
| 2349 | hddLog(VOS_TRACE_LEVEL_INFO, "maxBsidHistoryEntries (%u)", |
| 2350 | pData->maxBsidHistoryEntries); |
| 2351 | |
| 2352 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2353 | pData->requestId) || |
| 2354 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status) || |
| 2355 | nla_put_u32(skb, |
| 2356 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE, |
| 2357 | pData->scanCacheSize) || |
| 2358 | nla_put_u32(skb, |
| 2359 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS, |
| 2360 | pData->scanBuckets) || |
| 2361 | nla_put_u32(skb, |
| 2362 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN, |
| 2363 | pData->maxApPerScan) || |
| 2364 | nla_put_u32(skb, |
| 2365 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE, |
| 2366 | pData->maxRssiSampleSize) || |
| 2367 | nla_put_u32(skb, |
| 2368 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD, |
| 2369 | pData->maxScanReportingThreshold) || |
| 2370 | nla_put_u32(skb, |
| 2371 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_APS, |
| 2372 | pData->maxHotlistAPs) || |
| 2373 | nla_put_u32(skb, |
| 2374 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS, |
| 2375 | pData->maxSignificantWifiChangeAPs) || |
| 2376 | nla_put_u32(skb, |
| 2377 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES, |
| 2378 | pData->maxBsidHistoryEntries)) { |
| 2379 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2380 | goto nla_put_failure; |
| 2381 | } |
| 2382 | |
| 2383 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2384 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2385 | return; |
| 2386 | |
| 2387 | nla_put_failure: |
| 2388 | kfree_skb(skb); |
| 2389 | return; |
| 2390 | } |
| 2391 | |
| 2392 | |
| 2393 | static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg) |
| 2394 | { |
| 2395 | tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg; |
| 2396 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2397 | struct sk_buff *skb = NULL; |
| 2398 | tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal ); |
| 2399 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2400 | ENTER(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2401 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2402 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2403 | return; |
| 2404 | } |
| 2405 | if (!pMsg) |
| 2406 | { |
| 2407 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2408 | return; |
| 2409 | } |
| 2410 | |
| 2411 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2412 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2413 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START_INDEX, |
| 2414 | GFP_KERNEL); |
| 2415 | |
| 2416 | if (!skb) { |
| 2417 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2418 | FL("cfg80211_vendor_event_alloc failed")); |
| 2419 | return; |
| 2420 | } |
| 2421 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2422 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2423 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2424 | |
| 2425 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2426 | pData->requestId) || |
| 2427 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2428 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2429 | goto nla_put_failure; |
| 2430 | } |
| 2431 | |
| 2432 | /* |
| 2433 | * Store the Request ID for comparing with the requestID obtained |
| 2434 | * in other requests.HDD shall return a failure is the extscan_stop |
| 2435 | * request is issued with a different requestId as that of the |
| 2436 | * extscan_start request. Also, This requestId shall be used while |
| 2437 | * indicating the full scan results to the upper layers. |
| 2438 | * The requestId is stored with the assumption that the firmware |
| 2439 | * shall return the ext scan start request's requestId in ext scan |
| 2440 | * start response. |
| 2441 | */ |
| 2442 | if (pData->status == 0) |
| 2443 | pMac->sme.extScanStartReqId = pData->requestId; |
| 2444 | |
| 2445 | |
| 2446 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2447 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2448 | return; |
| 2449 | |
| 2450 | nla_put_failure: |
| 2451 | kfree_skb(skb); |
| 2452 | return; |
| 2453 | } |
| 2454 | |
| 2455 | |
| 2456 | static void wlan_hdd_cfg80211_extscan_stop_rsp(void *ctx, void *pMsg) |
| 2457 | { |
| 2458 | tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg; |
| 2459 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2460 | struct sk_buff *skb = NULL; |
| 2461 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2462 | ENTER(); |
| 2463 | |
| 2464 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2465 | return; |
| 2466 | } |
| 2467 | if (!pMsg) |
| 2468 | { |
| 2469 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2470 | return; |
| 2471 | } |
| 2472 | |
| 2473 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2474 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2475 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP_INDEX, |
| 2476 | GFP_KERNEL); |
| 2477 | |
| 2478 | if (!skb) { |
| 2479 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2480 | FL("cfg80211_vendor_event_alloc failed")); |
| 2481 | return; |
| 2482 | } |
| 2483 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2484 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2485 | |
| 2486 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2487 | pData->requestId) || |
| 2488 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2489 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2490 | goto nla_put_failure; |
| 2491 | } |
| 2492 | |
| 2493 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2494 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2495 | return; |
| 2496 | |
| 2497 | nla_put_failure: |
| 2498 | kfree_skb(skb); |
| 2499 | return; |
| 2500 | } |
| 2501 | |
| 2502 | |
| 2503 | static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx, |
| 2504 | void *pMsg) |
| 2505 | { |
| 2506 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2507 | struct sk_buff *skb = NULL; |
| 2508 | tpSirEXTScanSetBssidHotListRspParams pData = |
| 2509 | (tpSirEXTScanSetBssidHotListRspParams) pMsg; |
| 2510 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2511 | ENTER(); |
| 2512 | |
| 2513 | if (wlan_hdd_validate_context(pHddCtx)){ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2514 | return; |
| 2515 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2516 | if (!pMsg) |
| 2517 | { |
| 2518 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2519 | return; |
| 2520 | } |
| 2521 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2522 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2523 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2524 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST_INDEX, |
| 2525 | GFP_KERNEL); |
| 2526 | |
| 2527 | if (!skb) { |
| 2528 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2529 | FL("cfg80211_vendor_event_alloc failed")); |
| 2530 | return; |
| 2531 | } |
| 2532 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2533 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2534 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2535 | |
| 2536 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2537 | pData->requestId) || |
| 2538 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2539 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2540 | goto nla_put_failure; |
| 2541 | } |
| 2542 | |
| 2543 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2544 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2545 | return; |
| 2546 | |
| 2547 | nla_put_failure: |
| 2548 | kfree_skb(skb); |
| 2549 | return; |
| 2550 | } |
| 2551 | |
| 2552 | static void wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(void *ctx, |
| 2553 | void *pMsg) |
| 2554 | { |
| 2555 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2556 | struct sk_buff *skb = NULL; |
| 2557 | tpSirEXTScanResetBssidHotlistRspParams pData = |
| 2558 | (tpSirEXTScanResetBssidHotlistRspParams) pMsg; |
| 2559 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2560 | ENTER(); |
| 2561 | |
| 2562 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2563 | return; |
| 2564 | } |
| 2565 | if (!pMsg) |
| 2566 | { |
| 2567 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2568 | return; |
| 2569 | } |
| 2570 | |
| 2571 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2572 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2573 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST_INDEX, |
| 2574 | GFP_KERNEL); |
| 2575 | |
| 2576 | if (!skb) { |
| 2577 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2578 | FL("cfg80211_vendor_event_alloc failed")); |
| 2579 | return; |
| 2580 | } |
| 2581 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2582 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2583 | |
| 2584 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2585 | pData->requestId) || |
| 2586 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2587 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2588 | goto nla_put_failure; |
| 2589 | } |
| 2590 | |
| 2591 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2592 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2593 | return; |
| 2594 | |
| 2595 | nla_put_failure: |
| 2596 | kfree_skb(skb); |
| 2597 | return; |
| 2598 | } |
| 2599 | |
| 2600 | |
| 2601 | static void wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(void *ctx, |
| 2602 | void *pMsg) |
| 2603 | { |
| 2604 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2605 | struct sk_buff *skb = NULL; |
| 2606 | tpSirEXTScanSetSignificantChangeRspParams pData = |
| 2607 | (tpSirEXTScanSetSignificantChangeRspParams) pMsg; |
| 2608 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2609 | ENTER(); |
| 2610 | |
| 2611 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2612 | return; |
| 2613 | } |
| 2614 | if (!pMsg) |
| 2615 | { |
| 2616 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2617 | return; |
| 2618 | } |
| 2619 | |
| 2620 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2621 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2622 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE_INDEX, |
| 2623 | GFP_KERNEL); |
| 2624 | |
| 2625 | if (!skb) { |
| 2626 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2627 | FL("cfg80211_vendor_event_alloc failed")); |
| 2628 | return; |
| 2629 | } |
| 2630 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2631 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2632 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2633 | |
| 2634 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2635 | pData->requestId) || |
| 2636 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2637 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2638 | goto nla_put_failure; |
| 2639 | } |
| 2640 | |
| 2641 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2642 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2643 | return; |
| 2644 | |
| 2645 | nla_put_failure: |
| 2646 | kfree_skb(skb); |
| 2647 | return; |
| 2648 | } |
| 2649 | |
| 2650 | |
| 2651 | static void wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(void *ctx, |
| 2652 | void *pMsg) |
| 2653 | { |
| 2654 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2655 | struct sk_buff *skb = NULL; |
| 2656 | tpSirEXTScanResetSignificantChangeRspParams pData = |
| 2657 | (tpSirEXTScanResetSignificantChangeRspParams) pMsg; |
| 2658 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2659 | ENTER(); |
| 2660 | |
| 2661 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2662 | return; |
| 2663 | } |
| 2664 | if (!pMsg) |
| 2665 | { |
| 2666 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2667 | return; |
| 2668 | } |
| 2669 | |
| 2670 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2671 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2672 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE_INDEX, |
| 2673 | GFP_KERNEL); |
| 2674 | |
| 2675 | if (!skb) { |
| 2676 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2677 | FL("cfg80211_vendor_event_alloc failed")); |
| 2678 | return; |
| 2679 | } |
| 2680 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2681 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2682 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2683 | |
| 2684 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2685 | pData->requestId) || |
| 2686 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2687 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2688 | goto nla_put_failure; |
| 2689 | } |
| 2690 | |
| 2691 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2692 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2693 | return; |
| 2694 | |
| 2695 | nla_put_failure: |
| 2696 | kfree_skb(skb); |
| 2697 | return; |
| 2698 | } |
| 2699 | |
| 2700 | static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx, |
| 2701 | void *pMsg) |
| 2702 | { |
| 2703 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2704 | struct sk_buff *skb = NULL; |
| 2705 | tANI_U32 i = 0, j, resultsPerEvent; |
| 2706 | tANI_S32 totalResults; |
| 2707 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2708 | tpSirWifiScanResult pSirWifiScanResult; |
| 2709 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2710 | ENTER(); |
| 2711 | |
| 2712 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2713 | return; |
| 2714 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2715 | if (!pMsg) |
| 2716 | { |
| 2717 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2718 | return; |
| 2719 | } |
| 2720 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2721 | totalResults = pData->numOfAps; |
| 2722 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2723 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2724 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2725 | |
| 2726 | do{ |
| 2727 | resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ? |
| 2728 | EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults); |
| 2729 | totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND; |
| 2730 | |
| 2731 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2732 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2733 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS_INDEX, |
| 2734 | GFP_KERNEL); |
| 2735 | |
| 2736 | if (!skb) { |
| 2737 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2738 | FL("cfg80211_vendor_event_alloc failed")); |
| 2739 | return; |
| 2740 | } |
| 2741 | |
| 2742 | hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent); |
| 2743 | |
| 2744 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2745 | pData->requestId) || |
| 2746 | nla_put_u32(skb, |
| 2747 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2748 | resultsPerEvent)) { |
| 2749 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2750 | goto fail; |
| 2751 | } |
| 2752 | if (nla_put_u8(skb, |
| 2753 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2754 | pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 ))) |
| 2755 | { |
| 2756 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2757 | goto fail; |
| 2758 | } |
| 2759 | |
| 2760 | if (resultsPerEvent) { |
| 2761 | struct nlattr *aps; |
| 2762 | |
| 2763 | aps = nla_nest_start(skb, |
| 2764 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2765 | if (!aps) |
| 2766 | { |
| 2767 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2768 | goto fail; |
| 2769 | } |
| 2770 | |
| 2771 | for (j = 0; j < resultsPerEvent; j++, i++) { |
| 2772 | struct nlattr *ap; |
| 2773 | pSirWifiScanResult = (tpSirWifiScanResult) ((tANI_U8 *) |
| 2774 | pData->ap + ( i* sizeof(tSirWifiScanResult))); |
| 2775 | |
| 2776 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) " |
| 2777 | "Ssid (%s)" |
| 2778 | "Bssid: %pM " |
| 2779 | "Channel (%u)" |
| 2780 | "Rssi (%d)" |
| 2781 | "RTT (%u)" |
| 2782 | "RTT_SD (%u)", |
| 2783 | i, |
| 2784 | pSirWifiScanResult->ts, |
| 2785 | pSirWifiScanResult->ssid, |
| 2786 | pSirWifiScanResult->bssid, |
| 2787 | pSirWifiScanResult->channel, |
| 2788 | pSirWifiScanResult->rssi, |
| 2789 | pSirWifiScanResult->rtt, |
| 2790 | pSirWifiScanResult->rtt_sd); |
| 2791 | |
| 2792 | ap = nla_nest_start(skb, j + 1); |
| 2793 | if (!ap) |
| 2794 | { |
| 2795 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2796 | goto fail; |
| 2797 | } |
| 2798 | |
| 2799 | if (nla_put_u64(skb, |
| 2800 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2801 | pSirWifiScanResult->ts) ) |
| 2802 | { |
| 2803 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2804 | goto fail; |
| 2805 | } |
| 2806 | if (nla_put(skb, |
| 2807 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2808 | sizeof(pSirWifiScanResult->ssid), |
| 2809 | pSirWifiScanResult->ssid) ) |
| 2810 | { |
| 2811 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2812 | goto fail; |
| 2813 | } |
| 2814 | if (nla_put(skb, |
| 2815 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2816 | sizeof(pSirWifiScanResult->bssid), |
| 2817 | pSirWifiScanResult->bssid) ) |
| 2818 | { |
| 2819 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2820 | goto fail; |
| 2821 | } |
| 2822 | if (nla_put_u32(skb, |
| 2823 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2824 | pSirWifiScanResult->channel) ) |
| 2825 | { |
| 2826 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2827 | goto fail; |
| 2828 | } |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 2829 | if (nla_put_s32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2830 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2831 | pSirWifiScanResult->rssi) ) |
| 2832 | { |
| 2833 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2834 | goto fail; |
| 2835 | } |
| 2836 | if (nla_put_u32(skb, |
| 2837 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2838 | pSirWifiScanResult->rtt) ) |
| 2839 | { |
| 2840 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2841 | goto fail; |
| 2842 | } |
| 2843 | if (nla_put_u32(skb, |
| 2844 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2845 | pSirWifiScanResult->rtt_sd)) |
| 2846 | { |
| 2847 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2848 | goto fail; |
| 2849 | } |
| 2850 | |
| 2851 | nla_nest_end(skb, ap); |
| 2852 | } |
| 2853 | nla_nest_end(skb, aps); |
| 2854 | |
| 2855 | } |
| 2856 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2857 | } while (totalResults > 0); |
| 2858 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2859 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2860 | return; |
| 2861 | fail: |
| 2862 | kfree_skb(skb); |
| 2863 | return; |
| 2864 | } |
| 2865 | |
| 2866 | static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx, |
| 2867 | void *pMsg) |
| 2868 | { |
| 2869 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2870 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2871 | struct sk_buff *skb = NULL; |
| 2872 | tANI_U32 i; |
| 2873 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2874 | ENTER(); |
| 2875 | |
| 2876 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2877 | return; |
| 2878 | } |
| 2879 | if (!pMsg) |
| 2880 | { |
| 2881 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2882 | return; |
| 2883 | } |
| 2884 | |
| 2885 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2886 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2887 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX, |
| 2888 | GFP_KERNEL); |
| 2889 | |
| 2890 | if (!skb) { |
| 2891 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2892 | FL("cfg80211_vendor_event_alloc failed")); |
| 2893 | return; |
| 2894 | } |
| 2895 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2896 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2897 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2898 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2899 | |
| 2900 | for (i = 0; i < pData->numOfAps; i++) { |
| 2901 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) " |
| 2902 | "Ssid (%s) " |
| 2903 | "Bssid (" MAC_ADDRESS_STR ") " |
| 2904 | "Channel (%u) " |
| 2905 | "Rssi (%d) " |
| 2906 | "RTT (%u) " |
| 2907 | "RTT_SD (%u) ", |
| 2908 | i, |
| 2909 | pData->ap[i].ts, |
| 2910 | pData->ap[i].ssid, |
| 2911 | MAC_ADDR_ARRAY(pData->ap[i].bssid), |
| 2912 | pData->ap[i].channel, |
| 2913 | pData->ap[i].rssi, |
| 2914 | pData->ap[i].rtt, |
| 2915 | pData->ap[i].rtt_sd); |
| 2916 | } |
| 2917 | |
| 2918 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2919 | pData->requestId) || |
| 2920 | nla_put_u32(skb, |
| 2921 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2922 | pData->numOfAps)) { |
| 2923 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2924 | goto fail; |
| 2925 | } |
| 2926 | if (pData->numOfAps) { |
| 2927 | struct nlattr *aps; |
| 2928 | |
| 2929 | aps = nla_nest_start(skb, |
| 2930 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2931 | if (!aps) |
| 2932 | goto fail; |
| 2933 | |
| 2934 | for (i = 0; i < pData->numOfAps; i++) { |
| 2935 | struct nlattr *ap; |
| 2936 | |
| 2937 | ap = nla_nest_start(skb, i + 1); |
| 2938 | if (!ap) |
| 2939 | goto fail; |
| 2940 | |
| 2941 | if (nla_put_u64(skb, |
| 2942 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2943 | pData->ap[i].ts) || |
| 2944 | nla_put(skb, |
| 2945 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2946 | sizeof(pData->ap[i].ssid), |
| 2947 | pData->ap[i].ssid) || |
| 2948 | nla_put(skb, |
| 2949 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2950 | sizeof(pData->ap[i].bssid), |
| 2951 | pData->ap[i].bssid) || |
| 2952 | nla_put_u32(skb, |
| 2953 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2954 | pData->ap[i].channel) || |
| 2955 | nla_put_s32(skb, |
| 2956 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2957 | pData->ap[i].rssi) || |
| 2958 | nla_put_u32(skb, |
| 2959 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2960 | pData->ap[i].rtt) || |
| 2961 | nla_put_u32(skb, |
| 2962 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2963 | pData->ap[i].rtt_sd)) |
| 2964 | goto fail; |
| 2965 | |
| 2966 | nla_nest_end(skb, ap); |
| 2967 | } |
| 2968 | nla_nest_end(skb, aps); |
| 2969 | |
| 2970 | if (nla_put_u8(skb, |
| 2971 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2972 | pData->moreData)) |
| 2973 | goto fail; |
| 2974 | } |
| 2975 | |
| 2976 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2977 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2978 | return; |
| 2979 | |
| 2980 | fail: |
| 2981 | kfree_skb(skb); |
| 2982 | return; |
| 2983 | |
| 2984 | } |
| 2985 | static void wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(void *ctx, |
| 2986 | void *pMsg) |
| 2987 | { |
| 2988 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2989 | struct sk_buff *skb = NULL; |
| 2990 | tANI_U32 i, j; |
| 2991 | tpSirWifiSignificantChangeEvent pData = |
| 2992 | (tpSirWifiSignificantChangeEvent) pMsg; |
| 2993 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2994 | ENTER(); |
| 2995 | |
| 2996 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2997 | return; |
| 2998 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2999 | if (!pMsg) |
| 3000 | { |
| 3001 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 3002 | return; |
| 3003 | } |
| 3004 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3005 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 3006 | EXTSCAN_EVENT_BUF_SIZE, |
| 3007 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE_INDEX, |
| 3008 | GFP_KERNEL); |
| 3009 | |
| 3010 | if (!skb) { |
| 3011 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3012 | FL("cfg80211_vendor_event_alloc failed")); |
| 3013 | return; |
| 3014 | } |
| 3015 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3016 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 3017 | hddLog(VOS_TRACE_LEVEL_INFO, "total List Size %u ", pData->numSigRssiBss); |
| 3018 | hddLog(VOS_TRACE_LEVEL_INFO, " CUrrent List size (%u)", |
| 3019 | pData->numSigRssiBss); |
| 3020 | hddLog(VOS_TRACE_LEVEL_INFO, "moreData (%u)", pData->moreData); |
| 3021 | |
| 3022 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 3023 | hddLog(VOS_TRACE_LEVEL_INFO , "Rssi List [%d] BSSID: (%pM) Channel %u " |
| 3024 | " num RSSI %u ", |
| 3025 | i, pData->sigRssiResult[i].bssid, |
| 3026 | pData->sigRssiResult[i].channel, |
| 3027 | pData->sigRssiResult[i].numRssi); |
| 3028 | |
| 3029 | for (j = 0; j < pData->sigRssiResult[i].numRssi; j++){ |
| 3030 | |
| 3031 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3032 | " [%d]", |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 3033 | pData->sigRssiResult[i].rssi[j]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3034 | |
| 3035 | } |
| 3036 | } |
| 3037 | |
| 3038 | |
| 3039 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3040 | pData->requestId) || |
| 3041 | nla_put_u32(skb, |
| 3042 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3043 | pData->numSigRssiBss)) { |
| 3044 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3045 | goto fail; |
| 3046 | } |
| 3047 | |
| 3048 | if (pData->numSigRssiBss) { |
| 3049 | struct nlattr *aps; |
| 3050 | aps = nla_nest_start(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 3051 | if (!aps) |
| 3052 | goto fail; |
| 3053 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 3054 | struct nlattr *ap; |
| 3055 | |
| 3056 | ap = nla_nest_start(skb, i); |
| 3057 | if (!ap) |
| 3058 | goto fail; |
| 3059 | if (nla_put(skb, |
| 3060 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_BSSID, |
| 3061 | sizeof(tSirMacAddr), pData->sigRssiResult[i].bssid) || |
| 3062 | nla_put_u32(skb, |
| 3063 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_CHANNEL, |
| 3064 | pData->sigRssiResult[i].channel) || |
| 3065 | nla_put_u32(skb, |
| 3066 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_NUM_RSSI, |
| 3067 | pData->sigRssiResult[i].numRssi) || |
| 3068 | nla_put(skb, |
| 3069 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_RSSI_LIST, |
| 3070 | sizeof(s32) * pData->sigRssiResult[i].numRssi, |
| 3071 | pData->sigRssiResult[i].rssi)) |
| 3072 | goto fail; |
| 3073 | nla_nest_end(skb, ap); |
| 3074 | } |
| 3075 | nla_nest_end(skb, aps); |
| 3076 | if (nla_put_u8(skb, |
| 3077 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 3078 | pData->moreData)) |
| 3079 | goto fail; |
| 3080 | } |
| 3081 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3082 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3083 | return; |
| 3084 | fail: |
| 3085 | kfree_skb(skb); |
| 3086 | return; |
| 3087 | } |
| 3088 | |
| 3089 | static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx, |
| 3090 | void *pMsg) |
| 3091 | { |
| 3092 | struct sk_buff *skb; |
| 3093 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3094 | tpSirWifiFullScanResultEvent pData = |
| 3095 | (tpSirWifiFullScanResultEvent) (pMsg); |
| 3096 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3097 | ENTER(); |
| 3098 | |
| 3099 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 3100 | return; |
| 3101 | } |
| 3102 | if (!pMsg) |
| 3103 | { |
| 3104 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3105 | return; |
| 3106 | } |
| 3107 | |
| 3108 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 3109 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3110 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX, |
| 3111 | GFP_KERNEL); |
| 3112 | |
| 3113 | if (!skb) { |
| 3114 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3115 | FL("cfg80211_vendor_event_alloc failed")); |
| 3116 | return; |
| 3117 | } |
| 3118 | |
| 3119 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3120 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId); |
| 3121 | hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData); |
| 3122 | hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) " |
| 3123 | "Ssid (%s)" |
| 3124 | "Bssid (" MAC_ADDRESS_STR ")" |
| 3125 | "Channel (%u)" |
| 3126 | "Rssi (%d)" |
| 3127 | "RTT (%u)" |
| 3128 | "RTT_SD (%u)"), |
| 3129 | pData->ap.ts, |
| 3130 | pData->ap.ssid, |
| 3131 | MAC_ADDR_ARRAY(pData->ap.bssid), |
| 3132 | pData->ap.channel, |
| 3133 | pData->ap.rssi, |
| 3134 | pData->ap.rtt, |
| 3135 | pData->ap.rtt_sd); |
| 3136 | hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength); |
| 3137 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3138 | pData->requestId) || |
| 3139 | nla_put_u64(skb, |
| 3140 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 3141 | pData->ap.ts) || |
| 3142 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 3143 | sizeof(pData->ap.ssid), |
| 3144 | pData->ap.ssid) || |
| 3145 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 3146 | WNI_CFG_BSSID_LEN, |
| 3147 | pData->ap.bssid) || |
| 3148 | nla_put_u32(skb, |
| 3149 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 3150 | pData->ap.channel) || |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 3151 | 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] | 3152 | pData->ap.rssi) || |
| 3153 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 3154 | pData->ap.rtt) || |
| 3155 | nla_put_u32(skb, |
| 3156 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 3157 | pData->ap.rtt_sd) || |
| 3158 | nla_put_u16(skb, |
| 3159 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 3160 | pData->ap.beaconPeriod) || |
| 3161 | nla_put_u16(skb, |
| 3162 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 3163 | pData->ap.capability) || |
| 3164 | nla_put_u32(skb, |
| 3165 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
| 3166 | pData->ieLength)) |
| 3167 | { |
| 3168 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3169 | goto nla_put_failure; |
| 3170 | } |
| 3171 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 3172 | pData->ieLength, |
| 3173 | pData->ie)) |
| 3174 | { |
| 3175 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3176 | goto nla_put_failure; |
| 3177 | } |
| 3178 | |
| 3179 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3180 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3181 | return; |
| 3182 | |
| 3183 | nla_put_failure: |
| 3184 | kfree_skb(skb); |
| 3185 | return; |
| 3186 | } |
| 3187 | |
| 3188 | static void wlan_hdd_cfg80211_extscan_scan_res_available_event(void *ctx, |
| 3189 | void *pMsg) |
| 3190 | { |
| 3191 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3192 | struct sk_buff *skb = NULL; |
| 3193 | tpSirEXTScanResultsAvailableIndParams pData = |
| 3194 | (tpSirEXTScanResultsAvailableIndParams) pMsg; |
| 3195 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3196 | ENTER(); |
| 3197 | |
| 3198 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 3199 | return; |
| 3200 | } |
| 3201 | if (!pMsg) |
| 3202 | { |
| 3203 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3204 | return; |
| 3205 | } |
| 3206 | |
| 3207 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 3208 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3209 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX, |
| 3210 | GFP_KERNEL); |
| 3211 | |
| 3212 | if (!skb) { |
| 3213 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3214 | FL("cfg80211_vendor_event_alloc failed")); |
| 3215 | return; |
| 3216 | } |
| 3217 | |
| 3218 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3219 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 3220 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", |
| 3221 | pData->numResultsAvailable); |
| 3222 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3223 | pData->requestId) || |
| 3224 | nla_put_u32(skb, |
| 3225 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3226 | pData->numResultsAvailable)) { |
| 3227 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3228 | goto nla_put_failure; |
| 3229 | } |
| 3230 | |
| 3231 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3232 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3233 | return; |
| 3234 | |
| 3235 | nla_put_failure: |
| 3236 | kfree_skb(skb); |
| 3237 | return; |
| 3238 | } |
| 3239 | |
| 3240 | static void wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx, void *pMsg) |
| 3241 | { |
| 3242 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3243 | struct sk_buff *skb = NULL; |
| 3244 | tpSirEXTScanProgressIndParams pData = |
| 3245 | (tpSirEXTScanProgressIndParams) pMsg; |
| 3246 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3247 | ENTER(); |
| 3248 | |
| 3249 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 3250 | return; |
| 3251 | } |
| 3252 | if (!pMsg) |
| 3253 | { |
| 3254 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3255 | return; |
| 3256 | } |
| 3257 | |
| 3258 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 3259 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3260 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX, |
| 3261 | GFP_KERNEL); |
| 3262 | |
| 3263 | if (!skb) { |
| 3264 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3265 | FL("cfg80211_vendor_event_alloc failed")); |
| 3266 | return; |
| 3267 | } |
| 3268 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3269 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)", |
| 3270 | pData->extScanEventType); |
| 3271 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)", |
| 3272 | pData->status); |
| 3273 | |
| 3274 | if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE, |
| 3275 | pData->extScanEventType) || |
| 3276 | nla_put_u32(skb, |
Dasari Srinivas | 5a28865 | 2014-06-30 17:13:22 +0530 | [diff] [blame] | 3277 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3278 | pData->requestId) || |
| 3279 | nla_put_u32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3280 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS, |
| 3281 | pData->status)) { |
| 3282 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3283 | goto nla_put_failure; |
| 3284 | } |
| 3285 | |
| 3286 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3287 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3288 | return; |
| 3289 | |
| 3290 | nla_put_failure: |
| 3291 | kfree_skb(skb); |
| 3292 | return; |
| 3293 | } |
| 3294 | |
| 3295 | void wlan_hdd_cfg80211_extscan_callback(void *ctx, const tANI_U16 evType, |
| 3296 | void *pMsg) |
| 3297 | { |
| 3298 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3299 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3300 | ENTER(); |
| 3301 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3302 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3303 | return; |
| 3304 | } |
| 3305 | |
| 3306 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 3307 | |
| 3308 | |
| 3309 | switch(evType) { |
| 3310 | case SIR_HAL_EXTSCAN_START_RSP: |
| 3311 | wlan_hdd_cfg80211_extscan_start_rsp(ctx, pMsg); |
| 3312 | break; |
| 3313 | |
| 3314 | case SIR_HAL_EXTSCAN_STOP_RSP: |
| 3315 | wlan_hdd_cfg80211_extscan_stop_rsp(ctx, pMsg); |
| 3316 | break; |
| 3317 | case SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP: |
| 3318 | /* There is no need to send this response to upper layer |
| 3319 | Just log the message */ |
| 3320 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3321 | FL("Rcvd SIR_HAL_EXTSCAN_CACHED_RESULTS_RSP")); |
| 3322 | break; |
| 3323 | case SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP: |
| 3324 | wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(ctx, pMsg); |
| 3325 | break; |
| 3326 | |
| 3327 | case SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP: |
| 3328 | wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg); |
| 3329 | break; |
| 3330 | |
| 3331 | case SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP: |
| 3332 | wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(ctx, pMsg); |
| 3333 | break; |
| 3334 | |
| 3335 | case SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP: |
| 3336 | wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(ctx, pMsg); |
| 3337 | break; |
| 3338 | case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP: |
| 3339 | wlan_hdd_cfg80211_extscan_get_capabilities_ind(ctx, pMsg); |
| 3340 | break; |
| 3341 | case SIR_HAL_EXTSCAN_PROGRESS_IND: |
| 3342 | wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg); |
| 3343 | break; |
| 3344 | case SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND: |
| 3345 | wlan_hdd_cfg80211_extscan_scan_res_available_event(ctx, pMsg); |
| 3346 | break; |
| 3347 | case SIR_HAL_EXTSCAN_SCAN_RESULT_IND: |
| 3348 | wlan_hdd_cfg80211_extscan_cached_results_ind(ctx, pMsg); |
| 3349 | break; |
| 3350 | case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND: |
| 3351 | wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg); |
| 3352 | break; |
| 3353 | case SIR_HAL_EXTSCAN_SIGNF_WIFI_CHANGE_IND: |
| 3354 | wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(ctx, pMsg); |
| 3355 | break; |
| 3356 | case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 3357 | wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg); |
| 3358 | break; |
| 3359 | default: |
| 3360 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 3361 | break; |
| 3362 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3363 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3364 | } |
| 3365 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3366 | static int __wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3367 | struct wireless_dev *wdev, |
| 3368 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3369 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3370 | tSirGetEXTScanCapabilitiesReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3371 | struct net_device *dev = wdev->netdev; |
| 3372 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3373 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3374 | struct nlattr |
| 3375 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3376 | eHalStatus status; |
| 3377 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3378 | ENTER(); |
| 3379 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3380 | status = wlan_hdd_validate_context(pHddCtx); |
| 3381 | if (0 != status) |
| 3382 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3383 | return -EINVAL; |
| 3384 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3385 | /* check the EXTScan Capability */ |
| 3386 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3387 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3388 | { |
| 3389 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3390 | FL("EXTScan not enabled/supported by Firmware")); |
| 3391 | return -EINVAL; |
| 3392 | } |
| 3393 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3394 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3395 | data, dataLen, |
| 3396 | wlan_hdd_extscan_config_policy)) { |
| 3397 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3398 | return -EINVAL; |
| 3399 | } |
| 3400 | |
| 3401 | /* Parse and fetch request Id */ |
| 3402 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3403 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3404 | return -EINVAL; |
| 3405 | } |
| 3406 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3407 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3408 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3409 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3410 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3411 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3412 | reqMsg.sessionId = pAdapter->sessionId; |
| 3413 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3414 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3415 | status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3416 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3417 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3418 | FL("sme_EXTScanGetCapabilities failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3419 | return -EINVAL; |
| 3420 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3421 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3422 | return 0; |
| 3423 | } |
| 3424 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3425 | static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3426 | struct wireless_dev *wdev, |
| 3427 | const void *data, int dataLen) |
| 3428 | { |
| 3429 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3430 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3431 | vos_ssr_protect(__func__); |
| 3432 | ret = __wlan_hdd_cfg80211_extscan_get_capabilities(wiphy, wdev, data, dataLen); |
| 3433 | vos_ssr_unprotect(__func__); |
| 3434 | |
| 3435 | return ret; |
| 3436 | } |
| 3437 | |
| 3438 | static int __wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3439 | struct wireless_dev *wdev, |
| 3440 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3441 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3442 | tSirEXTScanGetCachedResultsReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3443 | struct net_device *dev = wdev->netdev; |
| 3444 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3445 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3446 | struct nlattr |
| 3447 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3448 | eHalStatus status; |
| 3449 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3450 | ENTER(); |
| 3451 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3452 | status = wlan_hdd_validate_context(pHddCtx); |
| 3453 | if (0 != status) |
| 3454 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3455 | return -EINVAL; |
| 3456 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3457 | /* check the EXTScan Capability */ |
| 3458 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3459 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3460 | { |
| 3461 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3462 | FL("EXTScan not enabled/supported by Firmware")); |
| 3463 | return -EINVAL; |
| 3464 | } |
| 3465 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3466 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3467 | data, dataLen, |
| 3468 | wlan_hdd_extscan_config_policy)) { |
| 3469 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3470 | return -EINVAL; |
| 3471 | } |
| 3472 | /* Parse and fetch request Id */ |
| 3473 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3474 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3475 | return -EINVAL; |
| 3476 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3477 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3478 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3479 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3480 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3481 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3482 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3483 | reqMsg.sessionId = pAdapter->sessionId; |
| 3484 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3485 | |
| 3486 | /* Parse and fetch flush parameter */ |
| 3487 | if (!tb |
| 3488 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]) |
| 3489 | { |
| 3490 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed")); |
| 3491 | goto failed; |
| 3492 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3493 | reqMsg.flush = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3494 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]); |
| 3495 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3496 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3497 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3498 | status = sme_getCachedResults(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3499 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3500 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3501 | FL("sme_getCachedResults failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3502 | return -EINVAL; |
| 3503 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3504 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3505 | return 0; |
| 3506 | |
| 3507 | failed: |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3508 | return -EINVAL; |
| 3509 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3510 | static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3511 | struct wireless_dev *wdev, |
| 3512 | const void *data, int dataLen) |
| 3513 | { |
| 3514 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3515 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3516 | vos_ssr_protect(__func__); |
| 3517 | ret = __wlan_hdd_cfg80211_extscan_get_cached_results(wiphy, wdev, data, dataLen); |
| 3518 | vos_ssr_unprotect(__func__); |
| 3519 | |
| 3520 | return ret; |
| 3521 | } |
| 3522 | |
| 3523 | static int __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3524 | struct wireless_dev *wdev, |
Edhar, Mahesh Kumar | ed8631f | 2015-01-20 14:31:47 +0530 | [diff] [blame] | 3525 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3526 | { |
| 3527 | tpSirEXTScanSetBssidHotListReqParams pReqMsg = NULL; |
| 3528 | struct net_device *dev = wdev->netdev; |
| 3529 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3530 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3531 | struct nlattr |
| 3532 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3533 | struct nlattr |
| 3534 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3535 | struct nlattr *apTh; |
| 3536 | eHalStatus status; |
| 3537 | tANI_U8 i = 0; |
| 3538 | int rem; |
| 3539 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3540 | ENTER(); |
| 3541 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3542 | status = wlan_hdd_validate_context(pHddCtx); |
| 3543 | if (0 != status) |
| 3544 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3545 | return -EINVAL; |
| 3546 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3547 | /* check the EXTScan Capability */ |
| 3548 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3549 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3550 | { |
| 3551 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3552 | FL("EXTScan not enabled/supported by Firmware")); |
| 3553 | return -EINVAL; |
| 3554 | } |
| 3555 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3556 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3557 | data, dataLen, |
| 3558 | wlan_hdd_extscan_config_policy)) { |
| 3559 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3560 | return -EINVAL; |
| 3561 | } |
| 3562 | |
| 3563 | /* Parse and fetch request Id */ |
| 3564 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3565 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3566 | return -EINVAL; |
| 3567 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3568 | pReqMsg = (tpSirEXTScanSetBssidHotListReqParams) |
| 3569 | vos_mem_malloc(sizeof(*pReqMsg)); |
| 3570 | if (!pReqMsg) { |
| 3571 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3572 | return -ENOMEM; |
| 3573 | } |
| 3574 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3575 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3576 | pReqMsg->requestId = nla_get_u32( |
| 3577 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3578 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3579 | |
| 3580 | /* Parse and fetch number of APs */ |
| 3581 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]) { |
| 3582 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3583 | goto fail; |
| 3584 | } |
| 3585 | |
| 3586 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3587 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3588 | |
| 3589 | pReqMsg->numAp = nla_get_u32( |
| 3590 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]); |
| 3591 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3592 | |
| 3593 | nla_for_each_nested(apTh, |
| 3594 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3595 | if(nla_parse(tb2, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3596 | nla_data(apTh), nla_len(apTh), |
| 3597 | NULL)) { |
| 3598 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3599 | goto fail; |
| 3600 | } |
| 3601 | |
| 3602 | /* Parse and fetch MAC address */ |
| 3603 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3604 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3605 | goto fail; |
| 3606 | } |
| 3607 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3608 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3609 | sizeof(tSirMacAddr)); |
| 3610 | hddLog(VOS_TRACE_LEVEL_INFO, FL("BSSID: %pM "), pReqMsg->ap[i].bssid); |
| 3611 | |
| 3612 | /* Parse and fetch low RSSI */ |
| 3613 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3614 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3615 | goto fail; |
| 3616 | } |
| 3617 | pReqMsg->ap[i].low = nla_get_s32( |
| 3618 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3619 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3620 | |
| 3621 | /* Parse and fetch high RSSI */ |
| 3622 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3623 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3624 | goto fail; |
| 3625 | } |
| 3626 | pReqMsg->ap[i].high = nla_get_s32( |
| 3627 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3628 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"), |
| 3629 | pReqMsg->ap[i].high); |
| 3630 | |
| 3631 | /* Parse and fetch channel */ |
| 3632 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3633 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3634 | goto fail; |
| 3635 | } |
| 3636 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3637 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3638 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3639 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3640 | i++; |
| 3641 | } |
| 3642 | status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg); |
| 3643 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3644 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3645 | FL("sme_SetBssHotlist failed(err=%d)"), status); |
| 3646 | vos_mem_free(pReqMsg); |
| 3647 | return -EINVAL; |
| 3648 | } |
| 3649 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3650 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3651 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3652 | return 0; |
| 3653 | |
| 3654 | fail: |
| 3655 | vos_mem_free(pReqMsg); |
| 3656 | return -EINVAL; |
| 3657 | } |
| 3658 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3659 | static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
| 3660 | struct wireless_dev *wdev, |
| 3661 | const void *data, int dataLen) |
| 3662 | { |
| 3663 | int ret = 0; |
| 3664 | |
| 3665 | vos_ssr_protect(__func__); |
| 3666 | ret = __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(wiphy, wdev, data, |
| 3667 | dataLen); |
| 3668 | vos_ssr_unprotect(__func__); |
| 3669 | |
| 3670 | return ret; |
| 3671 | } |
| 3672 | |
| 3673 | static int __wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3674 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3675 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3676 | { |
| 3677 | tpSirEXTScanSetSignificantChangeReqParams pReqMsg = NULL; |
| 3678 | struct net_device *dev = wdev->netdev; |
| 3679 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3680 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3681 | struct nlattr |
| 3682 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3683 | struct nlattr |
| 3684 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3685 | struct nlattr *apTh; |
| 3686 | eHalStatus status; |
| 3687 | int i = 0; |
| 3688 | int rem; |
| 3689 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3690 | ENTER(); |
| 3691 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3692 | status = wlan_hdd_validate_context(pHddCtx); |
| 3693 | if (0 != status) |
| 3694 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3695 | return -EINVAL; |
| 3696 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3697 | /* check the EXTScan Capability */ |
| 3698 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3699 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3700 | { |
| 3701 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3702 | FL("EXTScan not enabled/supported by Firmware")); |
| 3703 | return -EINVAL; |
| 3704 | } |
| 3705 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3706 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3707 | data, dataLen, |
| 3708 | wlan_hdd_extscan_config_policy)) { |
| 3709 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3710 | return -EINVAL; |
| 3711 | } |
| 3712 | |
| 3713 | /* Parse and fetch request Id */ |
| 3714 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3715 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3716 | return -EINVAL; |
| 3717 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3718 | pReqMsg = (tpSirEXTScanSetSignificantChangeReqParams) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3719 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3720 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3721 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3722 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3723 | } |
| 3724 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3725 | |
| 3726 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3727 | pReqMsg->requestId = nla_get_u32( |
| 3728 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3729 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3730 | |
| 3731 | /* Parse and fetch RSSI sample size */ |
| 3732 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]) |
| 3733 | { |
| 3734 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr RSSI sample size failed")); |
| 3735 | goto fail; |
| 3736 | } |
| 3737 | pReqMsg->rssiSampleSize = nla_get_u32( |
| 3738 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]); |
| 3739 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3740 | FL("RSSI sample size (%u)"), pReqMsg->rssiSampleSize); |
| 3741 | |
| 3742 | /* Parse and fetch lost AP sample size */ |
| 3743 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]) |
| 3744 | { |
| 3745 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr lost AP sample size failed")); |
| 3746 | goto fail; |
| 3747 | } |
| 3748 | pReqMsg->lostApSampleSize = nla_get_u32( |
| 3749 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]); |
| 3750 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3751 | FL("Lost AP sample size (%u)"), pReqMsg->lostApSampleSize); |
| 3752 | /* Parse and fetch minimum Breaching */ |
| 3753 | if (!tb |
| 3754 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]) { |
| 3755 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr minBreaching failed")); |
| 3756 | goto fail; |
| 3757 | } |
| 3758 | pReqMsg->minBreaching = nla_get_u32( |
| 3759 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]); |
| 3760 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Breaching (%d)"), pReqMsg->minBreaching); |
| 3761 | |
| 3762 | /* Parse and fetch number of APs */ |
| 3763 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]) { |
| 3764 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3765 | goto fail; |
| 3766 | } |
| 3767 | pReqMsg->numAp = nla_get_u32( |
| 3768 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]); |
| 3769 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3770 | |
| 3771 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3772 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3773 | |
| 3774 | nla_for_each_nested(apTh, |
| 3775 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3776 | if(nla_parse(tb2, |
| 3777 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3778 | nla_data(apTh), nla_len(apTh), |
| 3779 | NULL)) { |
| 3780 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3781 | goto fail; |
| 3782 | } |
| 3783 | |
| 3784 | /* Parse and fetch MAC address */ |
| 3785 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3786 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3787 | goto fail; |
| 3788 | } |
| 3789 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3790 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3791 | sizeof(tSirMacAddr)); |
| 3792 | |
| 3793 | /* Parse and fetch low RSSI */ |
| 3794 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3795 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3796 | goto fail; |
| 3797 | } |
| 3798 | pReqMsg->ap[i].low = nla_get_s32( |
| 3799 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3800 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3801 | |
| 3802 | /* Parse and fetch high RSSI */ |
| 3803 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3804 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3805 | goto fail; |
| 3806 | } |
| 3807 | pReqMsg->ap[i].high = nla_get_s32( |
| 3808 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3809 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3810 | FL("RSSI High (%d)"), pReqMsg->ap[i].high); |
| 3811 | |
| 3812 | /* Parse and fetch channel */ |
| 3813 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3814 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3815 | goto fail; |
| 3816 | } |
| 3817 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3818 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3819 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3820 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3821 | i++; |
| 3822 | } |
| 3823 | |
| 3824 | status = sme_SetSignificantChange(pHddCtx->hHal, pReqMsg); |
| 3825 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3826 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3827 | FL("sme_SetSignificantChange failed(err=%d)"), status); |
| 3828 | vos_mem_free(pReqMsg); |
| 3829 | return -EINVAL; |
| 3830 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3831 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3832 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3833 | return 0; |
| 3834 | |
| 3835 | fail: |
| 3836 | vos_mem_free(pReqMsg); |
| 3837 | return -EINVAL; |
| 3838 | } |
| 3839 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3840 | static int wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
| 3841 | struct wireless_dev *wdev, |
| 3842 | const void *data, int dataLen) |
| 3843 | { |
| 3844 | int ret = 0; |
| 3845 | |
| 3846 | vos_ssr_protect(__func__); |
| 3847 | ret = __wlan_hdd_cfg80211_extscan_set_significant_change(wiphy, wdev, data, |
| 3848 | dataLen); |
| 3849 | vos_ssr_unprotect(__func__); |
| 3850 | |
| 3851 | return ret; |
| 3852 | } |
| 3853 | |
| 3854 | static int __wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3855 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3856 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3857 | { |
| 3858 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3859 | tANI_U32 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 3860 | tANI_U8 numChannels = 0; |
| 3861 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3862 | tANI_U32 requestId; |
| 3863 | tWifiBand wifiBand; |
| 3864 | eHalStatus status; |
| 3865 | struct sk_buff *replySkb; |
| 3866 | tANI_U8 i; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3867 | int ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3868 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3869 | ENTER(); |
| 3870 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3871 | status = wlan_hdd_validate_context(pHddCtx); |
| 3872 | if (0 != status) |
| 3873 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3874 | return -EINVAL; |
| 3875 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3876 | /* check the EXTScan Capability */ |
| 3877 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3878 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3879 | { |
| 3880 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3881 | FL("EXTScan not enabled/supported by Firmware")); |
| 3882 | return -EINVAL; |
| 3883 | } |
| 3884 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3885 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3886 | data, dataLen, |
| 3887 | wlan_hdd_extscan_config_policy)) { |
| 3888 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3889 | return -EINVAL; |
| 3890 | } |
| 3891 | |
| 3892 | /* Parse and fetch request Id */ |
| 3893 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3894 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3895 | return -EINVAL; |
| 3896 | } |
| 3897 | requestId = nla_get_u32( |
| 3898 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3899 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); |
| 3900 | |
| 3901 | /* Parse and fetch wifi band */ |
| 3902 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) |
| 3903 | { |
| 3904 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3905 | return -EINVAL; |
| 3906 | } |
| 3907 | wifiBand = nla_get_u32( |
| 3908 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); |
| 3909 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); |
| 3910 | |
| 3911 | status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), |
| 3912 | wifiBand, ChannelList, |
| 3913 | &numChannels); |
| 3914 | if (eHAL_STATUS_SUCCESS != status) { |
| 3915 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3916 | FL("sme_GetValidChannelsByBand failed (err=%d)"), status); |
| 3917 | return -EINVAL; |
| 3918 | } |
| 3919 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of channels (%d)"), numChannels); |
| 3920 | for (i = 0; i < numChannels; i++) |
| 3921 | hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %u ", ChannelList[i]); |
| 3922 | |
| 3923 | replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 3924 | sizeof(u32) * numChannels + |
| 3925 | NLMSG_HDRLEN); |
| 3926 | |
| 3927 | if (!replySkb) { |
| 3928 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3929 | FL("valid channels: buffer alloc fail")); |
| 3930 | return -EINVAL; |
| 3931 | } |
| 3932 | if (nla_put_u32(replySkb, |
| 3933 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS, |
| 3934 | numChannels) || |
| 3935 | nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS, |
| 3936 | sizeof(u32) * numChannels, ChannelList)) { |
| 3937 | |
| 3938 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3939 | kfree_skb(replySkb); |
| 3940 | return -EINVAL; |
| 3941 | } |
| 3942 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3943 | ret = cfg80211_vendor_cmd_reply(replySkb); |
| 3944 | |
| 3945 | EXIT(); |
| 3946 | return ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3947 | } |
| 3948 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3949 | static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
| 3950 | struct wireless_dev *wdev, |
| 3951 | const void *data, int dataLen) |
| 3952 | { |
| 3953 | int ret = 0; |
| 3954 | |
| 3955 | vos_ssr_protect(__func__); |
| 3956 | ret = __wlan_hdd_cfg80211_extscan_get_valid_channels(wiphy, wdev, data, |
| 3957 | dataLen); |
| 3958 | vos_ssr_unprotect(__func__); |
| 3959 | |
| 3960 | return ret; |
| 3961 | } |
| 3962 | |
| 3963 | static int __wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3964 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3965 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3966 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3967 | tpSirEXTScanStartReqParams pReqMsg = NULL; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3968 | struct net_device *dev = wdev->netdev; |
| 3969 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3970 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3971 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3972 | struct nlattr *bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3973 | struct nlattr *channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3974 | struct nlattr *buckets; |
| 3975 | struct nlattr *channels; |
| 3976 | int rem1; |
| 3977 | int rem2; |
| 3978 | eHalStatus status; |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3979 | tANI_U32 j = 0, index = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3980 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3981 | ENTER(); |
| 3982 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3983 | status = wlan_hdd_validate_context(pHddCtx); |
| 3984 | if (0 != status) |
| 3985 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3986 | return -EINVAL; |
| 3987 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3988 | /* check the EXTScan Capability */ |
| 3989 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3990 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3991 | { |
| 3992 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3993 | FL("EXTScan not enabled/supported by Firmware")); |
| 3994 | return -EINVAL; |
| 3995 | } |
| 3996 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3997 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3998 | data, dataLen, |
| 3999 | wlan_hdd_extscan_config_policy)) { |
| 4000 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4001 | return -EINVAL; |
| 4002 | } |
| 4003 | |
| 4004 | /* Parse and fetch request Id */ |
| 4005 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4006 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4007 | return -EINVAL; |
| 4008 | } |
| 4009 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4010 | pReqMsg = (tpSirEXTScanStartReqParams) |
| 4011 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4012 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4013 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 4014 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4015 | } |
| 4016 | |
| 4017 | pReqMsg->requestId = nla_get_u32( |
| 4018 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 4019 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 4020 | |
| 4021 | pReqMsg->sessionId = pAdapter->sessionId; |
| 4022 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 4023 | |
| 4024 | /* Parse and fetch base period */ |
| 4025 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]) { |
| 4026 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed")); |
| 4027 | goto fail; |
| 4028 | } |
| 4029 | pReqMsg->basePeriod = nla_get_u32( |
| 4030 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]); |
| 4031 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"), |
| 4032 | pReqMsg->basePeriod); |
| 4033 | |
| 4034 | /* Parse and fetch max AP per scan */ |
| 4035 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]) { |
| 4036 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed")); |
| 4037 | goto fail; |
| 4038 | } |
| 4039 | pReqMsg->maxAPperScan = nla_get_u32( |
| 4040 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]); |
| 4041 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"), |
| 4042 | pReqMsg->maxAPperScan); |
| 4043 | |
| 4044 | /* Parse and fetch report threshold */ |
| 4045 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]) { |
| 4046 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed")); |
| 4047 | goto fail; |
| 4048 | } |
| 4049 | pReqMsg->reportThreshold = nla_get_u8( |
| 4050 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]); |
| 4051 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"), |
| 4052 | pReqMsg->reportThreshold); |
| 4053 | |
| 4054 | /* Parse and fetch number of buckets */ |
| 4055 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]) { |
| 4056 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed")); |
| 4057 | goto fail; |
| 4058 | } |
| 4059 | pReqMsg->numBuckets = nla_get_u8( |
| 4060 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]); |
| 4061 | if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) { |
| 4062 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets " |
| 4063 | "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS); |
| 4064 | pReqMsg->numBuckets = WLAN_EXTSCAN_MAX_BUCKETS; |
| 4065 | } |
| 4066 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"), |
| 4067 | pReqMsg->numBuckets); |
| 4068 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) { |
| 4069 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed")); |
| 4070 | goto fail; |
| 4071 | } |
| 4072 | |
| 4073 | nla_for_each_nested(buckets, |
| 4074 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) { |
| 4075 | if(nla_parse(bucket, |
| 4076 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4077 | nla_data(buckets), nla_len(buckets), NULL)) { //policy |
| 4078 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 4079 | goto fail; |
| 4080 | } |
| 4081 | |
| 4082 | /* Parse and fetch bucket spec */ |
| 4083 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) { |
| 4084 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket index failed")); |
| 4085 | goto fail; |
| 4086 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4087 | |
| 4088 | pReqMsg->buckets[index].bucket = nla_get_u8( |
| 4089 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]); |
| 4090 | |
| 4091 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bucket spec Index (%d)"), |
| 4092 | pReqMsg->buckets[index].bucket); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4093 | |
| 4094 | /* Parse and fetch wifi band */ |
| 4095 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) { |
| 4096 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 4097 | goto fail; |
| 4098 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4099 | pReqMsg->buckets[index].band = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4100 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]); |
| 4101 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4102 | pReqMsg->buckets[index].band); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4103 | |
| 4104 | /* Parse and fetch period */ |
| 4105 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) { |
| 4106 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr period failed")); |
| 4107 | goto fail; |
| 4108 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4109 | pReqMsg->buckets[index].period = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4110 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]); |
| 4111 | hddLog(VOS_TRACE_LEVEL_INFO, FL("period (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4112 | pReqMsg->buckets[index].period); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4113 | |
| 4114 | /* Parse and fetch report events */ |
| 4115 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) { |
| 4116 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report events failed")); |
| 4117 | goto fail; |
| 4118 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4119 | pReqMsg->buckets[index].reportEvents = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4120 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]); |
| 4121 | hddLog(VOS_TRACE_LEVEL_INFO, FL("report events (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4122 | pReqMsg->buckets[index].reportEvents); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4123 | |
| 4124 | /* Parse and fetch number of channels */ |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4125 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) |
| 4126 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4127 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr num channels failed")); |
| 4128 | goto fail; |
| 4129 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4130 | pReqMsg->buckets[index].numChannels = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4131 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]); |
| 4132 | hddLog(VOS_TRACE_LEVEL_INFO, FL("num channels (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4133 | pReqMsg->buckets[index].numChannels); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4134 | |
| 4135 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) { |
| 4136 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel spec failed")); |
| 4137 | goto fail; |
| 4138 | } |
| 4139 | |
| 4140 | j = 0; |
| 4141 | nla_for_each_nested(channels, |
| 4142 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) { |
| 4143 | if(nla_parse(channel, |
| 4144 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4145 | nla_data(channels), nla_len(channels), |
| 4146 | NULL)) { //wlan_hdd_extscan_config_policy here |
| 4147 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 4148 | goto fail; |
| 4149 | } |
| 4150 | |
| 4151 | /* Parse and fetch channel */ |
| 4152 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) { |
| 4153 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 4154 | goto fail; |
| 4155 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4156 | pReqMsg->buckets[index].channels[j].channel = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4157 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]); |
| 4158 | hddLog(VOS_TRACE_LEVEL_INFO, FL("channel (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4159 | pReqMsg->buckets[index].channels[j].channel); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4160 | |
| 4161 | /* Parse and fetch dwell time */ |
| 4162 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) { |
| 4163 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dwelltime failed")); |
| 4164 | goto fail; |
| 4165 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4166 | pReqMsg->buckets[index].channels[j].dwellTimeMs = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4167 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]); |
| 4168 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Dwell time (%u ms)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4169 | pReqMsg->buckets[index].channels[j].dwellTimeMs); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4170 | |
| 4171 | /* Parse and fetch channel spec passive */ |
| 4172 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) { |
| 4173 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4174 | FL("attr channel spec passive failed")); |
| 4175 | goto fail; |
| 4176 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4177 | pReqMsg->buckets[index].channels[j].passive = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4178 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]); |
| 4179 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Chnl spec passive (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4180 | pReqMsg->buckets[index].channels[j].passive); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4181 | j++; |
| 4182 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4183 | index++; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4184 | } |
| 4185 | status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg); |
| 4186 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4187 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4188 | FL("sme_EXTScanStart failed(err=%d)"), status); |
| 4189 | vos_mem_free(pReqMsg); |
| 4190 | return -EINVAL; |
| 4191 | } |
| 4192 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4193 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4194 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4195 | return 0; |
| 4196 | |
| 4197 | fail: |
| 4198 | vos_mem_free(pReqMsg); |
| 4199 | return -EINVAL; |
| 4200 | } |
| 4201 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4202 | static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
| 4203 | struct wireless_dev *wdev, |
| 4204 | const void *data, int dataLen) |
| 4205 | { |
| 4206 | int ret = 0; |
| 4207 | |
| 4208 | vos_ssr_protect(__func__); |
| 4209 | ret = __wlan_hdd_cfg80211_extscan_start(wiphy, wdev, data, dataLen); |
| 4210 | vos_ssr_unprotect(__func__); |
| 4211 | |
| 4212 | return ret; |
| 4213 | } |
| 4214 | |
| 4215 | static int __wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4216 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4217 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4218 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4219 | tSirEXTScanStopReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4220 | struct net_device *dev = wdev->netdev; |
| 4221 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4222 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4223 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4224 | eHalStatus status; |
| 4225 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4226 | ENTER(); |
| 4227 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4228 | status = wlan_hdd_validate_context(pHddCtx); |
| 4229 | if (0 != status) |
| 4230 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4231 | return -EINVAL; |
| 4232 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4233 | /* check the EXTScan Capability */ |
| 4234 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4235 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4236 | { |
| 4237 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4238 | FL("EXTScan not enabled/supported by Firmware")); |
| 4239 | return -EINVAL; |
| 4240 | } |
| 4241 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4242 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4243 | data, dataLen, |
| 4244 | wlan_hdd_extscan_config_policy)) { |
| 4245 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4246 | return -EINVAL; |
| 4247 | } |
| 4248 | |
| 4249 | /* Parse and fetch request Id */ |
| 4250 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4251 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4252 | return -EINVAL; |
| 4253 | } |
| 4254 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4255 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4256 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4257 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4258 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4259 | reqMsg.sessionId = pAdapter->sessionId; |
| 4260 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4261 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4262 | status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4263 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4264 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4265 | FL("sme_EXTScanStop failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4266 | return -EINVAL; |
| 4267 | } |
| 4268 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4269 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4270 | return 0; |
| 4271 | } |
| 4272 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4273 | static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
| 4274 | struct wireless_dev *wdev, |
| 4275 | const void *data, int dataLen) |
| 4276 | { |
| 4277 | int ret = 0; |
| 4278 | |
| 4279 | vos_ssr_protect(__func__); |
| 4280 | ret = __wlan_hdd_cfg80211_extscan_stop(wiphy, wdev, data, dataLen); |
| 4281 | vos_ssr_unprotect(__func__); |
| 4282 | |
| 4283 | return ret; |
| 4284 | } |
| 4285 | |
| 4286 | static int __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4287 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4288 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4289 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4290 | tSirEXTScanResetBssidHotlistReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4291 | struct net_device *dev = wdev->netdev; |
| 4292 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4293 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4294 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4295 | eHalStatus status; |
| 4296 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4297 | ENTER(); |
| 4298 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4299 | status = wlan_hdd_validate_context(pHddCtx); |
| 4300 | if (0 != status) |
| 4301 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4302 | return -EINVAL; |
| 4303 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4304 | /* check the EXTScan Capability */ |
| 4305 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4306 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4307 | { |
| 4308 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4309 | FL("EXTScan not enabled/supported by Firmware")); |
| 4310 | return -EINVAL; |
| 4311 | } |
| 4312 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4313 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4314 | data, dataLen, |
| 4315 | wlan_hdd_extscan_config_policy)) { |
| 4316 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4317 | return -EINVAL; |
| 4318 | } |
| 4319 | |
| 4320 | /* Parse and fetch request Id */ |
| 4321 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4322 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4323 | return -EINVAL; |
| 4324 | } |
| 4325 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4326 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4327 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4328 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4329 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4330 | reqMsg.sessionId = pAdapter->sessionId; |
| 4331 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4332 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4333 | status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4334 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4335 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4336 | FL("sme_ResetBssHotlist failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4337 | return -EINVAL; |
| 4338 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4339 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4340 | return 0; |
| 4341 | } |
| 4342 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4343 | static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
| 4344 | struct wireless_dev *wdev, |
| 4345 | const void *data, int dataLen) |
| 4346 | { |
| 4347 | int ret = 0; |
| 4348 | |
| 4349 | vos_ssr_protect(__func__); |
| 4350 | ret = __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(wiphy, wdev, data, dataLen); |
| 4351 | vos_ssr_unprotect(__func__); |
| 4352 | |
| 4353 | return ret; |
| 4354 | } |
| 4355 | |
| 4356 | static int __wlan_hdd_cfg80211_extscan_reset_significant_change( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4357 | struct wiphy *wiphy, |
| 4358 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4359 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4360 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4361 | tSirEXTScanResetSignificantChangeReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4362 | struct net_device *dev = wdev->netdev; |
| 4363 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4364 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4365 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4366 | eHalStatus status; |
| 4367 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4368 | ENTER(); |
| 4369 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4370 | status = wlan_hdd_validate_context(pHddCtx); |
| 4371 | if (0 != status) |
| 4372 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4373 | return -EINVAL; |
| 4374 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4375 | /* check the EXTScan Capability */ |
| 4376 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4377 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4378 | { |
| 4379 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4380 | FL("EXTScan not enabled/supported by Firmware")); |
| 4381 | return -EINVAL; |
| 4382 | } |
| 4383 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4384 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4385 | data, dataLen, |
| 4386 | wlan_hdd_extscan_config_policy)) { |
| 4387 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4388 | return -EINVAL; |
| 4389 | } |
| 4390 | |
| 4391 | /* Parse and fetch request Id */ |
| 4392 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4393 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4394 | return -EINVAL; |
| 4395 | } |
| 4396 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4397 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4398 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4399 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4400 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4401 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4402 | reqMsg.sessionId = pAdapter->sessionId; |
| 4403 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4404 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4405 | status = sme_ResetSignificantChange(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4406 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4407 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4408 | FL("sme_ResetSignificantChange failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4409 | return -EINVAL; |
| 4410 | } |
| 4411 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4412 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4413 | return 0; |
| 4414 | } |
| 4415 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4416 | static int wlan_hdd_cfg80211_extscan_reset_significant_change( |
| 4417 | struct wiphy *wiphy, |
| 4418 | struct wireless_dev *wdev, |
| 4419 | const void *data, int dataLen) |
| 4420 | { |
| 4421 | int ret = 0; |
| 4422 | |
| 4423 | vos_ssr_protect(__func__); |
| 4424 | ret = __wlan_hdd_cfg80211_extscan_reset_significant_change(wiphy, |
| 4425 | wdev, data, |
| 4426 | dataLen); |
| 4427 | vos_ssr_unprotect(__func__); |
| 4428 | |
| 4429 | return ret; |
| 4430 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4431 | #endif /* WLAN_FEATURE_EXTSCAN */ |
| 4432 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4433 | /*EXT TDLS*/ |
| 4434 | static const struct nla_policy |
| 4435 | wlan_hdd_tdls_config_enable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX +1] = |
| 4436 | { |
| 4437 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4438 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL] = {.type = NLA_S32 }, |
| 4439 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS] = |
| 4440 | {.type = NLA_S32 }, |
| 4441 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS] = {.type = NLA_S32 }, |
| 4442 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS] = {.type = NLA_S32 }, |
| 4443 | |
| 4444 | }; |
| 4445 | |
| 4446 | static const struct nla_policy |
| 4447 | wlan_hdd_tdls_config_disable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX +1] = |
| 4448 | { |
| 4449 | [QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4450 | |
| 4451 | }; |
| 4452 | |
| 4453 | static const struct nla_policy |
| 4454 | wlan_hdd_tdls_config_state_change_policy[ |
| 4455 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAX +1] = |
| 4456 | { |
| 4457 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4458 | [QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE] = {.type = NLA_S32 }, |
| 4459 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4460 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL] = {.type = NLA_S32 }, |
| 4461 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS] = |
| 4462 | {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4463 | |
| 4464 | }; |
| 4465 | |
| 4466 | static const struct nla_policy |
| 4467 | wlan_hdd_tdls_config_get_status_policy[ |
| 4468 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX +1] = |
| 4469 | { |
| 4470 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4471 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE] = {.type = NLA_S32 }, |
| 4472 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4473 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL] = {.type = NLA_S32 }, |
| 4474 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS] |
| 4475 | = {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4476 | |
| 4477 | }; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4478 | |
| 4479 | static const struct nla_policy |
| 4480 | wlan_hdd_mac_config[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX+1] = |
| 4481 | { |
| 4482 | [QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI] = {.type = NLA_UNSPEC }, |
| 4483 | }; |
| 4484 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4485 | static int __wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4486 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4487 | const void *data, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4488 | int data_len) |
| 4489 | { |
| 4490 | |
| 4491 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4492 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX + 1]; |
| 4493 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4494 | ENTER(); |
| 4495 | |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4496 | if (0 != wlan_hdd_validate_context(pHddCtx)){ |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4497 | return -EINVAL; |
| 4498 | } |
| 4499 | if (FALSE == pHddCtx->cfg_ini->enableMacSpoofing) { |
| 4500 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN disabled in ini")); |
| 4501 | return -ENOTSUPP; |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4502 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4503 | if (TRUE != sme_IsFeatureSupportedByFW(MAC_SPOOFED_SCAN)){ |
| 4504 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN not supported by FW")); |
| 4505 | return -ENOTSUPP; |
| 4506 | } |
| 4507 | |
| 4508 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX, |
| 4509 | data, data_len, wlan_hdd_mac_config)) { |
| 4510 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4511 | return -EINVAL; |
| 4512 | } |
| 4513 | |
| 4514 | /* Parse and fetch mac address */ |
| 4515 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]) { |
| 4516 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4517 | return -EINVAL; |
| 4518 | } |
| 4519 | |
| 4520 | memcpy(pHddCtx->spoofMacAddr.randomMacAddr.bytes, nla_data( |
| 4521 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4522 | VOS_MAC_ADDR_LAST_3_BYTES); |
| 4523 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4524 | pHddCtx->spoofMacAddr.isEnabled = TRUE; |
| 4525 | |
| 4526 | 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] | 4527 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4528 | VOS_MAC_ADDR_FIRST_3_BYTES); |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4529 | if ((pHddCtx->spoofMacAddr.randomMacAddr.bytes[0] == 0) && |
| 4530 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[1] == 0) && |
| 4531 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[2] == 0)) |
| 4532 | { |
| 4533 | hddLog(LOG1, FL("ZERO MAC OUI Recieved. Disabling Spoofing")); |
| 4534 | vos_mem_zero(pHddCtx->spoofMacAddr.randomMacAddr.bytes, |
| 4535 | VOS_MAC_ADDRESS_LEN); |
| 4536 | pHddCtx->spoofMacAddr.isEnabled = FALSE; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4537 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4538 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4539 | if (VOS_STATUS_SUCCESS != hdd_processSpoofMacAddrRequest(pHddCtx)) |
| 4540 | { |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4541 | hddLog(LOGE, FL("Failed to send Spoof Mac Addr to FW")); |
| 4542 | } |
| 4543 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4544 | EXIT(); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4545 | return 0; |
| 4546 | } |
| 4547 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4548 | static int wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
| 4549 | struct wireless_dev *wdev, |
| 4550 | const void *data, |
| 4551 | int data_len) |
| 4552 | { |
| 4553 | int ret = 0; |
| 4554 | |
| 4555 | vos_ssr_protect(__func__); |
| 4556 | ret = __wlan_hdd_cfg80211_set_spoofed_mac_oui(wiphy, wdev, data, data_len); |
| 4557 | vos_ssr_unprotect(__func__); |
| 4558 | |
| 4559 | return ret; |
| 4560 | } |
| 4561 | |
| 4562 | static int __wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4563 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4564 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4565 | int data_len) |
| 4566 | { |
| 4567 | u8 peer[6] = {0}; |
| 4568 | struct net_device *dev = wdev->netdev; |
| 4569 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4570 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4571 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; |
| 4572 | eHalStatus ret; |
| 4573 | tANI_S32 state; |
| 4574 | tANI_S32 reason; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4575 | tANI_S32 global_operating_class = 0; |
| 4576 | tANI_S32 channel = 0; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4577 | struct sk_buff *skb = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4578 | int retVal; |
| 4579 | |
| 4580 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4581 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4582 | if (!pAdapter) { |
| 4583 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 4584 | return -EINVAL; |
| 4585 | } |
| 4586 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4587 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4588 | if (0 != ret) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4589 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4590 | return -EINVAL; |
| 4591 | } |
| 4592 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4593 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4594 | return -ENOTSUPP; |
| 4595 | } |
| 4596 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, |
| 4597 | data, data_len, |
| 4598 | wlan_hdd_tdls_config_get_status_policy)) { |
| 4599 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4600 | return -EINVAL; |
| 4601 | } |
| 4602 | |
| 4603 | /* Parse and fetch mac address */ |
| 4604 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]) { |
| 4605 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4606 | return -EINVAL; |
| 4607 | } |
| 4608 | |
| 4609 | memcpy(peer, nla_data( |
| 4610 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]), |
| 4611 | sizeof(peer)); |
| 4612 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4613 | |
| 4614 | ret = wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason); |
| 4615 | |
| 4616 | if (0 != ret) { |
| 4617 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4618 | FL("get status Failed")); |
| 4619 | return -EINVAL; |
| 4620 | } |
| 4621 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4622 | 4 * sizeof(s32) + |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4623 | NLMSG_HDRLEN); |
| 4624 | |
| 4625 | if (!skb) { |
| 4626 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4627 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 4628 | return -EINVAL; |
| 4629 | } |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4630 | 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] | 4631 | reason, |
| 4632 | state, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4633 | global_operating_class, |
| 4634 | channel, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4635 | MAC_ADDR_ARRAY(peer)); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4636 | if (nla_put_s32(skb, |
| 4637 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE, |
| 4638 | state) || |
| 4639 | nla_put_s32(skb, |
| 4640 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON, |
| 4641 | reason) || |
| 4642 | nla_put_s32(skb, |
| 4643 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS, |
| 4644 | global_operating_class) || |
| 4645 | nla_put_s32(skb, |
| 4646 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL, |
| 4647 | channel)) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4648 | |
| 4649 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4650 | goto nla_put_failure; |
| 4651 | } |
| 4652 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4653 | retVal = cfg80211_vendor_cmd_reply(skb); |
| 4654 | EXIT(); |
| 4655 | return retVal; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4656 | |
| 4657 | nla_put_failure: |
| 4658 | kfree_skb(skb); |
| 4659 | return -EINVAL; |
| 4660 | } |
| 4661 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4662 | static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
| 4663 | struct wireless_dev *wdev, |
| 4664 | const void *data, |
| 4665 | int data_len) |
| 4666 | { |
| 4667 | int ret = 0; |
| 4668 | |
| 4669 | vos_ssr_protect(__func__); |
| 4670 | ret = __wlan_hdd_cfg80211_exttdls_get_status(wiphy, wdev, data, data_len); |
| 4671 | vos_ssr_unprotect(__func__); |
| 4672 | |
| 4673 | return ret; |
| 4674 | } |
| 4675 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4676 | static int wlan_hdd_cfg80211_exttdls_callback(tANI_U8* mac, |
| 4677 | tANI_S32 state, |
| 4678 | tANI_S32 reason, |
| 4679 | void *ctx) |
| 4680 | { |
| 4681 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)ctx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4682 | struct sk_buff *skb = NULL; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4683 | tANI_S32 global_operating_class = 0; |
| 4684 | tANI_S32 channel = 0; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4685 | hdd_context_t *pHddCtx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4686 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4687 | ENTER(); |
| 4688 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4689 | if (!pAdapter) { |
| 4690 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 4691 | return -EINVAL; |
| 4692 | } |
| 4693 | |
| 4694 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4695 | if (wlan_hdd_validate_context(pHddCtx)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4696 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4697 | return -EINVAL; |
| 4698 | } |
| 4699 | |
| 4700 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4701 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4702 | return -ENOTSUPP; |
| 4703 | } |
| 4704 | skb = cfg80211_vendor_event_alloc( |
| 4705 | pHddCtx->wiphy, |
| 4706 | EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 4707 | QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX, |
| 4708 | GFP_KERNEL); |
| 4709 | |
| 4710 | if (!skb) { |
| 4711 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4712 | FL("cfg80211_vendor_event_alloc failed")); |
| 4713 | return -EINVAL; |
| 4714 | } |
| 4715 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4716 | hddLog(VOS_TRACE_LEVEL_INFO, "Reason: (%d) Status: (%d) Class: (%d) Channel: (%d)", |
| 4717 | reason, |
| 4718 | state, |
| 4719 | global_operating_class, |
| 4720 | channel); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4721 | hddLog(VOS_TRACE_LEVEL_WARN, "tdls peer " MAC_ADDRESS_STR, |
| 4722 | MAC_ADDR_ARRAY(mac)); |
| 4723 | |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4724 | if (nla_put(skb, |
| 4725 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR, |
| 4726 | VOS_MAC_ADDR_SIZE, mac) || |
| 4727 | nla_put_s32(skb, |
| 4728 | QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE, |
| 4729 | state) || |
| 4730 | nla_put_s32(skb, |
| 4731 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON, |
| 4732 | reason) || |
| 4733 | nla_put_s32(skb, |
| 4734 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL, |
| 4735 | channel) || |
| 4736 | nla_put_s32(skb, |
| 4737 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS, |
| 4738 | global_operating_class) |
| 4739 | ) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4740 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4741 | goto nla_put_failure; |
| 4742 | } |
| 4743 | |
| 4744 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4745 | EXIT(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4746 | return (0); |
| 4747 | |
| 4748 | nla_put_failure: |
| 4749 | kfree_skb(skb); |
| 4750 | return -EINVAL; |
| 4751 | } |
| 4752 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4753 | static int __wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4754 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4755 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4756 | int data_len) |
| 4757 | { |
| 4758 | u8 peer[6] = {0}; |
| 4759 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4760 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4761 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1]; |
| 4762 | eHalStatus status; |
| 4763 | tdls_req_params_t pReqMsg = {0}; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4764 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4765 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4766 | |
| 4767 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4768 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4769 | if (!dev) { |
| 4770 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 4771 | return -EINVAL; |
| 4772 | } |
| 4773 | |
| 4774 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4775 | if (!pAdapter) { |
| 4776 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 4777 | return -EINVAL; |
| 4778 | } |
| 4779 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4780 | status = wlan_hdd_validate_context(pHddCtx); |
| 4781 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4782 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4783 | return -EINVAL; |
| 4784 | } |
| 4785 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4786 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4787 | return -ENOTSUPP; |
| 4788 | } |
| 4789 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX, |
| 4790 | data, data_len, |
| 4791 | wlan_hdd_tdls_config_enable_policy)) { |
| 4792 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4793 | return -EINVAL; |
| 4794 | } |
| 4795 | |
| 4796 | /* Parse and fetch mac address */ |
| 4797 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]) { |
| 4798 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4799 | return -EINVAL; |
| 4800 | } |
| 4801 | |
| 4802 | memcpy(peer, nla_data( |
| 4803 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]), |
| 4804 | sizeof(peer)); |
| 4805 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4806 | |
| 4807 | /* Parse and fetch channel */ |
| 4808 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]) { |
| 4809 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 4810 | return -EINVAL; |
| 4811 | } |
| 4812 | pReqMsg.channel = nla_get_s32( |
| 4813 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]); |
| 4814 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Channel Num (%d)"), pReqMsg.channel); |
| 4815 | |
| 4816 | /* Parse and fetch global operating class */ |
| 4817 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]) { |
| 4818 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr operating class failed")); |
| 4819 | return -EINVAL; |
| 4820 | } |
| 4821 | pReqMsg.global_operating_class = nla_get_s32( |
| 4822 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]); |
| 4823 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Operating class (%d)"), |
| 4824 | pReqMsg.global_operating_class); |
| 4825 | |
| 4826 | /* Parse and fetch latency ms */ |
| 4827 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]) { |
| 4828 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr latency failed")); |
| 4829 | return -EINVAL; |
| 4830 | } |
| 4831 | pReqMsg.max_latency_ms = nla_get_s32( |
| 4832 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]); |
| 4833 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Latency (%d)"), |
| 4834 | pReqMsg.max_latency_ms); |
| 4835 | |
| 4836 | /* Parse and fetch required bandwidth kbps */ |
| 4837 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]) { |
| 4838 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bandwidth failed")); |
| 4839 | return -EINVAL; |
| 4840 | } |
| 4841 | |
| 4842 | pReqMsg.min_bandwidth_kbps = nla_get_s32( |
| 4843 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]); |
| 4844 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bandwidth (%d)"), |
| 4845 | pReqMsg.min_bandwidth_kbps); |
| 4846 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4847 | ret = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4848 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 4849 | &pReqMsg, |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4850 | wlan_hdd_cfg80211_exttdls_callback); |
| 4851 | |
| 4852 | EXIT(); |
| 4853 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4854 | } |
| 4855 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4856 | static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
| 4857 | struct wireless_dev *wdev, |
| 4858 | const void *data, |
| 4859 | int data_len) |
| 4860 | { |
| 4861 | int ret = 0; |
| 4862 | |
| 4863 | vos_ssr_protect(__func__); |
| 4864 | ret = __wlan_hdd_cfg80211_exttdls_enable(wiphy, wdev, data, data_len); |
| 4865 | vos_ssr_unprotect(__func__); |
| 4866 | |
| 4867 | return ret; |
| 4868 | } |
| 4869 | |
| 4870 | static int __wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4871 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4872 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4873 | int data_len) |
| 4874 | { |
| 4875 | u8 peer[6] = {0}; |
| 4876 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4877 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4878 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1]; |
| 4879 | eHalStatus status; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4880 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4881 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4882 | |
| 4883 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4884 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4885 | if (!dev) { |
| 4886 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 4887 | return -EINVAL; |
| 4888 | } |
| 4889 | |
| 4890 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4891 | if (!pAdapter) { |
| 4892 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 4893 | return -EINVAL; |
| 4894 | } |
| 4895 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4896 | status = wlan_hdd_validate_context(pHddCtx); |
| 4897 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4898 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4899 | return -EINVAL; |
| 4900 | } |
| 4901 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4902 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4903 | return -ENOTSUPP; |
| 4904 | } |
| 4905 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX, |
| 4906 | data, data_len, |
| 4907 | wlan_hdd_tdls_config_disable_policy)) { |
| 4908 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4909 | return -EINVAL; |
| 4910 | } |
| 4911 | /* Parse and fetch mac address */ |
| 4912 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]) { |
| 4913 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4914 | return -EINVAL; |
| 4915 | } |
| 4916 | |
| 4917 | memcpy(peer, nla_data( |
| 4918 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]), |
| 4919 | sizeof(peer)); |
| 4920 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4921 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4922 | ret = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
| 4923 | |
| 4924 | EXIT(); |
| 4925 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4926 | } |
| 4927 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4928 | static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
| 4929 | struct wireless_dev *wdev, |
| 4930 | const void *data, |
| 4931 | int data_len) |
| 4932 | { |
| 4933 | int ret = 0; |
| 4934 | |
| 4935 | vos_ssr_protect(__func__); |
| 4936 | ret = __wlan_hdd_cfg80211_exttdls_disable(wiphy, wdev, data, data_len); |
| 4937 | vos_ssr_unprotect(__func__); |
| 4938 | |
| 4939 | return ret; |
| 4940 | } |
| 4941 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4942 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4943 | __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4944 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4945 | const void *data, int data_len) |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4946 | { |
| 4947 | struct net_device *dev = wdev->netdev; |
| 4948 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4949 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4950 | struct sk_buff *skb = NULL; |
| 4951 | tANI_U32 fset = 0; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4952 | int ret = 0; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4953 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4954 | ENTER(); |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4955 | |
| 4956 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4957 | if (0 != ret) |
| 4958 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4959 | return ret; |
| 4960 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4961 | if (wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { |
| 4962 | hddLog(LOG1, FL("Infra Station mode is supported by driver")); |
| 4963 | fset |= WIFI_FEATURE_INFRA; |
| 4964 | } |
| 4965 | |
| 4966 | if (TRUE == hdd_is_5g_supported(pHddCtx)) { |
| 4967 | hddLog(LOG1, FL("INFRA_5G is supported by firmware")); |
| 4968 | fset |= WIFI_FEATURE_INFRA_5G; |
| 4969 | } |
| 4970 | |
| 4971 | #ifdef WLAN_FEATURE_P2P |
| 4972 | if ((wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) && |
| 4973 | (wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_GO))) { |
| 4974 | hddLog(LOG1, FL("WiFi-Direct is supported by driver")); |
| 4975 | fset |= WIFI_FEATURE_P2P; |
| 4976 | } |
| 4977 | #endif |
| 4978 | |
| 4979 | /* Soft-AP is supported currently by default */ |
| 4980 | fset |= WIFI_FEATURE_SOFT_AP; |
| 4981 | |
Kanchanapally, Vidyullatha | 683aed0 | 2015-03-24 16:58:38 +0530 | [diff] [blame] | 4982 | /* HOTSPOT is a supplicant feature, enable it by default */ |
| 4983 | fset |= WIFI_FEATURE_HOTSPOT; |
| 4984 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4985 | #ifdef WLAN_FEATURE_EXTSCAN |
| 4986 | if ((TRUE == pHddCtx->cfg_ini->fEnableEXTScan) && |
| 4987 | sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) { |
| 4988 | hddLog(LOG1, FL("EXTScan is supported by firmware")); |
| 4989 | fset |= WIFI_FEATURE_EXTSCAN; |
| 4990 | } |
| 4991 | #endif |
| 4992 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4993 | if (sme_IsFeatureSupportedByFW(NAN)) { |
| 4994 | hddLog(LOG1, FL("NAN is supported by firmware")); |
| 4995 | fset |= WIFI_FEATURE_NAN; |
| 4996 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4997 | |
| 4998 | /* D2D RTT is not supported currently by default */ |
| 4999 | if (sme_IsFeatureSupportedByFW(RTT)) { |
| 5000 | hddLog(LOG1, FL("RTT is supported by firmware")); |
| 5001 | fset |= WIFI_FEATURE_D2AP_RTT; |
| 5002 | } |
| 5003 | |
| 5004 | #ifdef FEATURE_WLAN_BATCH_SCAN |
| 5005 | if (fset & WIFI_FEATURE_EXTSCAN) { |
| 5006 | hddLog(LOG1, FL("Batch scan is supported as extscan is supported")); |
| 5007 | fset &= ~WIFI_FEATURE_BATCH_SCAN; |
| 5008 | } else if (sme_IsFeatureSupportedByFW(BATCH_SCAN)) { |
| 5009 | hddLog(LOG1, FL("Batch scan is supported by firmware")); |
| 5010 | fset |= WIFI_FEATURE_BATCH_SCAN; |
| 5011 | } |
| 5012 | #endif |
| 5013 | |
| 5014 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 5015 | if (pHddCtx->cfg_ini->configPNOScanSupport && |
| 5016 | (eHAL_STATUS_SUCCESS == wlan_hdd_is_pno_allowed(pAdapter))) { |
| 5017 | hddLog(LOG1, FL("PNO is supported by firmware")); |
| 5018 | fset |= WIFI_FEATURE_PNO; |
| 5019 | } |
| 5020 | #endif |
| 5021 | |
| 5022 | /* STA+STA is supported currently by default */ |
| 5023 | fset |= WIFI_FEATURE_ADDITIONAL_STA; |
| 5024 | |
| 5025 | #ifdef FEATURE_WLAN_TDLS |
| 5026 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSSupport) && |
| 5027 | sme_IsFeatureSupportedByFW(TDLS)) { |
| 5028 | hddLog(LOG1, FL("TDLS is supported by firmware")); |
| 5029 | fset |= WIFI_FEATURE_TDLS; |
| 5030 | } |
| 5031 | |
| 5032 | /* TDLS_OFFCHANNEL is not supported currently by default */ |
| 5033 | #endif |
| 5034 | |
| 5035 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 5036 | /* AP+STA concurrency is supported currently by default */ |
| 5037 | fset |= WIFI_FEATURE_AP_STA; |
| 5038 | #endif |
| 5039 | |
| 5040 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) + |
| 5041 | NLMSG_HDRLEN); |
| 5042 | |
| 5043 | if (!skb) { |
| 5044 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 5045 | return -EINVAL; |
| 5046 | } |
| 5047 | hddLog(LOG1, FL("Supported Features : 0x%x"), fset); |
| 5048 | |
| 5049 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_FEATURE_SET, fset)) { |
| 5050 | hddLog(LOGE, FL("nla put fail")); |
| 5051 | goto nla_put_failure; |
| 5052 | } |
| 5053 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5054 | ret = cfg80211_vendor_cmd_reply(skb); |
| 5055 | EXIT(); |
| 5056 | return ret; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5057 | |
| 5058 | nla_put_failure: |
| 5059 | kfree_skb(skb); |
| 5060 | return -EINVAL; |
| 5061 | } |
| 5062 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5063 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5064 | wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
| 5065 | struct wireless_dev *wdev, |
| 5066 | const void *data, int data_len) |
| 5067 | { |
| 5068 | int ret = 0; |
| 5069 | |
| 5070 | vos_ssr_protect(__func__); |
| 5071 | ret = __wlan_hdd_cfg80211_get_supported_features(wiphy, wdev, data, data_len); |
| 5072 | vos_ssr_unprotect(__func__); |
| 5073 | |
| 5074 | return ret; |
| 5075 | } |
| 5076 | |
| 5077 | static int |
| 5078 | __wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5079 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5080 | const void *data, int data_len) |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5081 | { |
| 5082 | uint32_t feature_set_matrix[WLAN_HDD_MAX_FEATURE_SET] = {0}; |
| 5083 | uint8_t i, feature_sets, max_feature_sets; |
| 5084 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX + 1]; |
| 5085 | struct sk_buff *reply_skb; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5086 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5087 | int ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5088 | |
| 5089 | ENTER(); |
| 5090 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5091 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5092 | if (0 != ret) |
| 5093 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5094 | return ret; |
| 5095 | } |
| 5096 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5097 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX, |
| 5098 | data, data_len, NULL)) { |
| 5099 | hddLog(LOGE, FL("Invalid ATTR")); |
| 5100 | return -EINVAL; |
| 5101 | } |
| 5102 | |
| 5103 | /* Parse and fetch max feature set */ |
| 5104 | if (!tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]) { |
| 5105 | hddLog(LOGE, FL("Attr max feature set size failed")); |
| 5106 | return -EINVAL; |
| 5107 | } |
| 5108 | max_feature_sets = nla_get_u32( |
| 5109 | tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]); |
| 5110 | hddLog(LOG1, FL("Max feature set size (%d)"), max_feature_sets); |
| 5111 | |
| 5112 | /* Fill feature combination matrix */ |
| 5113 | feature_sets = 0; |
| 5114 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 5115 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5116 | WIFI_FEATURE_P2P; |
| 5117 | |
| 5118 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 5119 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5120 | WIFI_FEATURE_SOFT_AP; |
| 5121 | |
| 5122 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 5123 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_P2P | |
| 5124 | WIFI_FEATURE_SOFT_AP; |
| 5125 | |
| 5126 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 5127 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5128 | WIFI_FEATURE_SOFT_AP | |
| 5129 | WIFI_FEATURE_P2P; |
| 5130 | |
| 5131 | /* Add more feature combinations here */ |
| 5132 | |
| 5133 | feature_sets = VOS_MIN(feature_sets, max_feature_sets); |
| 5134 | hddLog(LOG1, FL("Number of feature sets (%d)"), feature_sets); |
| 5135 | hddLog(LOG1, "Feature set matrix"); |
| 5136 | for (i = 0; i < feature_sets; i++) |
| 5137 | hddLog(LOG1, "[%d] 0x%02X", i, feature_set_matrix[i]); |
| 5138 | |
| 5139 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 5140 | sizeof(u32) * feature_sets + |
| 5141 | NLMSG_HDRLEN); |
| 5142 | |
| 5143 | if (reply_skb) { |
| 5144 | if (nla_put_u32(reply_skb, |
| 5145 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET_SIZE, |
| 5146 | feature_sets) || |
| 5147 | nla_put(reply_skb, |
| 5148 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET, |
| 5149 | sizeof(u32) * feature_sets, feature_set_matrix)) { |
| 5150 | hddLog(LOGE, FL("nla put fail")); |
| 5151 | kfree_skb(reply_skb); |
| 5152 | return -EINVAL; |
| 5153 | } |
| 5154 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5155 | ret = cfg80211_vendor_cmd_reply(reply_skb); |
| 5156 | EXIT(); |
| 5157 | return ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5158 | } |
| 5159 | hddLog(LOGE, FL("Feature set matrix: buffer alloc fail")); |
| 5160 | return -ENOMEM; |
| 5161 | |
| 5162 | max_buffer_err: |
| 5163 | hddLog(LOGE, FL("Feature set max buffer size reached. feature_sets(%d) max(%d)"), |
| 5164 | feature_sets, WLAN_HDD_MAX_FEATURE_SET); |
| 5165 | return -EINVAL; |
| 5166 | } |
| 5167 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5168 | static int |
| 5169 | wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
| 5170 | struct wireless_dev *wdev, |
| 5171 | const void *data, int data_len) |
| 5172 | { |
| 5173 | int ret = 0; |
| 5174 | |
| 5175 | vos_ssr_protect(__func__); |
| 5176 | ret = __wlan_hdd_cfg80211_get_concurrency_matrix(wiphy, wdev, data, |
| 5177 | data_len); |
| 5178 | vos_ssr_unprotect(__func__); |
| 5179 | |
| 5180 | return ret; |
| 5181 | } |
| 5182 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5183 | static const struct nla_policy |
| 5184 | wlan_hdd_set_no_dfs_flag_config_policy[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX |
| 5185 | +1] = |
| 5186 | { |
| 5187 | [QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG] = {.type = NLA_U32 }, |
| 5188 | }; |
| 5189 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5190 | static int __wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5191 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5192 | const void *data, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5193 | int data_len) |
| 5194 | { |
| 5195 | struct net_device *dev = wdev->netdev; |
| 5196 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5197 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5198 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5199 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX + 1]; |
| 5200 | eHalStatus status; |
| 5201 | u32 dfsFlag = 0; |
| 5202 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5203 | ENTER(); |
| 5204 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5205 | status = wlan_hdd_validate_context(pHddCtx); |
| 5206 | if (0 != status) { |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5207 | return -EINVAL; |
| 5208 | } |
| 5209 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX, |
| 5210 | data, data_len, |
| 5211 | wlan_hdd_set_no_dfs_flag_config_policy)) { |
| 5212 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5213 | return -EINVAL; |
| 5214 | } |
| 5215 | |
| 5216 | /* Parse and fetch required bandwidth kbps */ |
| 5217 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]) { |
| 5218 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dfs flag failed")); |
| 5219 | return -EINVAL; |
| 5220 | } |
| 5221 | |
| 5222 | dfsFlag = nla_get_u32( |
| 5223 | tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]); |
| 5224 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" DFS flag (%d)"), |
| 5225 | dfsFlag); |
| 5226 | |
| 5227 | pHddCtx->disable_dfs_flag = dfsFlag; |
| 5228 | |
| 5229 | sme_disable_dfs_channel(hHal, dfsFlag); |
| 5230 | sme_FilterScanResults(hHal, pAdapter->sessionId); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5231 | |
| 5232 | EXIT(); |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5233 | return 0; |
| 5234 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5235 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5236 | static int wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
| 5237 | struct wireless_dev *wdev, |
| 5238 | const void *data, |
| 5239 | int data_len) |
| 5240 | { |
| 5241 | int ret = 0; |
| 5242 | |
| 5243 | vos_ssr_protect(__func__); |
| 5244 | ret = __wlan_hdd_cfg80211_disable_dfs_channels(wiphy, wdev, data, data_len); |
| 5245 | vos_ssr_unprotect(__func__); |
| 5246 | |
| 5247 | return ret; |
| 5248 | |
| 5249 | } |
| 5250 | |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5251 | const struct |
| 5252 | nla_policy qca_wlan_vendor_attr[QCA_WLAN_VENDOR_ATTR_MAX+1] = |
| 5253 | { |
| 5254 | [QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY] = { .type = NLA_U32 }, |
| 5255 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { .type = NLA_UNSPEC }, |
| 5256 | }; |
| 5257 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5258 | static int __wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5259 | struct wireless_dev *wdev, const void *data, int data_len) |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5260 | { |
| 5261 | |
| 5262 | u8 bssid[6] = {0}; |
| 5263 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5264 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 5265 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5266 | v_U32_t isFwrRoamEnabled = FALSE; |
| 5267 | int ret; |
| 5268 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5269 | ENTER(); |
| 5270 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5271 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5272 | if (0 != ret) { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5273 | return ret; |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5274 | } |
| 5275 | |
| 5276 | ret = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, |
| 5277 | data, data_len, |
| 5278 | qca_wlan_vendor_attr); |
| 5279 | if (ret){ |
| 5280 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5281 | return -EINVAL; |
| 5282 | } |
| 5283 | |
| 5284 | /* Parse and fetch Enable flag */ |
| 5285 | if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]) { |
| 5286 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr enable failed")); |
| 5287 | return -EINVAL; |
| 5288 | } |
| 5289 | |
| 5290 | isFwrRoamEnabled = nla_get_u32( |
| 5291 | tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]); |
| 5292 | |
| 5293 | hddLog(VOS_TRACE_LEVEL_INFO, FL("isFwrRoamEnabled (%d)"), isFwrRoamEnabled); |
| 5294 | |
| 5295 | /* Parse and fetch bssid */ |
| 5296 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 5297 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bss id failed")); |
| 5298 | return -EINVAL; |
| 5299 | } |
| 5300 | |
| 5301 | memcpy(bssid, nla_data( |
| 5302 | tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 5303 | sizeof(bssid)); |
| 5304 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(bssid)); |
| 5305 | |
| 5306 | //Update roaming |
| 5307 | status = sme_ConfigFwrRoaming((tHalHandle)(pHddCtx->hHal), isFwrRoamEnabled); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5308 | EXIT(); |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5309 | return status; |
| 5310 | } |
| 5311 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5312 | static int wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
| 5313 | struct wireless_dev *wdev, const void *data, int data_len) |
| 5314 | { |
| 5315 | int ret = 0; |
| 5316 | |
| 5317 | vos_ssr_protect(__func__); |
| 5318 | ret = __wlan_hdd_cfg80211_firmware_roaming(wiphy, wdev, data, data_len); |
| 5319 | vos_ssr_unprotect(__func__); |
| 5320 | |
| 5321 | return ret; |
| 5322 | } |
| 5323 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5324 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 5325 | { |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5326 | { |
| 5327 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5328 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAMING, |
| 5329 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5330 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5331 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5332 | .doit = wlan_hdd_cfg80211_firmware_roaming |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5333 | }, |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 5334 | |
| 5335 | { |
| 5336 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5337 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN, |
| 5338 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5339 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5340 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 5341 | .doit = wlan_hdd_cfg80211_nan_request |
| 5342 | }, |
| 5343 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5344 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5345 | { |
| 5346 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5347 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 5348 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5349 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5350 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5351 | .doit = wlan_hdd_cfg80211_ll_stats_clear |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5352 | }, |
| 5353 | |
| 5354 | { |
| 5355 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5356 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 5357 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5358 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5359 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5360 | .doit = wlan_hdd_cfg80211_ll_stats_set |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5361 | }, |
| 5362 | |
| 5363 | { |
| 5364 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5365 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 5366 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5367 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5368 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5369 | .doit = wlan_hdd_cfg80211_ll_stats_get |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5370 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5371 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5372 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5373 | { |
| 5374 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5375 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START, |
| 5376 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5377 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5378 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5379 | .doit = wlan_hdd_cfg80211_extscan_start |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5380 | }, |
| 5381 | { |
| 5382 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5383 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP, |
| 5384 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5385 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5386 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5387 | .doit = wlan_hdd_cfg80211_extscan_stop |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5388 | }, |
| 5389 | { |
| 5390 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5391 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS, |
| 5392 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5393 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5394 | .doit = wlan_hdd_cfg80211_extscan_get_valid_channels |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5395 | }, |
| 5396 | { |
| 5397 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5398 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES, |
| 5399 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5400 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5401 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5402 | .doit = wlan_hdd_cfg80211_extscan_get_capabilities |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5403 | }, |
| 5404 | { |
| 5405 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5406 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS, |
| 5407 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5408 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5409 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5410 | .doit = wlan_hdd_cfg80211_extscan_get_cached_results |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5411 | }, |
| 5412 | { |
| 5413 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5414 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST, |
| 5415 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5416 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5417 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5418 | .doit = wlan_hdd_cfg80211_extscan_set_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5419 | }, |
| 5420 | { |
| 5421 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5422 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST, |
| 5423 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5424 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5425 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5426 | .doit = wlan_hdd_cfg80211_extscan_reset_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5427 | }, |
| 5428 | { |
| 5429 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5430 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE, |
| 5431 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5432 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5433 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5434 | .doit = wlan_hdd_cfg80211_extscan_set_significant_change |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5435 | }, |
| 5436 | { |
| 5437 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5438 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE, |
| 5439 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5440 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5441 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5442 | .doit = wlan_hdd_cfg80211_extscan_reset_significant_change |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5443 | }, |
| 5444 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5445 | /*EXT TDLS*/ |
| 5446 | { |
| 5447 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5448 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE, |
| 5449 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5450 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5451 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5452 | .doit = wlan_hdd_cfg80211_exttdls_enable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5453 | }, |
| 5454 | { |
| 5455 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5456 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE, |
| 5457 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5458 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5459 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5460 | .doit = wlan_hdd_cfg80211_exttdls_disable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5461 | }, |
| 5462 | { |
| 5463 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5464 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS, |
| 5465 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5466 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5467 | .doit = wlan_hdd_cfg80211_exttdls_get_status |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5468 | }, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5469 | { |
| 5470 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5471 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES, |
| 5472 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5473 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5474 | .doit = wlan_hdd_cfg80211_get_supported_features |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5475 | }, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5476 | { |
| 5477 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5478 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG, |
| 5479 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5480 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5481 | .doit = wlan_hdd_cfg80211_disable_dfs_channels |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5482 | }, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5483 | { |
| 5484 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5485 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MAC_OUI, |
| 5486 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5487 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5488 | .doit = wlan_hdd_cfg80211_set_spoofed_mac_oui |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5489 | }, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5490 | { |
| 5491 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5492 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX, |
| 5493 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5494 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5495 | .doit = wlan_hdd_cfg80211_get_concurrency_matrix |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5496 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5497 | }; |
| 5498 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5499 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5500 | static const |
| 5501 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5502 | { |
| 5503 | #ifdef FEATURE_WLAN_CH_AVOID |
| 5504 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5505 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5506 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5507 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5508 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 5509 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5510 | { |
| 5511 | /* Index = 1*/ |
| 5512 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5513 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 5514 | }, |
| 5515 | { |
| 5516 | /* Index = 2*/ |
| 5517 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5518 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 5519 | }, |
| 5520 | { |
| 5521 | /* Index = 3*/ |
| 5522 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5523 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 5524 | }, |
| 5525 | { |
| 5526 | /* Index = 4*/ |
| 5527 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5528 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 5529 | }, |
| 5530 | { |
| 5531 | /* Index = 5*/ |
| 5532 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5533 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 5534 | }, |
| 5535 | { |
| 5536 | /* Index = 6*/ |
| 5537 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5538 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 5539 | }, |
| 5540 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5541 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5542 | { |
| 5543 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5544 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START |
| 5545 | }, |
| 5546 | { |
| 5547 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5548 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP |
| 5549 | }, |
| 5550 | { |
| 5551 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5552 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES |
| 5553 | }, |
| 5554 | { |
| 5555 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5556 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS |
| 5557 | }, |
| 5558 | { |
| 5559 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5560 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE |
| 5561 | }, |
| 5562 | { |
| 5563 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5564 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT |
| 5565 | }, |
| 5566 | { |
| 5567 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5568 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT |
| 5569 | }, |
| 5570 | { |
| 5571 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5572 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND |
| 5573 | }, |
| 5574 | { |
| 5575 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5576 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST |
| 5577 | }, |
| 5578 | { |
| 5579 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5580 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST |
| 5581 | }, |
| 5582 | { |
| 5583 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5584 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE |
| 5585 | }, |
| 5586 | { |
| 5587 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5588 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE |
| 5589 | }, |
| 5590 | { |
| 5591 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5592 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE |
| 5593 | }, |
| 5594 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5595 | /*EXT TDLS*/ |
| 5596 | { |
| 5597 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5598 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE |
| 5599 | }, |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 5600 | |
| 5601 | { |
| 5602 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5603 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN |
| 5604 | }, |
| 5605 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5606 | }; |
| 5607 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5608 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5609 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5610 | * This function is called by hdd_wlan_startup() |
| 5611 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5612 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5613 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5614 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5615 | { |
| 5616 | struct wiphy *wiphy; |
| 5617 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5618 | /* |
| 5619 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5620 | */ |
| 5621 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 5622 | |
| 5623 | if (!wiphy) |
| 5624 | { |
| 5625 | /* Print error and jump into err label and free the memory */ |
| 5626 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 5627 | return NULL; |
| 5628 | } |
| 5629 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5630 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5631 | return wiphy; |
| 5632 | } |
| 5633 | |
| 5634 | /* |
| 5635 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5636 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5637 | * private ioctl to change the band value |
| 5638 | */ |
| 5639 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 5640 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5641 | int i, j; |
| 5642 | eNVChannelEnabledType channelEnabledState; |
| 5643 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5644 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5645 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5646 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5647 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5648 | |
| 5649 | if (NULL == wiphy->bands[i]) |
| 5650 | { |
| 5651 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 5652 | __func__, i); |
| 5653 | continue; |
| 5654 | } |
| 5655 | |
| 5656 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 5657 | { |
| 5658 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 5659 | |
| 5660 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 5661 | band->channels[j].hw_value); |
| 5662 | |
| 5663 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 5664 | { |
Abhishek Singh | 678227a | 2014-11-04 10:52:38 +0530 | [diff] [blame] | 5665 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5666 | continue; |
| 5667 | } |
| 5668 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 5669 | { |
| 5670 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5671 | continue; |
| 5672 | } |
| 5673 | |
| 5674 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 5675 | NV_CHANNEL_INVALID == channelEnabledState) |
| 5676 | { |
| 5677 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5678 | } |
| 5679 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 5680 | { |
| 5681 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 5682 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 5683 | } |
| 5684 | else |
| 5685 | { |
| 5686 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 5687 | |IEEE80211_CHAN_RADAR); |
| 5688 | } |
| 5689 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5690 | } |
| 5691 | return 0; |
| 5692 | } |
| 5693 | /* |
| 5694 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5695 | * This function is called by hdd_wlan_startup() |
| 5696 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5697 | * This function is used to initialize and register wiphy structure. |
| 5698 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5699 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5700 | struct wiphy *wiphy, |
| 5701 | hdd_config_t *pCfg |
| 5702 | ) |
| 5703 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5704 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 5705 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5706 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5707 | ENTER(); |
| 5708 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5709 | /* Now bind the underlying wlan device with wiphy */ |
| 5710 | set_wiphy_dev(wiphy, dev); |
| 5711 | |
| 5712 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5713 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5714 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 5715 | /* the flag for the other case would be initialzed in |
| 5716 | vos_init_wiphy_from_nv_bin */ |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 5717 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5718 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5719 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5720 | /* This will disable updating of NL channels from passive to |
| 5721 | * active if a beacon is received on passive channel. */ |
| 5722 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Amar Singhal | f007319 | 2013-09-20 12:34:56 -0700 | [diff] [blame] | 5723 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5724 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5725 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5726 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 5727 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 5728 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 5729 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5730 | | WIPHY_FLAG_OFFCHAN_TX; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5731 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5732 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5733 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5734 | #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] | 5735 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 5736 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 5737 | || pCfg->isFastRoamIniFeatureEnabled |
| 5738 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5739 | #ifdef FEATURE_WLAN_ESE |
| 5740 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 5741 | #endif |
| 5742 | ) |
| 5743 | { |
| 5744 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 5745 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 5746 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5747 | #ifdef FEATURE_WLAN_TDLS |
| 5748 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 5749 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 5750 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 5751 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 5752 | if (pCfg->configPNOScanSupport) |
| 5753 | { |
| 5754 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 5755 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 5756 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 5757 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 5758 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 5759 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5760 | |
Abhishek Singh | 10d8597 | 2015-04-17 10:27:23 +0530 | [diff] [blame] | 5761 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 5762 | wiphy->features |= NL80211_FEATURE_HT_IBSS; |
| 5763 | #endif |
| 5764 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5765 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 5766 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 5767 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5768 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 5769 | driver need to determine what to do with both |
| 5770 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5771 | |
| 5772 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5773 | #else |
| 5774 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5775 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5776 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5777 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 5778 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 5779 | wiphy->max_scan_ie_len = SIR_MAC_MAX_ADD_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5780 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 5781 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 5782 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5783 | /* Supports STATION & AD-HOC modes right now */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5784 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5785 | | BIT(NL80211_IFTYPE_ADHOC) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5786 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 5787 | | BIT(NL80211_IFTYPE_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5788 | | BIT(NL80211_IFTYPE_AP); |
| 5789 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5790 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5791 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5792 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 5793 | if( pCfg->enableMCC ) |
| 5794 | { |
| 5795 | /* Currently, supports up to two channels */ |
| 5796 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5797 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5798 | if( !pCfg->allowMCCGODiffBI ) |
| 5799 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5800 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5801 | } |
| 5802 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 5803 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5804 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5805 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5806 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5807 | /* Before registering we need to update the ht capabilitied based |
| 5808 | * on ini values*/ |
| 5809 | if( !pCfg->ShortGI20MhzEnable ) |
| 5810 | { |
| 5811 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5812 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5813 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5814 | } |
| 5815 | |
| 5816 | if( !pCfg->ShortGI40MhzEnable ) |
| 5817 | { |
| 5818 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 5819 | } |
| 5820 | |
| 5821 | if( !pCfg->nChannelBondingMode5GHz ) |
| 5822 | { |
| 5823 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 5824 | } |
| 5825 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5826 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 5827 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 5828 | { |
| 5829 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 5830 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5831 | |
| 5832 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 5833 | { |
| 5834 | |
| 5835 | if (NULL == wiphy->bands[i]) |
| 5836 | { |
| 5837 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 5838 | __func__, i); |
| 5839 | continue; |
| 5840 | } |
| 5841 | |
| 5842 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 5843 | { |
| 5844 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 5845 | |
| 5846 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 5847 | { |
| 5848 | // Enable social channels for P2P |
| 5849 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 5850 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 5851 | else |
| 5852 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5853 | continue; |
| 5854 | } |
| 5855 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 5856 | { |
| 5857 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5858 | continue; |
| 5859 | } |
| 5860 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5861 | } |
| 5862 | /*Initialise the supported cipher suite details*/ |
| 5863 | wiphy->cipher_suites = hdd_cipher_suites; |
| 5864 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 5865 | |
| 5866 | /*signal strength in mBm (100*dBm) */ |
| 5867 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 5868 | |
| 5869 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 5870 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5871 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5872 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5873 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 5874 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5875 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 5876 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 5877 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5878 | EXIT(); |
| 5879 | return 0; |
| 5880 | } |
| 5881 | |
| 5882 | /* In this function we are registering wiphy. */ |
| 5883 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 5884 | { |
| 5885 | ENTER(); |
| 5886 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5887 | if (0 > wiphy_register(wiphy)) |
| 5888 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5889 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5890 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 5891 | return -EIO; |
| 5892 | } |
| 5893 | |
| 5894 | EXIT(); |
| 5895 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5896 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5897 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5898 | /* In this function we are updating channel list when, |
| 5899 | regulatory domain is FCC and country code is US. |
| 5900 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 5901 | As per FCC smart phone is not a indoor device. |
| 5902 | GO should not opeate on indoor channels */ |
| 5903 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 5904 | { |
| 5905 | int j; |
| 5906 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5907 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 5908 | //Default counrtycode from NV at the time of wiphy initialization. |
| 5909 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 5910 | &defaultCountryCode[0])) |
| 5911 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 5912 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5913 | } |
| 5914 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 5915 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5916 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 5917 | { |
| 5918 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 5919 | return; |
| 5920 | } |
| 5921 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 5922 | { |
| 5923 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 5924 | // Mark UNII -1 band channel as passive |
| 5925 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 5926 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 5927 | } |
| 5928 | } |
| 5929 | } |
| 5930 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 5931 | /* This function registers for all frame which supplicant is interested in */ |
| 5932 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5933 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5934 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5935 | /* Register for all P2P action, public action etc frames */ |
| 5936 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 5937 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5938 | ENTER(); |
| 5939 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5940 | /* Right now we are registering these frame when driver is getting |
| 5941 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 5942 | frame register ops, we will move this code as a part of that */ |
| 5943 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5944 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5945 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 5946 | |
| 5947 | /* GAS Initial Response */ |
| 5948 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5949 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5950 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5951 | /* GAS Comeback Request */ |
| 5952 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5953 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 5954 | |
| 5955 | /* GAS Comeback Response */ |
| 5956 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5957 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 5958 | |
| 5959 | /* P2P Public Action */ |
| 5960 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5961 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5962 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 5963 | |
| 5964 | /* P2P Action */ |
| 5965 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5966 | (v_U8_t*)P2P_ACTION_FRAME, |
| 5967 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5968 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 5969 | /* WNM BSS Transition Request frame */ |
| 5970 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5971 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 5972 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 5973 | |
| 5974 | /* WNM-Notification */ |
| 5975 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5976 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 5977 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5978 | } |
| 5979 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 5980 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5981 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5982 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5983 | /* Register for all P2P action, public action etc frames */ |
| 5984 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 5985 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5986 | ENTER(); |
| 5987 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5988 | /* Right now we are registering these frame when driver is getting |
| 5989 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 5990 | frame register ops, we will move this code as a part of that */ |
| 5991 | /* GAS Initial Request */ |
| 5992 | |
| 5993 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5994 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 5995 | |
| 5996 | /* GAS Initial Response */ |
| 5997 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5998 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5999 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6000 | /* GAS Comeback Request */ |
| 6001 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6002 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 6003 | |
| 6004 | /* GAS Comeback Response */ |
| 6005 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6006 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 6007 | |
| 6008 | /* P2P Public Action */ |
| 6009 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6010 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6011 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 6012 | |
| 6013 | /* P2P Action */ |
| 6014 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6015 | (v_U8_t*)P2P_ACTION_FRAME, |
| 6016 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 6017 | /* WNM-Notification */ |
| 6018 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6019 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 6020 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6021 | } |
| 6022 | |
| 6023 | #ifdef FEATURE_WLAN_WAPI |
| 6024 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
| 6025 | const u8 *mac_addr, u8 *key , int key_Len) |
| 6026 | { |
| 6027 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6028 | tCsrRoamSetKey setKey; |
| 6029 | v_BOOL_t isConnected = TRUE; |
| 6030 | int status = 0; |
| 6031 | v_U32_t roamId= 0xFF; |
| 6032 | tANI_U8 *pKeyPtr = NULL; |
| 6033 | int n = 0; |
| 6034 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6035 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 6036 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6037 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6038 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 6039 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6040 | setKey.keyId = key_index; // Store Key ID |
| 6041 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 6042 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 6043 | setKey.paeRole = 0 ; // the PAE role |
| 6044 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 6045 | { |
| 6046 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 6047 | } |
| 6048 | else |
| 6049 | { |
| 6050 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 6051 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 6052 | } |
| 6053 | setKey.keyLength = key_Len; |
| 6054 | pKeyPtr = setKey.Key; |
| 6055 | memcpy( pKeyPtr, key, key_Len); |
| 6056 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6057 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6058 | __func__, key_Len); |
| 6059 | for (n = 0 ; n < key_Len; n++) |
| 6060 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 6061 | __func__,n,setKey.Key[n]); |
| 6062 | |
| 6063 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 6064 | if ( isConnected ) |
| 6065 | { |
| 6066 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6067 | pAdapter->sessionId, &setKey, &roamId ); |
| 6068 | } |
| 6069 | if ( status != 0 ) |
| 6070 | { |
| 6071 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6072 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 6073 | __LINE__, status ); |
| 6074 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 6075 | } |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 6076 | /* Need to clear any trace of key value in the memory. |
| 6077 | * Thus zero out the memory even though it is local |
| 6078 | * variable. |
| 6079 | */ |
| 6080 | vos_mem_zero(&setKey, sizeof(setKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6081 | } |
| 6082 | #endif /* FEATURE_WLAN_WAPI*/ |
| 6083 | |
| 6084 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6085 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6086 | beacon_data_t **ppBeacon, |
| 6087 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6088 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6089 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6090 | beacon_data_t **ppBeacon, |
| 6091 | struct cfg80211_beacon_data *params, |
| 6092 | int dtim_period) |
| 6093 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6094 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6095 | int size; |
| 6096 | beacon_data_t *beacon = NULL; |
| 6097 | beacon_data_t *old = NULL; |
| 6098 | int head_len,tail_len; |
| 6099 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6100 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6101 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6102 | { |
| 6103 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6104 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6105 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6106 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6107 | |
| 6108 | old = pAdapter->sessionCtx.ap.beacon; |
| 6109 | |
| 6110 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6111 | { |
| 6112 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6113 | FL("session(%d) old and new heads points to NULL"), |
| 6114 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6115 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6116 | } |
| 6117 | |
| 6118 | if (params->tail && !params->tail_len) |
| 6119 | { |
| 6120 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6121 | FL("tail_len is zero but tail is not NULL")); |
| 6122 | return -EINVAL; |
| 6123 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6124 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6125 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 6126 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 6127 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6128 | { |
| 6129 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6130 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6131 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6132 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6133 | #endif |
| 6134 | |
| 6135 | if(params->head) |
| 6136 | head_len = params->head_len; |
| 6137 | else |
| 6138 | head_len = old->head_len; |
| 6139 | |
| 6140 | if(params->tail || !old) |
| 6141 | tail_len = params->tail_len; |
| 6142 | else |
| 6143 | tail_len = old->tail_len; |
| 6144 | |
| 6145 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 6146 | |
| 6147 | beacon = kzalloc(size, GFP_KERNEL); |
| 6148 | |
| 6149 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6150 | { |
| 6151 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6152 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6153 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6154 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6155 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6156 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6157 | if(params->dtim_period || !old ) |
| 6158 | beacon->dtim_period = params->dtim_period; |
| 6159 | else |
| 6160 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6161 | #else |
| 6162 | if(dtim_period || !old ) |
| 6163 | beacon->dtim_period = dtim_period; |
| 6164 | else |
| 6165 | beacon->dtim_period = old->dtim_period; |
| 6166 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6167 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6168 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 6169 | beacon->tail = beacon->head + head_len; |
| 6170 | beacon->head_len = head_len; |
| 6171 | beacon->tail_len = tail_len; |
| 6172 | |
| 6173 | if(params->head) { |
| 6174 | memcpy (beacon->head,params->head,beacon->head_len); |
| 6175 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6176 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6177 | if(old) |
| 6178 | memcpy (beacon->head,old->head,beacon->head_len); |
| 6179 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6180 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6181 | if(params->tail) { |
| 6182 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 6183 | } |
| 6184 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6185 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6186 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 6187 | } |
| 6188 | |
| 6189 | *ppBeacon = beacon; |
| 6190 | |
| 6191 | kfree(old); |
| 6192 | |
| 6193 | return 0; |
| 6194 | |
| 6195 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6196 | |
| 6197 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid) |
| 6198 | { |
| 6199 | int left = length; |
| 6200 | v_U8_t *ptr = pIes; |
| 6201 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6202 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6203 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6204 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6205 | elem_id = ptr[0]; |
| 6206 | elem_len = ptr[1]; |
| 6207 | left -= 2; |
| 6208 | if(elem_len > left) |
| 6209 | { |
| 6210 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 6211 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6212 | eid,elem_len,left); |
| 6213 | return NULL; |
| 6214 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6215 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6216 | { |
| 6217 | return ptr; |
| 6218 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6219 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6220 | left -= elem_len; |
| 6221 | ptr += (elem_len + 2); |
| 6222 | } |
| 6223 | return NULL; |
| 6224 | } |
| 6225 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6226 | /* Check if rate is 11g rate or not */ |
| 6227 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 6228 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 6229 | 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] | 6230 | u8 i; |
| 6231 | for (i = 0; i < 8; i++) |
| 6232 | { |
| 6233 | if(rate == gRateArray[i]) |
| 6234 | return TRUE; |
| 6235 | } |
| 6236 | return FALSE; |
| 6237 | } |
| 6238 | |
| 6239 | /* Check for 11g rate and set proper 11g only mode */ |
| 6240 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 6241 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 6242 | { |
| 6243 | u8 i, num_rates = pIe[0]; |
| 6244 | |
| 6245 | pIe += 1; |
| 6246 | for ( i = 0; i < num_rates; i++) |
| 6247 | { |
| 6248 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 6249 | { |
| 6250 | /* If rate set have 11g rate than change the mode to 11G */ |
| 6251 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 6252 | if (pIe[i] & BASIC_RATE_MASK) |
| 6253 | { |
| 6254 | /* If we have 11g rate as basic rate, it means mode |
| 6255 | is 11g only mode. |
| 6256 | */ |
| 6257 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 6258 | *pCheckRatesfor11g = FALSE; |
| 6259 | } |
| 6260 | } |
| 6261 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 6262 | { |
| 6263 | *require_ht = TRUE; |
| 6264 | } |
| 6265 | } |
| 6266 | return; |
| 6267 | } |
| 6268 | |
| 6269 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 6270 | { |
| 6271 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 6272 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6273 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 6274 | u8 checkRatesfor11g = TRUE; |
| 6275 | u8 require_ht = FALSE; |
| 6276 | u8 *pIe=NULL; |
| 6277 | |
| 6278 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 6279 | |
| 6280 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 6281 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 6282 | if (pIe != NULL) |
| 6283 | { |
| 6284 | pIe += 1; |
| 6285 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 6286 | &pConfig->SapHw_mode); |
| 6287 | } |
| 6288 | |
| 6289 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 6290 | WLAN_EID_EXT_SUPP_RATES); |
| 6291 | if (pIe != NULL) |
| 6292 | { |
| 6293 | |
| 6294 | pIe += 1; |
| 6295 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 6296 | &pConfig->SapHw_mode); |
| 6297 | } |
| 6298 | |
| 6299 | if( pConfig->channel > 14 ) |
| 6300 | { |
| 6301 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 6302 | } |
| 6303 | |
| 6304 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 6305 | WLAN_EID_HT_CAPABILITY); |
| 6306 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6307 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6308 | { |
| 6309 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 6310 | if(require_ht) |
| 6311 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 6312 | } |
| 6313 | } |
| 6314 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6315 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 6316 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 6317 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6318 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6319 | v_U8_t *pIe = NULL; |
| 6320 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6321 | |
| 6322 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 6323 | pBeacon->tail, pBeacon->tail_len); |
| 6324 | |
| 6325 | if (pIe) |
| 6326 | { |
| 6327 | ielen = pIe[1] + 2; |
| 6328 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 6329 | { |
| 6330 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 6331 | } |
| 6332 | else |
| 6333 | { |
| 6334 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 6335 | return -EINVAL; |
| 6336 | } |
| 6337 | *total_ielen += ielen; |
| 6338 | } |
| 6339 | return 0; |
| 6340 | } |
| 6341 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6342 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 6343 | v_U8_t *genie, v_U8_t *total_ielen) |
| 6344 | { |
| 6345 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6346 | int left = pBeacon->tail_len; |
| 6347 | v_U8_t *ptr = pBeacon->tail; |
| 6348 | v_U8_t elem_id, elem_len; |
| 6349 | v_U16_t ielen = 0; |
| 6350 | |
| 6351 | if ( NULL == ptr || 0 == left ) |
| 6352 | return; |
| 6353 | |
| 6354 | while (left >= 2) |
| 6355 | { |
| 6356 | elem_id = ptr[0]; |
| 6357 | elem_len = ptr[1]; |
| 6358 | left -= 2; |
| 6359 | if (elem_len > left) |
| 6360 | { |
| 6361 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 6362 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 6363 | elem_id, elem_len, left); |
| 6364 | return; |
| 6365 | } |
| 6366 | if (IE_EID_VENDOR == elem_id) |
| 6367 | { |
| 6368 | /* skipping the VSIE's which we don't want to include or |
| 6369 | * it will be included by existing code |
| 6370 | */ |
| 6371 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 6372 | #ifdef WLAN_FEATURE_WFD |
| 6373 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 6374 | #endif |
| 6375 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6376 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6377 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 6378 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6379 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 6380 | { |
| 6381 | ielen = ptr[1] + 2; |
| 6382 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 6383 | { |
| 6384 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 6385 | *total_ielen += ielen; |
| 6386 | } |
| 6387 | else |
| 6388 | { |
| 6389 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 6390 | "IE Length is too big " |
| 6391 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 6392 | elem_id, elem_len, *total_ielen); |
| 6393 | } |
| 6394 | } |
| 6395 | } |
| 6396 | |
| 6397 | left -= elem_len; |
| 6398 | ptr += (elem_len + 2); |
| 6399 | } |
| 6400 | return; |
| 6401 | } |
| 6402 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6403 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6404 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 6405 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6406 | #else |
| 6407 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 6408 | struct cfg80211_beacon_data *params) |
| 6409 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6410 | { |
| 6411 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6412 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6413 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6414 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6415 | |
| 6416 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 6417 | |
| 6418 | if(genie == NULL) { |
| 6419 | |
| 6420 | return -ENOMEM; |
| 6421 | } |
| 6422 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6423 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6424 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6425 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6426 | hddLog(LOGE, |
| 6427 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6428 | ret = -EINVAL; |
| 6429 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6430 | } |
| 6431 | |
| 6432 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6433 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6434 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 6435 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6436 | hddLog(LOGE, |
| 6437 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6438 | ret = -EINVAL; |
| 6439 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6440 | } |
| 6441 | #endif |
| 6442 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6443 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6444 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6445 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6446 | hddLog(LOGE, |
| 6447 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6448 | ret = -EINVAL; |
| 6449 | goto done; |
| 6450 | } |
| 6451 | |
| 6452 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 6453 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6454 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6455 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6456 | |
| 6457 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6458 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 6459 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 6460 | { |
| 6461 | hddLog(LOGE, |
| 6462 | "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] | 6463 | ret = -EINVAL; |
| 6464 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6465 | } |
| 6466 | |
| 6467 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6468 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 6469 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6470 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6471 | ==eHAL_STATUS_FAILURE) |
| 6472 | { |
| 6473 | hddLog(LOGE, |
| 6474 | "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] | 6475 | ret = -EINVAL; |
| 6476 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6477 | } |
| 6478 | |
| 6479 | // Added for ProResp IE |
| 6480 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 6481 | { |
| 6482 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 6483 | u8 probe_rsp_ie_len[3] = {0}; |
| 6484 | u8 counter = 0; |
| 6485 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 6486 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 6487 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 6488 | Store More then 255 bytes into One Variable. |
| 6489 | */ |
| 6490 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 6491 | { |
| 6492 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 6493 | { |
| 6494 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 6495 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 6496 | } |
| 6497 | else |
| 6498 | { |
| 6499 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 6500 | rem_probe_resp_ie_len = 0; |
| 6501 | } |
| 6502 | } |
| 6503 | |
| 6504 | rem_probe_resp_ie_len = 0; |
| 6505 | |
| 6506 | if (probe_rsp_ie_len[0] > 0) |
| 6507 | { |
| 6508 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6509 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 6510 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6511 | probe_rsp_ie_len[0], NULL, |
| 6512 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6513 | { |
| 6514 | hddLog(LOGE, |
| 6515 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6516 | ret = -EINVAL; |
| 6517 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6518 | } |
| 6519 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 6520 | } |
| 6521 | |
| 6522 | if (probe_rsp_ie_len[1] > 0) |
| 6523 | { |
| 6524 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6525 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 6526 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6527 | probe_rsp_ie_len[1], NULL, |
| 6528 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6529 | { |
| 6530 | hddLog(LOGE, |
| 6531 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6532 | ret = -EINVAL; |
| 6533 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6534 | } |
| 6535 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 6536 | } |
| 6537 | |
| 6538 | if (probe_rsp_ie_len[2] > 0) |
| 6539 | { |
| 6540 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6541 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 6542 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6543 | probe_rsp_ie_len[2], NULL, |
| 6544 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6545 | { |
| 6546 | hddLog(LOGE, |
| 6547 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6548 | ret = -EINVAL; |
| 6549 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6550 | } |
| 6551 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 6552 | } |
| 6553 | |
| 6554 | if (probe_rsp_ie_len[1] == 0 ) |
| 6555 | { |
| 6556 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6557 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 6558 | eANI_BOOLEAN_FALSE) ) |
| 6559 | { |
| 6560 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6561 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6562 | } |
| 6563 | } |
| 6564 | |
| 6565 | if (probe_rsp_ie_len[2] == 0 ) |
| 6566 | { |
| 6567 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6568 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 6569 | eANI_BOOLEAN_FALSE) ) |
| 6570 | { |
| 6571 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6572 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6573 | } |
| 6574 | } |
| 6575 | |
| 6576 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6577 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 6578 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6579 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6580 | == eHAL_STATUS_FAILURE) |
| 6581 | { |
| 6582 | hddLog(LOGE, |
| 6583 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6584 | ret = -EINVAL; |
| 6585 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6586 | } |
| 6587 | } |
| 6588 | else |
| 6589 | { |
| 6590 | // Reset WNI_CFG_PROBE_RSP Flags |
| 6591 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 6592 | |
| 6593 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6594 | "%s: No Probe Response IE received in set beacon", |
| 6595 | __func__); |
| 6596 | } |
| 6597 | |
| 6598 | // Added for AssocResp IE |
| 6599 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 6600 | { |
| 6601 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6602 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 6603 | params->assocresp_ies_len, NULL, |
| 6604 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6605 | { |
| 6606 | hddLog(LOGE, |
| 6607 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6608 | ret = -EINVAL; |
| 6609 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6610 | } |
| 6611 | |
| 6612 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6613 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 6614 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6615 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6616 | == eHAL_STATUS_FAILURE) |
| 6617 | { |
| 6618 | hddLog(LOGE, |
| 6619 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6620 | ret = -EINVAL; |
| 6621 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6622 | } |
| 6623 | } |
| 6624 | else |
| 6625 | { |
| 6626 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6627 | "%s: No Assoc Response IE received in set beacon", |
| 6628 | __func__); |
| 6629 | |
| 6630 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6631 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 6632 | eANI_BOOLEAN_FALSE) ) |
| 6633 | { |
| 6634 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6635 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6636 | } |
| 6637 | } |
| 6638 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6639 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6640 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6641 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6642 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6643 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6644 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6645 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 6646 | * called by wlan_hdd_cfg80211_start_bss() and |
| 6647 | * wlan_hdd_cfg80211_set_channel() |
| 6648 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6649 | * channel list. |
| 6650 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 6651 | 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] | 6652 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6653 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6654 | v_U32_t num_ch = 0; |
| 6655 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 6656 | u32 indx = 0; |
| 6657 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6658 | v_U8_t fValidChannel = FALSE, count = 0; |
| 6659 | 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] | 6660 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6661 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6662 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6663 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6664 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6665 | /* Validate the channel */ |
| 6666 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6667 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6668 | if ( channel == rfChannels[count].channelNum ) |
| 6669 | { |
| 6670 | fValidChannel = TRUE; |
| 6671 | break; |
| 6672 | } |
| 6673 | } |
| 6674 | if (fValidChannel != TRUE) |
| 6675 | { |
| 6676 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6677 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6678 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6679 | } |
| 6680 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6681 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6682 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6683 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 6684 | valid_ch, &num_ch)) |
| 6685 | { |
| 6686 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6687 | "%s: failed to get valid channel list", __func__); |
| 6688 | return VOS_STATUS_E_FAILURE; |
| 6689 | } |
| 6690 | for (indx = 0; indx < num_ch; indx++) |
| 6691 | { |
| 6692 | if (channel == valid_ch[indx]) |
| 6693 | { |
| 6694 | break; |
| 6695 | } |
| 6696 | } |
| 6697 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6698 | if (indx >= num_ch) |
| 6699 | { |
| 6700 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6701 | { |
| 6702 | eCsrBand band; |
| 6703 | unsigned int freq; |
| 6704 | |
| 6705 | sme_GetFreqBand(hHal, &band); |
| 6706 | |
| 6707 | if (eCSR_BAND_5G == band) |
| 6708 | { |
| 6709 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 6710 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 6711 | { |
| 6712 | freq = ieee80211_channel_to_frequency(channel, |
| 6713 | IEEE80211_BAND_2GHZ); |
| 6714 | } |
| 6715 | else |
| 6716 | { |
| 6717 | freq = ieee80211_channel_to_frequency(channel, |
| 6718 | IEEE80211_BAND_5GHZ); |
| 6719 | } |
| 6720 | #else |
| 6721 | freq = ieee80211_channel_to_frequency(channel); |
| 6722 | #endif |
| 6723 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 6724 | return VOS_STATUS_SUCCESS; |
| 6725 | } |
| 6726 | } |
| 6727 | |
| 6728 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6729 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6730 | return VOS_STATUS_E_FAILURE; |
| 6731 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6732 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6733 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6734 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6735 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6736 | } |
| 6737 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6738 | /** |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6739 | * FUNCTION: __wlan_hdd_cfg80211_set_channel |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6740 | * This function is used to set the channel number |
| 6741 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6742 | 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] | 6743 | struct ieee80211_channel *chan, |
| 6744 | enum nl80211_channel_type channel_type |
| 6745 | ) |
| 6746 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6747 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6748 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6749 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6750 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6751 | hdd_context_t *pHddCtx; |
| 6752 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6753 | |
| 6754 | ENTER(); |
| 6755 | |
| 6756 | if( NULL == dev ) |
| 6757 | { |
| 6758 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6759 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6760 | return -ENODEV; |
| 6761 | } |
| 6762 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6763 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6764 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6765 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 6766 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6767 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6768 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 6769 | hdd_device_modetoString(pAdapter->device_mode), |
| 6770 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6771 | |
| 6772 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6773 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6774 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6775 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6776 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6777 | } |
| 6778 | |
| 6779 | /* |
| 6780 | * Do freq to chan conversion |
| 6781 | * TODO: for 11a |
| 6782 | */ |
| 6783 | |
| 6784 | channel = ieee80211_frequency_to_channel(freq); |
| 6785 | |
| 6786 | /* Check freq range */ |
| 6787 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 6788 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 6789 | { |
| 6790 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6791 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6792 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 6793 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 6794 | return -EINVAL; |
| 6795 | } |
| 6796 | |
| 6797 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6798 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 6799 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 6800 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6801 | { |
| 6802 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6803 | { |
| 6804 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6805 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6806 | return -EINVAL; |
| 6807 | } |
| 6808 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 6809 | "%s: set channel to [%d] for device mode =%d", |
| 6810 | __func__, channel,pAdapter->device_mode); |
| 6811 | } |
| 6812 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6813 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6814 | ) |
| 6815 | { |
| 6816 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6817 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 6818 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6819 | |
| 6820 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 6821 | { |
| 6822 | /* Link is up then return cant set channel*/ |
| 6823 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6824 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6825 | return -EINVAL; |
| 6826 | } |
| 6827 | |
| 6828 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 6829 | pHddStaCtx->conn_info.operationChannel = channel; |
| 6830 | pRoamProfile->ChannelInfo.ChannelList = |
| 6831 | &pHddStaCtx->conn_info.operationChannel; |
| 6832 | } |
| 6833 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6834 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6835 | ) |
| 6836 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6837 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6838 | { |
| 6839 | if(VOS_STATUS_SUCCESS != |
| 6840 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6841 | { |
| 6842 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6843 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6844 | return -EINVAL; |
| 6845 | } |
| 6846 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 6847 | } |
| 6848 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6849 | { |
| 6850 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 6851 | |
| 6852 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 6853 | channel set by supplicant |
| 6854 | */ |
| 6855 | if ( cfg_param->apAutoChannelSelection ) |
| 6856 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6857 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 6858 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6859 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6860 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 6861 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6862 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6863 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6864 | else |
| 6865 | { |
| 6866 | if(VOS_STATUS_SUCCESS != |
| 6867 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6868 | { |
| 6869 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6870 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6871 | return -EINVAL; |
| 6872 | } |
| 6873 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 6874 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6875 | } |
| 6876 | } |
| 6877 | else |
| 6878 | { |
| 6879 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 6880 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 6881 | return -EINVAL; |
| 6882 | } |
| 6883 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6884 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6885 | } |
| 6886 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6887 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, |
| 6888 | struct net_device *dev, |
| 6889 | struct ieee80211_channel *chan, |
| 6890 | enum nl80211_channel_type channel_type |
| 6891 | ) |
| 6892 | { |
| 6893 | int ret; |
| 6894 | |
| 6895 | vos_ssr_protect(__func__); |
| 6896 | ret = __wlan_hdd_cfg80211_set_channel(wiphy, dev, chan, channel_type); |
| 6897 | vos_ssr_unprotect(__func__); |
| 6898 | |
| 6899 | return ret; |
| 6900 | } |
| 6901 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6902 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 6903 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 6904 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6905 | #else |
| 6906 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 6907 | struct cfg80211_beacon_data *params, |
| 6908 | const u8 *ssid, size_t ssid_len, |
| 6909 | enum nl80211_hidden_ssid hidden_ssid) |
| 6910 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6911 | { |
| 6912 | tsap_Config_t *pConfig; |
| 6913 | beacon_data_t *pBeacon = NULL; |
| 6914 | struct ieee80211_mgmt *pMgmt_frame; |
| 6915 | v_U8_t *pIe=NULL; |
| 6916 | v_U16_t capab_info; |
| 6917 | eCsrAuthType RSNAuthType; |
| 6918 | eCsrEncryptionType RSNEncryptType; |
| 6919 | eCsrEncryptionType mcRSNEncryptType; |
| 6920 | int status = VOS_STATUS_SUCCESS; |
| 6921 | tpWLAN_SAPEventCB pSapEventCallback; |
| 6922 | hdd_hostapd_state_t *pHostapdState; |
| 6923 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 6924 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6925 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6926 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6927 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6928 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 6929 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6930 | tSmeConfigParams *psmeConfig; |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 6931 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 6932 | v_BOOL_t MFPRequired = VOS_FALSE; |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 6933 | v_BOOL_t sapEnable11AC = |
| 6934 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapEnable11AC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6935 | ENTER(); |
| 6936 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6937 | iniConfig = pHddCtx->cfg_ini; |
| 6938 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6939 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 6940 | |
| 6941 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 6942 | |
| 6943 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6944 | |
| 6945 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 6946 | |
| 6947 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 6948 | |
| 6949 | //channel is already set in the set_channel Call back |
| 6950 | //pConfig->channel = pCommitConfig->channel; |
| 6951 | |
| 6952 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6953 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6954 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 6955 | |
| 6956 | pConfig->dtim_period = pBeacon->dtim_period; |
| 6957 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6958 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6959 | pConfig->dtim_period); |
| 6960 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 6961 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6962 | { |
| 6963 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6964 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 6965 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 6966 | { |
| 6967 | tANI_BOOLEAN restartNeeded; |
| 6968 | pConfig->ieee80211d = 1; |
| 6969 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 6970 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 6971 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 6972 | } |
| 6973 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6974 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6975 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6976 | pConfig->ieee80211d = 1; |
| 6977 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 6978 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 6979 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6980 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6981 | else |
| 6982 | { |
| 6983 | pConfig->ieee80211d = 0; |
| 6984 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6985 | /* |
| 6986 | * If auto channel is configured i.e. channel is 0, |
| 6987 | * so skip channel validation. |
| 6988 | */ |
| 6989 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 6990 | { |
| 6991 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 6992 | { |
| 6993 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6994 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6995 | return -EINVAL; |
| 6996 | } |
| 6997 | } |
| 6998 | else |
| 6999 | { |
| 7000 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 7001 | { |
| 7002 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 7003 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 7004 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 7005 | } |
| 7006 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 7007 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7008 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7009 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7010 | { |
| 7011 | pConfig->ieee80211d = 0; |
| 7012 | } |
| 7013 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 7014 | |
| 7015 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7016 | |
| 7017 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7018 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 7019 | |
| 7020 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 7021 | |
| 7022 | /*Set wps station to configured*/ |
| 7023 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 7024 | |
| 7025 | if(pIe) |
| 7026 | { |
| 7027 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 7028 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7029 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7030 | return -EINVAL; |
| 7031 | } |
| 7032 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 7033 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 7034 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7035 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 7036 | * WPS state |
| 7037 | */ |
| 7038 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 7039 | { |
| 7040 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 7041 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 7042 | { |
| 7043 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 7044 | } |
| 7045 | } |
| 7046 | } |
| 7047 | else |
| 7048 | { |
| 7049 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 7050 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7051 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7052 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 7053 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 7054 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 7055 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 7056 | eCSR_ENCRYPT_TYPE_NONE; |
| 7057 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7058 | pConfig->RSNWPAReqIELength = 0; |
| 7059 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7060 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7061 | WLAN_EID_RSN); |
| 7062 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7063 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7064 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 7065 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 7066 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7067 | /* The actual processing may eventually be more extensive than |
| 7068 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7069 | * by the app. |
| 7070 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7071 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7072 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 7073 | &RSNEncryptType, |
| 7074 | &mcRSNEncryptType, |
| 7075 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7076 | &MFPCapable, |
| 7077 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7078 | pConfig->pRSNWPAReqIE[1]+2, |
| 7079 | pConfig->pRSNWPAReqIE ); |
| 7080 | |
| 7081 | if( VOS_STATUS_SUCCESS == status ) |
| 7082 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7083 | /* Now copy over all the security attributes you have |
| 7084 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7085 | * */ |
| 7086 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 7087 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 7088 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 7089 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 7090 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7091 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7092 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 7093 | } |
| 7094 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7095 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7096 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7097 | pBeacon->tail, pBeacon->tail_len); |
| 7098 | |
| 7099 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 7100 | { |
| 7101 | if (pConfig->pRSNWPAReqIE) |
| 7102 | { |
| 7103 | /*Mixed mode WPA/WPA2*/ |
| 7104 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 7105 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 7106 | } |
| 7107 | else |
| 7108 | { |
| 7109 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 7110 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 7111 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7112 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7113 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 7114 | &RSNEncryptType, |
| 7115 | &mcRSNEncryptType, |
| 7116 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7117 | &MFPCapable, |
| 7118 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7119 | pConfig->pRSNWPAReqIE[1]+2, |
| 7120 | pConfig->pRSNWPAReqIE ); |
| 7121 | |
| 7122 | if( VOS_STATUS_SUCCESS == status ) |
| 7123 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7124 | /* Now copy over all the security attributes you have |
| 7125 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7126 | * */ |
| 7127 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 7128 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 7129 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 7130 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 7131 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7132 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7133 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 7134 | } |
| 7135 | } |
| 7136 | } |
| 7137 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7138 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 7139 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 7140 | return -EINVAL; |
| 7141 | } |
| 7142 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7143 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 7144 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7145 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7146 | if (params->ssid != NULL) |
| 7147 | { |
| 7148 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 7149 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 7150 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 7151 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 7152 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7153 | #else |
| 7154 | if (ssid != NULL) |
| 7155 | { |
| 7156 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 7157 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 7158 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 7159 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 7160 | } |
| 7161 | #endif |
| 7162 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7163 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7164 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7165 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7166 | /* default value */ |
| 7167 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 7168 | pConfig->num_accept_mac = 0; |
| 7169 | pConfig->num_deny_mac = 0; |
| 7170 | |
| 7171 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7172 | pBeacon->tail, pBeacon->tail_len); |
| 7173 | |
| 7174 | /* pIe for black list is following form: |
| 7175 | type : 1 byte |
| 7176 | length : 1 byte |
| 7177 | OUI : 4 bytes |
| 7178 | acl type : 1 byte |
| 7179 | no of mac addr in black list: 1 byte |
| 7180 | 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] | 7181 | */ |
| 7182 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7183 | { |
| 7184 | pConfig->SapMacaddr_acl = pIe[6]; |
| 7185 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7186 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7187 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7188 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 7189 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7190 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 7191 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 7192 | { |
| 7193 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 7194 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7195 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7196 | } |
| 7197 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7198 | pBeacon->tail, pBeacon->tail_len); |
| 7199 | |
| 7200 | /* pIe for white list is following form: |
| 7201 | type : 1 byte |
| 7202 | length : 1 byte |
| 7203 | OUI : 4 bytes |
| 7204 | acl type : 1 byte |
| 7205 | no of mac addr in white list: 1 byte |
| 7206 | 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] | 7207 | */ |
| 7208 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7209 | { |
| 7210 | pConfig->SapMacaddr_acl = pIe[6]; |
| 7211 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7212 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7213 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7214 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 7215 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7216 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 7217 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 7218 | { |
| 7219 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 7220 | acl_entry++; |
| 7221 | } |
| 7222 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7223 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7224 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 7225 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7226 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 7227 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 7228 | * This is valid only if mode is set to 11n in hostapd, sapEnable11AC |
| 7229 | * 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] | 7230 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 7231 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 7232 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 7233 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 7234 | (sapEnable11AC) && (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 7235 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7236 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7237 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7238 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7239 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7240 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 7241 | /* If ACS disable and selected channel <= 14 |
| 7242 | * OR |
| 7243 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 7244 | * AND |
| 7245 | * VHT in 2.4G Disabled |
| 7246 | * THEN |
| 7247 | * Fallback to 11N mode |
| 7248 | */ |
| 7249 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 7250 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 7251 | operatingBand == eSAP_RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 7252 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7253 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7254 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 7255 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7256 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 7257 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7258 | } |
| 7259 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7260 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7261 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 7262 | pConfig->ht_capab = |
| 7263 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 7264 | |
| 7265 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 7266 | { |
| 7267 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 7268 | return -EINVAL; |
| 7269 | } |
| 7270 | |
| 7271 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7272 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7273 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 7274 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7275 | pConfig->obssProtEnabled = |
| 7276 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7277 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7278 | #ifdef WLAN_FEATURE_11W |
| 7279 | pConfig->mfpCapable = MFPCapable; |
| 7280 | pConfig->mfpRequired = MFPRequired; |
| 7281 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 7282 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 7283 | #endif |
| 7284 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7285 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7286 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7287 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 7288 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 7289 | (int)pConfig->channel); |
| 7290 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 7291 | pConfig->SapHw_mode, pConfig->privacy, |
| 7292 | pConfig->authType); |
| 7293 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 7294 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 7295 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 7296 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7297 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7298 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7299 | { |
| 7300 | //Bss already started. just return. |
| 7301 | //TODO Probably it should update some beacon params. |
| 7302 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 7303 | EXIT(); |
| 7304 | return 0; |
| 7305 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7306 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7307 | if (vos_max_concurrent_connections_reached()) { |
| 7308 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7309 | return -EINVAL; |
| 7310 | } |
| 7311 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7312 | pConfig->persona = pHostapdAdapter->device_mode; |
| 7313 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7314 | psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams)); |
| 7315 | if ( NULL != psmeConfig) |
| 7316 | { |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 7317 | vos_mem_zero(psmeConfig, sizeof (tSmeConfigParams)); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7318 | sme_GetConfigParam(hHal, psmeConfig); |
| 7319 | pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference; |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 7320 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 7321 | if (((pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 7322 | || (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 7323 | && pHddCtx->cfg_ini->apHT40_24GEnabled) |
| 7324 | { |
| 7325 | psmeConfig->csrConfig.apHT40_24GEnabled = 1; |
| 7326 | sme_UpdateConfig (hHal, psmeConfig); |
| 7327 | } |
| 7328 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7329 | vos_mem_free(psmeConfig); |
| 7330 | } |
Peng Xu | afc34e3 | 2014-09-25 13:23:55 +0530 | [diff] [blame] | 7331 | pConfig->acsBandSwitchThreshold = iniConfig->acsBandSwitchThreshold; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7332 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7333 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 7334 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 7335 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 7336 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7337 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7338 | return -EINVAL; |
| 7339 | } |
| 7340 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7341 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7342 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 7343 | |
| 7344 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7345 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7346 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7347 | { |
| 7348 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7349 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 7350 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7351 | VOS_ASSERT(0); |
| 7352 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7353 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7354 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Kaushik, Sushant | f607080 | 2014-10-15 15:09:23 +0530 | [diff] [blame] | 7355 | /* Initialize WMM configuation */ |
| 7356 | hdd_wmm_init(pHostapdAdapter); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7357 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7358 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7359 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7360 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 7361 | { |
| 7362 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 7363 | { |
| 7364 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 7365 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 7366 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7367 | } |
| 7368 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 7369 | { |
| 7370 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 7371 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 7372 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7373 | } |
| 7374 | } |
| 7375 | #endif |
| 7376 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7377 | pHostapdState->bCommit = TRUE; |
| 7378 | EXIT(); |
| 7379 | |
| 7380 | return 0; |
| 7381 | } |
| 7382 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7383 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7384 | static int __wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7385 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7386 | struct beacon_parameters *params) |
| 7387 | { |
| 7388 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7389 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7390 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7391 | |
| 7392 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7393 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7394 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7395 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 7396 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7397 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 7398 | hdd_device_modetoString(pAdapter->device_mode), |
| 7399 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7400 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7401 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7402 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7403 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7404 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7405 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7406 | } |
| 7407 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7408 | if (vos_max_concurrent_connections_reached()) { |
| 7409 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7410 | return -EINVAL; |
| 7411 | } |
| 7412 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7413 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7414 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7415 | ) |
| 7416 | { |
| 7417 | beacon_data_t *old,*new; |
| 7418 | |
| 7419 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7420 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7421 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7422 | { |
| 7423 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 7424 | FL("already beacon info added to session(%d)"), |
| 7425 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7426 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7427 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7428 | |
| 7429 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 7430 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7431 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7432 | { |
| 7433 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7434 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7435 | return -EINVAL; |
| 7436 | } |
| 7437 | |
| 7438 | pAdapter->sessionCtx.ap.beacon = new; |
| 7439 | |
| 7440 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 7441 | } |
| 7442 | |
| 7443 | EXIT(); |
| 7444 | return status; |
| 7445 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7446 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7447 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 7448 | struct net_device *dev, |
| 7449 | struct beacon_parameters *params) |
| 7450 | { |
| 7451 | int ret; |
| 7452 | |
| 7453 | vos_ssr_protect(__func__); |
| 7454 | ret = __wlan_hdd_cfg80211_add_beacon(wiphy, dev, params); |
| 7455 | vos_ssr_unprotect(__func__); |
| 7456 | |
| 7457 | return ret; |
| 7458 | } |
| 7459 | |
| 7460 | static int __wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7461 | struct net_device *dev, |
| 7462 | struct beacon_parameters *params) |
| 7463 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7464 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7465 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7466 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7467 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7468 | |
| 7469 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 7470 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7471 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7472 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 7473 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 7474 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7475 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7476 | pAdapter->device_mode); |
| 7477 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7478 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7479 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7480 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7481 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7482 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7483 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7484 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7485 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7486 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7487 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7488 | { |
| 7489 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7490 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7491 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7492 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7493 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7494 | { |
| 7495 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7496 | FL("session(%d) old and new heads points to NULL"), |
| 7497 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7498 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7499 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7500 | |
| 7501 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 7502 | |
| 7503 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7504 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7505 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7506 | return -EINVAL; |
| 7507 | } |
| 7508 | |
| 7509 | pAdapter->sessionCtx.ap.beacon = new; |
| 7510 | |
| 7511 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 7512 | } |
| 7513 | |
| 7514 | EXIT(); |
| 7515 | return status; |
| 7516 | } |
| 7517 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7518 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
| 7519 | struct net_device *dev, |
| 7520 | struct beacon_parameters *params) |
| 7521 | { |
| 7522 | int ret; |
| 7523 | |
| 7524 | vos_ssr_protect(__func__); |
| 7525 | ret = __wlan_hdd_cfg80211_set_beacon(wiphy, dev, params); |
| 7526 | vos_ssr_unprotect(__func__); |
| 7527 | |
| 7528 | return ret; |
| 7529 | } |
| 7530 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7531 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7532 | |
| 7533 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7534 | static int __wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7535 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7536 | #else |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7537 | static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7538 | struct net_device *dev) |
| 7539 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7540 | { |
| 7541 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7542 | hdd_context_t *pHddCtx = NULL; |
| 7543 | hdd_scaninfo_t *pScanInfo = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7544 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7545 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7546 | |
| 7547 | ENTER(); |
| 7548 | |
| 7549 | if (NULL == pAdapter) |
| 7550 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7551 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7552 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7553 | return -ENODEV; |
| 7554 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7555 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7556 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7557 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 7558 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7559 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7560 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7561 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7562 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7563 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7564 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7565 | |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7566 | pScanInfo = &pHddCtx->scan_info; |
| 7567 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7568 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7569 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7570 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7571 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7572 | ret = wlan_hdd_scan_abort(pAdapter); |
| 7573 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 7574 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7575 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7576 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7577 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7578 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7579 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7580 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7581 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7582 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 7583 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7584 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7585 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7586 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7587 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7588 | } |
| 7589 | |
Rashmi Ramanna | 1f0948d | 2014-08-28 15:33:48 +0530 | [diff] [blame] | 7590 | /* Delete all associated STAs before stopping AP/P2P GO */ |
| 7591 | hdd_del_all_sta(pAdapter); |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 7592 | hdd_hostapd_stop(dev); |
| 7593 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7594 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7595 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7596 | ) |
| 7597 | { |
| 7598 | beacon_data_t *old; |
| 7599 | |
| 7600 | old = pAdapter->sessionCtx.ap.beacon; |
| 7601 | |
| 7602 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7603 | { |
| 7604 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7605 | FL("session(%d) beacon data points to NULL"), |
| 7606 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7607 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7608 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7609 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7610 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7611 | |
| 7612 | mutex_lock(&pHddCtx->sap_lock); |
| 7613 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 7614 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7615 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7616 | { |
| 7617 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 7618 | |
| 7619 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 7620 | |
| 7621 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 7622 | { |
| 7623 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7624 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7625 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7626 | } |
| 7627 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7628 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7629 | /* BSS stopped, clear the active sessions for this device mode */ |
| 7630 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7631 | } |
| 7632 | mutex_unlock(&pHddCtx->sap_lock); |
| 7633 | |
| 7634 | if(status != VOS_STATUS_SUCCESS) |
| 7635 | { |
| 7636 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7637 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7638 | return -EINVAL; |
| 7639 | } |
| 7640 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7641 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7642 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 7643 | ==eHAL_STATUS_FAILURE) |
| 7644 | { |
| 7645 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7646 | "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] | 7647 | } |
| 7648 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7649 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7650 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 7651 | eANI_BOOLEAN_FALSE) ) |
| 7652 | { |
| 7653 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7654 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7655 | } |
| 7656 | |
| 7657 | // Reset WNI_CFG_PROBE_RSP Flags |
| 7658 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 7659 | |
| 7660 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 7661 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7662 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7663 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 7664 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 7665 | { |
| 7666 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 7667 | "GO got removed"); |
| 7668 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 7669 | } |
| 7670 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7671 | } |
| 7672 | EXIT(); |
| 7673 | return status; |
| 7674 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7675 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7676 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7677 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 7678 | struct net_device *dev) |
| 7679 | { |
| 7680 | int ret; |
| 7681 | |
| 7682 | vos_ssr_protect(__func__); |
| 7683 | ret = __wlan_hdd_cfg80211_del_beacon(wiphy, dev); |
| 7684 | vos_ssr_unprotect(__func__); |
| 7685 | |
| 7686 | return ret; |
| 7687 | } |
| 7688 | #else |
| 7689 | static int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, |
| 7690 | struct net_device *dev) |
| 7691 | { |
| 7692 | int ret; |
| 7693 | |
| 7694 | vos_ssr_protect(__func__); |
| 7695 | ret = __wlan_hdd_cfg80211_stop_ap(wiphy, dev); |
| 7696 | vos_ssr_unprotect(__func__); |
| 7697 | |
| 7698 | return ret; |
| 7699 | } |
| 7700 | #endif |
| 7701 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7702 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 7703 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7704 | static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7705 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7706 | struct cfg80211_ap_settings *params) |
| 7707 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7708 | hdd_adapter_t *pAdapter; |
| 7709 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7710 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7711 | |
| 7712 | ENTER(); |
| 7713 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7714 | if (NULL == dev || NULL == params) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7715 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7716 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7717 | "%s: Device or params is Null", __func__); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7718 | return -ENODEV; |
| 7719 | } |
| 7720 | |
| 7721 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7722 | if (NULL == pAdapter) |
| 7723 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7724 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7725 | "%s: HDD adapter is Null", __func__); |
| 7726 | return -ENODEV; |
| 7727 | } |
| 7728 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7729 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7730 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 7731 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7732 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 7733 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7734 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7735 | "%s: HDD adapter magic is invalid", __func__); |
| 7736 | return -ENODEV; |
| 7737 | } |
| 7738 | |
| 7739 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7740 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7741 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7742 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7743 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7744 | } |
| 7745 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7746 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 7747 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7748 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7749 | |
| 7750 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7751 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7752 | ) |
| 7753 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7754 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7755 | |
| 7756 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7757 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7758 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7759 | { |
| 7760 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 7761 | FL("already beacon info added to session(%d)"), |
| 7762 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7763 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7764 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7765 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7766 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7767 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 7768 | &new, |
| 7769 | ¶ms->beacon); |
| 7770 | #else |
| 7771 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 7772 | &new, |
| 7773 | ¶ms->beacon, |
| 7774 | params->dtim_period); |
| 7775 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7776 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7777 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7778 | { |
| 7779 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7780 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7781 | return -EINVAL; |
| 7782 | } |
| 7783 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7784 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 7785 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 7786 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 7787 | params->channel, params->channel_type); |
| 7788 | #else |
| 7789 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 7790 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7791 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7792 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
| 7793 | params->ssid_len, params->hidden_ssid); |
| 7794 | } |
| 7795 | |
| 7796 | EXIT(); |
| 7797 | return status; |
| 7798 | } |
| 7799 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7800 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 7801 | struct net_device *dev, |
| 7802 | struct cfg80211_ap_settings *params) |
| 7803 | { |
| 7804 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7805 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7806 | vos_ssr_protect(__func__); |
| 7807 | ret = __wlan_hdd_cfg80211_start_ap(wiphy, dev, params); |
| 7808 | vos_ssr_unprotect(__func__); |
| 7809 | |
| 7810 | return ret; |
| 7811 | } |
| 7812 | |
| 7813 | static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7814 | struct net_device *dev, |
| 7815 | struct cfg80211_beacon_data *params) |
| 7816 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7817 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7818 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7819 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7820 | |
| 7821 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7822 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7823 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7824 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 7825 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7826 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7827 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7828 | |
| 7829 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7830 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7831 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7832 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7833 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7834 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7835 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7836 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7837 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7838 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7839 | { |
| 7840 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7841 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7842 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7843 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7844 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7845 | { |
| 7846 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7847 | FL("session(%d) beacon data points to NULL"), |
| 7848 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7849 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7850 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7851 | |
| 7852 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 7853 | |
| 7854 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7855 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7856 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7857 | return -EINVAL; |
| 7858 | } |
| 7859 | |
| 7860 | pAdapter->sessionCtx.ap.beacon = new; |
| 7861 | |
| 7862 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0); |
| 7863 | } |
| 7864 | |
| 7865 | EXIT(); |
| 7866 | return status; |
| 7867 | } |
| 7868 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7869 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
| 7870 | struct net_device *dev, |
| 7871 | struct cfg80211_beacon_data *params) |
| 7872 | { |
| 7873 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7874 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7875 | vos_ssr_protect(__func__); |
| 7876 | ret = __wlan_hdd_cfg80211_change_beacon(wiphy, dev, params); |
| 7877 | vos_ssr_unprotect(__func__); |
| 7878 | |
| 7879 | return ret; |
| 7880 | } |
| 7881 | |
| 7882 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7883 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 7884 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7885 | struct net_device *dev, |
| 7886 | struct bss_parameters *params) |
| 7887 | { |
| 7888 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7889 | hdd_context_t *pHddCtx; |
| 7890 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7891 | |
| 7892 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7893 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7894 | if (NULL == pAdapter) |
| 7895 | { |
| 7896 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7897 | "%s: HDD adapter is Null", __func__); |
| 7898 | return -ENODEV; |
| 7899 | } |
| 7900 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7901 | ret = wlan_hdd_validate_context(pHddCtx); |
| 7902 | if (0 != ret) |
| 7903 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7904 | return ret; |
| 7905 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7906 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7907 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 7908 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7909 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7910 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7911 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7912 | |
| 7913 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7914 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7915 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7916 | { |
| 7917 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 7918 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7919 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7920 | { |
| 7921 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7922 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7923 | } |
| 7924 | |
| 7925 | EXIT(); |
| 7926 | return 0; |
| 7927 | } |
| 7928 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 7929 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 7930 | struct net_device *dev, |
| 7931 | struct bss_parameters *params) |
| 7932 | { |
| 7933 | int ret; |
| 7934 | |
| 7935 | vos_ssr_protect(__func__); |
| 7936 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 7937 | vos_ssr_unprotect(__func__); |
| 7938 | |
| 7939 | return ret; |
| 7940 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7941 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 7942 | * to wait for contry code completion |
| 7943 | */ |
| 7944 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 7945 | { |
| 7946 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 7947 | complete(&call_back_pAdapter->change_country_code); |
| 7948 | return NULL; |
| 7949 | } |
| 7950 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7951 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7952 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7953 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 7954 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7955 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7956 | struct net_device *ndev, |
| 7957 | enum nl80211_iftype type, |
| 7958 | u32 *flags, |
| 7959 | struct vif_params *params |
| 7960 | ) |
| 7961 | { |
| 7962 | struct wireless_dev *wdev; |
| 7963 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7964 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7965 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7966 | tCsrRoamProfile *pRoamProfile = NULL; |
| 7967 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7968 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7969 | eMib_dot11DesiredBssType connectedBssType; |
| 7970 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7971 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7972 | |
| 7973 | ENTER(); |
| 7974 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7975 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7976 | { |
| 7977 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7978 | "%s: Adapter context is null", __func__); |
| 7979 | return VOS_STATUS_E_FAILURE; |
| 7980 | } |
| 7981 | |
| 7982 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7983 | if (!pHddCtx) |
| 7984 | { |
| 7985 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7986 | "%s: HDD context is null", __func__); |
| 7987 | return VOS_STATUS_E_FAILURE; |
| 7988 | } |
| 7989 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7990 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7991 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 7992 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7993 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7994 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7995 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7996 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7997 | } |
| 7998 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7999 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8000 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8001 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8002 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 8003 | if (vos_max_concurrent_connections_reached()) { |
| 8004 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 8005 | return -EINVAL; |
| 8006 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8007 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8008 | wdev = ndev->ieee80211_ptr; |
| 8009 | |
| 8010 | #ifdef WLAN_BTAMP_FEATURE |
| 8011 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 8012 | (NL80211_IFTYPE_ADHOC == type)|| |
| 8013 | (NL80211_IFTYPE_AP == type)|| |
| 8014 | (NL80211_IFTYPE_P2P_GO == type)) |
| 8015 | { |
| 8016 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 8017 | // stop AMP traffic |
| 8018 | status = WLANBAP_StopAmp(); |
| 8019 | if(VOS_STATUS_SUCCESS != status ) |
| 8020 | { |
| 8021 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 8022 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 8023 | "%s: Failed to stop AMP", __func__); |
| 8024 | return -EINVAL; |
| 8025 | } |
| 8026 | } |
| 8027 | #endif //WLAN_BTAMP_FEATURE |
| 8028 | /* Reset the current device mode bit mask*/ |
| 8029 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 8030 | |
| 8031 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8032 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8033 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8034 | ) |
| 8035 | { |
| 8036 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 8037 | if (!pWextState) |
| 8038 | { |
| 8039 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8040 | "%s: pWextState is null", __func__); |
| 8041 | return VOS_STATUS_E_FAILURE; |
| 8042 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8043 | pRoamProfile = &pWextState->roamProfile; |
| 8044 | LastBSSType = pRoamProfile->BSSType; |
| 8045 | |
| 8046 | switch (type) |
| 8047 | { |
| 8048 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8049 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8050 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8051 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 8052 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8053 | #ifdef WLAN_FEATURE_11AC |
| 8054 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 8055 | { |
| 8056 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 8057 | } |
| 8058 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8059 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8060 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8061 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8062 | //Check for sub-string p2p to confirm its a p2p interface |
| 8063 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8064 | { |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8065 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 8066 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 8067 | } |
| 8068 | else |
| 8069 | { |
| 8070 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8071 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8072 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8073 | break; |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 8074 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8075 | case NL80211_IFTYPE_ADHOC: |
| 8076 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8077 | "%s: setting interface Type to ADHOC", __func__); |
| 8078 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 8079 | pRoamProfile->phyMode = |
| 8080 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 8081 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8082 | wdev->iftype = type; |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 8083 | hdd_set_ibss_ops( pAdapter ); |
| 8084 | hdd_ibss_init_tx_rx( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8085 | break; |
| 8086 | |
| 8087 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8088 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8089 | { |
| 8090 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 8091 | "%s: setting interface Type to %s", __func__, |
| 8092 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 8093 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8094 | //Cancel any remain on channel for GO mode |
| 8095 | if (NL80211_IFTYPE_P2P_GO == type) |
| 8096 | { |
| 8097 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 8098 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8099 | if (NL80211_IFTYPE_AP == type) |
| 8100 | { |
| 8101 | /* As Loading WLAN Driver one interface being created for p2p device |
| 8102 | * address. This will take one HW STA and the max number of clients |
| 8103 | * that can connect to softAP will be reduced by one. so while changing |
| 8104 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 8105 | * interface as it is not required in SoftAP mode. |
| 8106 | */ |
| 8107 | |
| 8108 | // Get P2P Adapter |
| 8109 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 8110 | |
| 8111 | if (pP2pAdapter) |
| 8112 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 8113 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8114 | hdd_deinit_adapter(pHddCtx, pP2pAdapter, TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8115 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 8116 | } |
| 8117 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 8118 | //Disable IMPS & BMPS for SAP/GO |
| 8119 | if(VOS_STATUS_E_FAILURE == |
| 8120 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 8121 | { |
| 8122 | //Fail to Exit BMPS |
| 8123 | VOS_ASSERT(0); |
| 8124 | } |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 8125 | |
| 8126 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
| 8127 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8128 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8129 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8130 | /* A Mutex Lock is introduced while changing the mode to |
| 8131 | * protect the concurrent access for the Adapters by TDLS |
| 8132 | * module. |
| 8133 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8134 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8135 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8136 | //De-init the adapter. |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8137 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8138 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8139 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 8140 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8141 | #ifdef FEATURE_WLAN_TDLS |
| 8142 | mutex_unlock(&pHddCtx->tdls_lock); |
| 8143 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 8144 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 8145 | (pConfig->apRandomBssidEnabled)) |
| 8146 | { |
| 8147 | /* To meet Android requirements create a randomized |
| 8148 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 8149 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 8150 | ndev->dev_addr[0] = 0x02; |
| 8151 | ndev->dev_addr[1] = 0x1A; |
| 8152 | ndev->dev_addr[2] = 0x11; |
| 8153 | ndev->dev_addr[3] |= 0xF0; |
| 8154 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 8155 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 8156 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 8157 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 8158 | } |
| 8159 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8160 | hdd_set_ap_ops( pAdapter->dev ); |
| 8161 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8162 | /* This is for only SAP mode where users can |
| 8163 | * control country through ini. |
| 8164 | * P2P GO follows station country code |
| 8165 | * acquired during the STA scanning. */ |
| 8166 | if((NL80211_IFTYPE_AP == type) && |
| 8167 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 8168 | { |
| 8169 | int status = 0; |
| 8170 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 8171 | "%s: setting country code from INI ", __func__); |
| 8172 | init_completion(&pAdapter->change_country_code); |
| 8173 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 8174 | (void *)(tSmeChangeCountryCallback) |
| 8175 | wlan_hdd_change_country_code_cb, |
| 8176 | pConfig->apCntryCode, pAdapter, |
| 8177 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 8178 | eSIR_FALSE, |
| 8179 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8180 | if (eHAL_STATUS_SUCCESS == status) |
| 8181 | { |
| 8182 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8183 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8184 | &pAdapter->change_country_code, |
| 8185 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8186 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8187 | { |
| 8188 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8189 | FL("SME Timed out while setting country code %ld"), |
| 8190 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 8191 | |
| 8192 | if (pHddCtx->isLogpInProgress) |
| 8193 | { |
| 8194 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8195 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 8196 | return -EAGAIN; |
| 8197 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8198 | } |
| 8199 | } |
| 8200 | else |
| 8201 | { |
| 8202 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8203 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8204 | return -EINVAL; |
| 8205 | } |
| 8206 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8207 | status = hdd_init_ap_mode(pAdapter); |
| 8208 | if(status != VOS_STATUS_SUCCESS) |
| 8209 | { |
| 8210 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 8211 | "%s: Error initializing the ap mode", __func__); |
| 8212 | return -EINVAL; |
| 8213 | } |
| 8214 | hdd_set_conparam(1); |
| 8215 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8216 | /*interface type changed update in wiphy structure*/ |
| 8217 | if(wdev) |
| 8218 | { |
| 8219 | wdev->iftype = type; |
| 8220 | pHddCtx->change_iface = type; |
| 8221 | } |
| 8222 | else |
| 8223 | { |
| 8224 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8225 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 8226 | return -EINVAL; |
| 8227 | } |
| 8228 | goto done; |
| 8229 | } |
| 8230 | |
| 8231 | default: |
| 8232 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 8233 | __func__); |
| 8234 | return -EOPNOTSUPP; |
| 8235 | } |
| 8236 | } |
| 8237 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8238 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8239 | ) |
| 8240 | { |
| 8241 | switch(type) |
| 8242 | { |
| 8243 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8244 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8245 | case NL80211_IFTYPE_ADHOC: |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 8246 | |
| 8247 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8248 | #ifdef FEATURE_WLAN_TDLS |
| 8249 | |
| 8250 | /* A Mutex Lock is introduced while changing the mode to |
| 8251 | * protect the concurrent access for the Adapters by TDLS |
| 8252 | * module. |
| 8253 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8254 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8255 | #endif |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8256 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8257 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8258 | //Check for sub-string p2p to confirm its a p2p interface |
| 8259 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8260 | { |
| 8261 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 8262 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 8263 | } |
| 8264 | else |
| 8265 | { |
| 8266 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8267 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8268 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8269 | hdd_set_conparam(0); |
| 8270 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8271 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 8272 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8273 | #ifdef FEATURE_WLAN_TDLS |
| 8274 | mutex_unlock(&pHddCtx->tdls_lock); |
| 8275 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 8276 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8277 | if( VOS_STATUS_SUCCESS != status ) |
| 8278 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8279 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 8280 | * This is the right place to enable back bmps_imps() |
| 8281 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 8282 | if (pHddCtx->hdd_wlan_suspended) |
| 8283 | { |
| 8284 | hdd_set_pwrparams(pHddCtx); |
| 8285 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8286 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8287 | goto done; |
| 8288 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8289 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8290 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8291 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 8292 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8293 | goto done; |
| 8294 | default: |
| 8295 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 8296 | __func__); |
| 8297 | return -EOPNOTSUPP; |
| 8298 | |
| 8299 | } |
| 8300 | |
| 8301 | } |
| 8302 | else |
| 8303 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8304 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 8305 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8306 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8307 | return -EOPNOTSUPP; |
| 8308 | } |
| 8309 | |
| 8310 | |
| 8311 | if(pRoamProfile) |
| 8312 | { |
| 8313 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 8314 | { |
| 8315 | /*interface type changed update in wiphy structure*/ |
| 8316 | wdev->iftype = type; |
| 8317 | |
| 8318 | /*the BSS mode changed, We need to issue disconnect |
| 8319 | if connected or in IBSS disconnect state*/ |
| 8320 | if ( hdd_connGetConnectedBssType( |
| 8321 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 8322 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 8323 | { |
| 8324 | /*need to issue a disconnect to CSR.*/ |
| 8325 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 8326 | if( eHAL_STATUS_SUCCESS == |
| 8327 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8328 | pAdapter->sessionId, |
| 8329 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 8330 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8331 | ret = wait_for_completion_interruptible_timeout( |
| 8332 | &pAdapter->disconnect_comp_var, |
| 8333 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 8334 | if (ret <= 0) |
| 8335 | { |
| 8336 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8337 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 8338 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8339 | } |
| 8340 | } |
| 8341 | } |
| 8342 | } |
| 8343 | |
| 8344 | done: |
| 8345 | /*set bitmask based on updated value*/ |
| 8346 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 8347 | |
| 8348 | /* Only STA mode support TM now |
| 8349 | * all other mode, TM feature should be disabled */ |
| 8350 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 8351 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 8352 | { |
| 8353 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 8354 | } |
| 8355 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8356 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8357 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 8358 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8359 | { |
| 8360 | //we are ok to do AMP |
| 8361 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 8362 | } |
| 8363 | #endif //WLAN_BTAMP_FEATURE |
| 8364 | EXIT(); |
| 8365 | return 0; |
| 8366 | } |
| 8367 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 8368 | /* |
| 8369 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 8370 | * wrapper function to protect the actual implementation from SSR. |
| 8371 | */ |
| 8372 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 8373 | struct net_device *ndev, |
| 8374 | enum nl80211_iftype type, |
| 8375 | u32 *flags, |
| 8376 | struct vif_params *params |
| 8377 | ) |
| 8378 | { |
| 8379 | int ret; |
| 8380 | |
| 8381 | vos_ssr_protect(__func__); |
| 8382 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 8383 | vos_ssr_unprotect(__func__); |
| 8384 | |
| 8385 | return ret; |
| 8386 | } |
| 8387 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8388 | #ifdef FEATURE_WLAN_TDLS |
| 8389 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
| 8390 | struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams) |
| 8391 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8392 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8393 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8394 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8395 | tANI_U16 numCurrTdlsPeers; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 8396 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8397 | |
| 8398 | ENTER(); |
| 8399 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 8400 | if (!dev) { |
| 8401 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 8402 | return -EINVAL; |
| 8403 | } |
| 8404 | |
| 8405 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8406 | if (!pAdapter) { |
| 8407 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 8408 | return -EINVAL; |
| 8409 | } |
| 8410 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8411 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8412 | { |
| 8413 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8414 | "Invalid arguments"); |
| 8415 | return -EINVAL; |
| 8416 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8417 | |
| 8418 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 8419 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 8420 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8421 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8422 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 8423 | MAC_ADDRESS_STR " Request declined.", |
| 8424 | __func__, MAC_ADDR_ARRAY(mac)); |
| 8425 | return -ENOTSUPP; |
| 8426 | } |
| 8427 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8428 | if (pHddCtx->isLogpInProgress) |
| 8429 | { |
| 8430 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8431 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8432 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8433 | mac, |
| 8434 | eTDLS_LINK_IDLE, |
| 8435 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8436 | return -EBUSY; |
| 8437 | } |
| 8438 | |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 8439 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8440 | |
| 8441 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8442 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8443 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 8444 | __func__, MAC_ADDR_ARRAY(mac), update); |
| 8445 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8446 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8447 | |
| 8448 | /* in add station, we accept existing valid staId if there is */ |
| 8449 | if ((0 == update) && |
| 8450 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 8451 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8452 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8453 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8454 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8455 | " link_status %d. staId %d. add station ignored.", |
| 8456 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 8457 | return 0; |
| 8458 | } |
| 8459 | /* in change station, we accept only when staId is valid */ |
| 8460 | if ((1 == update) && |
| 8461 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 8462 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 8463 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8464 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8465 | "%s: " MAC_ADDRESS_STR |
| 8466 | " link status %d. staId %d. change station %s.", |
| 8467 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 8468 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 8469 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8470 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8471 | |
| 8472 | /* when others are on-going, we want to change link_status to idle */ |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 8473 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8474 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8475 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8476 | "%s: " MAC_ADDRESS_STR |
| 8477 | " TDLS setup is ongoing. Request declined.", |
| 8478 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8479 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8480 | } |
| 8481 | |
| 8482 | /* first to check if we reached to maximum supported TDLS peer. |
| 8483 | TODO: for now, return -EPERM looks working fine, |
| 8484 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8485 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 8486 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8487 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8488 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8489 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8490 | " TDLS Max peer already connected. Request declined." |
| 8491 | " Num of peers (%d), Max allowed (%d).", |
| 8492 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 8493 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8494 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8495 | } |
| 8496 | else |
| 8497 | { |
| 8498 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8499 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8500 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8501 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8502 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8503 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 8504 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8505 | return -EPERM; |
| 8506 | } |
| 8507 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8508 | if (0 == update) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8509 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8510 | mac, |
| 8511 | eTDLS_LINK_CONNECTING, |
| 8512 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8513 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 8514 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8515 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8516 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8517 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8518 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8519 | if(StaParams->htcap_present) |
| 8520 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8521 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8522 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8523 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8524 | "ht_capa->extended_capabilities: %0x", |
| 8525 | StaParams->HTCap.extendedHtCapInfo); |
| 8526 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8527 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8528 | "params->capability: %0x",StaParams->capability); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8529 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8530 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8531 | if(StaParams->vhtcap_present) |
| 8532 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8533 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8534 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 8535 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 8536 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 8537 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8538 | { |
| 8539 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8540 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8541 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8542 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8543 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 8544 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 8545 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8546 | else if ((1 == update) && (NULL == StaParams)) |
| 8547 | { |
| 8548 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8549 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 8550 | return -EPERM; |
| 8551 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8552 | |
| 8553 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 8554 | |
| 8555 | if (!update) |
| 8556 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8557 | ret = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8558 | pAdapter->sessionId, mac); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8559 | if (ret != eHAL_STATUS_SUCCESS) { |
| 8560 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to add TDLS peer STA")); |
| 8561 | return -EPERM; |
| 8562 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8563 | } |
| 8564 | else |
| 8565 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8566 | ret = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8567 | pAdapter->sessionId, mac, StaParams); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8568 | if (ret != eHAL_STATUS_SUCCESS) { |
| 8569 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to change TDLS peer STA params")); |
| 8570 | return -EPERM; |
| 8571 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8572 | } |
| 8573 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8574 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8575 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 8576 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8577 | if (ret <= 0) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8578 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8579 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8580 | "%s: timeout waiting for tdls add station indication %ld", |
| 8581 | __func__, ret); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8582 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8583 | } |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8584 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8585 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 8586 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8587 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8588 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8589 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8590 | } |
| 8591 | |
| 8592 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8593 | |
| 8594 | error: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8595 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8596 | mac, |
| 8597 | eTDLS_LINK_IDLE, |
| 8598 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8599 | return -EPERM; |
| 8600 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8601 | } |
| 8602 | #endif |
| 8603 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8604 | static int __wlan_hdd_change_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8605 | struct net_device *dev, |
| 8606 | u8 *mac, |
| 8607 | struct station_parameters *params) |
| 8608 | { |
| 8609 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8610 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8611 | hdd_context_t *pHddCtx; |
| 8612 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8613 | v_MACADDR_t STAMacAddress; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8614 | int ret = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8615 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8616 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8617 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8618 | tANI_U8 isOffChannelSupported = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8619 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8620 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8621 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8622 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8623 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8624 | if ((NULL == pAdapter)) |
| 8625 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8626 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8627 | "invalid adapter "); |
| 8628 | return -EINVAL; |
| 8629 | } |
| 8630 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8631 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8632 | TRACE_CODE_HDD_CHANGE_STATION, |
| 8633 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8634 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8635 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8636 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8637 | if (0 != ret) |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8638 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8639 | return ret; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8640 | } |
| 8641 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8642 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8643 | |
| 8644 | if (NULL == pHddStaCtx) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8645 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8646 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8647 | "invalid HDD station context"); |
| 8648 | return -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8649 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8650 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 8651 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8652 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 8653 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8654 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8655 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8656 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8657 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8658 | WLANTL_STA_AUTHENTICATED); |
| 8659 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8660 | if (status != VOS_STATUS_SUCCESS) |
| 8661 | { |
| 8662 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8663 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 8664 | return -EINVAL; |
| 8665 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8666 | } |
| 8667 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 8668 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 8669 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8670 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8671 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 8672 | StaParams.capability = params->capability; |
| 8673 | StaParams.uapsd_queues = params->uapsd_queues; |
| 8674 | StaParams.max_sp = params->max_sp; |
| 8675 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8676 | /* Convert (first channel , number of channels) tuple to |
| 8677 | * the total list of channels. This goes with the assumption |
| 8678 | * that if the first channel is < 14, then the next channels |
| 8679 | * are an incremental of 1 else an incremental of 4 till the number |
| 8680 | * of channels. |
| 8681 | */ |
| 8682 | if (0 != params->supported_channels_len) { |
| 8683 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 8684 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 8685 | { |
| 8686 | int wifi_chan_index; |
| 8687 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 8688 | wifi_chan_index = |
| 8689 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 8690 | no_of_channels = params->supported_channels[i+1]; |
| 8691 | for(k=1; k <= no_of_channels; k++) |
| 8692 | { |
| 8693 | StaParams.supported_channels[j+1] = |
| 8694 | StaParams.supported_channels[j] + wifi_chan_index; |
| 8695 | j+=1; |
| 8696 | } |
| 8697 | } |
| 8698 | StaParams.supported_channels_len = j; |
| 8699 | } |
| 8700 | vos_mem_copy(StaParams.supported_oper_classes, |
| 8701 | params->supported_oper_classes, |
| 8702 | params->supported_oper_classes_len); |
| 8703 | StaParams.supported_oper_classes_len = |
| 8704 | params->supported_oper_classes_len; |
| 8705 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8706 | if (0 != params->ext_capab_len) |
| 8707 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 8708 | sizeof(StaParams.extn_capability)); |
| 8709 | |
| 8710 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8711 | { |
| 8712 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8713 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8714 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8715 | |
| 8716 | StaParams.supported_rates_len = params->supported_rates_len; |
| 8717 | |
| 8718 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 8719 | * The supported_rates array , for all the structures propogating till Add Sta |
| 8720 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 8721 | * modified to send more rates. |
| 8722 | */ |
| 8723 | |
| 8724 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 8725 | */ |
| 8726 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 8727 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 8728 | |
| 8729 | if (0 != StaParams.supported_rates_len) { |
| 8730 | int i = 0; |
| 8731 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 8732 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8733 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8734 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 8735 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8736 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8737 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 8738 | } |
| 8739 | |
| 8740 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8741 | { |
| 8742 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8743 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8744 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8745 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8746 | if (0 != params->ext_capab_len ) { |
| 8747 | /*Define A Macro : TODO Sunil*/ |
| 8748 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 8749 | isBufSta = 1; |
| 8750 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8751 | /* TDLS Channel Switching Support */ |
| 8752 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 8753 | isOffChannelSupported = 1; |
| 8754 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8755 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8756 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 8757 | &StaParams, isBufSta, |
| 8758 | isOffChannelSupported); |
| 8759 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8760 | if (VOS_STATUS_SUCCESS != status) { |
| 8761 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8762 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 8763 | return -EINVAL; |
| 8764 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8765 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 8766 | |
| 8767 | if (VOS_STATUS_SUCCESS != status) { |
| 8768 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8769 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 8770 | return -EINVAL; |
| 8771 | } |
| 8772 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8773 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 8774 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8775 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8776 | return status; |
| 8777 | } |
| 8778 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8779 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 8780 | struct net_device *dev, |
| 8781 | u8 *mac, |
| 8782 | struct station_parameters *params) |
| 8783 | { |
| 8784 | int ret; |
| 8785 | |
| 8786 | vos_ssr_protect(__func__); |
| 8787 | ret = __wlan_hdd_change_station(wiphy, dev, mac, params); |
| 8788 | vos_ssr_unprotect(__func__); |
| 8789 | |
| 8790 | return ret; |
| 8791 | } |
| 8792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8793 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8794 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8795 | * This function is used to initialize the key information |
| 8796 | */ |
| 8797 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8798 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8799 | struct net_device *ndev, |
| 8800 | u8 key_index, bool pairwise, |
| 8801 | const u8 *mac_addr, |
| 8802 | struct key_params *params |
| 8803 | ) |
| 8804 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8805 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8806 | struct net_device *ndev, |
| 8807 | u8 key_index, const u8 *mac_addr, |
| 8808 | struct key_params *params |
| 8809 | ) |
| 8810 | #endif |
| 8811 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8812 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8813 | tCsrRoamSetKey setKey; |
| 8814 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8815 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8816 | v_U32_t roamId= 0xFF; |
| 8817 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8818 | hdd_hostapd_state_t *pHostapdState; |
| 8819 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8820 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8821 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8822 | |
| 8823 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8824 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8825 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8826 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 8827 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8828 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8829 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8830 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8831 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8832 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8833 | } |
| 8834 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8835 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8836 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8837 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8838 | |
| 8839 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8840 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8841 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8842 | key_index); |
| 8843 | |
| 8844 | return -EINVAL; |
| 8845 | } |
| 8846 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8847 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 8848 | { |
| 8849 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 8850 | params->key_len); |
| 8851 | |
| 8852 | return -EINVAL; |
| 8853 | } |
| 8854 | |
| 8855 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8856 | "%s: called with key index = %d & key length %d", |
| 8857 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8858 | |
| 8859 | /*extract key idx, key len and key*/ |
| 8860 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8861 | setKey.keyId = key_index; |
| 8862 | setKey.keyLength = params->key_len; |
| 8863 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 8864 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8865 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8866 | { |
| 8867 | case WLAN_CIPHER_SUITE_WEP40: |
| 8868 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 8869 | break; |
| 8870 | |
| 8871 | case WLAN_CIPHER_SUITE_WEP104: |
| 8872 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 8873 | break; |
| 8874 | |
| 8875 | case WLAN_CIPHER_SUITE_TKIP: |
| 8876 | { |
| 8877 | u8 *pKey = &setKey.Key[0]; |
| 8878 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 8879 | |
| 8880 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 8881 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8882 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8883 | |
| 8884 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8885 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8886 | |--------------|----------|----------| |
| 8887 | <---16bytes---><--8bytes--><--8bytes--> |
| 8888 | |
| 8889 | */ |
| 8890 | /*Sme expects the 32 bytes key to be in the below order |
| 8891 | |
| 8892 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8893 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8894 | |--------------|----------|----------| |
| 8895 | <---16bytes---><--8bytes--><--8bytes--> |
| 8896 | */ |
| 8897 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8898 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8899 | |
| 8900 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8901 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8902 | |
| 8903 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8904 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8905 | |
| 8906 | |
| 8907 | break; |
| 8908 | } |
| 8909 | |
| 8910 | case WLAN_CIPHER_SUITE_CCMP: |
| 8911 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 8912 | break; |
| 8913 | |
| 8914 | #ifdef FEATURE_WLAN_WAPI |
| 8915 | case WLAN_CIPHER_SUITE_SMS4: |
| 8916 | { |
| 8917 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8918 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 8919 | params->key, params->key_len); |
| 8920 | return 0; |
| 8921 | } |
| 8922 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8923 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8924 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8925 | case WLAN_CIPHER_SUITE_KRK: |
| 8926 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 8927 | break; |
| 8928 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8929 | |
| 8930 | #ifdef WLAN_FEATURE_11W |
| 8931 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 8932 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 8933 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8934 | #endif |
| 8935 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8936 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8937 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8938 | __func__, params->cipher); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8939 | status = -EOPNOTSUPP; |
| 8940 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8941 | } |
| 8942 | |
| 8943 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 8944 | __func__, setKey.encType); |
| 8945 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8946 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8947 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8948 | (!pairwise) |
| 8949 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8950 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8951 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8952 | ) |
| 8953 | { |
| 8954 | /* set group key*/ |
| 8955 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8956 | "%s- %d: setting Broadcast key", |
| 8957 | __func__, __LINE__); |
| 8958 | setKey.keyDirection = eSIR_RX_ONLY; |
| 8959 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 8960 | } |
| 8961 | else |
| 8962 | { |
| 8963 | /* set pairwise key*/ |
| 8964 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8965 | "%s- %d: setting pairwise key", |
| 8966 | __func__, __LINE__); |
| 8967 | setKey.keyDirection = eSIR_TX_RX; |
| 8968 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 8969 | } |
| 8970 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 8971 | { |
| 8972 | setKey.keyDirection = eSIR_TX_RX; |
| 8973 | /*Set the group key*/ |
| 8974 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8975 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8976 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8977 | if ( 0 != status ) |
| 8978 | { |
| 8979 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8980 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8981 | status = -EINVAL; |
| 8982 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8983 | } |
| 8984 | /*Save the keys here and call sme_RoamSetKey for setting |
| 8985 | the PTK after peer joins the IBSS network*/ |
| 8986 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 8987 | &setKey, sizeof(tCsrRoamSetKey)); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8988 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8989 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8990 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 8991 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 8992 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8993 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8994 | if( pHostapdState->bssState == BSS_START ) |
| 8995 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8996 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 8997 | |
| 8998 | if ( status != eHAL_STATUS_SUCCESS ) |
| 8999 | { |
| 9000 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9001 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 9002 | __LINE__, status ); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9003 | status = -EINVAL; |
| 9004 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9005 | } |
| 9006 | } |
| 9007 | |
| 9008 | /* Saving WEP keys */ |
| 9009 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 9010 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 9011 | { |
| 9012 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 9013 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 9014 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 9015 | } |
| 9016 | else |
| 9017 | { |
| 9018 | //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] | 9019 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9020 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 9021 | } |
| 9022 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9023 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 9024 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9025 | { |
| 9026 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9027 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9028 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9029 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9030 | if (!pairwise) |
| 9031 | #else |
| 9032 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 9033 | #endif |
| 9034 | { |
| 9035 | /* set group key*/ |
| 9036 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 9037 | { |
| 9038 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9039 | "%s- %d: Perform Set key Complete", |
| 9040 | __func__, __LINE__); |
| 9041 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 9042 | } |
| 9043 | } |
| 9044 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9045 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 9046 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 9047 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 9048 | |
| 9049 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9050 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9051 | params->key, params->key_len); |
| 9052 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9053 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9054 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 9055 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9056 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9057 | "%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] | 9058 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9059 | setKey.peerMac[2], setKey.peerMac[3], |
| 9060 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9061 | setKey.keyDirection); |
| 9062 | |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 9063 | /* Wait for EAPOL M4 before setting key. |
| 9064 | * No need to consider Dynamic WEP as we will receive M8. |
| 9065 | */ |
| 9066 | if ( (setKey.encType == eCSR_ENCRYPT_TYPE_AES || |
| 9067 | setKey.encType == eCSR_ENCRYPT_TYPE_TKIP) && |
| 9068 | ( 1 |
| 9069 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 9070 | && pHddStaCtx->conn_info.authType != eCSR_AUTH_TYPE_FT_RSN |
| 9071 | && pHddStaCtx->conn_info.authType != eCSR_AUTH_TYPE_FT_RSN_PSK |
| 9072 | #endif |
| 9073 | #ifdef FEATURE_WLAN_ESE |
| 9074 | && pHddStaCtx->conn_info.authType != eCSR_AUTH_TYPE_CCKM_WPA |
| 9075 | && pHddStaCtx->conn_info.authType != eCSR_AUTH_TYPE_CCKM_RSN |
| 9076 | #endif |
| 9077 | )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9078 | { |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 9079 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 9080 | |
| 9081 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 9082 | { |
| 9083 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9084 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 9085 | __LINE__, vos_status ); |
| 9086 | |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 9087 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9088 | |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 9089 | status = -EINVAL; |
| 9090 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9091 | |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 9092 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9093 | } |
| 9094 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9095 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9096 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 9097 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 9098 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9099 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9100 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9101 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9102 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 9103 | "%s: Update PreAuth Key success", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9104 | status = 0; |
| 9105 | goto end; |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9106 | } |
| 9107 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 9108 | { |
| 9109 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9110 | "%s: Update PreAuth Key failed", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9111 | status = -EINVAL; |
| 9112 | goto end; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9113 | } |
| 9114 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9115 | |
| 9116 | /* issue set key request to SME*/ |
| 9117 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9118 | pAdapter->sessionId, &setKey, &roamId ); |
| 9119 | |
| 9120 | if ( 0 != status ) |
| 9121 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9122 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9123 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 9124 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9125 | status = -EINVAL; |
| 9126 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9127 | } |
| 9128 | |
| 9129 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9130 | /* in case of IBSS as there was no information available about WEP keys during |
| 9131 | * 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] | 9132 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9133 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 9134 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 9135 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9136 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 9137 | ) |
| 9138 | && |
| 9139 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 9140 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 9141 | ) |
| 9142 | ) |
| 9143 | { |
| 9144 | setKey.keyDirection = eSIR_RX_ONLY; |
| 9145 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 9146 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9147 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9148 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9149 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9150 | setKey.peerMac[2], setKey.peerMac[3], |
| 9151 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9152 | setKey.keyDirection); |
| 9153 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9154 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9155 | pAdapter->sessionId, &setKey, &roamId ); |
| 9156 | |
| 9157 | if ( 0 != status ) |
| 9158 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9159 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9160 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9161 | __func__, status); |
| 9162 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9163 | status = -EINVAL; |
| 9164 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9165 | } |
| 9166 | } |
| 9167 | } |
| 9168 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9169 | end: |
| 9170 | /* Need to clear any trace of key value in the memory. |
| 9171 | * Thus zero out the memory even though it is local |
| 9172 | * variable. |
| 9173 | */ |
| 9174 | vos_mem_zero(&setKey, sizeof(setKey)); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9175 | EXIT(); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9176 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9177 | } |
| 9178 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9179 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9180 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 9181 | struct net_device *ndev, |
| 9182 | u8 key_index, bool pairwise, |
| 9183 | const u8 *mac_addr, |
| 9184 | struct key_params *params |
| 9185 | ) |
| 9186 | #else |
| 9187 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 9188 | struct net_device *ndev, |
| 9189 | u8 key_index, const u8 *mac_addr, |
| 9190 | struct key_params *params |
| 9191 | ) |
| 9192 | #endif |
| 9193 | { |
| 9194 | int ret; |
| 9195 | vos_ssr_protect(__func__); |
| 9196 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9197 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 9198 | mac_addr, params); |
| 9199 | #else |
| 9200 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 9201 | params); |
| 9202 | #endif |
| 9203 | vos_ssr_unprotect(__func__); |
| 9204 | |
| 9205 | return ret; |
| 9206 | } |
| 9207 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9208 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9209 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9210 | * This function is used to get the key information |
| 9211 | */ |
| 9212 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9213 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9214 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9215 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9216 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9217 | const u8 *mac_addr, void *cookie, |
| 9218 | void (*callback)(void *cookie, struct key_params*) |
| 9219 | ) |
| 9220 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9221 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9222 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9223 | struct net_device *ndev, |
| 9224 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 9225 | void (*callback)(void *cookie, struct key_params*) |
| 9226 | ) |
| 9227 | #endif |
| 9228 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9229 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9230 | hdd_wext_state_t *pWextState = NULL; |
| 9231 | tCsrRoamProfile *pRoamProfile = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9232 | struct key_params params; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9233 | hdd_context_t *pHddCtx; |
| 9234 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9235 | |
| 9236 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9237 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9238 | if (NULL == pAdapter) |
| 9239 | { |
| 9240 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9241 | "%s: HDD adapter is Null", __func__); |
| 9242 | return -ENODEV; |
| 9243 | } |
| 9244 | |
| 9245 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9246 | ret = wlan_hdd_validate_context(pHddCtx); |
| 9247 | if (0 != ret) |
| 9248 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9249 | return ret; |
| 9250 | } |
| 9251 | |
| 9252 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9253 | pRoamProfile = &(pWextState->roamProfile); |
| 9254 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9255 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 9256 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9257 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9258 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9259 | memset(¶ms, 0, sizeof(params)); |
| 9260 | |
| 9261 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9262 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9263 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9264 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9265 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9266 | |
| 9267 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 9268 | { |
| 9269 | case eCSR_ENCRYPT_TYPE_NONE: |
| 9270 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 9271 | break; |
| 9272 | |
| 9273 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 9274 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 9275 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 9276 | break; |
| 9277 | |
| 9278 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 9279 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 9280 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 9281 | break; |
| 9282 | |
| 9283 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 9284 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 9285 | break; |
| 9286 | |
| 9287 | case eCSR_ENCRYPT_TYPE_AES: |
| 9288 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 9289 | break; |
| 9290 | |
| 9291 | default: |
| 9292 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 9293 | break; |
| 9294 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9295 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 9296 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9297 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 9298 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9299 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9300 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 9301 | params.seq_len = 0; |
| 9302 | params.seq = NULL; |
| 9303 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 9304 | callback(cookie, ¶ms); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9305 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9306 | return 0; |
| 9307 | } |
| 9308 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9309 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9310 | static int wlan_hdd_cfg80211_get_key( |
| 9311 | struct wiphy *wiphy, |
| 9312 | struct net_device *ndev, |
| 9313 | u8 key_index, bool pairwise, |
| 9314 | const u8 *mac_addr, void *cookie, |
| 9315 | void (*callback)(void *cookie, struct key_params*) |
| 9316 | ) |
| 9317 | #else |
| 9318 | static int wlan_hdd_cfg80211_get_key( |
| 9319 | struct wiphy *wiphy, |
| 9320 | struct net_device *ndev, |
| 9321 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 9322 | void (*callback)(void *cookie, struct key_params*) |
| 9323 | ) |
| 9324 | #endif |
| 9325 | { |
| 9326 | int ret; |
| 9327 | |
| 9328 | vos_ssr_protect(__func__); |
| 9329 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9330 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 9331 | mac_addr, cookie, callback); |
| 9332 | #else |
| 9333 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 9334 | callback); |
| 9335 | #endif |
| 9336 | vos_ssr_unprotect(__func__); |
| 9337 | |
| 9338 | return ret; |
| 9339 | } |
| 9340 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9341 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9342 | * FUNCTION: __wlan_hdd_cfg80211_del_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9343 | * This function is used to delete the key information |
| 9344 | */ |
| 9345 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9346 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9347 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9348 | u8 key_index, |
| 9349 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9350 | const u8 *mac_addr |
| 9351 | ) |
| 9352 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9353 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9354 | struct net_device *ndev, |
| 9355 | u8 key_index, |
| 9356 | const u8 *mac_addr |
| 9357 | ) |
| 9358 | #endif |
| 9359 | { |
| 9360 | int status = 0; |
| 9361 | |
| 9362 | //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] | 9363 | //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] | 9364 | //it is observed that this is invalidating peer |
| 9365 | //key index whenever re-key is done. This is affecting data link. |
| 9366 | //It should be ok to ignore del_key. |
| 9367 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9368 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 9369 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9370 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 9371 | tCsrRoamSetKey setKey; |
| 9372 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9374 | ENTER(); |
| 9375 | |
| 9376 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 9377 | __func__,pAdapter->device_mode); |
| 9378 | |
| 9379 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9380 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9381 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9382 | key_index); |
| 9383 | |
| 9384 | return -EINVAL; |
| 9385 | } |
| 9386 | |
| 9387 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9388 | setKey.keyId = key_index; |
| 9389 | |
| 9390 | if (mac_addr) |
| 9391 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 9392 | else |
| 9393 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 9394 | |
| 9395 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 9396 | |
| 9397 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9398 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9399 | ) |
| 9400 | { |
| 9401 | |
| 9402 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9403 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 9404 | if( pHostapdState->bssState == BSS_START) |
| 9405 | { |
| 9406 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9407 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9408 | if ( status != eHAL_STATUS_SUCCESS ) |
| 9409 | { |
| 9410 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9411 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 9412 | __LINE__, status ); |
| 9413 | } |
| 9414 | } |
| 9415 | } |
| 9416 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9417 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9418 | ) |
| 9419 | { |
| 9420 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9421 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9422 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 9423 | |
| 9424 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9425 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9426 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9427 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9428 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9429 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 9430 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9431 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9432 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9433 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9434 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9435 | if ( 0 != status ) |
| 9436 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9437 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9438 | "%s: sme_RoamSetKey failure, returned %d", |
| 9439 | __func__, status); |
| 9440 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 9441 | return -EINVAL; |
| 9442 | } |
| 9443 | } |
| 9444 | } |
| 9445 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9446 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9447 | return status; |
| 9448 | } |
| 9449 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9450 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9451 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 9452 | struct net_device *ndev, |
| 9453 | u8 key_index, |
| 9454 | bool pairwise, |
| 9455 | const u8 *mac_addr |
| 9456 | ) |
| 9457 | #else |
| 9458 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 9459 | struct net_device *ndev, |
| 9460 | u8 key_index, |
| 9461 | const u8 *mac_addr |
| 9462 | ) |
| 9463 | #endif |
| 9464 | { |
| 9465 | int ret; |
| 9466 | |
| 9467 | vos_ssr_protect(__func__); |
| 9468 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9469 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, pairwise, |
| 9470 | mac_addr); |
| 9471 | #else |
| 9472 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, mac_addr); |
| 9473 | #endif |
| 9474 | vos_ssr_unprotect(__func__); |
| 9475 | |
| 9476 | return ret; |
| 9477 | } |
| 9478 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9479 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9480 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9481 | * This function is used to set the default tx key index |
| 9482 | */ |
| 9483 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9484 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9485 | struct net_device *ndev, |
| 9486 | u8 key_index, |
| 9487 | bool unicast, bool multicast) |
| 9488 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9489 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9490 | struct net_device *ndev, |
| 9491 | u8 key_index) |
| 9492 | #endif |
| 9493 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9494 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9495 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9496 | hdd_wext_state_t *pWextState; |
| 9497 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9498 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9499 | |
| 9500 | ENTER(); |
| 9501 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9502 | if ((NULL == pAdapter)) |
| 9503 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9504 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9505 | "invalid adapter"); |
| 9506 | return -EINVAL; |
| 9507 | } |
| 9508 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9509 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9510 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 9511 | pAdapter->sessionId, key_index)); |
| 9512 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9513 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9514 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9515 | |
| 9516 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 9517 | { |
| 9518 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9519 | "invalid Wext state or HDD context"); |
| 9520 | return -EINVAL; |
| 9521 | } |
| 9522 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9523 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9524 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9525 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9526 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9527 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9528 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9529 | key_index); |
| 9530 | |
| 9531 | return -EINVAL; |
| 9532 | } |
| 9533 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9534 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9535 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9536 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9537 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9538 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9539 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9540 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9541 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9542 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9543 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9544 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9545 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 9546 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9547 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 9548 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9549 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9550 | { |
| 9551 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9552 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9553 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9554 | tCsrRoamSetKey setKey; |
| 9555 | v_U32_t roamId= 0xFF; |
| 9556 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9557 | |
| 9558 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9559 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9560 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9561 | Keys->defaultIndex = (u8)key_index; |
| 9562 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9563 | setKey.keyId = key_index; |
| 9564 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9565 | |
| 9566 | vos_mem_copy(&setKey.Key[0], |
| 9567 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9568 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9569 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9570 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9571 | |
| 9572 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9573 | &pHddStaCtx->conn_info.bssId[0], |
| 9574 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9575 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9576 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 9577 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 9578 | eCSR_ENCRYPT_TYPE_WEP104) |
| 9579 | { |
| 9580 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 9581 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 9582 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 9583 | type(104) and switching encryption type to 40*/ |
| 9584 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 9585 | eCSR_ENCRYPT_TYPE_WEP40; |
| 9586 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 9587 | eCSR_ENCRYPT_TYPE_WEP40; |
| 9588 | } |
| 9589 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9590 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9591 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9592 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9593 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9594 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9595 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9596 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9597 | if ( 0 != status ) |
| 9598 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9599 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9600 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9601 | status); |
| 9602 | return -EINVAL; |
| 9603 | } |
| 9604 | } |
| 9605 | } |
| 9606 | |
| 9607 | /* In SoftAp mode setting key direction for default mode */ |
| 9608 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 9609 | { |
| 9610 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 9611 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 9612 | (eCSR_ENCRYPT_TYPE_AES != |
| 9613 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 9614 | ) |
| 9615 | { |
| 9616 | /* Saving key direction for default key index to TX default */ |
| 9617 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 9618 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 9619 | } |
| 9620 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9621 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9622 | return status; |
| 9623 | } |
| 9624 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9625 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9626 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 9627 | struct net_device *ndev, |
| 9628 | u8 key_index, |
| 9629 | bool unicast, bool multicast) |
| 9630 | #else |
| 9631 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 9632 | struct net_device *ndev, |
| 9633 | u8 key_index) |
| 9634 | #endif |
| 9635 | { |
| 9636 | int ret; |
| 9637 | vos_ssr_protect(__func__); |
| 9638 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9639 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 9640 | multicast); |
| 9641 | #else |
| 9642 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 9643 | #endif |
| 9644 | vos_ssr_unprotect(__func__); |
| 9645 | |
| 9646 | return ret; |
| 9647 | } |
| 9648 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9649 | /* |
| 9650 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 9651 | * This function is used to inform the BSS details to nl80211 interface. |
| 9652 | */ |
| 9653 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 9654 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 9655 | { |
| 9656 | struct net_device *dev = pAdapter->dev; |
| 9657 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 9658 | struct wiphy *wiphy = wdev->wiphy; |
| 9659 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 9660 | int chan_no; |
| 9661 | int ie_length; |
| 9662 | const char *ie; |
| 9663 | unsigned int freq; |
| 9664 | struct ieee80211_channel *chan; |
| 9665 | int rssi = 0; |
| 9666 | struct cfg80211_bss *bss = NULL; |
| 9667 | |
| 9668 | ENTER(); |
| 9669 | |
| 9670 | if( NULL == pBssDesc ) |
| 9671 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9672 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9673 | return bss; |
| 9674 | } |
| 9675 | |
| 9676 | chan_no = pBssDesc->channelId; |
| 9677 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 9678 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 9679 | |
| 9680 | if( NULL == ie ) |
| 9681 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9682 | 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] | 9683 | return bss; |
| 9684 | } |
| 9685 | |
| 9686 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 9687 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 9688 | { |
| 9689 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9690 | } |
| 9691 | else |
| 9692 | { |
| 9693 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9694 | } |
| 9695 | #else |
| 9696 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9697 | #endif |
| 9698 | |
| 9699 | chan = __ieee80211_get_channel(wiphy, freq); |
| 9700 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 9701 | if (!chan) { |
| 9702 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 9703 | return NULL; |
| 9704 | } |
| 9705 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9706 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9707 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9708 | return cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9709 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9710 | pBssDesc->capabilityInfo, |
| 9711 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9712 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9713 | } |
| 9714 | |
| 9715 | |
| 9716 | |
| 9717 | /* |
| 9718 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 9719 | * This function is used to inform the BSS details to nl80211 interface. |
| 9720 | */ |
| 9721 | struct cfg80211_bss* |
| 9722 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 9723 | tSirBssDescription *bss_desc |
| 9724 | ) |
| 9725 | { |
| 9726 | /* |
| 9727 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 9728 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 9729 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 9730 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 9731 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 9732 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 9733 | cfg80211_inform_bss_frame. |
| 9734 | */ |
| 9735 | struct net_device *dev = pAdapter->dev; |
| 9736 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 9737 | struct wiphy *wiphy = wdev->wiphy; |
| 9738 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 9739 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 9740 | qcom_ie_age *qie_age = NULL; |
| 9741 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 9742 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9743 | 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] | 9744 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9745 | const char *ie = |
| 9746 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 9747 | unsigned int freq; |
| 9748 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 9749 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9750 | struct cfg80211_bss *bss_status = NULL; |
| 9751 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 9752 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9753 | hdd_context_t *pHddCtx; |
| 9754 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9755 | #ifdef WLAN_OPEN_SOURCE |
| 9756 | struct timespec ts; |
| 9757 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9758 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9759 | ENTER(); |
| 9760 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9761 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9762 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9763 | if (0 != status) |
| 9764 | { |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 9765 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9766 | } |
| 9767 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 9768 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9769 | if (!mgmt) |
| 9770 | { |
| 9771 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9772 | "%s: memory allocation failed ", __func__); |
| 9773 | return NULL; |
| 9774 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 9775 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9776 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9777 | |
| 9778 | #ifdef WLAN_OPEN_SOURCE |
| 9779 | /* Android does not want the timestamp from the frame. |
| 9780 | Instead it wants a monotonic increasing value */ |
| 9781 | get_monotonic_boottime(&ts); |
| 9782 | mgmt->u.probe_resp.timestamp = |
| 9783 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 9784 | #else |
| 9785 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9786 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 9787 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9788 | |
| 9789 | #endif |
| 9790 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9791 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 9792 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 9793 | |
| 9794 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 9795 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 9796 | /* Assuming this is the last IE, copy at the end */ |
| 9797 | ie_length -=sizeof(qcom_ie_age); |
| 9798 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 9799 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 9800 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 9801 | qie_age->oui_1 = QCOM_OUI1; |
| 9802 | qie_age->oui_2 = QCOM_OUI2; |
| 9803 | qie_age->oui_3 = QCOM_OUI3; |
| 9804 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 9805 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 9806 | #endif |
| 9807 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9808 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 9809 | if (bss_desc->fProbeRsp) |
| 9810 | { |
| 9811 | mgmt->frame_control |= |
| 9812 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 9813 | } |
| 9814 | else |
| 9815 | { |
| 9816 | mgmt->frame_control |= |
| 9817 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 9818 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9819 | |
| 9820 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9821 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9822 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 9823 | { |
| 9824 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9825 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9826 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9827 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 9828 | |
| 9829 | { |
| 9830 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9831 | } |
| 9832 | else |
| 9833 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9834 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 9835 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9836 | kfree(mgmt); |
| 9837 | return NULL; |
| 9838 | } |
| 9839 | #else |
| 9840 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9841 | #endif |
| 9842 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 9843 | /*when the band is changed on the fly using the GUI, three things are done |
| 9844 | * 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) |
| 9845 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 9846 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 9847 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 9848 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 9849 | * 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 |
| 9850 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 9851 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 9852 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 9853 | * So drop the bss and continue to next bss. |
| 9854 | */ |
| 9855 | if(chan == NULL) |
| 9856 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9857 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 9858 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 9859 | return NULL; |
| 9860 | } |
Sachin Ahuja | 40530ed | 2015-04-20 00:20:58 +0530 | [diff] [blame] | 9861 | /* Supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 9862 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0)) * 100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9863 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9864 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
| 9865 | "RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 9866 | chan->center_freq, (int)(rssi/100)); |
| 9867 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9868 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 9869 | frame_len, rssi, GFP_KERNEL); |
| 9870 | kfree(mgmt); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9871 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9872 | return bss_status; |
| 9873 | } |
| 9874 | |
| 9875 | /* |
| 9876 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 9877 | * This function is used to update the BSS data base of CFG8011 |
| 9878 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9879 | 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] | 9880 | tCsrRoamInfo *pRoamInfo |
| 9881 | ) |
| 9882 | { |
| 9883 | tCsrRoamConnectedProfile roamProfile; |
| 9884 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9885 | struct cfg80211_bss *bss = NULL; |
| 9886 | |
| 9887 | ENTER(); |
| 9888 | |
| 9889 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 9890 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 9891 | |
| 9892 | if (NULL != roamProfile.pBssDesc) |
| 9893 | { |
Girish Gowli | f4b6802 | 2014-08-28 23:18:57 +0530 | [diff] [blame] | 9894 | bss = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 9895 | roamProfile.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9896 | |
| 9897 | if (NULL == bss) |
| 9898 | { |
| 9899 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 9900 | __func__); |
| 9901 | } |
| 9902 | |
| 9903 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 9904 | } |
| 9905 | else |
| 9906 | { |
| 9907 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 9908 | __func__); |
| 9909 | } |
| 9910 | return bss; |
| 9911 | } |
| 9912 | |
| 9913 | /* |
| 9914 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 9915 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9916 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 9917 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9918 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9919 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9920 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9921 | tCsrScanResultInfo *pScanResult; |
| 9922 | eHalStatus status = 0; |
| 9923 | tScanResultHandle pResult; |
| 9924 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9925 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9926 | |
| 9927 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9928 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9929 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9930 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 9931 | NO_SESSION, pAdapter->sessionId)); |
| 9932 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9933 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9934 | |
| 9935 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9936 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9937 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9938 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 9939 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9940 | } |
| 9941 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9942 | |
| 9943 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 9944 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9945 | { |
| 9946 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9947 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 9948 | return VOS_STATUS_E_PERM; |
| 9949 | } |
| 9950 | |
| 9951 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9952 | /* |
| 9953 | * start getting scan results and populate cgf80211 BSS database |
| 9954 | */ |
| 9955 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 9956 | |
| 9957 | /* no scan results */ |
| 9958 | if (NULL == pResult) |
| 9959 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9960 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 9961 | __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9962 | return status; |
| 9963 | } |
| 9964 | |
| 9965 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 9966 | |
| 9967 | while (pScanResult) |
| 9968 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9969 | /* |
| 9970 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 9971 | * entry already exists in bss data base of cfg80211 for that |
| 9972 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 9973 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 9974 | * mgmt packet as input. As of now there is no possibility to get |
| 9975 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9976 | * ieee80211_mgmt(probe response) and passing to c |
| 9977 | * fg80211_inform_bss_frame. |
| 9978 | * */ |
| 9979 | |
| 9980 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 9981 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9982 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9983 | |
| 9984 | if (NULL == bss_status) |
| 9985 | { |
| 9986 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9987 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9988 | } |
| 9989 | else |
| 9990 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 9991 | cfg80211_put_bss( |
| 9992 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 9993 | wiphy, |
| 9994 | #endif |
| 9995 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9996 | } |
| 9997 | |
| 9998 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 9999 | } |
| 10000 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10001 | sme_ScanResultPurge(hHal, pResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10002 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10003 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10004 | } |
| 10005 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10006 | void |
| 10007 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 10008 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10009 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 10010 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10011 | } /****** end hddPrintMacAddr() ******/ |
| 10012 | |
| 10013 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 10014 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10015 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10016 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10017 | "%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] | 10018 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 10019 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 10020 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10021 | } /****** end hddPrintPmkId() ******/ |
| 10022 | |
| 10023 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 10024 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 10025 | |
| 10026 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 10027 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 10028 | |
| 10029 | #define dump_bssid(bssid) \ |
| 10030 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10031 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 10032 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10033 | } |
| 10034 | |
| 10035 | #define dump_pmkid(pMac, pmkid) \ |
| 10036 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10037 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 10038 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10039 | } |
| 10040 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 10041 | #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] | 10042 | /* |
| 10043 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 10044 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 10045 | */ |
| 10046 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10047 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10048 | int index, bool preauth ) |
| 10049 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10050 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10051 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10052 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10053 | |
| 10054 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10055 | 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] | 10056 | |
| 10057 | if( NULL == pRoamInfo ) |
| 10058 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10059 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10060 | return -EINVAL; |
| 10061 | } |
| 10062 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10063 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 10064 | { |
| 10065 | dump_bssid(pRoamInfo->bssid); |
| 10066 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10067 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10068 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10069 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10070 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10071 | } |
| 10072 | #endif //FEATURE_WLAN_LFR |
| 10073 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 10074 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 10075 | /* |
| 10076 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 10077 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 10078 | * |
| 10079 | */ |
| 10080 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 10081 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 10082 | tCsrRoamInfo *pRoamInfo) |
| 10083 | { |
| 10084 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10085 | union iwreq_data wrqu; |
| 10086 | |
| 10087 | ENTER(); |
| 10088 | |
| 10089 | if (NULL == pAdapter) |
| 10090 | { |
| 10091 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10092 | return VOS_STATUS_E_FAILURE; |
| 10093 | } |
| 10094 | |
| 10095 | /* create the event */ |
| 10096 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10097 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10098 | |
| 10099 | wrqu.data.pointer = metrics_notification; |
| 10100 | wrqu.data.length = scnprintf(metrics_notification, |
| 10101 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 10102 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10103 | |
| 10104 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10105 | |
| 10106 | EXIT(); |
| 10107 | |
| 10108 | return VOS_STATUS_SUCCESS; |
| 10109 | } |
| 10110 | |
| 10111 | /* |
| 10112 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 10113 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 10114 | * or failure |
| 10115 | */ |
| 10116 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 10117 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 10118 | { |
| 10119 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10120 | union iwreq_data wrqu; |
| 10121 | |
| 10122 | ENTER(); |
| 10123 | |
| 10124 | if (NULL == pAdapter) |
| 10125 | { |
| 10126 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10127 | return VOS_STATUS_E_FAILURE; |
| 10128 | } |
| 10129 | |
| 10130 | /* create the event */ |
| 10131 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10132 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10133 | |
| 10134 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 10135 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 10136 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10137 | |
| 10138 | if (1 == preauth_status) |
| 10139 | strncat(metrics_notification, " TRUE", 5); |
| 10140 | else |
| 10141 | strncat(metrics_notification, " FALSE", 6); |
| 10142 | |
| 10143 | wrqu.data.pointer = metrics_notification; |
| 10144 | wrqu.data.length = strlen(metrics_notification); |
| 10145 | |
| 10146 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10147 | |
| 10148 | EXIT(); |
| 10149 | |
| 10150 | return VOS_STATUS_SUCCESS; |
| 10151 | } |
| 10152 | |
| 10153 | /* |
| 10154 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 10155 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 10156 | * |
| 10157 | */ |
| 10158 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 10159 | tCsrRoamInfo *pRoamInfo) |
| 10160 | { |
| 10161 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10162 | union iwreq_data wrqu; |
| 10163 | |
| 10164 | ENTER(); |
| 10165 | |
| 10166 | if (NULL == pAdapter) |
| 10167 | { |
| 10168 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10169 | return VOS_STATUS_E_FAILURE; |
| 10170 | } |
| 10171 | |
| 10172 | /* create the event */ |
| 10173 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10174 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10175 | |
| 10176 | wrqu.data.pointer = metrics_notification; |
| 10177 | wrqu.data.length = scnprintf(metrics_notification, |
| 10178 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 10179 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10180 | |
| 10181 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10182 | |
| 10183 | EXIT(); |
| 10184 | |
| 10185 | return VOS_STATUS_SUCCESS; |
| 10186 | } |
| 10187 | #endif |
| 10188 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10189 | /* |
| 10190 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 10191 | * scanning callback function, called after finishing scan |
| 10192 | * |
| 10193 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10194 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10195 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 10196 | { |
| 10197 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10198 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10199 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10200 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10201 | struct cfg80211_scan_request *req = NULL; |
| 10202 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10203 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10204 | long waitRet = 0; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10205 | tANI_U8 i; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10206 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10207 | |
| 10208 | ENTER(); |
| 10209 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10210 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10211 | if (0 != wlan_hdd_validate_context(pHddCtx)) { |
| 10212 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
| 10213 | goto allow_suspend; |
| 10214 | } |
| 10215 | |
| 10216 | pScanInfo = &pHddCtx->scan_info; |
| 10217 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10218 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10219 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10220 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10221 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 10222 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10223 | pScanInfo->mScanPendingCounter = 0; |
| 10224 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10225 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10226 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10227 | &pScanInfo->scan_req_completion_event, |
| 10228 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10229 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10230 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10231 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10232 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10233 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10234 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10235 | } |
| 10236 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 10237 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10238 | { |
| 10239 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10240 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10241 | } |
| 10242 | |
| 10243 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10244 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10245 | { |
| 10246 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10247 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10248 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10249 | (int) scanId); |
| 10250 | } |
| 10251 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10252 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10253 | pAdapter); |
| 10254 | |
| 10255 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10256 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10257 | |
| 10258 | |
| 10259 | /* If any client wait scan result through WEXT |
| 10260 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10261 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10262 | { |
| 10263 | /* The other scan request waiting for current scan finish |
| 10264 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10265 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10266 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10267 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10268 | } |
| 10269 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10270 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10271 | { |
| 10272 | struct net_device *dev = pAdapter->dev; |
| 10273 | union iwreq_data wrqu; |
| 10274 | int we_event; |
| 10275 | char *msg; |
| 10276 | |
| 10277 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 10278 | we_event = SIOCGIWSCAN; |
| 10279 | msg = NULL; |
| 10280 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 10281 | } |
| 10282 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10283 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10284 | |
| 10285 | /* Get the Scan Req */ |
| 10286 | req = pAdapter->request; |
| 10287 | |
| 10288 | if (!req) |
| 10289 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10290 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10291 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10292 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10293 | } |
| 10294 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10295 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10296 | /* Scan is no longer pending */ |
| 10297 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10298 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10299 | /* last_scan_timestamp is used to decide if new scan |
| 10300 | * is needed or not on station interface. If last station |
| 10301 | * scan time and new station scan time is less then |
| 10302 | * last_scan_timestamp ; driver will return cached scan. |
| 10303 | */ |
| 10304 | if (req->no_cck == FALSE && status == eCSR_SCAN_SUCCESS) // no_cck will be set during p2p find |
| 10305 | { |
| 10306 | pScanInfo->last_scan_timestamp = vos_timer_get_system_time(); |
| 10307 | |
| 10308 | if ( req->n_channels ) |
| 10309 | { |
| 10310 | for (i = 0; i < req->n_channels ; i++ ) |
| 10311 | { |
| 10312 | pHddCtx->scan_info.last_scan_channelList[i] = req->channels[i]->hw_value; |
| 10313 | } |
| 10314 | /* store no of channel scanned */ |
| 10315 | pHddCtx->scan_info.last_scan_numChannels= req->n_channels; |
| 10316 | } |
| 10317 | |
| 10318 | } |
| 10319 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 10320 | /* |
| 10321 | * cfg80211_scan_done informing NL80211 about completion |
| 10322 | * of scanning |
| 10323 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10324 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 10325 | { |
| 10326 | aborted = true; |
| 10327 | } |
| 10328 | cfg80211_scan_done(req, aborted); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 10329 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10330 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10331 | if (pHddCtx->spoofMacAddr.isEnabled || pHddCtx->spoofMacAddr.isReqDeferred) { |
| 10332 | /* Generate new random mac addr for next scan */ |
| 10333 | hddLog(VOS_TRACE_LEVEL_INFO, "scan completed - generate new spoof mac addr"); |
| 10334 | hdd_processSpoofMacAddrRequest(pHddCtx); |
| 10335 | } |
| 10336 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10337 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10338 | /* release the wake lock at the end of the scan*/ |
| 10339 | hdd_allow_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10340 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 10341 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 10342 | * immediatly after the driver gets connect request(i.e after scan) |
| 10343 | * from supplicant, this result in app's is suspending and not able |
| 10344 | * to process the connect request to AP */ |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 10345 | hdd_prevent_suspend_timeout(1000); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 10346 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 10347 | #ifdef FEATURE_WLAN_TDLS |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10348 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 10349 | #endif |
| 10350 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10351 | EXIT(); |
| 10352 | return 0; |
| 10353 | } |
| 10354 | |
| 10355 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10356 | * FUNCTION: hdd_isConnectionInProgress |
| 10357 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10358 | * |
| 10359 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10360 | v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10361 | { |
| 10362 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 10363 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 10364 | hdd_adapter_t *pAdapter = NULL; |
| 10365 | VOS_STATUS status = 0; |
| 10366 | v_U8_t staId = 0; |
| 10367 | v_U8_t *staMac = NULL; |
| 10368 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 10369 | if (TRUE == pHddCtx->btCoexModeSet) |
| 10370 | { |
| 10371 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10372 | FL("BTCoex Mode operation in progress")); |
| 10373 | return VOS_TRUE; |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 10374 | } |
| 10375 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10376 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 10377 | |
| 10378 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 10379 | { |
| 10380 | pAdapter = pAdapterNode->pAdapter; |
| 10381 | |
| 10382 | if( pAdapter ) |
| 10383 | { |
| 10384 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10385 | "%s: Adapter with device mode %s (%d) exists", |
| 10386 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10387 | pAdapter->device_mode); |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10388 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10389 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10390 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 10391 | (eConnectionState_Connecting == |
| 10392 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 10393 | { |
| 10394 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10395 | "%s: %p(%d) Connection is in progress", __func__, |
| 10396 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 10397 | return VOS_TRUE; |
| 10398 | } |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10399 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Padma, Santhosh Kumar | 3b9657d | 2015-02-04 19:37:32 +0530 | [diff] [blame] | 10400 | smeNeighborMiddleOfRoaming(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10401 | { |
| 10402 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10403 | "%s: %p(%d) Reassociation is in progress", __func__, |
| 10404 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 10405 | return VOS_TRUE; |
| 10406 | } |
| 10407 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10408 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10409 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10410 | { |
| 10411 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10412 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10413 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10414 | { |
| 10415 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 10416 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10417 | "%s: client " MAC_ADDRESS_STR |
| 10418 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 10419 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10420 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10421 | } |
| 10422 | } |
| 10423 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 10424 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 10425 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10426 | v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 10427 | ptSapContext pSapCtx = NULL; |
| 10428 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 10429 | if(pSapCtx == NULL){ |
| 10430 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10431 | FL("psapCtx is NULL")); |
| 10432 | return VOS_FALSE; |
| 10433 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10434 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 10435 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10436 | if ((pSapCtx->aStaInfo[staId].isUsed) && |
| 10437 | (WLANTL_STA_CONNECTED == pSapCtx->aStaInfo[staId].tlSTAState)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10438 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10439 | staMac = (v_U8_t *) &(pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10440 | |
| 10441 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10442 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 10443 | "middle of WPS/EAPOL exchange.", __func__, |
| 10444 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10445 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10446 | } |
| 10447 | } |
| 10448 | } |
| 10449 | } |
| 10450 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 10451 | pAdapterNode = pNext; |
| 10452 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10453 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10454 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10455 | |
| 10456 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10457 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10458 | * this scan respond to scan trigger and update cfg80211 scan database |
| 10459 | * later, scan dump command can be used to recieve scan results |
| 10460 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10461 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 10462 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10463 | struct net_device *dev, |
| 10464 | #endif |
| 10465 | struct cfg80211_scan_request *request) |
| 10466 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10467 | hdd_adapter_t *pAdapter = NULL; |
| 10468 | hdd_context_t *pHddCtx = NULL; |
| 10469 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10470 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10471 | tCsrScanRequest scanRequest; |
| 10472 | tANI_U8 *channelList = NULL, i; |
| 10473 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10474 | int status; |
| 10475 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10476 | v_U8_t* pP2pIe = NULL; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10477 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10478 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10479 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 10480 | struct net_device *dev = NULL; |
| 10481 | if (NULL == request) |
| 10482 | { |
| 10483 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10484 | "%s: scan req param null", __func__); |
| 10485 | return -EINVAL; |
| 10486 | } |
| 10487 | dev = request->wdev->netdev; |
| 10488 | #endif |
| 10489 | |
| 10490 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 10491 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 10492 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10493 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10494 | ENTER(); |
| 10495 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10496 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 10497 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10498 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10499 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10500 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10501 | if (0 != status) |
| 10502 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10503 | return status; |
| 10504 | } |
| 10505 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10506 | if (NULL == pwextBuf) |
| 10507 | { |
| 10508 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 10509 | __func__); |
| 10510 | return -EIO; |
| 10511 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10512 | cfg_param = pHddCtx->cfg_ini; |
| 10513 | pScanInfo = &pHddCtx->scan_info; |
| 10514 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10515 | #ifdef WLAN_BTAMP_FEATURE |
| 10516 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10517 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10518 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 10519 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10520 | "%s: No scanning when AMP is on", __func__); |
| 10521 | return -EOPNOTSUPP; |
| 10522 | } |
| 10523 | #endif |
| 10524 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10525 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10526 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10527 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10528 | "%s: Not scanning on device_mode = %s (%d)", |
| 10529 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10530 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10531 | return -EOPNOTSUPP; |
| 10532 | } |
| 10533 | |
| 10534 | if (TRUE == pScanInfo->mScanPending) |
| 10535 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10536 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 10537 | { |
| 10538 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 10539 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10540 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10541 | } |
| 10542 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10543 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10544 | //Channel and action frame is pending |
| 10545 | //Otherwise Cancel Remain On Channel and allow Scan |
| 10546 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10547 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10548 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10549 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10550 | return -EBUSY; |
| 10551 | } |
| 10552 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10553 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 10554 | { |
| 10555 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 10556 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10557 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10558 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10559 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 10560 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10561 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10562 | "%s: MAX TM Level Scan not allowed", __func__); |
| 10563 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10564 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10565 | } |
| 10566 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 10567 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10568 | /* Check if scan is allowed at this point of time. |
| 10569 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10570 | if (hdd_isConnectionInProgress(pHddCtx)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10571 | { |
| 10572 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 10573 | return -EBUSY; |
| 10574 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10575 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10576 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 10577 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10578 | hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d", |
| 10579 | (int)request->n_ssids); |
| 10580 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10581 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10582 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 10583 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 10584 | * is not aging out the scan results. |
| 10585 | */ |
| 10586 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10587 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10588 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10589 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10590 | |
| 10591 | if ((request->ssids) && (0 < request->n_ssids)) |
| 10592 | { |
| 10593 | tCsrSSIDInfo *SsidInfo; |
| 10594 | int j; |
| 10595 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 10596 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 10597 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 10598 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 10599 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 10600 | |
| 10601 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 10602 | { |
| 10603 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10604 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 10605 | return -ENOMEM; |
| 10606 | } |
| 10607 | |
| 10608 | /* copy all the ssid's and their length */ |
| 10609 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 10610 | { |
| 10611 | /* get the ssid length */ |
| 10612 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 10613 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 10614 | SsidInfo->SSID.length); |
| 10615 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 10616 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 10617 | j, SsidInfo->SSID.ssId); |
| 10618 | } |
| 10619 | /* set the scan type to active */ |
| 10620 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 10621 | } |
| 10622 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10623 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10624 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10625 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 10626 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10627 | /* set the scan type to active */ |
| 10628 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10629 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10630 | else |
| 10631 | { |
| 10632 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 10633 | scanRequest.scanType = pScanInfo->scan_mode; |
| 10634 | } |
| 10635 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 10636 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10637 | |
| 10638 | /* set BSSType to default type */ |
| 10639 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 10640 | |
| 10641 | /*TODO: scan the requested channels only*/ |
| 10642 | |
| 10643 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10644 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10645 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10646 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10647 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 10648 | request->n_channels = MAX_CHANNEL; |
| 10649 | } |
| 10650 | |
| 10651 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10652 | "No of Scan Channels: %d", request->n_channels); |
| 10653 | |
| 10654 | |
| 10655 | if( request->n_channels ) |
| 10656 | { |
| 10657 | char chList [(request->n_channels*5)+1]; |
| 10658 | int len; |
| 10659 | channelList = vos_mem_malloc( request->n_channels ); |
| 10660 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10661 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10662 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10663 | "%s: memory alloc failed channelList", __func__); |
| 10664 | status = -ENOMEM; |
| 10665 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10666 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10667 | |
| 10668 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 10669 | { |
| 10670 | channelList[i] = request->channels[i]->hw_value; |
| 10671 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 10672 | } |
| 10673 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10674 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10675 | "Channel-List: %s ", chList); |
| 10676 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10677 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10678 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 10679 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 10680 | |
| 10681 | /* set requestType to full scan */ |
| 10682 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 10683 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10684 | /* if there is back to back scan happening in driver with in |
| 10685 | * nDeferScanTimeInterval interval driver should defer new scan request |
| 10686 | * and should provide last cached scan results instead of new channel list. |
| 10687 | * This rule is not applicable if scan is p2p scan. |
| 10688 | * This condition will work only in case when last request no of channels |
| 10689 | * and channels are exactly same as new request. |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10690 | * This should be done only in connected state |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10691 | */ |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10692 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10693 | if ((VOS_STATUS_SUCCESS == hdd_is_any_session_connected(pHddCtx))) |
| 10694 | { |
| 10695 | if ( pScanInfo->last_scan_timestamp !=0 && |
| 10696 | ((vos_timer_get_system_time() - pScanInfo->last_scan_timestamp ) < pHddCtx->cfg_ini->nDeferScanTimeInterval)) |
| 10697 | { |
| 10698 | if ( request->no_cck == FALSE && scanRequest.ChannelInfo.numOfChannels != 1 && |
| 10699 | (pScanInfo->last_scan_numChannels == scanRequest.ChannelInfo.numOfChannels) && |
| 10700 | vos_mem_compare(pScanInfo->last_scan_channelList, |
| 10701 | channelList, pScanInfo->last_scan_numChannels)) |
| 10702 | { |
| 10703 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10704 | " New and old station scan time differ is less then %u", |
| 10705 | pHddCtx->cfg_ini->nDeferScanTimeInterval); |
| 10706 | |
| 10707 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10708 | pAdapter); |
| 10709 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10710 | hddLog(VOS_TRACE_LEVEL_WARN, |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 10711 | "Return old cached scan as all channels and no of channels are same"); |
| 10712 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10713 | if (0 > ret) |
| 10714 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10715 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10716 | cfg80211_scan_done(request, eCSR_SCAN_SUCCESS); |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 10717 | |
| 10718 | status = eHAL_STATUS_SUCCESS; |
| 10719 | goto free_mem; |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10720 | } |
| 10721 | } |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10722 | } |
| 10723 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10724 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 10725 | * search (Flush on both full scan and social scan but not on single |
| 10726 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 10727 | */ |
| 10728 | |
| 10729 | /* Supplicant does single channel scan after 8-way handshake |
| 10730 | * and in that case driver shoudnt flush scan results. If |
| 10731 | * driver flushes the scan results here and unfortunately if |
| 10732 | * the AP doesnt respond to our probe req then association |
| 10733 | * fails which is not desired |
| 10734 | */ |
| 10735 | |
| 10736 | if( request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN ) |
| 10737 | { |
| 10738 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 10739 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10740 | pAdapter->sessionId ); |
| 10741 | } |
| 10742 | |
| 10743 | if( request->ie_len ) |
| 10744 | { |
| 10745 | /* save this for future association (join requires this) */ |
| 10746 | /*TODO: Array needs to be converted to dynamic allocation, |
| 10747 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 10748 | * CR 597966 |
| 10749 | */ |
| 10750 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 10751 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 10752 | pScanInfo->scanAddIE.length = request->ie_len; |
| 10753 | |
| 10754 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 10755 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10756 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10757 | { |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 10758 | if (request->ie_len <= SIR_MAC_MAX_ADD_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10759 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10760 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 10761 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 10762 | request->ie, request->ie_len); |
| 10763 | } |
| 10764 | else |
| 10765 | { |
| 10766 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 10767 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10768 | } |
| 10769 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10770 | } |
| 10771 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 10772 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 10773 | |
| 10774 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 10775 | request->ie_len); |
| 10776 | if (pP2pIe != NULL) |
| 10777 | { |
| 10778 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 10779 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 10780 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 10781 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10782 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10783 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 10784 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 10785 | "Go nego completed to Connection is started"); |
| 10786 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 10787 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10788 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10789 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 10790 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10791 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10792 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 10793 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 10794 | "Disconnected state to Connection is started"); |
| 10795 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 10796 | "for 4way Handshake"); |
| 10797 | } |
| 10798 | #endif |
| 10799 | |
| 10800 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 10801 | if(TRUE == request->no_cck) |
| 10802 | { |
| 10803 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10804 | "%s: This is a P2P Search", __func__); |
| 10805 | scanRequest.p2pSearch = 1; |
| 10806 | |
| 10807 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10808 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10809 | /* set requestType to P2P Discovery */ |
| 10810 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 10811 | } |
| 10812 | |
| 10813 | /* |
| 10814 | Skip Dfs Channel in case of P2P Search |
| 10815 | if it is set in ini file |
| 10816 | */ |
| 10817 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 10818 | { |
| 10819 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10820 | } |
| 10821 | else |
| 10822 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10823 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10824 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10825 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10826 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10827 | } |
| 10828 | } |
| 10829 | |
| 10830 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 10831 | |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10832 | #ifdef FEATURE_WLAN_TDLS |
| 10833 | /* if tdls disagree scan right now, return immediately. |
| 10834 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 10835 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 10836 | */ |
| 10837 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 10838 | wiphy, |
| 10839 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10840 | dev, |
| 10841 | #endif |
| 10842 | request); |
| 10843 | if(status <= 0) |
| 10844 | { |
| 10845 | if(!status) |
| 10846 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 10847 | "scan rejected %d", __func__, status); |
| 10848 | else |
| 10849 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 10850 | __func__, status); |
| 10851 | |
| 10852 | return status; |
| 10853 | } |
| 10854 | #endif |
| 10855 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10856 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 10857 | * address the following issues. |
| 10858 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 10859 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 10860 | * for long time, this result in apps running at full power for long time. |
| 10861 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 10862 | * be stuck in full power because of resume BMPS |
| 10863 | */ |
| 10864 | hdd_prevent_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10865 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10866 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 10867 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10868 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 10869 | scanRequest.requestType, scanRequest.scanType, |
| 10870 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10871 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 10872 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10873 | if (pHddCtx->spoofMacAddr.isEnabled) |
| 10874 | { |
| 10875 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10876 | "%s: MAC Spoofing enabled for current scan", __func__); |
| 10877 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 10878 | * to fill TxBds for probe request during current scan |
| 10879 | */ |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 10880 | status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10881 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 10882 | |
| 10883 | if(status != VOS_STATUS_SUCCESS) |
| 10884 | { |
| 10885 | hdd_allow_suspend(); |
| 10886 | status = -EFAULT; |
| 10887 | goto free_mem; |
| 10888 | } |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10889 | } |
| 10890 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10891 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10892 | pAdapter->sessionId, &scanRequest, &scanId, |
| 10893 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10894 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10895 | if (eHAL_STATUS_SUCCESS != status) |
| 10896 | { |
| 10897 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10898 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 10899 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 10900 | if(eHAL_STATUS_RESOURCES == status) |
| 10901 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10902 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 10903 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 10904 | status = -EBUSY; |
| 10905 | } else { |
| 10906 | status = -EIO; |
| 10907 | } |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10908 | hdd_allow_suspend(); |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10909 | |
| 10910 | #ifdef FEATURE_WLAN_TDLS |
| 10911 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 10912 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10913 | goto free_mem; |
| 10914 | } |
| 10915 | |
| 10916 | pScanInfo->mScanPending = TRUE; |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 10917 | pScanInfo->sessionId = pAdapter->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10918 | pAdapter->request = request; |
| 10919 | pScanInfo->scanId = scanId; |
| 10920 | |
| 10921 | complete(&pScanInfo->scan_req_completion_event); |
| 10922 | |
| 10923 | free_mem: |
| 10924 | if( scanRequest.SSIDs.SSIDList ) |
| 10925 | { |
| 10926 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 10927 | } |
| 10928 | |
| 10929 | if( channelList ) |
| 10930 | vos_mem_free( channelList ); |
| 10931 | |
| 10932 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10933 | return status; |
| 10934 | } |
| 10935 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10936 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 10937 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10938 | struct net_device *dev, |
| 10939 | #endif |
| 10940 | struct cfg80211_scan_request *request) |
| 10941 | { |
| 10942 | int ret; |
| 10943 | |
| 10944 | vos_ssr_protect(__func__); |
| 10945 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 10946 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10947 | dev, |
| 10948 | #endif |
| 10949 | request); |
| 10950 | vos_ssr_unprotect(__func__); |
| 10951 | |
| 10952 | return ret; |
| 10953 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10954 | |
| 10955 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 10956 | { |
| 10957 | v_U8_t iniDot11Mode = |
| 10958 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 10959 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 10960 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10961 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 10962 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10963 | switch ( iniDot11Mode ) |
| 10964 | { |
| 10965 | case eHDD_DOT11_MODE_AUTO: |
| 10966 | case eHDD_DOT11_MODE_11ac: |
| 10967 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 10968 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 4b1d235 | 2014-08-01 21:59:28 +0530 | [diff] [blame] | 10969 | if ( sme_IsFeatureSupportedByDriver(DOT11AC) && |
| 10970 | sme_IsFeatureSupportedByFW(DOT11AC) ) |
| 10971 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 10972 | else |
| 10973 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10974 | #else |
| 10975 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 10976 | #endif |
| 10977 | break; |
| 10978 | case eHDD_DOT11_MODE_11n: |
| 10979 | case eHDD_DOT11_MODE_11n_ONLY: |
| 10980 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 10981 | break; |
| 10982 | default: |
| 10983 | hddDot11Mode = iniDot11Mode; |
| 10984 | break; |
| 10985 | } |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 10986 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 10987 | if (operationChannel > SIR_11B_CHANNEL_END) |
| 10988 | #endif |
| 10989 | { |
| 10990 | /* This call decides required channel bonding mode */ |
| 10991 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10992 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 10993 | operationChannel); |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 10994 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10995 | } |
| 10996 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10997 | /* |
| 10998 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10999 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11000 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11001 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11002 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11003 | { |
| 11004 | int status = 0; |
| 11005 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11006 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11007 | v_U32_t roamId; |
| 11008 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11009 | eCsrAuthType RSNAuthType; |
| 11010 | |
| 11011 | ENTER(); |
| 11012 | |
| 11013 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11014 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11015 | |
| 11016 | status = wlan_hdd_validate_context(pHddCtx); |
| 11017 | if (status) |
| 11018 | { |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11019 | return status; |
| 11020 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11021 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11022 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 11023 | { |
| 11024 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 11025 | return -EINVAL; |
| 11026 | } |
| 11027 | |
| 11028 | pRoamProfile = &pWextState->roamProfile; |
| 11029 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11030 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11031 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11032 | hdd_station_ctx_t *pHddStaCtx; |
| 11033 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11034 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11035 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11036 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 11037 | { |
| 11038 | /*QoS not enabled in cfg file*/ |
| 11039 | pRoamProfile->uapsd_mask = 0; |
| 11040 | } |
| 11041 | else |
| 11042 | { |
| 11043 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11044 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11045 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 11046 | } |
| 11047 | |
| 11048 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 11049 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 11050 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11051 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11052 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 11053 | ssid, ssid_len); |
| 11054 | |
| 11055 | if (bssid) |
| 11056 | { |
| 11057 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 11058 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 11059 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11060 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 11061 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11062 | case of join failure we should send valid BSSID to supplicant |
| 11063 | */ |
| 11064 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 11065 | WNI_CFG_BSSID_LEN); |
| 11066 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 11067 | else |
| 11068 | { |
| 11069 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 11070 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11071 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11072 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 11073 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11074 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 11075 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11076 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11077 | /*set gen ie*/ |
| 11078 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 11079 | /*set auth*/ |
| 11080 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 11081 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11082 | #ifdef FEATURE_WLAN_WAPI |
| 11083 | if (pAdapter->wapi_info.nWapiMode) |
| 11084 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11085 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11086 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 11087 | { |
| 11088 | case WAPI_AUTH_MODE_PSK: |
| 11089 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11090 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11091 | pAdapter->wapi_info.wapiAuthMode); |
| 11092 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 11093 | break; |
| 11094 | } |
| 11095 | case WAPI_AUTH_MODE_CERT: |
| 11096 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11097 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11098 | pAdapter->wapi_info.wapiAuthMode); |
| 11099 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 11100 | break; |
| 11101 | } |
| 11102 | } // End of switch |
| 11103 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 11104 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 11105 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11106 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11107 | pRoamProfile->AuthType.numEntries = 1; |
| 11108 | pRoamProfile->EncryptionType.numEntries = 1; |
| 11109 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 11110 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 11111 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 11112 | } |
| 11113 | } |
| 11114 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11115 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11116 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11117 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 11118 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 11119 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11120 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 11121 | sizeof (tSirGtkOffloadParams)); |
| 11122 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11123 | } |
| 11124 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11125 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 11126 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11127 | if( operatingChannel ) |
| 11128 | { |
| 11129 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 11130 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 11131 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11132 | else |
| 11133 | { |
| 11134 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 11135 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 11136 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11137 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 11138 | { |
| 11139 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 11140 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11141 | |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11142 | /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect() |
| 11143 | * 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] | 11144 | * 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] | 11145 | * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback() |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11146 | * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. |
| 11147 | */ |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 11148 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 11149 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 11150 | { |
| 11151 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11152 | "%s: Set HDD connState to eConnectionState_Connecting", |
| 11153 | __func__); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11154 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 11155 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 11156 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11157 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11158 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 11159 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 11160 | if ((eHAL_STATUS_SUCCESS != status) && |
| 11161 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 11162 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11163 | |
| 11164 | { |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11165 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with " |
| 11166 | "status %d. -> NotConnected", __func__, pAdapter->sessionId, status); |
| 11167 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11168 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11169 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11170 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11171 | |
| 11172 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 11173 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 11174 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11175 | } |
| 11176 | else |
| 11177 | { |
| 11178 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 11179 | return -EINVAL; |
| 11180 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 11181 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11182 | return status; |
| 11183 | } |
| 11184 | |
| 11185 | /* |
| 11186 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 11187 | * This function is used to set the authentication type (OPEN/SHARED). |
| 11188 | * |
| 11189 | */ |
| 11190 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 11191 | enum nl80211_auth_type auth_type) |
| 11192 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11193 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11194 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11195 | |
| 11196 | ENTER(); |
| 11197 | |
| 11198 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11199 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11200 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11201 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11202 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11203 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 11204 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 11205 | break; |
| 11206 | |
| 11207 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11208 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11209 | case NL80211_AUTHTYPE_FT: |
| 11210 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11211 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11212 | "%s: set authentication type to OPEN", __func__); |
| 11213 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 11214 | break; |
| 11215 | |
| 11216 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11217 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11218 | "%s: set authentication type to SHARED", __func__); |
| 11219 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 11220 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11221 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11222 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11223 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11224 | "%s: set authentication type to CCKM WPA", __func__); |
| 11225 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 11226 | break; |
| 11227 | #endif |
| 11228 | |
| 11229 | |
| 11230 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11231 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11232 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11233 | auth_type); |
| 11234 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 11235 | return -EINVAL; |
| 11236 | } |
| 11237 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11238 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11239 | pHddStaCtx->conn_info.authType; |
| 11240 | return 0; |
| 11241 | } |
| 11242 | |
| 11243 | /* |
| 11244 | * FUNCTION: wlan_hdd_set_akm_suite |
| 11245 | * This function is used to set the key mgmt type(PSK/8021x). |
| 11246 | * |
| 11247 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11248 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11249 | u32 key_mgmt |
| 11250 | ) |
| 11251 | { |
| 11252 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11253 | ENTER(); |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11254 | /* Should be in ieee802_11_defs.h */ |
| 11255 | #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05 |
| 11256 | #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11257 | /*set key mgmt type*/ |
| 11258 | switch(key_mgmt) |
| 11259 | { |
| 11260 | case WLAN_AKM_SUITE_PSK: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11261 | case WLAN_AKM_SUITE_PSK_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 11262 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11263 | case WLAN_AKM_SUITE_FT_PSK: |
| 11264 | #endif |
| 11265 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11266 | __func__); |
| 11267 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 11268 | break; |
| 11269 | |
| 11270 | case WLAN_AKM_SUITE_8021X: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11271 | case WLAN_AKM_SUITE_8021X_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 11272 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11273 | case WLAN_AKM_SUITE_FT_8021X: |
| 11274 | #endif |
| 11275 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11276 | __func__); |
| 11277 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 11278 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11279 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11280 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 11281 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 11282 | case WLAN_AKM_SUITE_CCKM: |
| 11283 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 11284 | __func__); |
| 11285 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 11286 | break; |
| 11287 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 11288 | #ifndef WLAN_AKM_SUITE_OSEN |
| 11289 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 11290 | case WLAN_AKM_SUITE_OSEN: |
| 11291 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 11292 | __func__); |
| 11293 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 11294 | break; |
| 11295 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11296 | |
| 11297 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11298 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11299 | __func__, key_mgmt); |
| 11300 | return -EINVAL; |
| 11301 | |
| 11302 | } |
| 11303 | return 0; |
| 11304 | } |
| 11305 | |
| 11306 | /* |
| 11307 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11308 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11309 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 11310 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11311 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 11312 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11313 | bool ucast |
| 11314 | ) |
| 11315 | { |
| 11316 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11317 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11318 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11319 | |
| 11320 | ENTER(); |
| 11321 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11322 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11323 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11324 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11325 | __func__, cipher); |
| 11326 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11327 | } |
| 11328 | else |
| 11329 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11330 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11331 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11332 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11333 | { |
| 11334 | case IW_AUTH_CIPHER_NONE: |
| 11335 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11336 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11337 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11338 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11339 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11340 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11341 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11342 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11343 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11344 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11345 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11346 | case WLAN_CIPHER_SUITE_TKIP: |
| 11347 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 11348 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11349 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11350 | case WLAN_CIPHER_SUITE_CCMP: |
| 11351 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 11352 | break; |
| 11353 | #ifdef FEATURE_WLAN_WAPI |
| 11354 | case WLAN_CIPHER_SUITE_SMS4: |
| 11355 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 11356 | break; |
| 11357 | #endif |
| 11358 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11359 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11360 | case WLAN_CIPHER_SUITE_KRK: |
| 11361 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 11362 | break; |
| 11363 | #endif |
| 11364 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11365 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11366 | __func__, cipher); |
| 11367 | return -EOPNOTSUPP; |
| 11368 | } |
| 11369 | } |
| 11370 | |
| 11371 | if (ucast) |
| 11372 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11373 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11374 | __func__, encryptionType); |
| 11375 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 11376 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11377 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11378 | encryptionType; |
| 11379 | } |
| 11380 | else |
| 11381 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11382 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11383 | __func__, encryptionType); |
| 11384 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 11385 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 11386 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 11387 | } |
| 11388 | |
| 11389 | return 0; |
| 11390 | } |
| 11391 | |
| 11392 | |
| 11393 | /* |
| 11394 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 11395 | * This function is used to parse WPA/RSN IE's. |
| 11396 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11397 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
| 11398 | u8 *ie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11399 | size_t ie_len |
| 11400 | ) |
| 11401 | { |
| 11402 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11403 | u8 *genie = ie; |
| 11404 | v_U16_t remLen = ie_len; |
| 11405 | #ifdef FEATURE_WLAN_WAPI |
| 11406 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 11407 | u16 *tmp; |
| 11408 | v_U16_t akmsuiteCount; |
| 11409 | int *akmlist; |
| 11410 | #endif |
| 11411 | ENTER(); |
| 11412 | |
| 11413 | /* clear previous assocAddIE */ |
| 11414 | pWextState->assocAddIE.length = 0; |
| 11415 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11416 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11417 | |
| 11418 | while (remLen >= 2) |
| 11419 | { |
| 11420 | v_U16_t eLen = 0; |
| 11421 | v_U8_t elementId; |
| 11422 | elementId = *genie++; |
| 11423 | eLen = *genie++; |
| 11424 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11425 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11426 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11427 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11428 | |
| 11429 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11430 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11431 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11432 | 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] | 11433 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11434 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11435 | "%s: Invalid WPA IE", __func__); |
| 11436 | return -EINVAL; |
| 11437 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11438 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11439 | { |
| 11440 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11441 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11442 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11443 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11444 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11445 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11446 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 11447 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11448 | VOS_ASSERT(0); |
| 11449 | return -ENOMEM; |
| 11450 | } |
| 11451 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 11452 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11453 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11454 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11455 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 11456 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11457 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11458 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11459 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 11460 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11461 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 11462 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 11463 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 11464 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 11465 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 11466 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11467 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 11468 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11469 | { |
| 11470 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11471 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11472 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11473 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11474 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11475 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11476 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11477 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11478 | VOS_ASSERT(0); |
| 11479 | return -ENOMEM; |
| 11480 | } |
| 11481 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 11482 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11483 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11484 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11485 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11486 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11487 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11488 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11489 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 11490 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11491 | /*Consider WFD IE, only for P2P Client */ |
| 11492 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 11493 | { |
| 11494 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11495 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11496 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11497 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11498 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11499 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11500 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11501 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11502 | VOS_ASSERT(0); |
| 11503 | return -ENOMEM; |
| 11504 | } |
| 11505 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 11506 | // WPS IE + P2P IE + WFD IE |
| 11507 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11508 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11509 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11510 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11511 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11512 | } |
| 11513 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11514 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11515 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11516 | HS20_OUI_TYPE_SIZE)) ) |
| 11517 | { |
| 11518 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11519 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11520 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11521 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11522 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11523 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11524 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11525 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11526 | VOS_ASSERT(0); |
| 11527 | return -ENOMEM; |
| 11528 | } |
| 11529 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11530 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11531 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11532 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11533 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11534 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11535 | /* Appending OSEN Information Element in Assiciation Request */ |
| 11536 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 11537 | OSEN_OUI_TYPE_SIZE)) ) |
| 11538 | { |
| 11539 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 11540 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 11541 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11542 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11543 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11544 | { |
| 11545 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11546 | "Need bigger buffer space"); |
| 11547 | VOS_ASSERT(0); |
| 11548 | return -ENOMEM; |
| 11549 | } |
| 11550 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11551 | pWextState->assocAddIE.length += eLen + 2; |
| 11552 | |
| 11553 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 11554 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11555 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11556 | } |
| 11557 | |
| 11558 | break; |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 11559 | if (WLAN_HDD_IBSS == pAdapter->device_mode) { |
| 11560 | |
| 11561 | /* populating as ADDIE in beacon frames */ |
| 11562 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11563 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie - 2, eLen + 2, |
| 11564 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 11565 | { |
| 11566 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11567 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 11568 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 11569 | { |
| 11570 | hddLog(LOGE, |
| 11571 | "Coldn't pass " |
| 11572 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 11573 | } |
| 11574 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 11575 | else |
| 11576 | hddLog(LOGE, |
| 11577 | "Could not pass on " |
| 11578 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 11579 | |
| 11580 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 11581 | beaconIE's need to be populated in probe response frames */ |
| 11582 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 11583 | { |
| 11584 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 11585 | u8 probe_rsp_ie_len[3] = {0}; |
| 11586 | u8 counter = 0; |
| 11587 | |
| 11588 | /* Check Probe Resp Length if it is greater then 255 then |
| 11589 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 11590 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 11591 | not able Store More then 255 bytes into One Variable */ |
| 11592 | |
| 11593 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 11594 | { |
| 11595 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 11596 | { |
| 11597 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 11598 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 11599 | } |
| 11600 | else |
| 11601 | { |
| 11602 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 11603 | rem_probe_resp_ie_len = 0; |
| 11604 | } |
| 11605 | } |
| 11606 | |
| 11607 | rem_probe_resp_ie_len = 0; |
| 11608 | |
| 11609 | if (probe_rsp_ie_len[0] > 0) |
| 11610 | { |
| 11611 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11612 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 11613 | (tANI_U8*)(genie - 2), |
| 11614 | probe_rsp_ie_len[0], NULL, |
| 11615 | eANI_BOOLEAN_FALSE) |
| 11616 | == eHAL_STATUS_FAILURE) |
| 11617 | { |
| 11618 | hddLog(LOGE, |
| 11619 | "Could not pass" |
| 11620 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 11621 | } |
| 11622 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 11623 | } |
| 11624 | |
| 11625 | if (probe_rsp_ie_len[1] > 0) |
| 11626 | { |
| 11627 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11628 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 11629 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 11630 | probe_rsp_ie_len[1], NULL, |
| 11631 | eANI_BOOLEAN_FALSE) |
| 11632 | == eHAL_STATUS_FAILURE) |
| 11633 | { |
| 11634 | hddLog(LOGE, |
| 11635 | "Could not pass" |
| 11636 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 11637 | } |
| 11638 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 11639 | } |
| 11640 | |
| 11641 | if (probe_rsp_ie_len[2] > 0) |
| 11642 | { |
| 11643 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11644 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 11645 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 11646 | probe_rsp_ie_len[2], NULL, |
| 11647 | eANI_BOOLEAN_FALSE) |
| 11648 | == eHAL_STATUS_FAILURE) |
| 11649 | { |
| 11650 | hddLog(LOGE, |
| 11651 | "Could not pass" |
| 11652 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 11653 | } |
| 11654 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 11655 | } |
| 11656 | |
| 11657 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11658 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 11659 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 11660 | { |
| 11661 | hddLog(LOGE, |
| 11662 | "Could not pass" |
| 11663 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 11664 | } |
| 11665 | } |
| 11666 | else |
| 11667 | { |
| 11668 | // Reset WNI_CFG_PROBE_RSP Flags |
| 11669 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 11670 | |
| 11671 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11672 | "%s: No Probe Response IE received in set beacon", |
| 11673 | __func__); |
| 11674 | } |
| 11675 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11676 | break; |
| 11677 | case DOT11F_EID_RSN: |
| 11678 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 11679 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 11680 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 11681 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 11682 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 11683 | break; |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 11684 | |
| 11685 | /* Appending Extended Capabilities with Interworking bit set |
| 11686 | * in Assoc Req. |
| 11687 | * |
| 11688 | * In assoc req this EXT Cap will only be taken into account if |
| 11689 | * interworkingService bit is set to 1. Currently |
| 11690 | * driver is only interested in interworkingService capability |
| 11691 | * from supplicant. If in future any other EXT Cap info is |
| 11692 | * required from supplicat, it needs to be handled while |
| 11693 | * sending Assoc Req in LIM. |
| 11694 | */ |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11695 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11696 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11697 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11698 | 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] | 11699 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11700 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11701 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11702 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11703 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11704 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11705 | VOS_ASSERT(0); |
| 11706 | return -ENOMEM; |
| 11707 | } |
| 11708 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11709 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11710 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11711 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11712 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11713 | break; |
| 11714 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11715 | #ifdef FEATURE_WLAN_WAPI |
| 11716 | case WLAN_EID_WAPI: |
| 11717 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 11718 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11719 | pAdapter->wapi_info.nWapiMode); |
| 11720 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11721 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11722 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 11723 | tmp = tmp + 1; |
| 11724 | akmlist = (int *)(tmp); |
| 11725 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 11726 | { |
| 11727 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 11728 | } |
| 11729 | else |
| 11730 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11731 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11732 | VOS_ASSERT(0); |
| 11733 | return -EINVAL; |
| 11734 | } |
| 11735 | |
| 11736 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 11737 | { |
| 11738 | 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] | 11739 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11740 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11741 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11742 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11743 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11744 | 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] | 11745 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11746 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 11747 | } |
| 11748 | break; |
| 11749 | #endif |
| 11750 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11751 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11752 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11753 | /* when Unknown IE is received we should break and continue |
| 11754 | * to the next IE in the buffer instead we were returning |
| 11755 | * so changing this to break */ |
| 11756 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11757 | } |
| 11758 | genie += eLen; |
| 11759 | remLen -= eLen; |
| 11760 | } |
| 11761 | EXIT(); |
| 11762 | return 0; |
| 11763 | } |
| 11764 | |
| 11765 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 11766 | * FUNCTION: hdd_isWPAIEPresent |
| 11767 | * Parse the received IE to find the WPA IE |
| 11768 | * |
| 11769 | */ |
| 11770 | static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len) |
| 11771 | { |
| 11772 | v_U8_t eLen = 0; |
| 11773 | v_U16_t remLen = ie_len; |
| 11774 | v_U8_t elementId = 0; |
| 11775 | |
| 11776 | while (remLen >= 2) |
| 11777 | { |
| 11778 | elementId = *ie++; |
| 11779 | eLen = *ie++; |
| 11780 | remLen -= 2; |
| 11781 | if (eLen > remLen) |
| 11782 | { |
| 11783 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11784 | "%s: IE length is wrong %d", __func__, eLen); |
| 11785 | return FALSE; |
| 11786 | } |
| 11787 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 11788 | { |
| 11789 | /* OUI - 0x00 0X50 0XF2 |
| 11790 | WPA Information Element - 0x01 |
| 11791 | WPA version - 0x01*/ |
| 11792 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 11793 | return TRUE; |
| 11794 | } |
| 11795 | ie += eLen; |
| 11796 | remLen -= eLen; |
| 11797 | } |
| 11798 | return FALSE; |
| 11799 | } |
| 11800 | |
| 11801 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11802 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11803 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11804 | * parameters during connect operation. |
| 11805 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11806 | int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11807 | struct cfg80211_connect_params *req |
| 11808 | ) |
| 11809 | { |
| 11810 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11811 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11812 | ENTER(); |
| 11813 | |
| 11814 | /*set wpa version*/ |
| 11815 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 11816 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11817 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11818 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 11819 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11820 | { |
| 11821 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 11822 | } |
| 11823 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 11824 | { |
| 11825 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 11826 | } |
| 11827 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11828 | |
| 11829 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11830 | pWextState->wpaVersion); |
| 11831 | |
| 11832 | /*set authentication type*/ |
| 11833 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 11834 | |
| 11835 | if (0 > status) |
| 11836 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11837 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11838 | "%s: failed to set authentication type ", __func__); |
| 11839 | return status; |
| 11840 | } |
| 11841 | |
| 11842 | /*set key mgmt type*/ |
| 11843 | if (req->crypto.n_akm_suites) |
| 11844 | { |
| 11845 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 11846 | if (0 > status) |
| 11847 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11848 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11849 | __func__); |
| 11850 | return status; |
| 11851 | } |
| 11852 | } |
| 11853 | |
| 11854 | /*set pairwise cipher type*/ |
| 11855 | if (req->crypto.n_ciphers_pairwise) |
| 11856 | { |
| 11857 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 11858 | req->crypto.ciphers_pairwise[0], true); |
| 11859 | if (0 > status) |
| 11860 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11861 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11862 | "%s: failed to set unicast cipher type", __func__); |
| 11863 | return status; |
| 11864 | } |
| 11865 | } |
| 11866 | else |
| 11867 | { |
| 11868 | /*Reset previous cipher suite to none*/ |
| 11869 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 11870 | if (0 > status) |
| 11871 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11872 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11873 | "%s: failed to set unicast cipher type", __func__); |
| 11874 | return status; |
| 11875 | } |
| 11876 | } |
| 11877 | |
| 11878 | /*set group cipher type*/ |
| 11879 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 11880 | false); |
| 11881 | |
| 11882 | if (0 > status) |
| 11883 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11884 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11885 | __func__); |
| 11886 | return status; |
| 11887 | } |
| 11888 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11889 | #ifdef WLAN_FEATURE_11W |
| 11890 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 11891 | #endif |
| 11892 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11893 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 11894 | if (req->ie_len) |
| 11895 | { |
| 11896 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 11897 | if ( 0 > status) |
| 11898 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11899 | 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] | 11900 | __func__); |
| 11901 | return status; |
| 11902 | } |
| 11903 | } |
| 11904 | |
| 11905 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11906 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11907 | { |
| 11908 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 11909 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 11910 | ) |
| 11911 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11912 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11913 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 11914 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11915 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11916 | __func__); |
| 11917 | return -EOPNOTSUPP; |
| 11918 | } |
| 11919 | else |
| 11920 | { |
| 11921 | u8 key_len = req->key_len; |
| 11922 | u8 key_idx = req->key_idx; |
| 11923 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11924 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11925 | && (CSR_MAX_NUM_KEY > key_idx) |
| 11926 | ) |
| 11927 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11928 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11929 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11930 | __func__, key_idx, key_len); |
| 11931 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11932 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11933 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11934 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11935 | (u8)key_len; |
| 11936 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 11937 | } |
| 11938 | } |
| 11939 | } |
| 11940 | } |
| 11941 | |
| 11942 | return status; |
| 11943 | } |
| 11944 | |
| 11945 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 11946 | * FUNCTION: wlan_hdd_try_disconnect |
| 11947 | * This function is used to disconnect from previous |
| 11948 | * connection |
| 11949 | */ |
| 11950 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 11951 | { |
| 11952 | long ret = 0; |
| 11953 | hdd_station_ctx_t *pHddStaCtx; |
| 11954 | eMib_dot11DesiredBssType connectedBssType; |
| 11955 | |
| 11956 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11957 | |
| 11958 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 11959 | |
| 11960 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 11961 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 11962 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 11963 | { |
| 11964 | /* Issue disconnect to CSR */ |
| 11965 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 11966 | if( eHAL_STATUS_SUCCESS == |
| 11967 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11968 | pAdapter->sessionId, |
| 11969 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 11970 | { |
| 11971 | ret = wait_for_completion_interruptible_timeout( |
| 11972 | &pAdapter->disconnect_comp_var, |
| 11973 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 11974 | if (0 >= ret) |
| 11975 | { |
| 11976 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 11977 | return -EALREADY; |
| 11978 | } |
| 11979 | } |
| 11980 | } |
| 11981 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 11982 | { |
| 11983 | ret = wait_for_completion_interruptible_timeout( |
| 11984 | &pAdapter->disconnect_comp_var, |
| 11985 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 11986 | if (0 >= ret) |
| 11987 | { |
| 11988 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 11989 | return -EALREADY; |
| 11990 | } |
| 11991 | } |
| 11992 | |
| 11993 | return 0; |
| 11994 | } |
| 11995 | |
| 11996 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11997 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 11998 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11999 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12000 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12001 | struct net_device *ndev, |
| 12002 | struct cfg80211_connect_params *req |
| 12003 | ) |
| 12004 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12005 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12006 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12007 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 12008 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12009 | |
| 12010 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12011 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12012 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12013 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 12014 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12015 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12016 | "%s: device_mode = %s (%d)", __func__, |
| 12017 | hdd_device_modetoString(pAdapter->device_mode), |
| 12018 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12019 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12020 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 12021 | if (!pHddCtx) |
| 12022 | { |
| 12023 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12024 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12025 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 12026 | } |
| 12027 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12028 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12029 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12030 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12031 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12032 | } |
| 12033 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12034 | if (vos_max_concurrent_connections_reached()) { |
| 12035 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 12036 | return -ECONNREFUSED; |
| 12037 | } |
| 12038 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12039 | #ifdef WLAN_BTAMP_FEATURE |
| 12040 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12041 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12042 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12043 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12044 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 12045 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12046 | } |
| 12047 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12048 | |
| 12049 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 12050 | //P2P Mode will be taken care in Open/close adapter |
| 12051 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12052 | (vos_concurrent_open_sessions_running())) { |
| 12053 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 12054 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12055 | } |
| 12056 | |
| 12057 | /*Try disconnecting if already in connected state*/ |
| 12058 | status = wlan_hdd_try_disconnect(pAdapter); |
| 12059 | if ( 0 > status) |
| 12060 | { |
| 12061 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 12062 | " connection")); |
| 12063 | return -EALREADY; |
| 12064 | } |
| 12065 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12066 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12067 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12068 | |
| 12069 | if ( 0 > status) |
| 12070 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12071 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12072 | __func__); |
| 12073 | return status; |
| 12074 | } |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 12075 | if ( req->channel ) |
| 12076 | { |
| 12077 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 12078 | req->ssid_len, req->bssid, |
| 12079 | req->channel->hw_value); |
| 12080 | } |
| 12081 | else |
| 12082 | { |
| 12083 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12084 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 12085 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12086 | |
Sushant Kaushik | d708398 | 2015-03-18 14:33:24 +0530 | [diff] [blame] | 12087 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12088 | { |
| 12089 | //ReEnable BMPS if disabled |
| 12090 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 12091 | (NULL != pHddCtx)) |
| 12092 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 12093 | if (pHddCtx->hdd_wlan_suspended) |
| 12094 | { |
| 12095 | hdd_set_pwrparams(pHddCtx); |
| 12096 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12097 | //ReEnable Bmps and Imps back |
| 12098 | hdd_enable_bmps_imps(pHddCtx); |
| 12099 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12100 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12101 | return status; |
| 12102 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12103 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12104 | EXIT(); |
| 12105 | return status; |
| 12106 | } |
| 12107 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12108 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 12109 | struct net_device *ndev, |
| 12110 | struct cfg80211_connect_params *req) |
| 12111 | { |
| 12112 | int ret; |
| 12113 | vos_ssr_protect(__func__); |
| 12114 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 12115 | vos_ssr_unprotect(__func__); |
| 12116 | |
| 12117 | return ret; |
| 12118 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12119 | |
| 12120 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12121 | * FUNCTION: wlan_hdd_disconnect |
| 12122 | * This function is used to issue a disconnect request to SME |
| 12123 | */ |
| 12124 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 12125 | { |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12126 | int status, result = 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12127 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12128 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12129 | long ret; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12130 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12131 | ENTER(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12132 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12133 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12134 | if (0 != status) |
| 12135 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12136 | return status; |
| 12137 | } |
| 12138 | |
| 12139 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12140 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12141 | /* Need to apply spin lock before decreasing active sessions |
| 12142 | * as there can be chance for double decrement if context switch |
| 12143 | * Calls hdd_DisConnectHandler. |
| 12144 | */ |
| 12145 | |
| 12146 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12147 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 12148 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12149 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 12150 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12151 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 12152 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12153 | |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 12154 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12155 | FL( "Set HDD connState to eConnectionState_Disconnecting" )); |
| 12156 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12157 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12158 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12159 | /* |
| 12160 | * stop tx queues before deleting STA/BSS context from the firmware. |
| 12161 | * tx has to be disabled because the firmware can get busy dropping |
| 12162 | * the tx frames after BSS/STA has been deleted and will not send |
| 12163 | * back a response resulting in WDI timeout |
| 12164 | */ |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 12165 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12166 | netif_tx_disable(pAdapter->dev); |
| 12167 | netif_carrier_off(pAdapter->dev); |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 12168 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12169 | /*issue disconnect*/ |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12170 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12171 | pAdapter->sessionId, reason); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12172 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
| 12173 | { |
| 12174 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12175 | FL("status = %d, already disconnected"), |
| 12176 | (int)status ); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12177 | |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12178 | } |
| 12179 | else if ( 0 != status ) |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12180 | { |
| 12181 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12182 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12183 | __func__, (int)status ); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12184 | result = -EINVAL; |
| 12185 | goto disconnected; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12186 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12187 | ret = wait_for_completion_interruptible_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12188 | &pAdapter->disconnect_comp_var, |
| 12189 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12190 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status )) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12191 | { |
| 12192 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12193 | "%s: Failed to disconnect, timed out", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12194 | result = -ETIMEDOUT; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12195 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12196 | else if (ret == -ERESTARTSYS) |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12197 | { |
| 12198 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12199 | "%s: Failed to disconnect, wait interrupted", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12200 | result = -ERESTARTSYS; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12201 | } |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12202 | disconnected: |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12203 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12204 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 12205 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 12206 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12207 | EXIT(); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12208 | return result; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12209 | } |
| 12210 | |
| 12211 | |
| 12212 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12213 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12214 | * This function is used to issue a disconnect request to SME |
| 12215 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12216 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12217 | struct net_device *dev, |
| 12218 | u16 reason |
| 12219 | ) |
| 12220 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12221 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12222 | int status; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12223 | tCsrRoamProfile *pRoamProfile; |
| 12224 | hdd_station_ctx_t *pHddStaCtx; |
| 12225 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12226 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12227 | tANI_U8 staIdx; |
| 12228 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12229 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12230 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12231 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12232 | if (!pAdapter) { |
| 12233 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 12234 | return -EINVAL; |
| 12235 | } |
| 12236 | |
| 12237 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12238 | if (!pHddStaCtx) { |
| 12239 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD STA context is NULL")); |
| 12240 | return -EINVAL; |
| 12241 | } |
| 12242 | |
| 12243 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12244 | status = wlan_hdd_validate_context(pHddCtx); |
| 12245 | if (0 != status) |
| 12246 | { |
| 12247 | return status; |
| 12248 | } |
| 12249 | |
| 12250 | pRoamProfile = &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
| 12251 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12252 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12253 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 12254 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12255 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 12256 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12257 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12258 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12259 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 12260 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12261 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12262 | if (NULL != pRoamProfile) |
| 12263 | { |
| 12264 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 12265 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 12266 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12267 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12268 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12269 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12270 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12271 | switch(reason) |
| 12272 | { |
| 12273 | case WLAN_REASON_MIC_FAILURE: |
| 12274 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 12275 | break; |
| 12276 | |
| 12277 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 12278 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 12279 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 12280 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 12281 | break; |
| 12282 | |
| 12283 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 12284 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 12285 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12286 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 12287 | break; |
| 12288 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12289 | default: |
| 12290 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 12291 | break; |
| 12292 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12293 | pScanInfo = &pHddCtx->scan_info; |
| 12294 | if (pScanInfo->mScanPending) |
| 12295 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 12296 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12297 | "Aborting Scan"); |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 12298 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 12299 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12300 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12301 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12302 | #ifdef FEATURE_WLAN_TDLS |
| 12303 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12304 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12305 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12306 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 12307 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12308 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12309 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12310 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12311 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12312 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12313 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12314 | MAC_ADDR_ARRAY(mac)); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 12315 | status = sme_DeleteTdlsPeerSta( |
| 12316 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12317 | pAdapter->sessionId, |
| 12318 | mac); |
| 12319 | if (status != eHAL_STATUS_SUCCESS) { |
| 12320 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 12321 | return -EPERM; |
| 12322 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12323 | } |
| 12324 | } |
| 12325 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 12326 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12327 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 12328 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12329 | { |
| 12330 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12331 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12332 | __func__, (int)status ); |
| 12333 | return -EINVAL; |
| 12334 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12335 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 12336 | else |
| 12337 | { |
| 12338 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 12339 | "called while in %d state", __func__, |
| 12340 | pHddStaCtx->conn_info.connState); |
| 12341 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12342 | } |
| 12343 | else |
| 12344 | { |
| 12345 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 12346 | } |
| 12347 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12348 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12349 | return status; |
| 12350 | } |
| 12351 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12352 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 12353 | struct net_device *dev, |
| 12354 | u16 reason |
| 12355 | ) |
| 12356 | { |
| 12357 | int ret; |
| 12358 | vos_ssr_protect(__func__); |
| 12359 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 12360 | vos_ssr_unprotect(__func__); |
| 12361 | |
| 12362 | return ret; |
| 12363 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12364 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12365 | /* |
| 12366 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12367 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12368 | * settings in IBSS mode. |
| 12369 | */ |
| 12370 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12371 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12372 | struct cfg80211_ibss_params *params |
| 12373 | ) |
| 12374 | { |
| 12375 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12376 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12377 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 12378 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12379 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12380 | ENTER(); |
| 12381 | |
| 12382 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 12383 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12384 | |
| 12385 | if (params->ie_len && ( NULL != params->ie) ) |
| 12386 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12387 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 12388 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12389 | { |
| 12390 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 12391 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 12392 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12393 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12394 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12395 | tDot11fIEWPA dot11WPAIE; |
| 12396 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12397 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12398 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 12399 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12400 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 12401 | params->ie_len, DOT11F_EID_WPA); |
| 12402 | if ( NULL != ie ) |
| 12403 | { |
| 12404 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 12405 | // Unpack the WPA IE |
| 12406 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 12407 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 12408 | &ie[2+4], |
| 12409 | ie[1] - 4, |
| 12410 | &dot11WPAIE); |
| 12411 | /*Extract the multicast cipher, the encType for unicast |
| 12412 | cipher for wpa-none is none*/ |
| 12413 | encryptionType = |
| 12414 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 12415 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12416 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12417 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12418 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 12419 | |
| 12420 | if (0 > status) |
| 12421 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12422 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12423 | __func__); |
| 12424 | return status; |
| 12425 | } |
| 12426 | } |
| 12427 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12428 | pWextState->roamProfile.AuthType.authType[0] = |
| 12429 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12430 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 12431 | |
| 12432 | if (params->privacy) |
| 12433 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12434 | /* Security enabled IBSS, At this time there is no information available |
| 12435 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12436 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12437 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12438 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12439 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12440 | *enable privacy bit in beacons */ |
| 12441 | |
| 12442 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 12443 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12444 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 12445 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12446 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 12447 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 12448 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12449 | return status; |
| 12450 | } |
| 12451 | |
| 12452 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12453 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12454 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12455 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12456 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12457 | struct net_device *dev, |
| 12458 | struct cfg80211_ibss_params *params |
| 12459 | ) |
| 12460 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12461 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12462 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12463 | tCsrRoamProfile *pRoamProfile; |
| 12464 | int status; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12465 | bool alloc_bssid = VOS_FALSE; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12466 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12467 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12468 | |
| 12469 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12470 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12471 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12472 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 12473 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12474 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12475 | "%s: device_mode = %s (%d)", __func__, |
| 12476 | hdd_device_modetoString(pAdapter->device_mode), |
| 12477 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12478 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12479 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12480 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12481 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12482 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12483 | } |
| 12484 | |
| 12485 | if (NULL == pWextState) |
| 12486 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12487 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12488 | __func__); |
| 12489 | return -EIO; |
| 12490 | } |
| 12491 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12492 | if (vos_max_concurrent_connections_reached()) { |
| 12493 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 12494 | return -ECONNREFUSED; |
| 12495 | } |
| 12496 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12497 | /*Try disconnecting if already in connected state*/ |
| 12498 | status = wlan_hdd_try_disconnect(pAdapter); |
| 12499 | if ( 0 > status) |
| 12500 | { |
| 12501 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 12502 | " IBSS connection")); |
| 12503 | return -EALREADY; |
| 12504 | } |
| 12505 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12506 | pRoamProfile = &pWextState->roamProfile; |
| 12507 | |
| 12508 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 12509 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12510 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12511 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12512 | return -EINVAL; |
| 12513 | } |
| 12514 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12515 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 12516 | if (NULL != params->bssid) { |
| 12517 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 12518 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 12519 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12520 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 12521 | return -EIO; |
| 12522 | } |
| 12523 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12524 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 12525 | { |
| 12526 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 12527 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 12528 | { |
| 12529 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12530 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 12531 | return -EIO; |
| 12532 | } |
Sachin Ahuja | 46ff491 | 2015-03-23 22:48:43 +0530 | [diff] [blame] | 12533 | params->bssid = vos_mem_malloc(VOS_MAC_ADDR_SIZE); |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12534 | if (!params->bssid) |
| 12535 | { |
| 12536 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12537 | "%s:Failed memory allocation", __func__); |
| 12538 | return -EIO; |
| 12539 | } |
| 12540 | vos_mem_copy((v_U8_t *)params->bssid, |
| 12541 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
| 12542 | VOS_MAC_ADDR_SIZE); |
| 12543 | alloc_bssid = VOS_TRUE; |
| 12544 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12545 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12546 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12547 | if (NULL != |
| 12548 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 12549 | params->chandef.chan) |
| 12550 | #else |
| 12551 | params->channel) |
| 12552 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12553 | { |
| 12554 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12555 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 12556 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 12557 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12558 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12559 | |
| 12560 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12561 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12562 | ieee80211_frequency_to_channel( |
| 12563 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 12564 | params->chandef.chan->center_freq); |
| 12565 | #else |
| 12566 | params->channel->center_freq); |
| 12567 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12568 | |
| 12569 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 12570 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12571 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12572 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 12573 | __func__); |
| 12574 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12575 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12576 | |
| 12577 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12578 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12579 | if (channelNum == validChan[indx]) |
| 12580 | { |
| 12581 | break; |
| 12582 | } |
| 12583 | } |
| 12584 | if (indx >= numChans) |
| 12585 | { |
| 12586 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12587 | __func__, channelNum); |
| 12588 | return -EINVAL; |
| 12589 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12590 | /* Set the Operational Channel */ |
| 12591 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 12592 | channelNum); |
| 12593 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 12594 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 12595 | pRoamProfile->ChannelInfo.ChannelList = |
| 12596 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12597 | } |
| 12598 | |
| 12599 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12600 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12601 | if (status < 0) |
| 12602 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12603 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12604 | __func__); |
| 12605 | return status; |
| 12606 | } |
| 12607 | |
| 12608 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12609 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12610 | params->ssid_len, params->bssid, |
| 12611 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12612 | |
| 12613 | if (0 > status) |
| 12614 | { |
| 12615 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 12616 | return status; |
| 12617 | } |
| 12618 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12619 | if (NULL != params->bssid && |
| 12620 | pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0 && |
| 12621 | alloc_bssid == VOS_TRUE) |
| 12622 | { |
| 12623 | vos_mem_free(params->bssid); |
| 12624 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12625 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12626 | return 0; |
| 12627 | } |
| 12628 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12629 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 12630 | struct net_device *dev, |
| 12631 | struct cfg80211_ibss_params *params |
| 12632 | ) |
| 12633 | { |
| 12634 | int ret = 0; |
| 12635 | |
| 12636 | vos_ssr_protect(__func__); |
| 12637 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 12638 | vos_ssr_unprotect(__func__); |
| 12639 | |
| 12640 | return ret; |
| 12641 | } |
| 12642 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12643 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12644 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12645 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12646 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12647 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12648 | struct net_device *dev |
| 12649 | ) |
| 12650 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12651 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12652 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12653 | tCsrRoamProfile *pRoamProfile; |
| 12654 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12655 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12656 | |
| 12657 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12658 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12659 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12660 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 12661 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12662 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12663 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12664 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12665 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12666 | } |
| 12667 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12668 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 12669 | hdd_device_modetoString(pAdapter->device_mode), |
| 12670 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12671 | if (NULL == pWextState) |
| 12672 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12673 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12674 | __func__); |
| 12675 | return -EIO; |
| 12676 | } |
| 12677 | |
| 12678 | pRoamProfile = &pWextState->roamProfile; |
| 12679 | |
| 12680 | /* Issue disconnect only if interface type is set to IBSS */ |
| 12681 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 12682 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12683 | 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] | 12684 | __func__); |
| 12685 | return -EINVAL; |
| 12686 | } |
| 12687 | |
| 12688 | /* Issue Disconnect request */ |
| 12689 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 12690 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 12691 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 12692 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12693 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12694 | return 0; |
| 12695 | } |
| 12696 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12697 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 12698 | struct net_device *dev |
| 12699 | ) |
| 12700 | { |
| 12701 | int ret = 0; |
| 12702 | |
| 12703 | vos_ssr_protect(__func__); |
| 12704 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 12705 | vos_ssr_unprotect(__func__); |
| 12706 | |
| 12707 | return ret; |
| 12708 | } |
| 12709 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12710 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12711 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12712 | * This function is used to set the phy parameters |
| 12713 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 12714 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12715 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12716 | u32 changed) |
| 12717 | { |
| 12718 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 12719 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12720 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12721 | |
| 12722 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12723 | |
| 12724 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12725 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 12726 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12727 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12728 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12729 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12730 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12731 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12732 | } |
| 12733 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12734 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 12735 | { |
| 12736 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 12737 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 12738 | wiphy->rts_threshold; |
| 12739 | |
| 12740 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12741 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12742 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12743 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12744 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12745 | __func__, rts_threshold); |
| 12746 | return -EINVAL; |
| 12747 | } |
| 12748 | |
| 12749 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 12750 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12751 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12752 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12753 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12754 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12755 | __func__, rts_threshold); |
| 12756 | return -EIO; |
| 12757 | } |
| 12758 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12759 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12760 | rts_threshold); |
| 12761 | } |
| 12762 | |
| 12763 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 12764 | { |
| 12765 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 12766 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 12767 | wiphy->frag_threshold; |
| 12768 | |
| 12769 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12770 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12771 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12772 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12773 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12774 | frag_threshold); |
| 12775 | return -EINVAL; |
| 12776 | } |
| 12777 | |
| 12778 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 12779 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12780 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12781 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12782 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12783 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12784 | __func__, frag_threshold); |
| 12785 | return -EIO; |
| 12786 | } |
| 12787 | |
| 12788 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 12789 | frag_threshold); |
| 12790 | } |
| 12791 | |
| 12792 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 12793 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 12794 | { |
| 12795 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 12796 | wiphy->retry_short : |
| 12797 | wiphy->retry_long; |
| 12798 | |
| 12799 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 12800 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 12801 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12802 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12803 | __func__, retry_value); |
| 12804 | return -EINVAL; |
| 12805 | } |
| 12806 | |
| 12807 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 12808 | { |
| 12809 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 12810 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12811 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12812 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12813 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12814 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12815 | __func__, retry_value); |
| 12816 | return -EIO; |
| 12817 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12818 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12819 | __func__, retry_value); |
| 12820 | } |
| 12821 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 12822 | { |
| 12823 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 12824 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12825 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12826 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12827 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12828 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12829 | __func__, retry_value); |
| 12830 | return -EIO; |
| 12831 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12832 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12833 | __func__, retry_value); |
| 12834 | } |
| 12835 | } |
| 12836 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12837 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12838 | return 0; |
| 12839 | } |
| 12840 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12841 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 12842 | u32 changed) |
| 12843 | { |
| 12844 | int ret; |
| 12845 | |
| 12846 | vos_ssr_protect(__func__); |
| 12847 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 12848 | vos_ssr_unprotect(__func__); |
| 12849 | |
| 12850 | return ret; |
| 12851 | } |
| 12852 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12853 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12854 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12855 | * This function is used to set the txpower |
| 12856 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12857 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12858 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12859 | struct wireless_dev *wdev, |
| 12860 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12861 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12862 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12863 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12864 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12865 | #endif |
| 12866 | int dbm) |
| 12867 | { |
| 12868 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12869 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12870 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 12871 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12872 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12873 | |
| 12874 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12875 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12876 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12877 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 12878 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12879 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12880 | if (0 != status) |
| 12881 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12882 | return status; |
| 12883 | } |
| 12884 | |
| 12885 | hHal = pHddCtx->hHal; |
| 12886 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12887 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 12888 | dbm, ccmCfgSetCallback, |
| 12889 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12890 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12891 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12892 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 12893 | return -EIO; |
| 12894 | } |
| 12895 | |
| 12896 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 12897 | dbm); |
| 12898 | |
| 12899 | switch(type) |
| 12900 | { |
| 12901 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 12902 | /* Fall through */ |
| 12903 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 12904 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 12905 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12906 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 12907 | __func__); |
| 12908 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12909 | } |
| 12910 | break; |
| 12911 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12912 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12913 | __func__); |
| 12914 | return -EOPNOTSUPP; |
| 12915 | break; |
| 12916 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12917 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 12918 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12919 | return -EIO; |
| 12920 | } |
| 12921 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12922 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12923 | return 0; |
| 12924 | } |
| 12925 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12926 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 12927 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12928 | struct wireless_dev *wdev, |
| 12929 | #endif |
| 12930 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 12931 | enum tx_power_setting type, |
| 12932 | #else |
| 12933 | enum nl80211_tx_power_setting type, |
| 12934 | #endif |
| 12935 | int dbm) |
| 12936 | { |
| 12937 | int ret; |
| 12938 | vos_ssr_protect(__func__); |
| 12939 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 12940 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12941 | wdev, |
| 12942 | #endif |
| 12943 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 12944 | type, |
| 12945 | #else |
| 12946 | type, |
| 12947 | #endif |
| 12948 | dbm); |
| 12949 | vos_ssr_unprotect(__func__); |
| 12950 | |
| 12951 | return ret; |
| 12952 | } |
| 12953 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12954 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12955 | * FUNCTION: __wlan_hdd_cfg80211_get_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12956 | * This function is used to read the txpower |
| 12957 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12958 | static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12959 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12960 | struct wireless_dev *wdev, |
| 12961 | #endif |
| 12962 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12963 | { |
| 12964 | |
| 12965 | hdd_adapter_t *pAdapter; |
| 12966 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12967 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12968 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12969 | ENTER(); |
| 12970 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12971 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12972 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12973 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12974 | *dbm = 0; |
| 12975 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12976 | } |
| 12977 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12978 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 12979 | if (NULL == pAdapter) |
| 12980 | { |
| 12981 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 12982 | return -ENOENT; |
| 12983 | } |
| 12984 | |
| 12985 | wlan_hdd_get_classAstats(pAdapter); |
| 12986 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 12987 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12988 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12989 | return 0; |
| 12990 | } |
| 12991 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12992 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 12993 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12994 | struct wireless_dev *wdev, |
| 12995 | #endif |
| 12996 | int *dbm) |
| 12997 | { |
| 12998 | int ret; |
| 12999 | |
| 13000 | vos_ssr_protect(__func__); |
| 13001 | ret = __wlan_hdd_cfg80211_get_txpower(wiphy, |
| 13002 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13003 | wdev, |
| 13004 | #endif |
| 13005 | dbm); |
| 13006 | vos_ssr_unprotect(__func__); |
| 13007 | |
| 13008 | return ret; |
| 13009 | } |
| 13010 | |
| 13011 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13012 | 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] | 13013 | u8* mac, struct station_info *sinfo) |
| 13014 | { |
| 13015 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 13016 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13017 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13018 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13019 | |
| 13020 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 13021 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13022 | |
| 13023 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 13024 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 13025 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 13026 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 13027 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 13028 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 13029 | tANI_U16 maxRate = 0; |
| 13030 | tANI_U16 myRate; |
| 13031 | tANI_U16 currentRate = 0; |
| 13032 | tANI_U8 maxSpeedMCS = 0; |
| 13033 | tANI_U8 maxMCSIdx = 0; |
| 13034 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13035 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 13036 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13037 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13038 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13039 | #ifdef WLAN_FEATURE_11AC |
| 13040 | tANI_U32 vht_mcs_map; |
| 13041 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 13042 | #endif /* WLAN_FEATURE_11AC */ |
| 13043 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13044 | ENTER(); |
| 13045 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13046 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 13047 | (0 == ssidlen)) |
| 13048 | { |
| 13049 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 13050 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 13051 | /*To keep GUI happy*/ |
| 13052 | return 0; |
| 13053 | } |
| 13054 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 13055 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 13056 | { |
| 13057 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13058 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 13059 | return 0; |
| 13060 | } |
| 13061 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13062 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13063 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13064 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13065 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13066 | } |
| 13067 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13068 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 13069 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 13070 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 13071 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 13072 | wlan_hdd_get_station_stats(pAdapter); |
| 13073 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
| 13074 | |
| 13075 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13076 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 13077 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13078 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13079 | { |
| 13080 | rate_flags = pAdapter->maxRateFlags; |
| 13081 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13082 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13083 | //convert to the UI units of 100kbps |
| 13084 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 13085 | |
| 13086 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13087 | 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] | 13088 | sinfo->signal, |
| 13089 | pCfg->reportMaxLinkSpeed, |
| 13090 | myRate, |
| 13091 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13092 | (int) pCfg->linkSpeedRssiMid, |
| 13093 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13094 | (int) rate_flags, |
| 13095 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13096 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13097 | |
| 13098 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 13099 | { |
| 13100 | // we do not want to necessarily report the current speed |
| 13101 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 13102 | { |
| 13103 | // report the max possible speed |
| 13104 | rssidx = 0; |
| 13105 | } |
| 13106 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 13107 | { |
| 13108 | // report the max possible speed with RSSI scaling |
| 13109 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 13110 | { |
| 13111 | // report the max possible speed |
| 13112 | rssidx = 0; |
| 13113 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13114 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13115 | { |
| 13116 | // report middle speed |
| 13117 | rssidx = 1; |
| 13118 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13119 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 13120 | { |
| 13121 | // report middle speed |
| 13122 | rssidx = 2; |
| 13123 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13124 | else |
| 13125 | { |
| 13126 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13127 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13128 | } |
| 13129 | } |
| 13130 | else |
| 13131 | { |
| 13132 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 13133 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13134 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 13135 | __func__, pCfg->reportMaxLinkSpeed); |
| 13136 | rssidx = 0; |
| 13137 | } |
| 13138 | |
| 13139 | maxRate = 0; |
| 13140 | |
| 13141 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13142 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 13143 | OperationalRates, &ORLeng)) |
| 13144 | { |
| 13145 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13146 | /*To keep GUI happy*/ |
| 13147 | return 0; |
| 13148 | } |
| 13149 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13150 | for (i = 0; i < ORLeng; i++) |
| 13151 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13152 | 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] | 13153 | { |
| 13154 | /* Validate Rate Set */ |
| 13155 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 13156 | { |
| 13157 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 13158 | break; |
| 13159 | } |
| 13160 | } |
| 13161 | /* Update MAX rate */ |
| 13162 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 13163 | } |
| 13164 | |
| 13165 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13166 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 13167 | ExtendedRates, &ERLeng)) |
| 13168 | { |
| 13169 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13170 | /*To keep GUI happy*/ |
| 13171 | return 0; |
| 13172 | } |
| 13173 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13174 | for (i = 0; i < ERLeng; i++) |
| 13175 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13176 | 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] | 13177 | { |
| 13178 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 13179 | { |
| 13180 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 13181 | break; |
| 13182 | } |
| 13183 | } |
| 13184 | /* Update MAX rate */ |
| 13185 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 13186 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13187 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 13188 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 13189 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 13190 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13191 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13192 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13193 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13194 | mode = 2; |
| 13195 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 13196 | mode = 1; |
| 13197 | else |
| 13198 | mode = 0; |
| 13199 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13200 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 13201 | MCSRates, &MCSLeng)) |
| 13202 | { |
| 13203 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13204 | /*To keep GUI happy*/ |
| 13205 | return 0; |
| 13206 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13207 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13208 | #ifdef WLAN_FEATURE_11AC |
| 13209 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13210 | 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] | 13211 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13212 | 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] | 13213 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13214 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13215 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13216 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13217 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13218 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13219 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13220 | maxMCSIdx = 7; |
| 13221 | } |
| 13222 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 13223 | { |
| 13224 | maxMCSIdx = 8; |
| 13225 | } |
| 13226 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 13227 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13228 | //VHT20 is supporting 0~8 |
| 13229 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13230 | maxMCSIdx = 8; |
| 13231 | else |
| 13232 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13233 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13234 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13235 | if (0 != rssidx)/*check for scaled */ |
| 13236 | { |
| 13237 | //get middle rate MCS index if rssi=1/2 |
| 13238 | for (i=0; i <= maxMCSIdx; i++) |
| 13239 | { |
| 13240 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 13241 | { |
| 13242 | maxMCSIdx = i; |
| 13243 | break; |
| 13244 | } |
| 13245 | } |
| 13246 | } |
| 13247 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13248 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13249 | { |
| 13250 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 13251 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 13252 | } |
| 13253 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 13254 | { |
| 13255 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 13256 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 13257 | } |
| 13258 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13259 | { |
| 13260 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 13261 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 13262 | } |
| 13263 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13264 | maxSpeedMCS = 1; |
| 13265 | if (currentRate > maxRate) |
| 13266 | { |
| 13267 | maxRate = currentRate; |
| 13268 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13269 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13270 | } |
| 13271 | else |
| 13272 | #endif /* WLAN_FEATURE_11AC */ |
| 13273 | { |
| 13274 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13275 | { |
| 13276 | rateFlag |= 1; |
| 13277 | } |
| 13278 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13279 | { |
| 13280 | rateFlag |= 2; |
| 13281 | } |
| 13282 | |
Girish Gowli | 01abcee | 2014-07-31 20:18:55 +0530 | [diff] [blame] | 13283 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13284 | if (rssidx == 1 || rssidx == 2) |
| 13285 | { |
| 13286 | //get middle rate MCS index if rssi=1/2 |
| 13287 | for (i=0; i <= 7; i++) |
| 13288 | { |
| 13289 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 13290 | { |
| 13291 | temp = i+1; |
| 13292 | break; |
| 13293 | } |
| 13294 | } |
| 13295 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13296 | |
| 13297 | for (i = 0; i < MCSLeng; i++) |
| 13298 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13299 | for (j = 0; j < temp; j++) |
| 13300 | { |
| 13301 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 13302 | { |
| 13303 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
| 13304 | break; |
| 13305 | } |
| 13306 | } |
| 13307 | if ((j < temp) && (currentRate > maxRate)) |
| 13308 | { |
| 13309 | maxRate = currentRate; |
| 13310 | maxSpeedMCS = 1; |
| 13311 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
| 13312 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13313 | } |
| 13314 | } |
| 13315 | } |
| 13316 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13317 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 13318 | { |
| 13319 | maxRate = myRate; |
| 13320 | maxSpeedMCS = 1; |
| 13321 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 13322 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13323 | // 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] | 13324 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13325 | { |
| 13326 | maxRate = myRate; |
| 13327 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 13328 | { |
| 13329 | maxSpeedMCS = 0; |
| 13330 | } |
| 13331 | else |
| 13332 | { |
| 13333 | maxSpeedMCS = 1; |
| 13334 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 13335 | } |
| 13336 | } |
| 13337 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13338 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13339 | { |
| 13340 | sinfo->txrate.legacy = maxRate; |
| 13341 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13342 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 13343 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13344 | } |
| 13345 | else |
| 13346 | { |
| 13347 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13348 | #ifdef WLAN_FEATURE_11AC |
| 13349 | sinfo->txrate.nss = 1; |
| 13350 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13351 | { |
| 13352 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13353 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13354 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13355 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13356 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13357 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13358 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13359 | } |
| 13360 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13361 | { |
| 13362 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13363 | } |
| 13364 | #endif /* WLAN_FEATURE_11AC */ |
| 13365 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 13366 | { |
| 13367 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 13368 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13369 | { |
| 13370 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13371 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13372 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13373 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13374 | { |
| 13375 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 13376 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13377 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13378 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13379 | pr_info("Reporting MCS rate %d flags %x\n", |
| 13380 | sinfo->txrate.mcs, |
| 13381 | sinfo->txrate.flags ); |
| 13382 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13383 | } |
| 13384 | } |
| 13385 | else |
| 13386 | { |
| 13387 | // report current rate instead of max rate |
| 13388 | |
| 13389 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 13390 | { |
| 13391 | //provide to the UI in units of 100kbps |
| 13392 | sinfo->txrate.legacy = myRate; |
| 13393 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13394 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 13395 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13396 | } |
| 13397 | else |
| 13398 | { |
| 13399 | //must be MCS |
| 13400 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13401 | #ifdef WLAN_FEATURE_11AC |
| 13402 | sinfo->txrate.nss = 1; |
| 13403 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13404 | { |
| 13405 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13406 | } |
| 13407 | else |
| 13408 | #endif /* WLAN_FEATURE_11AC */ |
| 13409 | { |
| 13410 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 13411 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13412 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13413 | { |
| 13414 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 13415 | } |
| 13416 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13417 | { |
| 13418 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13419 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13420 | #ifdef WLAN_FEATURE_11AC |
| 13421 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13422 | { |
| 13423 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 13424 | } |
| 13425 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13426 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13427 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 13428 | sinfo->txrate.mcs, |
| 13429 | sinfo->txrate.flags ); |
| 13430 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13431 | } |
| 13432 | } |
| 13433 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 13434 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 13435 | sinfo->tx_packets = |
| 13436 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 13437 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 13438 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 13439 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 13440 | |
| 13441 | sinfo->tx_retries = |
| 13442 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 13443 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 13444 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 13445 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 13446 | |
| 13447 | sinfo->tx_failed = |
| 13448 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 13449 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 13450 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 13451 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 13452 | |
| 13453 | sinfo->filled |= |
| 13454 | STATION_INFO_TX_PACKETS | |
| 13455 | STATION_INFO_TX_RETRIES | |
| 13456 | STATION_INFO_TX_FAILED; |
| 13457 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13458 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13459 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 13460 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 13461 | EXIT(); |
| 13462 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13463 | } |
| 13464 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13465 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 13466 | u8* mac, struct station_info *sinfo) |
| 13467 | { |
| 13468 | int ret; |
| 13469 | |
| 13470 | vos_ssr_protect(__func__); |
| 13471 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 13472 | vos_ssr_unprotect(__func__); |
| 13473 | |
| 13474 | return ret; |
| 13475 | } |
| 13476 | |
| 13477 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 13478 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13479 | { |
| 13480 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13481 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13482 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13483 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13484 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13485 | ENTER(); |
| 13486 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13487 | if (NULL == pAdapter) |
| 13488 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13489 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13490 | return -ENODEV; |
| 13491 | } |
| 13492 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13493 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13494 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 13495 | pAdapter->sessionId, timeout)); |
| 13496 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13497 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13498 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13499 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13500 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13501 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13502 | } |
| 13503 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13504 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 13505 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 13506 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 13507 | (eConnectionState_Associated == |
| 13508 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 13509 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 13510 | |
| 13511 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13512 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 13513 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13514 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13515 | { |
| 13516 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13517 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13518 | __func__, vos_status); |
| 13519 | } |
| 13520 | } |
| 13521 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13522 | /**The get power cmd from the supplicant gets updated by the nl only |
| 13523 | *on successful execution of the function call |
| 13524 | *we are oppositely mapped w.r.t mode in the driver |
| 13525 | **/ |
| 13526 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 13527 | |
| 13528 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 13529 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13530 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13531 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13532 | return -EINVAL; |
| 13533 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13534 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13535 | return 0; |
| 13536 | } |
| 13537 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13538 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 13539 | struct net_device *dev, bool mode, int timeout) |
| 13540 | { |
| 13541 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13542 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13543 | vos_ssr_protect(__func__); |
| 13544 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 13545 | vos_ssr_unprotect(__func__); |
| 13546 | |
| 13547 | return ret; |
| 13548 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13549 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13550 | static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 13551 | struct net_device *netdev, |
| 13552 | u8 key_index) |
| 13553 | { |
| 13554 | ENTER(); |
| 13555 | return 0; |
| 13556 | } |
| 13557 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13558 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13559 | struct net_device *netdev, |
| 13560 | u8 key_index) |
| 13561 | { |
| 13562 | int ret; |
| 13563 | vos_ssr_protect(__func__); |
| 13564 | ret = __wlan_hdd_set_default_mgmt_key(wiphy, netdev, key_index); |
| 13565 | vos_ssr_unprotect(__func__); |
| 13566 | return ret; |
| 13567 | } |
| 13568 | #endif //LINUX_VERSION_CODE |
| 13569 | |
| 13570 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 13571 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13572 | struct net_device *dev, |
| 13573 | struct ieee80211_txq_params *params) |
| 13574 | { |
| 13575 | ENTER(); |
| 13576 | return 0; |
| 13577 | } |
| 13578 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13579 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13580 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13581 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13582 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13583 | return 0; |
| 13584 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13585 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13586 | |
| 13587 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 13588 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13589 | struct net_device *dev, |
| 13590 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13591 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13592 | int ret; |
| 13593 | |
| 13594 | vos_ssr_protect(__func__); |
| 13595 | ret = __wlan_hdd_set_txq_params(wiphy, dev, params); |
| 13596 | vos_ssr_unprotect(__func__); |
| 13597 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13598 | } |
| 13599 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13600 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13601 | struct ieee80211_txq_params *params) |
| 13602 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13603 | int ret; |
| 13604 | |
| 13605 | vos_ssr_protect(__func__); |
| 13606 | ret = __wlan_hdd_set_txq_params(wiphy, params); |
| 13607 | vos_ssr_unprotect(__func__); |
| 13608 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13609 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13610 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13611 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13612 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13613 | struct net_device *dev, |
| 13614 | struct tagCsrDelStaParams *pDelStaParams) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13615 | { |
| 13616 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13617 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13618 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13619 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13620 | v_U8_t staId; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13621 | v_CONTEXT_t pVosContext = NULL; |
| 13622 | ptSapContext pSapCtx = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13623 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13624 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13625 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13626 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13627 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13628 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13629 | return -EINVAL; |
| 13630 | } |
| 13631 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13632 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13633 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 13634 | pAdapter->sessionId, pAdapter->device_mode)); |
| 13635 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13636 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13637 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13638 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13639 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13640 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13641 | } |
| 13642 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13643 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13644 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13645 | ) |
| 13646 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13647 | pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 13648 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 13649 | if(pSapCtx == NULL){ |
| 13650 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13651 | FL("psapCtx is NULL")); |
| 13652 | return -ENOENT; |
| 13653 | } |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13654 | if (vos_is_macaddr_broadcast((v_MACADDR_t *)pDelStaParams->peerMacAddr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13655 | { |
| 13656 | v_U16_t i; |
| 13657 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 13658 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13659 | if ((pSapCtx->aStaInfo[i].isUsed) && |
| 13660 | (!pSapCtx->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13661 | { |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13662 | vos_mem_copy(pDelStaParams->peerMacAddr, |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13663 | pSapCtx->aStaInfo[i].macAddrSTA.bytes, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13664 | ETHER_ADDR_LEN); |
| 13665 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13666 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13667 | "%s: Delete STA with MAC::" |
| 13668 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13669 | __func__, |
| 13670 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
| 13671 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 13672 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13673 | pSapCtx->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13674 | } |
| 13675 | } |
| 13676 | } |
| 13677 | else |
| 13678 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13679 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13680 | vos_status = hdd_softap_GetStaId(pAdapter, |
| 13681 | (v_MACADDR_t *)pDelStaParams->peerMacAddr, &staId); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13682 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13683 | { |
| 13684 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13685 | "%s: Skip this DEL STA as this is not used::" |
| 13686 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13687 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13688 | return -ENOENT; |
| 13689 | } |
| 13690 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13691 | if( pSapCtx->aStaInfo[staId].isDeauthInProgress == TRUE) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13692 | { |
| 13693 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13694 | "%s: Skip this DEL STA as deauth is in progress::" |
| 13695 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13696 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13697 | return -ENOENT; |
| 13698 | } |
| 13699 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13700 | pSapCtx->aStaInfo[staId].isDeauthInProgress = TRUE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13701 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13702 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13703 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13704 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13705 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13706 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13707 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13708 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13709 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13710 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13711 | pSapCtx->aStaInfo[staId].isDeauthInProgress = FALSE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13712 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13713 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13714 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13715 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13716 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13717 | return -ENOENT; |
| 13718 | } |
| 13719 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13720 | } |
| 13721 | } |
| 13722 | |
| 13723 | EXIT(); |
| 13724 | |
| 13725 | return 0; |
| 13726 | } |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13727 | |
| 13728 | #ifdef CFG80211_DEL_STA_V2 |
| 13729 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 13730 | struct net_device *dev, |
| 13731 | struct station_del_parameters *param) |
| 13732 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13733 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 13734 | struct net_device *dev, u8 *mac) |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13735 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13736 | { |
| 13737 | int ret; |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13738 | struct tagCsrDelStaParams delStaParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13739 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13740 | vos_ssr_protect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13741 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13742 | #ifdef CFG80211_DEL_STA_V2 |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13743 | if (NULL == param) { |
| 13744 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid argumet passed", __func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13745 | vos_ssr_unprotect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13746 | return -EINVAL; |
| 13747 | } |
| 13748 | |
| 13749 | WLANSAP_PopulateDelStaParams(param->mac, param->reason_code, |
| 13750 | param->subtype, &delStaParams); |
| 13751 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13752 | #else |
Sushant Kaushik | 4cd28f6 | 2014-12-26 14:23:50 +0530 | [diff] [blame] | 13753 | WLANSAP_PopulateDelStaParams(mac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13754 | (SIR_MAC_MGMT_DEAUTH >> 4), &delStaParams); |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13755 | #endif |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13756 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, &delStaParams); |
| 13757 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13758 | vos_ssr_unprotect(__func__); |
| 13759 | |
| 13760 | return ret; |
| 13761 | } |
| 13762 | |
| 13763 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13764 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 13765 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13766 | hdd_adapter_t *pAdapter; |
| 13767 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13768 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13769 | #ifdef FEATURE_WLAN_TDLS |
| 13770 | u32 mask, set; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13771 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13772 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13773 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13774 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13775 | if (NULL == pAdapter) |
| 13776 | { |
| 13777 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13778 | "%s: Adapter is NULL",__func__); |
| 13779 | return -EINVAL; |
| 13780 | } |
| 13781 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13782 | status = wlan_hdd_validate_context(pHddCtx); |
| 13783 | if (0 != status) |
| 13784 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13785 | return status; |
| 13786 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13787 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13788 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13789 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 13790 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13791 | mask = params->sta_flags_mask; |
| 13792 | |
| 13793 | set = params->sta_flags_set; |
| 13794 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 13795 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13796 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 13797 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13798 | |
| 13799 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 13800 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13801 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13802 | } |
| 13803 | } |
| 13804 | #endif |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13805 | EXIT(); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13806 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13807 | } |
| 13808 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13809 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 13810 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 13811 | { |
| 13812 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13813 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13814 | vos_ssr_protect(__func__); |
| 13815 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 13816 | vos_ssr_unprotect(__func__); |
| 13817 | |
| 13818 | return ret; |
| 13819 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13820 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13821 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13822 | 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] | 13823 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13824 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13825 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13826 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13827 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13828 | int status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13829 | hdd_context_t *pHddCtx; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13830 | tPmkidCacheInfo pmk_id; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13831 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13832 | ENTER(); |
| 13833 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13834 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13835 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13836 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13837 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13838 | return -EINVAL; |
| 13839 | } |
| 13840 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13841 | if (!pmksa) { |
| 13842 | hddLog(LOGE, FL("pmksa is NULL")); |
| 13843 | return -EINVAL; |
| 13844 | } |
| 13845 | |
| 13846 | if (!pmksa->bssid || !pmksa->pmkid) { |
| 13847 | hddLog(LOGE, FL("pmksa->bssid(%p) or pmksa->pmkid(%p) is NULL"), |
| 13848 | pmksa->bssid, pmksa->pmkid); |
| 13849 | return -EINVAL; |
| 13850 | } |
| 13851 | |
| 13852 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 13853 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13854 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13855 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13856 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13857 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13858 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13859 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13860 | } |
| 13861 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13862 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13863 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13864 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13865 | vos_mem_copy(pmk_id.BSSID, pmksa->bssid, ETHER_ADDR_LEN); |
| 13866 | vos_mem_copy(pmk_id.PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13867 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13868 | /* Add to the PMKSA ID Cache in CSR */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13869 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13870 | &pmk_id, 1, FALSE); |
| 13871 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13872 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13873 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 13874 | pAdapter->sessionId, result)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13875 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13876 | EXIT(); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13877 | return HAL_STATUS_SUCCESS(result) ? 0 : -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13878 | } |
| 13879 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13880 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 13881 | struct cfg80211_pmksa *pmksa) |
| 13882 | { |
| 13883 | int ret; |
| 13884 | |
| 13885 | vos_ssr_protect(__func__); |
| 13886 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 13887 | vos_ssr_unprotect(__func__); |
| 13888 | |
| 13889 | return ret; |
| 13890 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13891 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13892 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13893 | 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] | 13894 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13895 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13896 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13897 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13898 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13899 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13900 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13901 | ENTER(); |
| 13902 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13903 | /* Validate pAdapter */ |
| 13904 | if (NULL == pAdapter) |
| 13905 | { |
| 13906 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 13907 | return -EINVAL; |
| 13908 | } |
| 13909 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13910 | if (!pmksa) { |
| 13911 | hddLog(LOGE, FL("pmksa is NULL")); |
| 13912 | return -EINVAL; |
| 13913 | } |
| 13914 | |
| 13915 | if (!pmksa->bssid) { |
| 13916 | hddLog(LOGE, FL("pmksa->bssid is NULL")); |
| 13917 | return -EINVAL; |
| 13918 | } |
| 13919 | |
Kiet Lam | 98c46a1 | 2014-10-31 15:34:57 -0700 | [diff] [blame] | 13920 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 13921 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13922 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13923 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13924 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13925 | if (0 != status) |
| 13926 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13927 | return status; |
| 13928 | } |
| 13929 | |
| 13930 | /*Retrieve halHandle*/ |
| 13931 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13932 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13933 | /* Delete the PMKID CSR cache */ |
| 13934 | if (eHAL_STATUS_SUCCESS != |
| 13935 | sme_RoamDelPMKIDfromCache(halHandle, |
| 13936 | pAdapter->sessionId, pmksa->bssid, FALSE)) { |
| 13937 | hddLog(LOGE, FL("Failed to delete PMKSA for "MAC_ADDRESS_STR), |
| 13938 | MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13939 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13940 | } |
| 13941 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13942 | EXIT(); |
| 13943 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13944 | } |
| 13945 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13946 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13947 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 13948 | struct cfg80211_pmksa *pmksa) |
| 13949 | { |
| 13950 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13951 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13952 | vos_ssr_protect(__func__); |
| 13953 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 13954 | vos_ssr_unprotect(__func__); |
| 13955 | |
| 13956 | return ret; |
| 13957 | |
| 13958 | } |
| 13959 | |
| 13960 | 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] | 13961 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13962 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13963 | tHalHandle halHandle; |
| 13964 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13965 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13966 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13967 | ENTER(); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13968 | |
| 13969 | /* Validate pAdapter */ |
| 13970 | if (NULL == pAdapter) |
| 13971 | { |
| 13972 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13973 | "%s: Invalid Adapter" ,__func__); |
| 13974 | return -EINVAL; |
| 13975 | } |
| 13976 | |
| 13977 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13978 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13979 | if (0 != status) |
| 13980 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13981 | return status; |
| 13982 | } |
| 13983 | |
| 13984 | /*Retrieve halHandle*/ |
| 13985 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13986 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13987 | /* Flush the PMKID cache in CSR */ |
| 13988 | if (eHAL_STATUS_SUCCESS != |
| 13989 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, NULL, TRUE)) { |
| 13990 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Cannot flush PMKIDCache")); |
| 13991 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13992 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13993 | EXIT(); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13994 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13995 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13996 | |
| 13997 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 13998 | { |
| 13999 | int ret; |
| 14000 | |
| 14001 | vos_ssr_protect(__func__); |
| 14002 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 14003 | vos_ssr_unprotect(__func__); |
| 14004 | |
| 14005 | return ret; |
| 14006 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14007 | #endif |
| 14008 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14009 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14010 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 14011 | struct net_device *dev, |
| 14012 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14013 | { |
| 14014 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14015 | hdd_station_ctx_t *pHddStaCtx; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14016 | hdd_context_t *pHddCtx; |
| 14017 | int ret = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14018 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14019 | ENTER(); |
| 14020 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14021 | if (NULL == pAdapter) |
| 14022 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14023 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14024 | return -ENODEV; |
| 14025 | } |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14026 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14027 | ret = wlan_hdd_validate_context(pHddCtx); |
| 14028 | if (0 != ret) |
| 14029 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14030 | return ret; |
| 14031 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14032 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14033 | if (NULL == pHddStaCtx) |
| 14034 | { |
| 14035 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: STA Context is NULL", __func__); |
| 14036 | return -EINVAL; |
| 14037 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14038 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14039 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14040 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 14041 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14042 | // Added for debug on reception of Re-assoc Req. |
| 14043 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 14044 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14045 | 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] | 14046 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14047 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14048 | } |
| 14049 | |
| 14050 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14051 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14052 | ftie->ie_len); |
| 14053 | #endif |
| 14054 | |
| 14055 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 14056 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 14057 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14058 | ftie->ie_len); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14059 | |
| 14060 | EXIT(); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14061 | return 0; |
| 14062 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14063 | |
| 14064 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 14065 | struct net_device *dev, |
| 14066 | struct cfg80211_update_ft_ies_params *ftie) |
| 14067 | { |
| 14068 | int ret; |
| 14069 | |
| 14070 | vos_ssr_protect(__func__); |
| 14071 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 14072 | vos_ssr_unprotect(__func__); |
| 14073 | |
| 14074 | return ret; |
| 14075 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14076 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14077 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14078 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 14079 | |
| 14080 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 14081 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 14082 | { |
| 14083 | int ret; |
| 14084 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 14085 | hdd_context_t *pHddCtx; |
| 14086 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14087 | ENTER(); |
| 14088 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14089 | if (NULL == pAdapter) |
| 14090 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 14091 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14092 | "%s: HDD adapter is Null", __func__); |
| 14093 | return ; |
| 14094 | } |
| 14095 | |
| 14096 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14097 | if (NULL == pHddCtx) |
| 14098 | { |
| 14099 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14100 | "%s: HDD context is Null!!!", __func__); |
| 14101 | return ; |
| 14102 | } |
| 14103 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14104 | spin_lock(&pHddCtx->schedScan_lock); |
| 14105 | if (TRUE == pHddCtx->isWiphySuspended) |
| 14106 | { |
| 14107 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 14108 | spin_unlock(&pHddCtx->schedScan_lock); |
| 14109 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14110 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 14111 | return ; |
| 14112 | } |
| 14113 | spin_unlock(&pHddCtx->schedScan_lock); |
| 14114 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14115 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 14116 | |
| 14117 | if (0 > ret) |
| 14118 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 14119 | |
| 14120 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14121 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14122 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14123 | } |
| 14124 | |
| 14125 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14126 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14127 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14128 | */ |
| 14129 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 14130 | { |
| 14131 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 14132 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14133 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14134 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14135 | int status = 0; |
| 14136 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 14137 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14138 | /* The current firmware design does not allow PNO during any |
| 14139 | * active sessions. Hence, determine the active sessions |
| 14140 | * and return a failure. |
| 14141 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14142 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 14143 | { |
| 14144 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14145 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14146 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14147 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 14148 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 14149 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 14150 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 14151 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
Siddharth Bhal | 63a19a7 | 2014-11-07 14:31:56 +0530 | [diff] [blame] | 14152 | || (WLAN_HDD_TM_LEVEL_4 == pHddCtx->tmInfo.currentTmLevel) |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14153 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14154 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14155 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14156 | } |
| 14157 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 14158 | pAdapterNode = pNext; |
| 14159 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14160 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14161 | } |
| 14162 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14163 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 14164 | { |
| 14165 | hdd_adapter_t *pAdapter = callbackContext; |
| 14166 | hdd_context_t *pHddCtx; |
| 14167 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14168 | ENTER(); |
| 14169 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14170 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 14171 | { |
| 14172 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14173 | FL("Invalid adapter or adapter has invalid magic")); |
| 14174 | return; |
| 14175 | } |
| 14176 | |
| 14177 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14178 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 14179 | { |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14180 | return; |
| 14181 | } |
| 14182 | |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 14183 | if (VOS_STATUS_SUCCESS != status) |
| 14184 | { |
| 14185 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14186 | FL("PNO enable response status = %d"), status); |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 14187 | pHddCtx->isPnoEnable = FALSE; |
| 14188 | } |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14189 | |
| 14190 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 14191 | complete(&pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14192 | EXIT(); |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14193 | } |
| 14194 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14195 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14196 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 14197 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14198 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14199 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14200 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 14201 | { |
| 14202 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14203 | tSirPNOScanReq pnoRequest = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14204 | hdd_context_t *pHddCtx; |
| 14205 | tHalHandle hHal; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14206 | v_U32_t i, indx, num_ch, tempInterval, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 14207 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 14208 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14209 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 14210 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14211 | int ret = 0; |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14212 | hdd_config_t *pConfig = NULL; |
| 14213 | v_U32_t num_ignore_dfs_ch = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14214 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14215 | ENTER(); |
| 14216 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14217 | if (NULL == pAdapter) |
| 14218 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14219 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14220 | "%s: HDD adapter is Null", __func__); |
| 14221 | return -ENODEV; |
| 14222 | } |
| 14223 | |
| 14224 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14225 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14226 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14227 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14228 | { |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14229 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14230 | } |
| 14231 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14232 | pConfig = pHddCtx->cfg_ini; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14233 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14234 | if (NULL == hHal) |
| 14235 | { |
| 14236 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14237 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14238 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14239 | } |
Sushant Kaushik | 2fe8993 | 2014-09-03 10:58:09 +0530 | [diff] [blame] | 14240 | sme_ScanFlushResult(hHal, pAdapter->sessionId); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 14241 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 14242 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 14243 | { |
| 14244 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14245 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 14246 | return -EBUSY; |
| 14247 | } |
| 14248 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14249 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14250 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14251 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14252 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14253 | return -EBUSY; |
| 14254 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14255 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14256 | if (TRUE == pHddCtx->isPnoEnable) |
| 14257 | { |
| 14258 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 14259 | FL("already PNO is enabled")); |
| 14260 | return -EBUSY; |
| 14261 | } |
c_hpothu | 225aa7c | 2014-10-22 17:45:13 +0530 | [diff] [blame] | 14262 | |
| 14263 | if (VOS_STATUS_SUCCESS != wlan_hdd_cancel_remain_on_channel(pHddCtx)) |
| 14264 | { |
| 14265 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14266 | "%s: abort ROC failed ", __func__); |
| 14267 | return -EBUSY; |
| 14268 | } |
| 14269 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14270 | pHddCtx->isPnoEnable = TRUE; |
| 14271 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14272 | pnoRequest.enable = 1; /*Enable PNO */ |
| 14273 | pnoRequest.ucNetworksCount = request->n_match_sets; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14274 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14275 | if (( !pnoRequest.ucNetworksCount ) || |
| 14276 | ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14277 | { |
| 14278 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14279 | "%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] | 14280 | __func__, pnoRequest.ucNetworksCount, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14281 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14282 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14283 | goto error; |
| 14284 | } |
| 14285 | |
| 14286 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 14287 | { |
| 14288 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14289 | "%s: Incorrect number of channels %d", |
| 14290 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14291 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14292 | goto error; |
| 14293 | } |
| 14294 | |
| 14295 | /* Framework provides one set of channels(all) |
| 14296 | * common for all saved profile */ |
| 14297 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 14298 | channels_allowed, &num_channels_allowed)) |
| 14299 | { |
| 14300 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14301 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14302 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14303 | goto error; |
| 14304 | } |
| 14305 | /* Checking each channel against allowed channel list */ |
| 14306 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14307 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14308 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14309 | char chList [(request->n_channels*5)+1]; |
| 14310 | int len; |
| 14311 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14312 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14313 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14314 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14315 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 14316 | { |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14317 | if ((!pConfig->enableDFSPnoChnlScan) && |
| 14318 | (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channels_allowed[indx]))) |
| 14319 | { |
| 14320 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14321 | "%s : Dropping DFS channel : %d", |
| 14322 | __func__,channels_allowed[indx]); |
| 14323 | num_ignore_dfs_ch++; |
| 14324 | break; |
| 14325 | } |
| 14326 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14327 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 14328 | len += snprintf(chList+len, 5, "%d ", |
| 14329 | request->channels[i]->hw_value); |
| 14330 | break ; |
| 14331 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14332 | } |
| 14333 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14334 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14335 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14336 | /*If all channels are DFS and dropped, then ignore the PNO request*/ |
| 14337 | if (num_ignore_dfs_ch == request->n_channels) |
| 14338 | { |
| 14339 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14340 | "%s : All requested channels are DFS channels", __func__); |
| 14341 | ret = -EINVAL; |
| 14342 | goto error; |
| 14343 | } |
| 14344 | } |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14345 | |
| 14346 | pnoRequest.aNetworks = |
| 14347 | vos_mem_malloc(sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14348 | if (pnoRequest.aNetworks == NULL) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14349 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14350 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14351 | FL("failed to allocate memory aNetworks %u"), |
| 14352 | (uint32)sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14353 | goto error; |
| 14354 | } |
| 14355 | vos_mem_zero(pnoRequest.aNetworks, |
| 14356 | sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14357 | |
| 14358 | /* Filling per profile params */ |
| 14359 | for (i = 0; i < pnoRequest.ucNetworksCount; i++) |
| 14360 | { |
| 14361 | pnoRequest.aNetworks[i].ssId.length = |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14362 | request->match_sets[i].ssid.ssid_len; |
| 14363 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14364 | if (( 0 == pnoRequest.aNetworks[i].ssId.length ) || |
| 14365 | ( pnoRequest.aNetworks[i].ssId.length > 32 ) ) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14366 | { |
| 14367 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14368 | "%s: SSID Len %d is not correct for network %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14369 | __func__, pnoRequest.aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14370 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14371 | goto error; |
| 14372 | } |
| 14373 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14374 | memcpy(pnoRequest.aNetworks[i].ssId.ssId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14375 | request->match_sets[i].ssid.ssid, |
| 14376 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14377 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14378 | "%s: SSID of network %d is %s ", __func__, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14379 | i, pnoRequest.aNetworks[i].ssId.ssId); |
| 14380 | pnoRequest.aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 14381 | pnoRequest.aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 14382 | pnoRequest.aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14383 | |
| 14384 | /*Copying list of valid channel into request */ |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14385 | memcpy(pnoRequest.aNetworks[i].aChannels, valid_ch, num_ch); |
| 14386 | pnoRequest.aNetworks[i].ucChannelCount = num_ch; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14387 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14388 | pnoRequest.aNetworks[i].rssiThreshold = 0; //Default value |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14389 | } |
| 14390 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14391 | for (i = 0; i < request->n_ssids; i++) |
| 14392 | { |
| 14393 | j = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14394 | while (j < pnoRequest.ucNetworksCount) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14395 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14396 | if ((pnoRequest.aNetworks[j].ssId.length == |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14397 | request->ssids[i].ssid_len) && |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14398 | (0 == memcmp(pnoRequest.aNetworks[j].ssId.ssId, |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14399 | request->ssids[i].ssid, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14400 | pnoRequest.aNetworks[j].ssId.length))) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14401 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14402 | pnoRequest.aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14403 | break; |
| 14404 | } |
| 14405 | j++; |
| 14406 | } |
| 14407 | } |
| 14408 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14409 | "Number of hidden networks being Configured = %d", |
| 14410 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14411 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 14412 | "request->ie_len = %zu", request->ie_len); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14413 | |
| 14414 | pnoRequest.p24GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 14415 | if (pnoRequest.p24GProbeTemplate == NULL) |
| 14416 | { |
| 14417 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14418 | FL("failed to allocate memory p24GProbeTemplate %u"), |
| 14419 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 14420 | goto error; |
| 14421 | } |
| 14422 | |
| 14423 | pnoRequest.p5GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 14424 | if (pnoRequest.p5GProbeTemplate == NULL) |
| 14425 | { |
| 14426 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14427 | FL("failed to allocate memory p5GProbeTemplate %u"), |
| 14428 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 14429 | goto error; |
| 14430 | } |
| 14431 | |
| 14432 | vos_mem_zero(pnoRequest.p24GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 14433 | vos_mem_zero(pnoRequest.p5GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 14434 | |
Hanumantha Reddy Pothula | 06e87b2 | 2015-03-02 18:02:23 +0530 | [diff] [blame] | 14435 | if ((0 < request->ie_len) && (request->ie_len <= SIR_PNO_MAX_PB_REQ_SIZE) && |
| 14436 | (NULL != request->ie)) |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14437 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14438 | pnoRequest.us24GProbeTemplateLen = request->ie_len; |
| 14439 | memcpy(pnoRequest.p24GProbeTemplate, request->ie, |
| 14440 | pnoRequest.us24GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14441 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14442 | pnoRequest.us5GProbeTemplateLen = request->ie_len; |
| 14443 | memcpy(pnoRequest.p5GProbeTemplate, request->ie, |
| 14444 | pnoRequest.us5GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14445 | } |
| 14446 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14447 | /* Driver gets only one time interval which is hardcoded in |
| 14448 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 14449 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 14450 | * 80,160,320 secs. And number of scan cycle for each timer |
| 14451 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 14452 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 14453 | * will be repeated after each interval specified by supplicant |
| 14454 | * till PNO is disabled. |
| 14455 | */ |
| 14456 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14457 | pnoRequest.scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14458 | else |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14459 | pnoRequest.scanTimers.ucScanTimersCount = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14460 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 14461 | |
| 14462 | tempInterval = (request->interval)/1000; |
| 14463 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14464 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 14465 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14466 | for ( i = 0; i < pnoRequest.scanTimers.ucScanTimersCount; i++) |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14467 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14468 | pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14469 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14470 | pnoRequest.scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14471 | tempInterval *= 2; |
| 14472 | } |
| 14473 | //Repeat last timer until pno disabled. |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14474 | pnoRequest.scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14475 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14476 | pnoRequest.modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14477 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14478 | INIT_COMPLETION(pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14479 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 14480 | pnoRequest.callbackContext = pAdapter; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14481 | pAdapter->pno_req_status = 0; |
| 14482 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14483 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14484 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14485 | pAdapter->sessionId, pnoRequest.enable, pnoRequest.modePNO, |
| 14486 | pnoRequest.scanTimers.ucScanTimersCount); |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14487 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14488 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14489 | &pnoRequest, pAdapter->sessionId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14490 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 14491 | if (eHAL_STATUS_SUCCESS != status) |
| 14492 | { |
| 14493 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14494 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14495 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14496 | goto error; |
| 14497 | } |
| 14498 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14499 | ret = wait_for_completion_timeout( |
| 14500 | &pAdapter->pno_comp_var, |
| 14501 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 14502 | if (0 >= ret) |
| 14503 | { |
| 14504 | // Did not receive the response for PNO enable in time. |
| 14505 | // Assuming the PNO enable was success. |
| 14506 | // Returning error from here, because we timeout, results |
| 14507 | // in side effect of Wifi (Wifi Setting) not to work. |
| 14508 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14509 | FL("Timed out waiting for PNO to be Enabled")); |
| 14510 | ret = 0; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14511 | } |
| 14512 | |
| 14513 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14514 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14515 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14516 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14517 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14518 | FL("PNO scanRequest offloaded ret = %d"), ret); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14519 | pHddCtx->isPnoEnable = FALSE; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14520 | if (pnoRequest.aNetworks) |
| 14521 | vos_mem_free(pnoRequest.aNetworks); |
| 14522 | if (pnoRequest.p24GProbeTemplate) |
| 14523 | vos_mem_free(pnoRequest.p24GProbeTemplate); |
| 14524 | if (pnoRequest.p5GProbeTemplate) |
| 14525 | vos_mem_free(pnoRequest.p5GProbeTemplate); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14526 | |
| 14527 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14528 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14529 | } |
| 14530 | |
| 14531 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14532 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 14533 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14534 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14535 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 14536 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 14537 | { |
| 14538 | int ret; |
| 14539 | |
| 14540 | vos_ssr_protect(__func__); |
| 14541 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 14542 | vos_ssr_unprotect(__func__); |
| 14543 | |
| 14544 | return ret; |
| 14545 | } |
| 14546 | |
| 14547 | /* |
| 14548 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 14549 | * Function to disable PNO |
| 14550 | */ |
| 14551 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14552 | struct net_device *dev) |
| 14553 | { |
| 14554 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14555 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14556 | hdd_context_t *pHddCtx; |
| 14557 | tHalHandle hHal; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14558 | tSirPNOScanReq pnoRequest = {0}; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14559 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14560 | |
| 14561 | ENTER(); |
| 14562 | |
| 14563 | if (NULL == pAdapter) |
| 14564 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14565 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14566 | "%s: HDD adapter is Null", __func__); |
| 14567 | return -ENODEV; |
| 14568 | } |
| 14569 | |
| 14570 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14571 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14572 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14573 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14574 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14575 | "%s: HDD context is Null", __func__); |
| 14576 | return -ENODEV; |
| 14577 | } |
| 14578 | |
| 14579 | /* The return 0 is intentional when isLogpInProgress and |
| 14580 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 14581 | * failure in sched_scan_stop , especially for a case where the unload |
| 14582 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 14583 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 14584 | * success. If it returns a failure , then its next invocation due to the |
| 14585 | * clean up of the second interface will have the dev pointer corresponding |
| 14586 | * to the first one leading to a crash. |
| 14587 | */ |
| 14588 | if (pHddCtx->isLogpInProgress) |
| 14589 | { |
| 14590 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14591 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14592 | return ret; |
| 14593 | } |
| 14594 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 14595 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14596 | { |
| 14597 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14598 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14599 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14600 | } |
| 14601 | |
| 14602 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14603 | if (NULL == hHal) |
| 14604 | { |
| 14605 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14606 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14607 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14608 | } |
| 14609 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14610 | pnoRequest.enable = 0; /* Disable PNO */ |
| 14611 | pnoRequest.ucNetworksCount = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14612 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14613 | status = sme_SetPreferredNetworkList(hHal, &pnoRequest, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14614 | pAdapter->sessionId, |
| 14615 | NULL, pAdapter); |
| 14616 | if (eHAL_STATUS_SUCCESS != status) |
| 14617 | { |
| 14618 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14619 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14620 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14621 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14622 | } |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14623 | pHddCtx->isPnoEnable = FALSE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14624 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14625 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14626 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14627 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14628 | |
| 14629 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14630 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14631 | } |
| 14632 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14633 | /* |
| 14634 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 14635 | * NL interface to disable PNO |
| 14636 | */ |
| 14637 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 14638 | struct net_device *dev) |
| 14639 | { |
| 14640 | int ret; |
| 14641 | |
| 14642 | vos_ssr_protect(__func__); |
| 14643 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 14644 | vos_ssr_unprotect(__func__); |
| 14645 | |
| 14646 | return ret; |
| 14647 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14648 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 14649 | |
| 14650 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14651 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14652 | #if TDLS_MGMT_VERSION2 |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14653 | 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] | 14654 | u8 *peer, u8 action_code, u8 dialog_token, |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14655 | u16 status_code, u32 peer_capability, const u8 *buf, size_t len) |
| 14656 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14657 | 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] | 14658 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14659 | u16 status_code, const u8 *buf, size_t len) |
| 14660 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14661 | { |
| 14662 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14663 | hdd_adapter_t *pAdapter; |
| 14664 | hdd_context_t *pHddCtx; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14665 | u8 peerMac[6]; |
| 14666 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14667 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14668 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14669 | long rc; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14670 | int ret; |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14671 | #if !(TDLS_MGMT_VERSION2) |
| 14672 | u32 peer_capability = 0; |
| 14673 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14674 | tANI_U16 numCurrTdlsPeers; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14675 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14676 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14677 | if (NULL == pAdapter) |
| 14678 | { |
| 14679 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14680 | "%s: Adapter is NULL",__func__); |
| 14681 | return -EINVAL; |
| 14682 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14683 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14684 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 14685 | pAdapter->sessionId, action_code)); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14686 | pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14687 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14688 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14689 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14690 | "Invalid arguments"); |
| 14691 | return -EINVAL; |
| 14692 | } |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14693 | if (pHddCtx->isLogpInProgress) |
| 14694 | { |
| 14695 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14696 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14697 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 14698 | peer, |
| 14699 | eTDLS_LINK_IDLE, |
| 14700 | eTDLS_LINK_UNSPECIFIED); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14701 | return -EBUSY; |
| 14702 | } |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14703 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
| 14704 | { |
| 14705 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14706 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14707 | return -EAGAIN; |
| 14708 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14709 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14710 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14711 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14712 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 14713 | MAC_ADDRESS_STR " action %d declined.", |
| 14714 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14715 | return -ENOTSUPP; |
| 14716 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14717 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14718 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 14719 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 14720 | { |
| 14721 | /* if tdls_mode is disabled to respond to peer's request */ |
| 14722 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 14723 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14724 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14725 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14726 | " TDLS mode is disabled. action %d declined.", |
| 14727 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14728 | |
| 14729 | return -ENOTSUPP; |
| 14730 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 14731 | |
| 14732 | if (vos_max_concurrent_connections_reached()) |
| 14733 | { |
| 14734 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 14735 | return -EINVAL; |
| 14736 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14737 | } |
| 14738 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14739 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 14740 | { |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 14741 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14742 | { |
| 14743 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14744 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14745 | " TDLS setup is ongoing. action %d declined.", |
| 14746 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 14747 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14748 | } |
| 14749 | } |
| 14750 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14751 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 14752 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14753 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14754 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 14755 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14756 | { |
| 14757 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 14758 | we return error code at 'add_station()'. Hence we have this |
| 14759 | check again in addtion to add_station(). |
| 14760 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14761 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14762 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14763 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14764 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14765 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 14766 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 14767 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 14768 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14769 | } |
| 14770 | else |
| 14771 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14772 | /* maximum reached. tweak to send error code to peer and return |
| 14773 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14774 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14775 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14776 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14777 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 14778 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 14779 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14780 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14781 | /* fall through to send setup resp with failure status |
| 14782 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14783 | } |
| 14784 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14785 | else |
| 14786 | { |
| 14787 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14788 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 14789 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14790 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14791 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14792 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 14793 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14794 | return -EPERM; |
| 14795 | } |
| 14796 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14797 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14798 | vos_mem_copy(peerMac, peer, 6); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14799 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14800 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 14801 | "%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] | 14802 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 14803 | action_code, dialog_token, status_code, len); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14804 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14805 | /*Except teardown responder will not be used so just make 0*/ |
| 14806 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14807 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14808 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14809 | |
| 14810 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14811 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14812 | |
| 14813 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 14814 | responder = pTdlsPeer->is_responder; |
| 14815 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14816 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14817 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 14818 | "%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] | 14819 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 14820 | dialog_token, status_code, len); |
| 14821 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14822 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14823 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14824 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14825 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 14826 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14827 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14828 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 14829 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14830 | { |
| 14831 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 14832 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14833 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14834 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14835 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 14836 | if (status != VOS_STATUS_SUCCESS) { |
| 14837 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
| 14838 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14839 | } |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14840 | if (SIR_MAC_TDLS_DIS_REQ != action_code) { |
| 14841 | if (0 != wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED)) { |
| 14842 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS capabilities")); |
| 14843 | } |
| 14844 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14845 | } |
| 14846 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14847 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 14848 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 14849 | { |
| 14850 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14851 | "%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] | 14852 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14853 | ret = -EBUSY; |
| 14854 | goto tx_failed; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14855 | } |
| 14856 | |
| 14857 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14858 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 14859 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14860 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 14861 | 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] | 14862 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14863 | if (VOS_STATUS_SUCCESS != status) |
| 14864 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14865 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14866 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14867 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14868 | ret = -EINVAL; |
| 14869 | goto tx_failed; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14870 | } |
| 14871 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14872 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 14873 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 14874 | |
| 14875 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14876 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14877 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 14878 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14879 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14880 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 14881 | |
| 14882 | if (pHddCtx->isLogpInProgress) |
| 14883 | { |
| 14884 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14885 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14886 | return -EAGAIN; |
| 14887 | } |
| 14888 | |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14889 | ret = -EINVAL; |
| 14890 | goto tx_failed; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14891 | } |
| 14892 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14893 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14894 | { |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14895 | ret = max_sta_failed; |
| 14896 | goto tx_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14897 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14898 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14899 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 14900 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14901 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE)) { |
| 14902 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 14903 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14904 | } |
| 14905 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 14906 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14907 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE)) { |
| 14908 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 14909 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14910 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14911 | |
| 14912 | return 0; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14913 | |
| 14914 | tx_failed: |
| 14915 | /* add_station will be called before sending TDLS_SETUP_REQ and |
| 14916 | * TDLS_SETUP_RSP and as part of add_station driver will enable |
| 14917 | * BMPS. NL80211_TDLS_DISABLE_LINK will be called if the tx of |
| 14918 | * TDLS_SETUP_REQ or TDLS_SETUP_RSP fails. BMPS will be enabled |
| 14919 | * as part of processing NL80211_TDLS_DISABLE_LINK. So need to |
| 14920 | * enable BMPS for TDLS_SETUP_REQ and TDLS_SETUP_RSP if tx fails. |
| 14921 | */ |
| 14922 | |
| 14923 | if ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 14924 | (SIR_MAC_TDLS_SETUP_RSP == action_code)) |
| 14925 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 14926 | return ret; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14927 | } |
| 14928 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14929 | #if TDLS_MGMT_VERSION2 |
| 14930 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 14931 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14932 | u16 status_code, u32 peer_capability, |
| 14933 | const u8 *buf, size_t len) |
| 14934 | #else |
| 14935 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 14936 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14937 | u16 status_code, const u8 *buf, size_t len) |
| 14938 | #endif |
| 14939 | { |
| 14940 | int ret; |
| 14941 | |
| 14942 | vos_ssr_protect(__func__); |
| 14943 | #if TDLS_MGMT_VERSION2 |
| 14944 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token, |
| 14945 | status_code, peer_capability, buf, len); |
| 14946 | #else |
| 14947 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token, |
| 14948 | status_code, buf, len); |
| 14949 | #endif |
| 14950 | vos_ssr_unprotect(__func__); |
| 14951 | |
| 14952 | return ret; |
| 14953 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14954 | |
| 14955 | int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter, |
| 14956 | u8 *peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14957 | tdls_req_params_t *tdls_peer_params, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14958 | cfg80211_exttdls_callback callback) |
| 14959 | { |
| 14960 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14961 | hddTdlsPeer_t *pTdlsPeer = NULL; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14962 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 14963 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14964 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14965 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 14966 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14967 | |
| 14968 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 14969 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 14970 | |
| 14971 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14972 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 14973 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 14974 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14975 | return -ENOTSUPP; |
| 14976 | } |
| 14977 | |
| 14978 | /* To cater the requirement of establishing the TDLS link |
| 14979 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 14980 | */ |
| 14981 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 14982 | if (pTdlsPeer == NULL) { |
| 14983 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14984 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 14985 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14986 | return -EINVAL; |
| 14987 | } |
| 14988 | |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 14989 | /* check FW TDLS Off Channel capability */ |
| 14990 | if ((TRUE == sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)) && |
| 14991 | (NULL != tdls_peer_params)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14992 | { |
| 14993 | pTdlsPeer->peerParams.channel = tdls_peer_params->channel; |
| 14994 | pTdlsPeer->peerParams.global_operating_class = |
| 14995 | tdls_peer_params->global_operating_class; |
| 14996 | pTdlsPeer->peerParams.max_latency_ms = tdls_peer_params->max_latency_ms; |
| 14997 | pTdlsPeer->peerParams.min_bandwidth_kbps = |
| 14998 | tdls_peer_params->min_bandwidth_kbps; |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 14999 | /* check configured channel is valid, non dfs and |
| 15000 | * not current operating channel */ |
| 15001 | if ((sme_IsTdlsOffChannelValid(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15002 | tdls_peer_params->channel)) && |
| 15003 | (pHddStaCtx) && |
| 15004 | (tdls_peer_params->channel != |
| 15005 | pHddStaCtx->conn_info.operationChannel)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15006 | { |
| 15007 | pTdlsPeer->isOffChannelConfigured = TRUE; |
| 15008 | } |
| 15009 | else |
| 15010 | { |
| 15011 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 15012 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15013 | "%s: Configured Tdls Off Channel is not valid", __func__); |
| 15014 | |
| 15015 | } |
| 15016 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15017 | "%s: tdls_off_channel %d isOffChannelConfigured %d " |
| 15018 | "current operating channel %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15019 | __func__, pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15020 | pTdlsPeer->isOffChannelConfigured, |
| 15021 | (pHddStaCtx ? pHddStaCtx->conn_info.operationChannel : 0)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15022 | } |
| 15023 | else |
| 15024 | { |
| 15025 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 15026 | "%s: TDLS off channel FW capability %d or " |
| 15027 | "Invalid TDLS Peer Params", __func__, |
| 15028 | sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15029 | } |
| 15030 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15031 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 15032 | |
| 15033 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15034 | " %s TDLS Add Force Peer Failed", |
| 15035 | __func__); |
| 15036 | return -EINVAL; |
| 15037 | } |
| 15038 | /*EXT TDLS*/ |
| 15039 | |
| 15040 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) { |
| 15041 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15042 | " %s TDLS set callback Failed", |
| 15043 | __func__); |
| 15044 | return -EINVAL; |
| 15045 | } |
| 15046 | |
| 15047 | return(0); |
| 15048 | |
| 15049 | } |
| 15050 | |
| 15051 | int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, u8 *peer) |
| 15052 | { |
| 15053 | |
| 15054 | hddTdlsPeer_t *pTdlsPeer; |
| 15055 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15056 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15057 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 15058 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15059 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 15060 | if (0 != wlan_hdd_validate_context(pHddCtx)) { |
| 15061 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is NULL")); |
| 15062 | return -EINVAL; |
| 15063 | } |
| 15064 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15065 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 15066 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 15067 | |
| 15068 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15069 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 15070 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 15071 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15072 | return -ENOTSUPP; |
| 15073 | } |
| 15074 | |
| 15075 | |
| 15076 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 15077 | |
| 15078 | if ( NULL == pTdlsPeer ) { |
| 15079 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
| 15080 | " peer not exsting", |
| 15081 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15082 | return -EINVAL; |
| 15083 | } |
| 15084 | else { |
| 15085 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 15086 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15087 | /* if channel switch is configured, reset |
| 15088 | the channel for this peer */ |
| 15089 | if (TRUE == pTdlsPeer->isOffChannelConfigured) |
| 15090 | { |
| 15091 | pTdlsPeer->peerParams.channel = 0; |
| 15092 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 15093 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15094 | } |
| 15095 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15096 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) { |
| 15097 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set force peer")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15098 | return -EINVAL; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15099 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15100 | |
| 15101 | /*EXT TDLS*/ |
| 15102 | |
| 15103 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) { |
| 15104 | |
| 15105 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15106 | " %s TDLS set callback Failed", |
| 15107 | __func__); |
| 15108 | return -EINVAL; |
| 15109 | } |
| 15110 | return(0); |
| 15111 | |
| 15112 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15113 | 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] | 15114 | u8 *peer, enum nl80211_tdls_operation oper) |
| 15115 | { |
| 15116 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15117 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15118 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15119 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15120 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15121 | ENTER(); |
| 15122 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 15123 | if (!pAdapter) { |
| 15124 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 15125 | return -EINVAL; |
| 15126 | } |
| 15127 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15128 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15129 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 15130 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15131 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15132 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15133 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 15134 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15135 | return -EINVAL; |
| 15136 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15137 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15138 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15139 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 15140 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15141 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 15142 | } |
| 15143 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15144 | |
| 15145 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15146 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15147 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15148 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15149 | "TDLS Disabled in INI (%d) OR not enabled in FW (%d) " |
| 15150 | "Cannot process TDLS commands", |
| 15151 | pHddCtx->cfg_ini->fEnableTDLSSupport, |
| 15152 | sme_IsFeatureSupportedByFW(TDLS)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15153 | return -ENOTSUPP; |
| 15154 | } |
| 15155 | |
| 15156 | switch (oper) { |
| 15157 | case NL80211_TDLS_ENABLE_LINK: |
| 15158 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15159 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15160 | long ret; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15161 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15162 | WLAN_STADescType staDesc; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15163 | tANI_U16 numCurrTdlsPeers = 0; |
| 15164 | hddTdlsPeer_t *connPeer = NULL; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15165 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15166 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15167 | memset(&staDesc, 0, sizeof(staDesc)); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15168 | if ( NULL == pTdlsPeer ) { |
| 15169 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 15170 | " (oper %d) not exsting. ignored", |
| 15171 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 15172 | return -EINVAL; |
| 15173 | } |
| 15174 | |
| 15175 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15176 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 15177 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 15178 | "NL80211_TDLS_ENABLE_LINK"); |
| 15179 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 15180 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 15181 | { |
| 15182 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 15183 | MAC_ADDRESS_STR " failed", |
| 15184 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 15185 | return -EINVAL; |
| 15186 | } |
| 15187 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame^] | 15188 | /* before starting tdls connection, set tdls |
| 15189 | * off channel established status to default value */ |
| 15190 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15191 | /* TDLS Off Channel, Disable tdls channel switch, |
| 15192 | when there are more than one tdls link */ |
| 15193 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 15194 | if (numCurrTdlsPeers == 2) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15195 | { |
| 15196 | /* get connected peer and send disable tdls off chan */ |
| 15197 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
| 15198 | if (connPeer && (connPeer->isOffChannelConfigured == TRUE)) |
| 15199 | { |
| 15200 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15201 | "%s: More then one peer connected, Disable " |
| 15202 | "TDLS channel switch", __func__); |
| 15203 | |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15204 | connPeer->isOffChannelEstablished = FALSE; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15205 | ret = sme_SendTdlsChanSwitchReq( |
| 15206 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15207 | pAdapter->sessionId, |
| 15208 | connPeer->peerMac, |
| 15209 | connPeer->peerParams.channel, |
| 15210 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15211 | TDLS_CHANNEL_SWITCH_DISABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15212 | if (ret != VOS_STATUS_SUCCESS) { |
| 15213 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel request")); |
| 15214 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15215 | } |
| 15216 | else |
| 15217 | { |
| 15218 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15219 | "%s: No TDLS Connected Peer or " |
| 15220 | "isOffChannelConfigured %d", |
| 15221 | __func__, |
| 15222 | (connPeer ? connPeer->isOffChannelConfigured : -1)); |
| 15223 | } |
| 15224 | } |
| 15225 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15226 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15227 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15228 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 15229 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15230 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 15231 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15232 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to get link establishment params")); |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15233 | return -EINVAL; |
| 15234 | } |
| 15235 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15236 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15237 | ret = sme_SendTdlsLinkEstablishParams( |
| 15238 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15239 | pAdapter->sessionId, peer, |
| 15240 | &tdlsLinkEstablishParams); |
| 15241 | if (ret != VOS_STATUS_SUCCESS) { |
| 15242 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send link establishment params")); |
| 15243 | } |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15244 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 15245 | * register with the TL on after the response for this operation |
| 15246 | * is received . |
| 15247 | */ |
| 15248 | ret = wait_for_completion_interruptible_timeout( |
| 15249 | &pAdapter->tdls_link_establish_req_comp, |
| 15250 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 15251 | if (ret <= 0) |
| 15252 | { |
| 15253 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15254 | "%s: Link Establish Request Faled Status %ld", |
| 15255 | __func__, ret); |
| 15256 | return -EINVAL; |
| 15257 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15258 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15259 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 15260 | eTDLS_LINK_CONNECTED, |
| 15261 | eTDLS_LINK_SUCCESS); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15262 | staDesc.ucSTAId = pTdlsPeer->staId; |
| 15263 | staDesc.ucQosEnabled = tdlsLinkEstablishParams.qos; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15264 | ret = WLANTL_UpdateTdlsSTAClient( |
| 15265 | pHddCtx->pvosContext, |
| 15266 | &staDesc); |
| 15267 | if (ret != VOS_STATUS_SUCCESS) { |
| 15268 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to update TDLS STA params")); |
| 15269 | } |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15270 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 15271 | /* Mark TDLS client Authenticated .*/ |
| 15272 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 15273 | pTdlsPeer->staId, |
| 15274 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 15275 | if (VOS_STATUS_SUCCESS == status) |
| 15276 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15277 | if (pTdlsPeer->is_responder == 0) |
| 15278 | { |
| 15279 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 15280 | |
| 15281 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 15282 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 15283 | WAIT_TIME_TDLS_INITIATOR); |
| 15284 | /* suspend initiator TX until it receives direct packet from the |
| 15285 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15286 | ret = WLANTL_SuspendDataTx( |
| 15287 | (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 15288 | &staId, NULL); |
| 15289 | if (ret != VOS_STATUS_SUCCESS) { |
| 15290 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to suspend data tx")); |
| 15291 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15292 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15293 | |
| 15294 | /* TDLS Off Channel, Enable tdls channel switch, |
| 15295 | when their is only one tdls link and it supports */ |
| 15296 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15297 | if ((numCurrTdlsPeers == 1) && |
| 15298 | (TRUE == pTdlsPeer->isOffChannelSupported) && |
| 15299 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
| 15300 | { |
| 15301 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15302 | "%s: Send TDLS channel switch request for channel %d", |
| 15303 | __func__, pTdlsPeer->peerParams.channel); |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15304 | |
| 15305 | pTdlsPeer->isOffChannelEstablished = TRUE; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15306 | ret = sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15307 | pAdapter->sessionId, |
| 15308 | pTdlsPeer->peerMac, |
| 15309 | pTdlsPeer->peerParams.channel, |
| 15310 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15311 | TDLS_CHANNEL_SWITCH_ENABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15312 | if (ret != VOS_STATUS_SUCCESS) { |
| 15313 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS offchannel: Failed to send TDLS switch channel req")); |
| 15314 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15315 | } |
| 15316 | else |
| 15317 | { |
| 15318 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15319 | "%s: TDLS channel switch request not sent" |
| 15320 | " numCurrTdlsPeers %d " |
| 15321 | "isOffChannelSupported %d " |
| 15322 | "isOffChannelConfigured %d", |
| 15323 | __func__, numCurrTdlsPeers, |
| 15324 | pTdlsPeer->isOffChannelSupported, |
| 15325 | pTdlsPeer->isOffChannelConfigured); |
| 15326 | } |
| 15327 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 15328 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15329 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15330 | |
| 15331 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15332 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 15333 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15334 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15335 | int ac; |
| 15336 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 15337 | WLANTL_AC_VI, |
| 15338 | WLANTL_AC_BK, |
| 15339 | WLANTL_AC_BE }; |
| 15340 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 15341 | for(ac=0; ac < 4; ac++) |
| 15342 | { |
| 15343 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 15344 | pTdlsPeer->staId, ucAc[ac], |
| 15345 | tlTid[ac], tlTid[ac], 0, 0, |
| 15346 | WLANTL_BI_DIR ); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15347 | if (status != VOS_STATUS_SUCCESS) { |
| 15348 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to enable UAPSD for AC")); |
| 15349 | } |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15350 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15351 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15352 | } |
| 15353 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15354 | } |
| 15355 | break; |
| 15356 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15357 | { |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15358 | tANI_U16 numCurrTdlsPeers = 0; |
| 15359 | hddTdlsPeer_t *connPeer = NULL; |
| 15360 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15361 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 15362 | |
| 15363 | if ( NULL == pTdlsPeer ) { |
| 15364 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 15365 | " (oper %d) not exsting. ignored", |
| 15366 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 15367 | return -EINVAL; |
| 15368 | } |
| 15369 | |
| 15370 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15371 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 15372 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 15373 | "NL80211_TDLS_DISABLE_LINK"); |
| 15374 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15375 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15376 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15377 | long status; |
| 15378 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame^] | 15379 | /* set tdls off channel status to false for this peer */ |
| 15380 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 15381 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 15382 | eTDLS_LINK_TEARING, |
| 15383 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 15384 | eTDLS_LINK_UNSPECIFIED: |
| 15385 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15386 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 15387 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15388 | status = sme_DeleteTdlsPeerSta( |
| 15389 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15390 | pAdapter->sessionId, peer ); |
| 15391 | if (status != VOS_STATUS_SUCCESS) { |
| 15392 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 15393 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15394 | |
| 15395 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 15396 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 15397 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
Atul Mittal | 454664b | 2014-10-10 11:03:46 +0530 | [diff] [blame] | 15398 | eTDLS_LINK_IDLE, |
| 15399 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15400 | if (status <= 0) |
| 15401 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15402 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15403 | "%s: Del station failed status %ld", |
| 15404 | __func__, status); |
| 15405 | return -EPERM; |
| 15406 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15407 | |
| 15408 | /* TDLS Off Channel, Enable tdls channel switch, |
| 15409 | when their is only one tdls link and it supports */ |
| 15410 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15411 | if (numCurrTdlsPeers == 1) |
| 15412 | { |
| 15413 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
| 15414 | if ((connPeer) && |
| 15415 | (connPeer->isOffChannelSupported == TRUE) && |
| 15416 | (connPeer->isOffChannelConfigured == TRUE)) |
| 15417 | { |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15418 | connPeer->isOffChannelEstablished = TRUE; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15419 | status = sme_SendTdlsChanSwitchReq( |
| 15420 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15421 | pAdapter->sessionId, |
| 15422 | connPeer->peerMac, |
| 15423 | connPeer->peerParams.channel, |
| 15424 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15425 | TDLS_CHANNEL_SWITCH_ENABLE); |
| 15426 | if (status != VOS_STATUS_SUCCESS) { |
| 15427 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel req")); |
| 15428 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15429 | } |
| 15430 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15431 | "%s: TDLS channel switch " |
| 15432 | "isOffChannelSupported %d " |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15433 | "isOffChannelConfigured %d " |
| 15434 | "isOffChannelEstablished %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15435 | __func__, |
| 15436 | (connPeer ? connPeer->isOffChannelSupported : -1), |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15437 | (connPeer ? connPeer->isOffChannelConfigured : -1), |
| 15438 | (connPeer ? connPeer->isOffChannelEstablished : -1)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15439 | } |
| 15440 | else |
| 15441 | { |
| 15442 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15443 | "%s: TDLS channel switch request not sent " |
| 15444 | "numCurrTdlsPeers %d ", |
| 15445 | __func__, numCurrTdlsPeers); |
| 15446 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15447 | } |
| 15448 | else |
| 15449 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15450 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15451 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15452 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15453 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15454 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15455 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15456 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15457 | status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15458 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15459 | if (0 != status) |
| 15460 | { |
| 15461 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15462 | "%s: Error in TDLS Teardown", __func__); |
| 15463 | return status; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15464 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15465 | break; |
| 15466 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15467 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15468 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15469 | status = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 15470 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15471 | NULL, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15472 | NULL); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15473 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15474 | if (0 != status) |
| 15475 | { |
| 15476 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15477 | "%s: Error in TDLS Setup", __func__); |
| 15478 | return status; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 15479 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 15480 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15481 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15482 | case NL80211_TDLS_DISCOVERY_REQ: |
| 15483 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15484 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 15485 | "%s: We don't support in-driver setup/teardown/discovery " |
| 15486 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15487 | return -ENOTSUPP; |
| 15488 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15489 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15490 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15491 | return -ENOTSUPP; |
| 15492 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15493 | |
| 15494 | EXIT(); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15495 | return 0; |
| 15496 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15497 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15498 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
| 15499 | u8 *peer, enum nl80211_tdls_operation oper) |
| 15500 | { |
| 15501 | int ret; |
| 15502 | |
| 15503 | vos_ssr_protect(__func__); |
| 15504 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 15505 | vos_ssr_unprotect(__func__); |
| 15506 | |
| 15507 | return ret; |
| 15508 | } |
| 15509 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15510 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 15511 | struct net_device *dev, u8 *peer) |
| 15512 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 15513 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 15514 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 15515 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15516 | |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15517 | #if TDLS_MGMT_VERSION2 |
| 15518 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 15519 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 15520 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15521 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 15522 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15523 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15524 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15525 | #endif |
| 15526 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15527 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 15528 | /* |
| 15529 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 15530 | * Callback rountine called upon receiving response for |
| 15531 | * get offload info |
| 15532 | */ |
| 15533 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 15534 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 15535 | { |
| 15536 | |
| 15537 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15538 | tANI_U8 tempReplayCounter[8]; |
| 15539 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15540 | |
| 15541 | ENTER(); |
| 15542 | |
| 15543 | if (NULL == pAdapter) |
| 15544 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 15545 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15546 | "%s: HDD adapter is Null", __func__); |
| 15547 | return ; |
| 15548 | } |
| 15549 | |
| 15550 | if (NULL == pGtkOffloadGetInfoRsp) |
| 15551 | { |
| 15552 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15553 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 15554 | return ; |
| 15555 | } |
| 15556 | |
| 15557 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 15558 | { |
| 15559 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15560 | "%s: wlan Failed to get replay counter value", |
| 15561 | __func__); |
| 15562 | return ; |
| 15563 | } |
| 15564 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15565 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15566 | /* Update replay counter */ |
| 15567 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 15568 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 15569 | |
| 15570 | { |
| 15571 | /* changing from little to big endian since supplicant |
| 15572 | * works on big endian format |
| 15573 | */ |
| 15574 | int i; |
| 15575 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 15576 | |
| 15577 | for (i = 0; i < 8; i++) |
| 15578 | { |
| 15579 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 15580 | } |
| 15581 | } |
| 15582 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15583 | /* Update replay counter to NL */ |
| 15584 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15585 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15586 | } |
| 15587 | |
| 15588 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15589 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15590 | * This function is used to offload GTK rekeying job to the firmware. |
| 15591 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15592 | 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] | 15593 | struct cfg80211_gtk_rekey_data *data) |
| 15594 | { |
| 15595 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15596 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 15597 | hdd_station_ctx_t *pHddStaCtx; |
| 15598 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15599 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15600 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15601 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 15602 | |
| 15603 | ENTER(); |
| 15604 | |
| 15605 | if (NULL == pAdapter) |
| 15606 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15607 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15608 | "%s: HDD adapter is Null", __func__); |
| 15609 | return -ENODEV; |
| 15610 | } |
| 15611 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15612 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15613 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 15614 | pAdapter->sessionId, pAdapter->device_mode)); |
| 15615 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15616 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15617 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15618 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15619 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15620 | } |
| 15621 | |
| 15622 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15623 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 15624 | if (NULL == hHal) |
| 15625 | { |
| 15626 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15627 | "%s: HAL context is Null!!!", __func__); |
| 15628 | return -EAGAIN; |
| 15629 | } |
| 15630 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15631 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 15632 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 15633 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 15634 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15635 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15636 | { |
| 15637 | /* changing from big to little endian since driver |
| 15638 | * works on little endian format |
| 15639 | */ |
| 15640 | tANI_U8 *p = |
| 15641 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 15642 | int i; |
| 15643 | |
| 15644 | for (i = 0; i < 8; i++) |
| 15645 | { |
| 15646 | p[7-i] = data->replay_ctr[i]; |
| 15647 | } |
| 15648 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15649 | |
| 15650 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 15651 | { |
| 15652 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15653 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 15654 | sizeof (tSirGtkOffloadParams)); |
| 15655 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15656 | pAdapter->sessionId); |
| 15657 | |
| 15658 | if (eHAL_STATUS_SUCCESS != status) |
| 15659 | { |
| 15660 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15661 | "%s: sme_SetGTKOffload failed, returned %d", |
| 15662 | __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 15663 | |
| 15664 | /* Need to clear any trace of key value in the memory. |
| 15665 | * Thus zero out the memory even though it is local |
| 15666 | * variable. |
| 15667 | */ |
| 15668 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 15669 | sizeof(hddGtkOffloadReqParams)); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15670 | return status; |
| 15671 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15672 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15673 | "%s: sme_SetGTKOffload successfull", __func__); |
| 15674 | } |
| 15675 | else |
| 15676 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15677 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15678 | "%s: wlan not suspended GTKOffload request is stored", |
| 15679 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15680 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15681 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 15682 | /* Need to clear any trace of key value in the memory. |
| 15683 | * Thus zero out the memory even though it is local |
| 15684 | * variable. |
| 15685 | */ |
| 15686 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 15687 | sizeof(hddGtkOffloadReqParams)); |
| 15688 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15689 | EXIT(); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15690 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15691 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15692 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15693 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 15694 | struct cfg80211_gtk_rekey_data *data) |
| 15695 | { |
| 15696 | int ret; |
| 15697 | |
| 15698 | vos_ssr_protect(__func__); |
| 15699 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 15700 | vos_ssr_unprotect(__func__); |
| 15701 | |
| 15702 | return ret; |
| 15703 | } |
| 15704 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15705 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15706 | * FUNCTION: __wlan_hdd_cfg80211_set_mac_acl |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15707 | * This function is used to set access control policy |
| 15708 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15709 | static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 15710 | struct net_device *dev, |
| 15711 | const struct cfg80211_acl_data *params) |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15712 | { |
| 15713 | int i; |
| 15714 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15715 | hdd_hostapd_state_t *pHostapdState; |
| 15716 | tsap_Config_t *pConfig; |
| 15717 | v_CONTEXT_t pVosContext = NULL; |
| 15718 | hdd_context_t *pHddCtx; |
| 15719 | int status; |
| 15720 | |
| 15721 | ENTER(); |
| 15722 | |
| 15723 | if (NULL == pAdapter) |
| 15724 | { |
| 15725 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15726 | "%s: HDD adapter is Null", __func__); |
| 15727 | return -ENODEV; |
| 15728 | } |
| 15729 | |
| 15730 | if (NULL == params) |
| 15731 | { |
| 15732 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15733 | "%s: params is Null", __func__); |
| 15734 | return -EINVAL; |
| 15735 | } |
| 15736 | |
| 15737 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15738 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15739 | if (0 != status) |
| 15740 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15741 | return status; |
| 15742 | } |
| 15743 | |
| 15744 | pVosContext = pHddCtx->pvosContext; |
| 15745 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 15746 | |
| 15747 | if (NULL == pHostapdState) |
| 15748 | { |
| 15749 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15750 | "%s: pHostapdState is Null", __func__); |
| 15751 | return -EINVAL; |
| 15752 | } |
| 15753 | |
| 15754 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 15755 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
| 15756 | |
| 15757 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 15758 | { |
| 15759 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 15760 | |
| 15761 | /* default value */ |
| 15762 | pConfig->num_accept_mac = 0; |
| 15763 | pConfig->num_deny_mac = 0; |
| 15764 | |
| 15765 | /** |
| 15766 | * access control policy |
| 15767 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 15768 | * listed in hostapd.deny file. |
| 15769 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 15770 | * listed in hostapd.accept file. |
| 15771 | */ |
| 15772 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 15773 | { |
| 15774 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 15775 | } |
| 15776 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 15777 | { |
| 15778 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 15779 | } |
| 15780 | else |
| 15781 | { |
| 15782 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15783 | "%s:Acl Policy : %d is not supported", |
| 15784 | __func__, params->acl_policy); |
| 15785 | return -ENOTSUPP; |
| 15786 | } |
| 15787 | |
| 15788 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 15789 | { |
| 15790 | pConfig->num_accept_mac = params->n_acl_entries; |
| 15791 | for (i = 0; i < params->n_acl_entries; i++) |
| 15792 | { |
| 15793 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15794 | "** Add ACL MAC entry %i in WhiletList :" |
| 15795 | MAC_ADDRESS_STR, i, |
| 15796 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 15797 | |
| 15798 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 15799 | sizeof(qcmacaddr)); |
| 15800 | } |
| 15801 | } |
| 15802 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 15803 | { |
| 15804 | pConfig->num_deny_mac = params->n_acl_entries; |
| 15805 | for (i = 0; i < params->n_acl_entries; i++) |
| 15806 | { |
| 15807 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15808 | "** Add ACL MAC entry %i in BlackList :" |
| 15809 | MAC_ADDRESS_STR, i, |
| 15810 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 15811 | |
| 15812 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 15813 | sizeof(qcmacaddr)); |
| 15814 | } |
| 15815 | } |
| 15816 | |
| 15817 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 15818 | { |
| 15819 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15820 | "%s: SAP Set Mac Acl fail", __func__); |
| 15821 | return -EINVAL; |
| 15822 | } |
| 15823 | } |
| 15824 | else |
| 15825 | { |
| 15826 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15827 | "%s: Invalid device_mode = %s (%d)", |
| 15828 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 15829 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15830 | return -EINVAL; |
| 15831 | } |
| 15832 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15833 | EXIT(); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15834 | return 0; |
| 15835 | } |
| 15836 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15837 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 15838 | struct net_device *dev, |
| 15839 | const struct cfg80211_acl_data *params) |
| 15840 | { |
| 15841 | int ret; |
| 15842 | vos_ssr_protect(__func__); |
| 15843 | ret = __wlan_hdd_cfg80211_set_mac_acl(wiphy, dev, params); |
| 15844 | vos_ssr_unprotect(__func__); |
| 15845 | |
| 15846 | return ret; |
| 15847 | } |
| 15848 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15849 | #ifdef WLAN_NL80211_TESTMODE |
| 15850 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15851 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15852 | ( |
| 15853 | void *pAdapter, |
| 15854 | void *indCont |
| 15855 | ) |
| 15856 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15857 | tSirLPHBInd *lphbInd; |
| 15858 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15859 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15860 | |
| 15861 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15862 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15863 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15864 | if (pAdapter == NULL) |
| 15865 | { |
| 15866 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15867 | "%s: pAdapter is NULL\n",__func__); |
| 15868 | return; |
| 15869 | } |
| 15870 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15871 | if (NULL == indCont) |
| 15872 | { |
| 15873 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15874 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15875 | return; |
| 15876 | } |
| 15877 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15878 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15879 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15880 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15881 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15882 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15883 | GFP_ATOMIC); |
| 15884 | if (!skb) |
| 15885 | { |
| 15886 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15887 | "LPHB timeout, NL buffer alloc fail"); |
| 15888 | return; |
| 15889 | } |
| 15890 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15891 | 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] | 15892 | { |
| 15893 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15894 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 15895 | goto nla_put_failure; |
| 15896 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15897 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15898 | { |
| 15899 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15900 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 15901 | goto nla_put_failure; |
| 15902 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15903 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15904 | sizeof(tSirLPHBInd), lphbInd)) |
| 15905 | { |
| 15906 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15907 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 15908 | goto nla_put_failure; |
| 15909 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15910 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 15911 | return; |
| 15912 | |
| 15913 | nla_put_failure: |
| 15914 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15915 | "NLA Put fail"); |
| 15916 | kfree_skb(skb); |
| 15917 | |
| 15918 | return; |
| 15919 | } |
| 15920 | #endif /* FEATURE_WLAN_LPHB */ |
| 15921 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15922 | 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] | 15923 | { |
| 15924 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 15925 | int err = 0; |
| 15926 | #ifdef FEATURE_WLAN_LPHB |
| 15927 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15928 | eHalStatus smeStatus; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15929 | |
| 15930 | ENTER(); |
| 15931 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 15932 | err = wlan_hdd_validate_context(pHddCtx); |
| 15933 | if (0 != err) |
| 15934 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 15935 | return err; |
| 15936 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15937 | #endif /* FEATURE_WLAN_LPHB */ |
| 15938 | |
| 15939 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 15940 | if (err) |
| 15941 | { |
| 15942 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15943 | "%s Testmode INV ATTR", __func__); |
| 15944 | return err; |
| 15945 | } |
| 15946 | |
| 15947 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 15948 | { |
| 15949 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15950 | "%s Testmode INV CMD", __func__); |
| 15951 | return -EINVAL; |
| 15952 | } |
| 15953 | |
| 15954 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 15955 | { |
| 15956 | #ifdef FEATURE_WLAN_LPHB |
| 15957 | /* Low Power Heartbeat configuration request */ |
| 15958 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 15959 | { |
| 15960 | int buf_len; |
| 15961 | void *buf; |
| 15962 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 15963 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15964 | |
| 15965 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 15966 | { |
| 15967 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15968 | "%s Testmode INV DATA", __func__); |
| 15969 | return -EINVAL; |
| 15970 | } |
| 15971 | |
| 15972 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 15973 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 15974 | |
| 15975 | hb_params_temp =(tSirLPHBReq *)buf; |
| 15976 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 15977 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 15978 | return -EINVAL; |
| 15979 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15980 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 15981 | if (NULL == hb_params) |
| 15982 | { |
| 15983 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15984 | "%s Request Buffer Alloc Fail", __func__); |
| 15985 | return -EINVAL; |
| 15986 | } |
| 15987 | |
| 15988 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15989 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 15990 | hb_params, |
| 15991 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 15992 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15993 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15994 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15995 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15996 | vos_mem_free(hb_params); |
| 15997 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15998 | return 0; |
| 15999 | } |
| 16000 | #endif /* FEATURE_WLAN_LPHB */ |
| 16001 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 16002 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16003 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16004 | return -EOPNOTSUPP; |
| 16005 | } |
| 16006 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16007 | EXIT(); |
| 16008 | return err; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16009 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16010 | |
| 16011 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) |
| 16012 | { |
| 16013 | int ret; |
| 16014 | |
| 16015 | vos_ssr_protect(__func__); |
| 16016 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 16017 | vos_ssr_unprotect(__func__); |
| 16018 | |
| 16019 | return ret; |
| 16020 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16021 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 16022 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16023 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16024 | struct net_device *dev, |
| 16025 | int idx, struct survey_info *survey) |
| 16026 | { |
| 16027 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16028 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16029 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16030 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16031 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16032 | v_S7_t snr,rssi; |
| 16033 | int status, i, j, filled = 0; |
| 16034 | |
| 16035 | ENTER(); |
| 16036 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16037 | if (NULL == pAdapter) |
| 16038 | { |
| 16039 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 16040 | "%s: HDD adapter is Null", __func__); |
| 16041 | return -ENODEV; |
| 16042 | } |
| 16043 | |
| 16044 | if (NULL == wiphy) |
| 16045 | { |
| 16046 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 16047 | "%s: wiphy is Null", __func__); |
| 16048 | return -ENODEV; |
| 16049 | } |
| 16050 | |
| 16051 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16052 | status = wlan_hdd_validate_context(pHddCtx); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16053 | if (0 != status) |
| 16054 | { |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16055 | return status; |
| 16056 | } |
| 16057 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16058 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 16059 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16060 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16061 | 0 != pAdapter->survey_idx || |
| 16062 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16063 | { |
| 16064 | /* The survey dump ops when implemented completely is expected to |
| 16065 | * return a survey of all channels and the ops is called by the |
| 16066 | * kernel with incremental values of the argument 'idx' till it |
| 16067 | * returns -ENONET. But we can only support the survey for the |
| 16068 | * operating channel for now. survey_idx is used to track |
| 16069 | * that the ops is called only once and then return -ENONET for |
| 16070 | * the next iteration |
| 16071 | */ |
| 16072 | pAdapter->survey_idx = 0; |
| 16073 | return -ENONET; |
| 16074 | } |
| 16075 | |
| 16076 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16077 | |
| 16078 | wlan_hdd_get_snr(pAdapter, &snr); |
| 16079 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 16080 | |
| 16081 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 16082 | hdd_wlan_get_freq(channel, &freq); |
| 16083 | |
| 16084 | |
| 16085 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 16086 | { |
| 16087 | if (NULL == wiphy->bands[i]) |
| 16088 | { |
| 16089 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 16090 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 16091 | continue; |
| 16092 | } |
| 16093 | |
| 16094 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 16095 | { |
| 16096 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 16097 | |
| 16098 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 16099 | { |
| 16100 | survey->channel = &band->channels[j]; |
| 16101 | /* The Rx BDs contain SNR values in dB for the received frames |
| 16102 | * while the supplicant expects noise. So we calculate and |
| 16103 | * return the value of noise (dBm) |
| 16104 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 16105 | */ |
| 16106 | survey->noise = rssi - snr; |
| 16107 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 16108 | filled = 1; |
| 16109 | } |
| 16110 | } |
| 16111 | } |
| 16112 | |
| 16113 | if (filled) |
| 16114 | pAdapter->survey_idx = 1; |
| 16115 | else |
| 16116 | { |
| 16117 | pAdapter->survey_idx = 0; |
| 16118 | return -ENONET; |
| 16119 | } |
| 16120 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16121 | EXIT(); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16122 | return 0; |
| 16123 | } |
| 16124 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16125 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 16126 | struct net_device *dev, |
| 16127 | int idx, struct survey_info *survey) |
| 16128 | { |
| 16129 | int ret; |
| 16130 | |
| 16131 | vos_ssr_protect(__func__); |
| 16132 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 16133 | vos_ssr_unprotect(__func__); |
| 16134 | |
| 16135 | return ret; |
| 16136 | } |
| 16137 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16138 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16139 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16140 | * this is called when cfg80211 driver resume |
| 16141 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 16142 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16143 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16144 | { |
| 16145 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 16146 | hdd_adapter_t *pAdapter; |
| 16147 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 16148 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 16149 | |
| 16150 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16151 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16152 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16153 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16154 | return 0; |
| 16155 | } |
| 16156 | |
| 16157 | spin_lock(&pHddCtx->schedScan_lock); |
| 16158 | pHddCtx->isWiphySuspended = FALSE; |
| 16159 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 16160 | { |
| 16161 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16162 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16163 | "%s: Return resume is not due to PNO indication", __func__); |
| 16164 | return 0; |
| 16165 | } |
| 16166 | // Reset flag to avoid updatating cfg80211 data old results again |
| 16167 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 16168 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16169 | |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16170 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16171 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 16172 | |
| 16173 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 16174 | { |
| 16175 | pAdapter = pAdapterNode->pAdapter; |
| 16176 | if ( (NULL != pAdapter) && |
| 16177 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 16178 | { |
| 16179 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16180 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16181 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 16182 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16183 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16184 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16185 | { |
| 16186 | /* Acquire wakelock to handle the case where APP's tries to |
| 16187 | * suspend immediately after updating the scan results. Whis |
| 16188 | * results in app's is in suspended state and not able to |
| 16189 | * process the connect request to AP |
| 16190 | */ |
| 16191 | hdd_prevent_suspend_timeout(2000); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16192 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16193 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16194 | |
| 16195 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16196 | "%s : cfg80211 scan result database updated", __func__); |
| 16197 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16198 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16199 | return 0; |
| 16200 | |
| 16201 | } |
| 16202 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 16203 | pAdapterNode = pNext; |
| 16204 | } |
| 16205 | |
| 16206 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16207 | "%s: Failed to find Adapter", __func__); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16208 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16209 | return 0; |
| 16210 | } |
| 16211 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16212 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 16213 | { |
| 16214 | int ret; |
| 16215 | |
| 16216 | vos_ssr_protect(__func__); |
| 16217 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 16218 | vos_ssr_unprotect(__func__); |
| 16219 | |
| 16220 | return ret; |
| 16221 | } |
| 16222 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16223 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16224 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16225 | * this is called when cfg80211 driver suspends |
| 16226 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16227 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16228 | struct cfg80211_wowlan *wow) |
| 16229 | { |
| 16230 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16231 | int ret = 0; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16232 | |
| 16233 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16234 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16235 | ret = wlan_hdd_validate_context(pHddCtx); |
| 16236 | if (0 != ret) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16237 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16238 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16239 | } |
| 16240 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16241 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16242 | pHddCtx->isWiphySuspended = TRUE; |
| 16243 | |
| 16244 | EXIT(); |
| 16245 | |
| 16246 | return 0; |
| 16247 | } |
| 16248 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16249 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 16250 | struct cfg80211_wowlan *wow) |
| 16251 | { |
| 16252 | int ret; |
| 16253 | |
| 16254 | vos_ssr_protect(__func__); |
| 16255 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 16256 | vos_ssr_unprotect(__func__); |
| 16257 | |
| 16258 | return ret; |
| 16259 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16260 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16261 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16262 | { |
| 16263 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 16264 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 16265 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 16266 | .change_station = wlan_hdd_change_station, |
| 16267 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 16268 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 16269 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 16270 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16271 | #else |
| 16272 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 16273 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 16274 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16275 | #endif |
| 16276 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 16277 | .add_key = wlan_hdd_cfg80211_add_key, |
| 16278 | .get_key = wlan_hdd_cfg80211_get_key, |
| 16279 | .del_key = wlan_hdd_cfg80211_del_key, |
| 16280 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 16281 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16282 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 16283 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16284 | .scan = wlan_hdd_cfg80211_scan, |
| 16285 | .connect = wlan_hdd_cfg80211_connect, |
| 16286 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 16287 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 16288 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 16289 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 16290 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 16291 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16292 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 16293 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 16294 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16295 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 16296 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 16297 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 16298 | .set_txq_params = wlan_hdd_set_txq_params, |
| 16299 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16300 | .get_station = wlan_hdd_cfg80211_get_station, |
| 16301 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 16302 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16303 | .add_station = wlan_hdd_cfg80211_add_station, |
| 16304 | #ifdef FEATURE_WLAN_LFR |
| 16305 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 16306 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 16307 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 16308 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16309 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 16310 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 16311 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16312 | #ifdef FEATURE_WLAN_TDLS |
| 16313 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 16314 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 16315 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16316 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 16317 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 16318 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16319 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 16320 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 16321 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 16322 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16323 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 16324 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16325 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16326 | #ifdef WLAN_NL80211_TESTMODE |
| 16327 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 16328 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16329 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16330 | }; |
| 16331 | |