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 | #include "wlan_hdd_tdls.h" |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 94 | #include "wlan_hdd_wmm.h" |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 95 | #include "wlan_qct_wda.h" |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 96 | #include "wlan_nv.h" |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 97 | #include "wlan_hdd_dev_pwr.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 98 | |
| 99 | #define g_mode_rates_size (12) |
| 100 | #define a_mode_rates_size (8) |
| 101 | #define FREQ_BASE_80211G (2407) |
| 102 | #define FREQ_BAND_DIFF_80211G (5) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 103 | #define MAX_SCAN_SSID 9 |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 104 | #define MAX_PENDING_LOG 5 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 105 | #define GET_IE_LEN_IN_BSS_DESC(lenInBss) ( lenInBss + sizeof(lenInBss) - \ |
krunal soni | 2a6a906 | 2014-02-11 14:14:23 -0800 | [diff] [blame] | 106 | ((uintptr_t)OFFSET_OF( tSirBssDescription, ieFields))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 107 | |
| 108 | #define HDD2GHZCHAN(freq, chan, flag) { \ |
| 109 | .band = IEEE80211_BAND_2GHZ, \ |
| 110 | .center_freq = (freq), \ |
| 111 | .hw_value = (chan),\ |
| 112 | .flags = (flag), \ |
| 113 | .max_antenna_gain = 0 ,\ |
| 114 | .max_power = 30, \ |
| 115 | } |
| 116 | |
| 117 | #define HDD5GHZCHAN(freq, chan, flag) { \ |
| 118 | .band = IEEE80211_BAND_5GHZ, \ |
| 119 | .center_freq = (freq), \ |
| 120 | .hw_value = (chan),\ |
| 121 | .flags = (flag), \ |
| 122 | .max_antenna_gain = 0 ,\ |
| 123 | .max_power = 30, \ |
| 124 | } |
| 125 | |
| 126 | #define HDD_G_MODE_RATETAB(rate, rate_id, flag)\ |
| 127 | {\ |
| 128 | .bitrate = rate, \ |
| 129 | .hw_value = rate_id, \ |
| 130 | .flags = flag, \ |
| 131 | } |
| 132 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 133 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 134 | #define WLAN_AKM_SUITE_FT_8021X 0x000FAC03 |
| 135 | #define WLAN_AKM_SUITE_FT_PSK 0x000FAC04 |
| 136 | #endif |
| 137 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 138 | #define HDD_CHANNEL_14 14 |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 139 | #define WLAN_HDD_MAX_FEATURE_SET 8 |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 140 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 141 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 142 | /* |
| 143 | * Used to allocate the size of 4096 for the link layer stats. |
| 144 | * The size of 4096 is considered assuming that all data per |
| 145 | * respective event fit with in the limit.Please take a call |
| 146 | * on the limit based on the data requirements on link layer |
| 147 | * statistics. |
| 148 | */ |
| 149 | #define LL_STATS_EVENT_BUF_SIZE 4096 |
| 150 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 151 | #ifdef WLAN_FEATURE_EXTSCAN |
| 152 | /* |
| 153 | * Used to allocate the size of 4096 for the EXTScan NL data. |
| 154 | * The size of 4096 is considered assuming that all data per |
| 155 | * respective event fit with in the limit.Please take a call |
| 156 | * on the limit based on the data requirements. |
| 157 | */ |
| 158 | |
| 159 | #define EXTSCAN_EVENT_BUF_SIZE 4096 |
| 160 | #define EXTSCAN_MAX_CACHED_RESULTS_PER_IND 32 |
| 161 | #endif |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 162 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 163 | /*EXT TDLS*/ |
| 164 | /* |
| 165 | * Used to allocate the size of 4096 for the TDLS. |
| 166 | * The size of 4096 is considered assuming that all data per |
| 167 | * respective event fit with in the limit.Please take a call |
| 168 | * on the limit based on the data requirements on link layer |
| 169 | * statistics. |
| 170 | */ |
| 171 | #define EXTTDLS_EVENT_BUF_SIZE 4096 |
| 172 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 173 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 174 | { |
| 175 | WLAN_CIPHER_SUITE_WEP40, |
| 176 | WLAN_CIPHER_SUITE_WEP104, |
| 177 | WLAN_CIPHER_SUITE_TKIP, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 178 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 179 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 180 | WLAN_CIPHER_SUITE_KRK, |
| 181 | WLAN_CIPHER_SUITE_CCMP, |
| 182 | #else |
| 183 | WLAN_CIPHER_SUITE_CCMP, |
| 184 | #endif |
| 185 | #ifdef FEATURE_WLAN_WAPI |
| 186 | WLAN_CIPHER_SUITE_SMS4, |
| 187 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 188 | #ifdef WLAN_FEATURE_11W |
| 189 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 190 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 191 | }; |
| 192 | |
| 193 | static inline int is_broadcast_ether_addr(const u8 *addr) |
| 194 | { |
| 195 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && |
| 196 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 197 | } |
| 198 | |
| 199 | static struct ieee80211_channel hdd_channels_2_4_GHZ[] = |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 200 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 201 | HDD2GHZCHAN(2412, 1, 0) , |
| 202 | HDD2GHZCHAN(2417, 2, 0) , |
| 203 | HDD2GHZCHAN(2422, 3, 0) , |
| 204 | HDD2GHZCHAN(2427, 4, 0) , |
| 205 | HDD2GHZCHAN(2432, 5, 0) , |
| 206 | HDD2GHZCHAN(2437, 6, 0) , |
| 207 | HDD2GHZCHAN(2442, 7, 0) , |
| 208 | HDD2GHZCHAN(2447, 8, 0) , |
| 209 | HDD2GHZCHAN(2452, 9, 0) , |
| 210 | HDD2GHZCHAN(2457, 10, 0) , |
| 211 | HDD2GHZCHAN(2462, 11, 0) , |
| 212 | HDD2GHZCHAN(2467, 12, 0) , |
| 213 | HDD2GHZCHAN(2472, 13, 0) , |
| 214 | HDD2GHZCHAN(2484, 14, 0) , |
| 215 | }; |
| 216 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 217 | static struct ieee80211_channel hdd_social_channels_2_4_GHZ[] = |
| 218 | { |
| 219 | HDD2GHZCHAN(2412, 1, 0) , |
| 220 | HDD2GHZCHAN(2437, 6, 0) , |
| 221 | HDD2GHZCHAN(2462, 11, 0) , |
| 222 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 223 | |
| 224 | static struct ieee80211_channel hdd_channels_5_GHZ[] = |
| 225 | { |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 226 | HDD5GHZCHAN(4920, 240, 0) , |
| 227 | HDD5GHZCHAN(4940, 244, 0) , |
| 228 | HDD5GHZCHAN(4960, 248, 0) , |
| 229 | HDD5GHZCHAN(4980, 252, 0) , |
| 230 | HDD5GHZCHAN(5040, 208, 0) , |
| 231 | HDD5GHZCHAN(5060, 212, 0) , |
| 232 | HDD5GHZCHAN(5080, 216, 0) , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 233 | HDD5GHZCHAN(5180, 36, 0) , |
| 234 | HDD5GHZCHAN(5200, 40, 0) , |
| 235 | HDD5GHZCHAN(5220, 44, 0) , |
| 236 | HDD5GHZCHAN(5240, 48, 0) , |
| 237 | HDD5GHZCHAN(5260, 52, 0) , |
| 238 | HDD5GHZCHAN(5280, 56, 0) , |
| 239 | HDD5GHZCHAN(5300, 60, 0) , |
| 240 | HDD5GHZCHAN(5320, 64, 0) , |
| 241 | HDD5GHZCHAN(5500,100, 0) , |
| 242 | HDD5GHZCHAN(5520,104, 0) , |
| 243 | HDD5GHZCHAN(5540,108, 0) , |
| 244 | HDD5GHZCHAN(5560,112, 0) , |
| 245 | HDD5GHZCHAN(5580,116, 0) , |
| 246 | HDD5GHZCHAN(5600,120, 0) , |
| 247 | HDD5GHZCHAN(5620,124, 0) , |
| 248 | HDD5GHZCHAN(5640,128, 0) , |
| 249 | HDD5GHZCHAN(5660,132, 0) , |
| 250 | HDD5GHZCHAN(5680,136, 0) , |
| 251 | HDD5GHZCHAN(5700,140, 0) , |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 252 | #ifdef FEATURE_WLAN_CH144 |
| 253 | HDD5GHZCHAN(5720,144, 0) , |
| 254 | #endif /* FEATURE_WLAN_CH144 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 255 | HDD5GHZCHAN(5745,149, 0) , |
| 256 | HDD5GHZCHAN(5765,153, 0) , |
| 257 | HDD5GHZCHAN(5785,157, 0) , |
| 258 | HDD5GHZCHAN(5805,161, 0) , |
| 259 | HDD5GHZCHAN(5825,165, 0) , |
| 260 | }; |
| 261 | |
| 262 | static struct ieee80211_rate g_mode_rates[] = |
| 263 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 264 | HDD_G_MODE_RATETAB(10, 0x1, 0), |
| 265 | HDD_G_MODE_RATETAB(20, 0x2, 0), |
| 266 | HDD_G_MODE_RATETAB(55, 0x4, 0), |
| 267 | HDD_G_MODE_RATETAB(110, 0x8, 0), |
| 268 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 269 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 270 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 271 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 272 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 273 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 274 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 275 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 276 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 277 | |
| 278 | static struct ieee80211_rate a_mode_rates[] = |
| 279 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 280 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 281 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 282 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 283 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 284 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 285 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 286 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 287 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
| 288 | }; |
| 289 | |
| 290 | static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ = |
| 291 | { |
| 292 | .channels = hdd_channels_2_4_GHZ, |
| 293 | .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ), |
| 294 | .band = IEEE80211_BAND_2GHZ, |
| 295 | .bitrates = g_mode_rates, |
| 296 | .n_bitrates = g_mode_rates_size, |
| 297 | .ht_cap.ht_supported = 1, |
| 298 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 299 | | IEEE80211_HT_CAP_GRN_FLD |
| 300 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 301 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 302 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 303 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 304 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 305 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 306 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 307 | }; |
| 308 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 309 | static struct ieee80211_supported_band wlan_hdd_band_p2p_2_4_GHZ = |
| 310 | { |
| 311 | .channels = hdd_social_channels_2_4_GHZ, |
| 312 | .n_channels = ARRAY_SIZE(hdd_social_channels_2_4_GHZ), |
| 313 | .band = IEEE80211_BAND_2GHZ, |
| 314 | .bitrates = g_mode_rates, |
| 315 | .n_bitrates = g_mode_rates_size, |
| 316 | .ht_cap.ht_supported = 1, |
| 317 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 318 | | IEEE80211_HT_CAP_GRN_FLD |
| 319 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 320 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 321 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 322 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 323 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 324 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 325 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 326 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 327 | |
| 328 | static struct ieee80211_supported_band wlan_hdd_band_5_GHZ = |
| 329 | { |
| 330 | .channels = hdd_channels_5_GHZ, |
| 331 | .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ), |
| 332 | .band = IEEE80211_BAND_5GHZ, |
| 333 | .bitrates = a_mode_rates, |
| 334 | .n_bitrates = a_mode_rates_size, |
| 335 | .ht_cap.ht_supported = 1, |
| 336 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 337 | | IEEE80211_HT_CAP_GRN_FLD |
| 338 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 339 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT |
| 340 | | IEEE80211_HT_CAP_SGI_40 |
| 341 | | IEEE80211_HT_CAP_SUP_WIDTH_20_40, |
| 342 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 343 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 344 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 345 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 346 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 347 | }; |
| 348 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 349 | /* This structure contain information what kind of frame are expected in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 350 | TX/RX direction for each kind of interface */ |
| 351 | static const struct ieee80211_txrx_stypes |
| 352 | wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = { |
| 353 | [NL80211_IFTYPE_STATION] = { |
| 354 | .tx = 0xffff, |
| 355 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 356 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 357 | }, |
| 358 | [NL80211_IFTYPE_AP] = { |
| 359 | .tx = 0xffff, |
| 360 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 361 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 362 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 363 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 364 | BIT(SIR_MAC_MGMT_AUTH) | |
| 365 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 366 | BIT(SIR_MAC_MGMT_ACTION), |
| 367 | }, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 368 | [NL80211_IFTYPE_ADHOC] = { |
| 369 | .tx = 0xffff, |
| 370 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 371 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 372 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 373 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 374 | BIT(SIR_MAC_MGMT_AUTH) | |
| 375 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 376 | BIT(SIR_MAC_MGMT_ACTION), |
| 377 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 378 | [NL80211_IFTYPE_P2P_CLIENT] = { |
| 379 | .tx = 0xffff, |
| 380 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 381 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 382 | }, |
| 383 | [NL80211_IFTYPE_P2P_GO] = { |
| 384 | /* This is also same as for SoftAP */ |
| 385 | .tx = 0xffff, |
| 386 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 387 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 388 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 389 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 390 | BIT(SIR_MAC_MGMT_AUTH) | |
| 391 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 392 | BIT(SIR_MAC_MGMT_ACTION), |
| 393 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 394 | }; |
| 395 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 396 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 397 | static const struct ieee80211_iface_limit |
| 398 | wlan_hdd_iface_limit[] = { |
| 399 | { |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 400 | /* max = 3 ; Our driver create two interfaces during driver init |
| 401 | * wlan0 and p2p0 interfaces. p2p0 is considered as station |
| 402 | * interface until a group is formed. In JB architecture, once the |
| 403 | * group is formed, interface type of p2p0 is changed to P2P GO or |
| 404 | * Client. |
| 405 | * When supplicant remove the group, it first issue a set interface |
| 406 | * cmd to change the mode back to Station. In JB this works fine as |
| 407 | * we advertize two station type interface during driver init. |
| 408 | * Some vendors create separate interface for P2P GO/Client, |
| 409 | * after group formation(Third one). But while group remove |
| 410 | * supplicant first tries to change the mode(3rd interface) to STATION |
| 411 | * But as we advertized only two sta type interfaces nl80211 was |
| 412 | * returning error for the third one which was leading to failure in |
| 413 | * delete interface. Ideally while removing the group, supplicant |
| 414 | * should not try to change the 3rd interface mode to Station type. |
| 415 | * Till we get a fix in wpa_supplicant, we advertize max STA |
| 416 | * interface type to 3 |
| 417 | */ |
| 418 | .max = 3, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 419 | .types = BIT(NL80211_IFTYPE_STATION), |
| 420 | }, |
| 421 | { |
| 422 | .max = 1, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 423 | .types = BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP), |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 424 | }, |
| 425 | { |
| 426 | .max = 1, |
| 427 | .types = BIT(NL80211_IFTYPE_P2P_GO) | |
| 428 | BIT(NL80211_IFTYPE_P2P_CLIENT), |
| 429 | }, |
| 430 | }; |
| 431 | |
| 432 | /* By default, only single channel concurrency is allowed */ |
| 433 | static struct ieee80211_iface_combination |
| 434 | wlan_hdd_iface_combination = { |
| 435 | .limits = wlan_hdd_iface_limit, |
| 436 | .num_different_channels = 1, |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 437 | /* |
| 438 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 439 | * and p2p0 interfaces during driver init |
| 440 | * Some vendors create separate interface for P2P operations. |
| 441 | * wlan0: STA interface |
| 442 | * p2p0: P2P Device interface, action frames goes |
| 443 | * through this interface. |
| 444 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 445 | * created for p2p operations(GO/CLIENT interface). |
| 446 | */ |
| 447 | .max_interfaces = WLAN_MAX_INTERFACES, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 448 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 449 | .beacon_int_infra_match = false, |
| 450 | }; |
| 451 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 452 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 453 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 454 | |
| 455 | /* Data rate 100KBPS based on IE Index */ |
| 456 | struct index_data_rate_type |
| 457 | { |
| 458 | v_U8_t beacon_rate_index; |
| 459 | v_U16_t supported_rate[4]; |
| 460 | }; |
| 461 | |
| 462 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 463 | The IDX field is the rate index |
| 464 | The HI field is the rate when RSSI is strong or being ignored |
| 465 | (in this case we report actual rate) |
| 466 | The MID field is the rate when RSSI is moderate |
| 467 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 468 | The LO field is the rate when RSSI is low |
| 469 | (in this case we don't report rates, actual current rate used) |
| 470 | */ |
| 471 | static const struct |
| 472 | { |
| 473 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 474 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 475 | } supported_data_rate[] = |
| 476 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 477 | /* IDX HI HM LM LO (RSSI-based index */ |
| 478 | {2, { 10, 10, 10, 0}}, |
| 479 | {4, { 20, 20, 10, 0}}, |
| 480 | {11, { 55, 20, 10, 0}}, |
| 481 | {12, { 60, 55, 20, 0}}, |
| 482 | {18, { 90, 55, 20, 0}}, |
| 483 | {22, {110, 55, 20, 0}}, |
| 484 | {24, {120, 90, 60, 0}}, |
| 485 | {36, {180, 120, 60, 0}}, |
| 486 | {44, {220, 180, 60, 0}}, |
| 487 | {48, {240, 180, 90, 0}}, |
| 488 | {66, {330, 180, 90, 0}}, |
| 489 | {72, {360, 240, 90, 0}}, |
| 490 | {96, {480, 240, 120, 0}}, |
| 491 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 492 | }; |
| 493 | |
| 494 | /* MCS Based rate table */ |
| 495 | static struct index_data_rate_type supported_mcs_rate[] = |
| 496 | { |
| 497 | /* MCS L20 L40 S20 S40 */ |
| 498 | {0, {65, 135, 72, 150}}, |
| 499 | {1, {130, 270, 144, 300}}, |
| 500 | {2, {195, 405, 217, 450}}, |
| 501 | {3, {260, 540, 289, 600}}, |
| 502 | {4, {390, 810, 433, 900}}, |
| 503 | {5, {520, 1080, 578, 1200}}, |
| 504 | {6, {585, 1215, 650, 1350}}, |
| 505 | {7, {650, 1350, 722, 1500}} |
| 506 | }; |
| 507 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 508 | #ifdef WLAN_FEATURE_11AC |
| 509 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 510 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 511 | |
| 512 | struct index_vht_data_rate_type |
| 513 | { |
| 514 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 515 | v_U16_t supported_VHT80_rate[2]; |
| 516 | v_U16_t supported_VHT40_rate[2]; |
| 517 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 518 | }; |
| 519 | |
| 520 | typedef enum |
| 521 | { |
| 522 | DATA_RATE_11AC_MAX_MCS_7, |
| 523 | DATA_RATE_11AC_MAX_MCS_8, |
| 524 | DATA_RATE_11AC_MAX_MCS_9, |
| 525 | DATA_RATE_11AC_MAX_MCS_NA |
| 526 | } eDataRate11ACMaxMcs; |
| 527 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 528 | /* SSID broadcast type */ |
| 529 | typedef enum eSSIDBcastType |
| 530 | { |
| 531 | eBCAST_UNKNOWN = 0, |
| 532 | eBCAST_NORMAL = 1, |
| 533 | eBCAST_HIDDEN = 2, |
| 534 | } tSSIDBcastType; |
| 535 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 536 | /* MCS Based VHT rate table */ |
| 537 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 538 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 539 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 540 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 541 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 542 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 543 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 544 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 545 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 546 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 547 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 548 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 549 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 550 | }; |
| 551 | #endif /* WLAN_FEATURE_11AC */ |
| 552 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 553 | /*array index points to MCS and array value points respective rssi*/ |
| 554 | static int rssiMcsTbl[][10] = |
| 555 | { |
| 556 | /*MCS 0 1 2 3 4 5 6 7 8 9*/ |
| 557 | {-82, -79, -77, -74, -70, -66, -65, -64, -59, -57}, //20 |
| 558 | {-79, -76, -74, -71, -67, -63, -62, -61, -56, -54}, //40 |
| 559 | {-76, -73, -71, -68, -64, -60, -59, -58, -53, -51} //80 |
| 560 | }; |
| 561 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 562 | extern struct net_device_ops net_ops_struct; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 563 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 564 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter); |
| 565 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 566 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 567 | #ifdef WLAN_NL80211_TESTMODE |
| 568 | enum wlan_hdd_tm_attr |
| 569 | { |
| 570 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 571 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 572 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 573 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 574 | /* keep last */ |
| 575 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 576 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 577 | }; |
| 578 | |
| 579 | enum wlan_hdd_tm_cmd |
| 580 | { |
| 581 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 582 | }; |
| 583 | |
| 584 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 585 | |
| 586 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 587 | { |
| 588 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 589 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 590 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 591 | }; |
| 592 | #endif /* WLAN_NL80211_TESTMODE */ |
| 593 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 594 | #ifdef FEATURE_WLAN_CH_AVOID |
| 595 | /* |
| 596 | * FUNCTION: wlan_hdd_send_avoid_freq_event |
| 597 | * This is called when wlan driver needs to send vendor specific |
| 598 | * avoid frequency range event to userspace |
| 599 | */ |
| 600 | int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx, |
| 601 | tHddAvoidFreqList *pAvoidFreqList) |
| 602 | { |
| 603 | struct sk_buff *vendor_event; |
| 604 | |
| 605 | ENTER(); |
| 606 | |
| 607 | if (!pHddCtx) |
| 608 | { |
| 609 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 610 | "%s: HDD context is null", __func__); |
| 611 | return -1; |
| 612 | } |
| 613 | |
| 614 | if (!pAvoidFreqList) |
| 615 | { |
| 616 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 617 | "%s: pAvoidFreqList is null", __func__); |
| 618 | return -1; |
| 619 | } |
| 620 | |
| 621 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 622 | sizeof(tHddAvoidFreqList), |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 623 | QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 624 | GFP_KERNEL); |
| 625 | if (!vendor_event) |
| 626 | { |
| 627 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 628 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 629 | return -1; |
| 630 | } |
| 631 | |
| 632 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 633 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 634 | |
| 635 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 636 | |
| 637 | EXIT(); |
| 638 | return 0; |
| 639 | } |
| 640 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 641 | |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 642 | /* |
| 643 | * FUNCTION: __wlan_hdd_cfg80211_nan_request |
| 644 | * This is called when wlan driver needs to send vendor specific |
| 645 | * nan request event. |
| 646 | */ |
| 647 | static int __wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 648 | struct wireless_dev *wdev, |
| 649 | const void *data, int data_len) |
| 650 | { |
| 651 | tNanRequestReq nan_req; |
| 652 | VOS_STATUS status; |
| 653 | int ret_val = -1; |
Srinivas Dasari | a3f11c0 | 2015-03-20 13:15:20 +0530 | [diff] [blame] | 654 | struct net_device *dev = wdev->netdev; |
| 655 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 656 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 657 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 658 | |
| 659 | if (0 == data_len) |
| 660 | { |
| 661 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 662 | FL("NAN - Invalid Request, length = 0")); |
| 663 | return ret_val; |
| 664 | } |
| 665 | |
| 666 | if (NULL == data) |
| 667 | { |
| 668 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 669 | FL("NAN - Invalid Request, data is NULL")); |
| 670 | return ret_val; |
| 671 | } |
| 672 | |
| 673 | status = wlan_hdd_validate_context(pHddCtx); |
| 674 | if (0 != status) |
| 675 | { |
| 676 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 677 | FL("HDD context is not valid")); |
| 678 | return -EINVAL; |
| 679 | } |
| 680 | |
| 681 | hddLog(LOG1, FL("Received NAN command")); |
| 682 | vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 683 | (tANI_U8 *)data, data_len); |
| 684 | |
| 685 | /* check the NAN Capability */ |
| 686 | if (TRUE != sme_IsFeatureSupportedByFW(NAN)) |
| 687 | { |
| 688 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 689 | FL("NAN is not supported by Firmware")); |
| 690 | return -EINVAL; |
| 691 | } |
| 692 | |
| 693 | nan_req.request_data_len = data_len; |
| 694 | nan_req.request_data = data; |
| 695 | |
Srinivas Dasari | a3f11c0 | 2015-03-20 13:15:20 +0530 | [diff] [blame] | 696 | status = sme_NanRequest(hHal, &nan_req, pAdapter->sessionId); |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 697 | if (VOS_STATUS_SUCCESS == status) |
| 698 | { |
| 699 | ret_val = 0; |
| 700 | } |
| 701 | return ret_val; |
| 702 | } |
| 703 | |
| 704 | /* |
| 705 | * FUNCTION: wlan_hdd_cfg80211_nan_request |
| 706 | * Wrapper to protect the nan vendor command from ssr |
| 707 | */ |
| 708 | static int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 709 | struct wireless_dev *wdev, |
| 710 | const void *data, int data_len) |
| 711 | { |
| 712 | int ret; |
| 713 | |
| 714 | vos_ssr_protect(__func__); |
| 715 | ret = __wlan_hdd_cfg80211_nan_request(wiphy, wdev, data, data_len); |
| 716 | vos_ssr_unprotect(__func__); |
| 717 | |
| 718 | return ret; |
| 719 | } |
| 720 | |
| 721 | /* |
| 722 | * FUNCTION: wlan_hdd_cfg80211_nan_callback |
| 723 | * This is a callback function and it gets called |
| 724 | * when we need to report nan response event to |
| 725 | * upper layers. |
| 726 | */ |
| 727 | static void wlan_hdd_cfg80211_nan_callback(void* ctx, tSirNanEvent* msg) |
| 728 | { |
| 729 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 730 | struct sk_buff *vendor_event; |
| 731 | int status; |
| 732 | tSirNanEvent *data; |
| 733 | |
| 734 | ENTER(); |
| 735 | if (NULL == msg) |
| 736 | { |
| 737 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 738 | FL(" msg received here is null")); |
| 739 | return; |
| 740 | } |
| 741 | data = msg; |
| 742 | |
| 743 | status = wlan_hdd_validate_context(pHddCtx); |
| 744 | |
| 745 | if (0 != status) |
| 746 | { |
| 747 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 748 | FL("HDD context is not valid")); |
| 749 | return; |
| 750 | } |
| 751 | |
| 752 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 753 | data->event_data_len + |
| 754 | NLMSG_HDRLEN, |
| 755 | QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX, |
| 756 | GFP_KERNEL); |
| 757 | |
| 758 | if (!vendor_event) |
| 759 | { |
| 760 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 761 | FL("cfg80211_vendor_event_alloc failed")); |
| 762 | return; |
| 763 | } |
| 764 | if (nla_put(vendor_event, QCA_WLAN_VENDOR_ATTR_NAN, |
| 765 | data->event_data_len, data->event_data)) |
| 766 | { |
| 767 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 768 | FL("QCA_WLAN_VENDOR_ATTR_NAN put fail")); |
| 769 | kfree_skb(vendor_event); |
| 770 | return; |
| 771 | } |
| 772 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 773 | EXIT(); |
| 774 | } |
| 775 | |
| 776 | /* |
| 777 | * FUNCTION: wlan_hdd_cfg80211_nan_init |
| 778 | * This function is called to register the callback to sme layer |
| 779 | */ |
| 780 | inline void wlan_hdd_cfg80211_nan_init(hdd_context_t *pHddCtx) |
| 781 | { |
| 782 | sme_NanRegisterCallback(pHddCtx->hHal, wlan_hdd_cfg80211_nan_callback); |
| 783 | } |
| 784 | |
| 785 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 786 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 787 | |
| 788 | static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats, |
| 789 | struct sk_buff *vendor_event) |
| 790 | { |
| 791 | if (nla_put_u8(vendor_event, |
| 792 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_PREAMBLE, |
| 793 | stats->rate.preamble) || |
| 794 | nla_put_u8(vendor_event, |
| 795 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_NSS, |
| 796 | stats->rate.nss) || |
| 797 | nla_put_u8(vendor_event, |
| 798 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BW, |
| 799 | stats->rate.bw) || |
| 800 | nla_put_u8(vendor_event, |
| 801 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX, |
| 802 | stats->rate.rateMcsIdx) || |
| 803 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE, |
| 804 | stats->rate.bitrate ) || |
| 805 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU, |
| 806 | stats->txMpdu ) || |
| 807 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU, |
| 808 | stats->rxMpdu ) || |
| 809 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST, |
| 810 | stats->mpduLost ) || |
| 811 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES, |
| 812 | stats->retries) || |
| 813 | nla_put_u32(vendor_event, |
| 814 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT, |
| 815 | stats->retriesShort ) || |
| 816 | nla_put_u32(vendor_event, |
| 817 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG, |
| 818 | stats->retriesLong)) |
| 819 | { |
| 820 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 821 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 822 | return FALSE; |
| 823 | } |
| 824 | return TRUE; |
| 825 | } |
| 826 | |
| 827 | static v_BOOL_t put_wifi_peer_info( tpSirWifiPeerInfo stats, |
| 828 | struct sk_buff *vendor_event) |
| 829 | { |
| 830 | u32 i = 0; |
| 831 | struct nlattr *rateInfo; |
| 832 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE, |
| 833 | stats->type) || |
| 834 | nla_put(vendor_event, |
| 835 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS, |
| 836 | VOS_MAC_ADDR_SIZE, &stats->peerMacAddress[0]) || |
| 837 | nla_put_u32(vendor_event, |
| 838 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES, |
| 839 | stats->capabilities) || |
| 840 | nla_put_u32(vendor_event, |
| 841 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES, |
| 842 | stats->numRate)) |
| 843 | { |
| 844 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 845 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 846 | goto error; |
| 847 | } |
| 848 | |
| 849 | rateInfo = nla_nest_start(vendor_event, |
| 850 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 851 | if(!rateInfo) |
| 852 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 853 | for (i = 0; i < stats->numRate; i++) |
| 854 | { |
| 855 | struct nlattr *rates; |
| 856 | tpSirWifiRateStat pRateStats = (tpSirWifiRateStat )((uint8 *) |
| 857 | stats->rateStats + |
| 858 | (i * sizeof(tSirWifiRateStat))); |
| 859 | rates = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 860 | if(!rates) |
| 861 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 862 | |
| 863 | if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event)) |
| 864 | { |
| 865 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 866 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 867 | return FALSE; |
| 868 | } |
| 869 | nla_nest_end(vendor_event, rates); |
| 870 | } |
| 871 | nla_nest_end(vendor_event, rateInfo); |
| 872 | |
| 873 | return TRUE; |
| 874 | error: |
| 875 | return FALSE; |
| 876 | } |
| 877 | |
| 878 | static v_BOOL_t put_wifi_wmm_ac_stat( tpSirWifiWmmAcStat stats, |
| 879 | struct sk_buff *vendor_event) |
| 880 | { |
| 881 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_AC, |
| 882 | stats->ac ) || |
| 883 | nla_put_u32(vendor_event, |
| 884 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MPDU, |
| 885 | stats->txMpdu ) || |
| 886 | nla_put_u32(vendor_event, |
| 887 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MPDU, |
| 888 | stats->rxMpdu ) || |
| 889 | nla_put_u32(vendor_event, |
| 890 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MCAST, |
| 891 | stats->txMcast ) || |
| 892 | nla_put_u32(vendor_event, |
| 893 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MCAST, |
| 894 | stats->rxMcast ) || |
| 895 | nla_put_u32(vendor_event, |
| 896 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_AMPDU, |
| 897 | stats->rxAmpdu ) || |
| 898 | nla_put_u32(vendor_event, |
| 899 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_AMPDU, |
| 900 | stats->txAmpdu ) || |
| 901 | nla_put_u32(vendor_event, |
| 902 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_MPDU_LOST, |
| 903 | stats->mpduLost )|| |
| 904 | nla_put_u32(vendor_event, |
| 905 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES, |
| 906 | stats->retries ) || |
| 907 | nla_put_u32(vendor_event, |
| 908 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_SHORT, |
| 909 | stats->retriesShort ) || |
| 910 | nla_put_u32(vendor_event, |
| 911 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_LONG, |
| 912 | stats->retriesLong ) || |
| 913 | nla_put_u32(vendor_event, |
| 914 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MIN, |
| 915 | stats->contentionTimeMin ) || |
| 916 | nla_put_u32(vendor_event, |
| 917 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MAX, |
| 918 | stats->contentionTimeMax ) || |
| 919 | nla_put_u32(vendor_event, |
| 920 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_AVG, |
| 921 | stats->contentionTimeAvg ) || |
| 922 | nla_put_u32(vendor_event, |
| 923 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_NUM_SAMPLES, |
| 924 | stats->contentionNumSamples )) |
| 925 | { |
| 926 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 927 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 928 | return FALSE; |
| 929 | } |
| 930 | return TRUE; |
| 931 | } |
| 932 | |
| 933 | static v_BOOL_t put_wifi_interface_info(tpSirWifiInterfaceInfo stats, |
| 934 | struct sk_buff *vendor_event) |
| 935 | { |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 936 | if (nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 937 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE, stats->mode ) || |
| 938 | nla_put(vendor_event, |
| 939 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MAC_ADDR, |
| 940 | VOS_MAC_ADDR_SIZE, stats->macAddr) || |
| 941 | nla_put_u32(vendor_event, |
| 942 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_STATE, |
| 943 | stats->state ) || |
| 944 | nla_put_u32(vendor_event, |
| 945 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_ROAMING, |
| 946 | stats->roaming ) || |
| 947 | nla_put_u32(vendor_event, |
| 948 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_CAPABILITIES, |
| 949 | stats->capabilities ) || |
| 950 | nla_put(vendor_event, |
| 951 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_SSID, |
| 952 | strlen(stats->ssid), stats->ssid) || |
| 953 | nla_put(vendor_event, |
| 954 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_BSSID, |
| 955 | WNI_CFG_BSSID_LEN, stats->bssid) || |
| 956 | nla_put(vendor_event, |
| 957 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_AP_COUNTRY_STR, |
| 958 | WNI_CFG_COUNTRY_CODE_LEN, stats->apCountryStr) || |
| 959 | nla_put(vendor_event, |
| 960 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_COUNTRY_STR, |
| 961 | WNI_CFG_COUNTRY_CODE_LEN, stats->countryStr) |
| 962 | ) |
| 963 | { |
| 964 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 965 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 966 | return FALSE; |
| 967 | } |
| 968 | return TRUE; |
| 969 | } |
| 970 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 971 | static v_BOOL_t put_wifi_iface_stats(hdd_adapter_t *pAdapter, |
| 972 | tpSirWifiIfaceStat pWifiIfaceStat, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 973 | struct sk_buff *vendor_event) |
| 974 | { |
| 975 | int i = 0; |
| 976 | struct nlattr *wmmInfo; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 977 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 978 | WLANTL_InterfaceStatsType *pWifiIfaceStatTL = NULL; |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 979 | tSirWifiWmmAcStat accessclassStats; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 980 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 981 | if (FALSE == put_wifi_interface_info( |
| 982 | &pWifiIfaceStat->info, |
| 983 | vendor_event)) |
| 984 | { |
| 985 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 986 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 987 | return FALSE; |
| 988 | |
| 989 | } |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 990 | pWifiIfaceStatTL = (WLANTL_InterfaceStatsType *) |
| 991 | vos_mem_malloc(sizeof(WLANTL_InterfaceStatsType)); |
| 992 | if (NULL == pWifiIfaceStatTL) |
| 993 | { |
| 994 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 995 | return FALSE; |
| 996 | } |
| 997 | |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 998 | accessclassStats = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK]; |
| 999 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK] = |
| 1000 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE]; |
| 1001 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE] = accessclassStats; |
| 1002 | |
| 1003 | accessclassStats.ac = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac; |
| 1004 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac = |
| 1005 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac; |
| 1006 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac = accessclassStats.ac; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1007 | |
| 1008 | if ( pWifiIfaceStat->info.state == WIFI_ASSOCIATED) |
| 1009 | { |
| 1010 | if (VOS_STATUS_SUCCESS == |
| 1011 | WLANTL_CollectInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1012 | pHddStaCtx->conn_info.staId[0], pWifiIfaceStatTL)) |
| 1013 | { |
| 1014 | /* mgmtRx, MgmtActionRx, rxMcast, rxMpdu, rxAmpdu, rssiData are |
| 1015 | * obtained from TL structure |
| 1016 | */ |
| 1017 | |
| 1018 | pWifiIfaceStat->mgmtRx = pWifiIfaceStat->beaconRx + |
| 1019 | pWifiIfaceStatTL->mgmtRx; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1020 | pWifiIfaceStat->rssiData = pWifiIfaceStatTL->rssiData; |
| 1021 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1022 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMcast |
| 1023 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMcast; |
| 1024 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMcast |
| 1025 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMcast; |
| 1026 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMcast |
| 1027 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMcast; |
| 1028 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMcast |
| 1029 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMcast; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1030 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1031 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMpdu |
| 1032 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMpdu; |
| 1033 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMpdu |
| 1034 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMpdu; |
| 1035 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMpdu |
| 1036 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMpdu; |
| 1037 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMpdu |
| 1038 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1039 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1040 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxAmpdu |
| 1041 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxAmpdu; |
| 1042 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxAmpdu |
| 1043 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxAmpdu; |
| 1044 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxAmpdu |
| 1045 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxAmpdu; |
| 1046 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxAmpdu |
| 1047 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxAmpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1048 | } |
| 1049 | else |
| 1050 | { |
| 1051 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in getting stats from TL")); |
| 1052 | } |
| 1053 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1054 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].txMcast = |
| 1055 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO]; |
| 1056 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].txMcast = |
| 1057 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI]; |
| 1058 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].txMcast = |
| 1059 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE]; |
| 1060 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].txMcast = |
| 1061 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK]; |
| 1062 | } |
| 1063 | else |
| 1064 | { |
| 1065 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Interface not Associated")); |
| 1066 | } |
| 1067 | |
| 1068 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1069 | |
| 1070 | if (nla_put_u32(vendor_event, |
| 1071 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX, |
| 1072 | pWifiIfaceStat->beaconRx) || |
| 1073 | nla_put_u32(vendor_event, |
| 1074 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_RX, |
| 1075 | pWifiIfaceStat->mgmtRx) || |
| 1076 | nla_put_u32(vendor_event, |
| 1077 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_RX, |
| 1078 | pWifiIfaceStat->mgmtActionRx) || |
| 1079 | nla_put_u32(vendor_event, |
| 1080 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_TX, |
| 1081 | pWifiIfaceStat->mgmtActionTx) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1082 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1083 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_MGMT, |
| 1084 | pWifiIfaceStat->rssiMgmt) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1085 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1086 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_DATA, |
| 1087 | pWifiIfaceStat->rssiData) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1088 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1089 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_ACK, |
| 1090 | pWifiIfaceStat->rssiAck)) |
| 1091 | { |
| 1092 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1093 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1094 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1095 | return FALSE; |
| 1096 | } |
| 1097 | |
| 1098 | wmmInfo = nla_nest_start(vendor_event, |
| 1099 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1100 | if(!wmmInfo) |
| 1101 | { |
| 1102 | vos_mem_free(pWifiIfaceStatTL); |
| 1103 | return FALSE; |
| 1104 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1105 | for (i = 0; i < WIFI_AC_MAX; i++) |
| 1106 | { |
| 1107 | struct nlattr *wmmStats; |
| 1108 | wmmStats = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1109 | if(!wmmStats) |
| 1110 | { |
| 1111 | vos_mem_free(pWifiIfaceStatTL); |
| 1112 | return FALSE; |
| 1113 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1114 | if (FALSE == put_wifi_wmm_ac_stat( |
| 1115 | &pWifiIfaceStat->AccessclassStats[i], |
| 1116 | vendor_event)) |
| 1117 | { |
| 1118 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1119 | FL("QCA_WLAN_VENDOR_ATTR put Fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1120 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1121 | return FALSE; |
| 1122 | } |
| 1123 | |
| 1124 | nla_nest_end(vendor_event, wmmStats); |
| 1125 | } |
| 1126 | nla_nest_end(vendor_event, wmmInfo); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1127 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1128 | return TRUE; |
| 1129 | } |
| 1130 | |
| 1131 | static tSirWifiInterfaceMode |
| 1132 | hdd_map_device_to_ll_iface_mode ( int deviceMode ) |
| 1133 | { |
| 1134 | switch (deviceMode) |
| 1135 | { |
| 1136 | case WLAN_HDD_INFRA_STATION: |
| 1137 | return WIFI_INTERFACE_STA; |
| 1138 | case WLAN_HDD_SOFTAP: |
| 1139 | return WIFI_INTERFACE_SOFTAP; |
| 1140 | case WLAN_HDD_P2P_CLIENT: |
| 1141 | return WIFI_INTERFACE_P2P_CLIENT; |
| 1142 | case WLAN_HDD_P2P_GO: |
| 1143 | return WIFI_INTERFACE_P2P_GO; |
| 1144 | case WLAN_HDD_IBSS: |
| 1145 | return WIFI_INTERFACE_IBSS; |
| 1146 | default: |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 1147 | return WIFI_INTERFACE_UNKNOWN; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1148 | } |
| 1149 | } |
| 1150 | |
| 1151 | static v_BOOL_t hdd_get_interface_info(hdd_adapter_t *pAdapter, |
| 1152 | tpSirWifiInterfaceInfo pInfo) |
| 1153 | { |
| 1154 | v_U8_t *staMac = NULL; |
| 1155 | hdd_station_ctx_t *pHddStaCtx; |
| 1156 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1157 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1158 | |
| 1159 | pInfo->mode = hdd_map_device_to_ll_iface_mode(pAdapter->device_mode); |
| 1160 | |
| 1161 | vos_mem_copy(pInfo->macAddr, |
| 1162 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 1163 | |
| 1164 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1165 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 1166 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))) |
| 1167 | { |
| 1168 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1169 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) |
| 1170 | { |
| 1171 | pInfo->state = WIFI_DISCONNECTED; |
| 1172 | } |
| 1173 | if (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) |
| 1174 | { |
| 1175 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1176 | "%s: Session ID %d, Connection is in progress", __func__, |
| 1177 | pAdapter->sessionId); |
| 1178 | pInfo->state = WIFI_ASSOCIATING; |
| 1179 | } |
| 1180 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 1181 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 1182 | { |
| 1183 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 1184 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1185 | "%s: client " MAC_ADDRESS_STR |
| 1186 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 1187 | MAC_ADDR_ARRAY(staMac)); |
| 1188 | pInfo->state = WIFI_AUTHENTICATING; |
| 1189 | } |
| 1190 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 1191 | { |
| 1192 | pInfo->state = WIFI_ASSOCIATED; |
| 1193 | vos_mem_copy(pInfo->bssid, |
| 1194 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 1195 | vos_mem_copy(pInfo->ssid, |
| 1196 | pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 1197 | pHddStaCtx->conn_info.SSID.SSID.length); |
| 1198 | //NULL Terminate the string. |
| 1199 | pInfo->ssid[pHddStaCtx->conn_info.SSID.SSID.length] = 0; |
| 1200 | } |
| 1201 | } |
| 1202 | vos_mem_copy(pInfo->countryStr, |
| 1203 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1204 | |
| 1205 | vos_mem_copy(pInfo->apCountryStr, |
| 1206 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1207 | |
| 1208 | return TRUE; |
| 1209 | } |
| 1210 | |
| 1211 | /* |
| 1212 | * hdd_link_layer_process_peer_stats () - This function is called after |
| 1213 | * receiving Link Layer Peer statistics from FW.This function converts |
| 1214 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1215 | * layers. |
| 1216 | */ |
| 1217 | static v_VOID_t hdd_link_layer_process_peer_stats(hdd_adapter_t *pAdapter, |
| 1218 | v_VOID_t *pData) |
| 1219 | { |
| 1220 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1221 | tpSirWifiRateStat pWifiRateStat; |
| 1222 | tpSirWifiPeerStat pWifiPeerStat; |
| 1223 | tpSirWifiPeerInfo pWifiPeerInfo; |
| 1224 | struct nlattr *peerInfo; |
| 1225 | struct sk_buff *vendor_event; |
| 1226 | int status, i; |
| 1227 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1228 | ENTER(); |
| 1229 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1230 | status = wlan_hdd_validate_context(pHddCtx); |
| 1231 | if (0 != status) |
| 1232 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1233 | return; |
| 1234 | } |
| 1235 | |
| 1236 | pWifiPeerStat = (tpSirWifiPeerStat) pData; |
| 1237 | |
| 1238 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1239 | "LL_STATS_PEER_ALL : numPeers %u", |
| 1240 | pWifiPeerStat->numPeers); |
| 1241 | { |
| 1242 | for (i = 0; i < pWifiPeerStat->numPeers; i++) |
| 1243 | { |
| 1244 | pWifiPeerInfo = (tpSirWifiPeerInfo) |
| 1245 | ((uint8 *)pWifiPeerStat->peerInfo + |
| 1246 | ( i * sizeof(tSirWifiPeerInfo))); |
| 1247 | |
Dasari Srinivas | 1be0c4e | 2014-10-19 13:03:41 +0530 | [diff] [blame] | 1248 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) { |
| 1249 | pWifiPeerInfo->type = WIFI_PEER_AP; |
| 1250 | } |
| 1251 | if (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) { |
| 1252 | pWifiPeerInfo->type = WIFI_PEER_P2P_GO; |
| 1253 | } |
| 1254 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1255 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1256 | " %d) LL_STATS Channel Stats " |
| 1257 | " Peer Type %u " |
| 1258 | " peerMacAddress %pM " |
| 1259 | " capabilities 0x%x " |
| 1260 | " numRate %u ", |
| 1261 | i, |
| 1262 | pWifiPeerInfo->type, |
| 1263 | pWifiPeerInfo->peerMacAddress, |
| 1264 | pWifiPeerInfo->capabilities, |
| 1265 | pWifiPeerInfo->numRate); |
| 1266 | { |
| 1267 | int j; |
| 1268 | for (j = 0; j < pWifiPeerInfo->numRate; j++) |
| 1269 | { |
| 1270 | pWifiRateStat = (tpSirWifiRateStat) |
| 1271 | ((tANI_U8 *) pWifiPeerInfo->rateStats + |
| 1272 | ( j * sizeof(tSirWifiRateStat))); |
| 1273 | |
| 1274 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1275 | " peer Rate Stats " |
| 1276 | " preamble %u " |
| 1277 | " nss %u " |
| 1278 | " bw %u " |
| 1279 | " rateMcsIdx %u " |
| 1280 | " reserved %u " |
| 1281 | " bitrate %u " |
| 1282 | " txMpdu %u " |
| 1283 | " rxMpdu %u " |
| 1284 | " mpduLost %u " |
| 1285 | " retries %u " |
| 1286 | " retriesShort %u " |
| 1287 | " retriesLong %u", |
| 1288 | pWifiRateStat->rate.preamble, |
| 1289 | pWifiRateStat->rate.nss, |
| 1290 | pWifiRateStat->rate.bw, |
| 1291 | pWifiRateStat->rate.rateMcsIdx, |
| 1292 | pWifiRateStat->rate.reserved, |
| 1293 | pWifiRateStat->rate.bitrate, |
| 1294 | pWifiRateStat->txMpdu, |
| 1295 | pWifiRateStat->rxMpdu, |
| 1296 | pWifiRateStat->mpduLost, |
| 1297 | pWifiRateStat->retries, |
| 1298 | pWifiRateStat->retriesShort, |
| 1299 | pWifiRateStat->retriesLong); |
| 1300 | } |
| 1301 | } |
| 1302 | } |
| 1303 | } |
| 1304 | |
| 1305 | /* |
| 1306 | * Allocate a size of 4096 for the peer stats comprising |
| 1307 | * each of size = sizeof (tSirWifiPeerInfo) + numRate * |
| 1308 | * sizeof (tSirWifiRateStat).Each field is put with an |
| 1309 | * NL attribute.The size of 4096 is considered assuming |
| 1310 | * that number of rates shall not exceed beyond 50 with |
| 1311 | * the sizeof (tSirWifiRateStat) being 32. |
| 1312 | */ |
| 1313 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1314 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1315 | QCA_NL80211_VENDOR_SUBCMD_LL_PEER_INFO_STATS_INDEX, |
| 1316 | GFP_KERNEL); |
| 1317 | if (!vendor_event) |
| 1318 | { |
| 1319 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1320 | "%s: cfg80211_vendor_event_alloc failed", |
| 1321 | __func__); |
| 1322 | return; |
| 1323 | } |
| 1324 | if (nla_put_u32(vendor_event, |
| 1325 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS, |
| 1326 | pWifiPeerStat->numPeers)) |
| 1327 | { |
| 1328 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1329 | "%s: QCA_WLAN_VENDOR_ATTR put fail", __func__); |
| 1330 | kfree_skb(vendor_event); |
| 1331 | return; |
| 1332 | } |
| 1333 | |
| 1334 | peerInfo = nla_nest_start(vendor_event, |
| 1335 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1336 | if(!peerInfo) |
| 1337 | { |
| 1338 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1339 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO put fail", |
| 1340 | __func__); |
| 1341 | kfree_skb(vendor_event); |
| 1342 | return; |
| 1343 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1344 | |
| 1345 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1346 | pWifiPeerStat->peerInfo); |
| 1347 | |
| 1348 | for (i = 1; i <= pWifiPeerStat->numPeers; i++) |
| 1349 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1350 | int numRate = pWifiPeerInfo->numRate; |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1351 | struct nlattr *peers = nla_nest_start(vendor_event, i); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1352 | |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1353 | if(!peers) |
| 1354 | { |
| 1355 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1356 | "%s: peer stats put fail", |
| 1357 | __func__); |
| 1358 | kfree_skb(vendor_event); |
| 1359 | return; |
| 1360 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1361 | if (FALSE == put_wifi_peer_info( |
| 1362 | pWifiPeerInfo, vendor_event)) |
| 1363 | { |
| 1364 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1365 | "%s: put_wifi_peer_info put fail", __func__); |
| 1366 | kfree_skb(vendor_event); |
| 1367 | return; |
| 1368 | } |
| 1369 | |
| 1370 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1371 | pWifiPeerStat->peerInfo + |
| 1372 | (i * sizeof(tSirWifiPeerInfo)) + |
| 1373 | (numRate * sizeof (tSirWifiRateStat))); |
| 1374 | nla_nest_end(vendor_event, peers); |
| 1375 | } |
| 1376 | nla_nest_end(vendor_event, peerInfo); |
| 1377 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1378 | |
| 1379 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1380 | } |
| 1381 | |
| 1382 | /* |
| 1383 | * hdd_link_layer_process_iface_stats () - This function is called after |
| 1384 | * receiving Link Layer Interface statistics from FW.This function converts |
| 1385 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1386 | * layers. |
| 1387 | */ |
| 1388 | static v_VOID_t hdd_link_layer_process_iface_stats(hdd_adapter_t *pAdapter, |
| 1389 | v_VOID_t *pData) |
| 1390 | { |
| 1391 | tpSirWifiIfaceStat pWifiIfaceStat; |
| 1392 | struct sk_buff *vendor_event; |
| 1393 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1394 | int status; |
| 1395 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1396 | ENTER(); |
| 1397 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1398 | status = wlan_hdd_validate_context(pHddCtx); |
| 1399 | if (0 != status) |
| 1400 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1401 | return; |
| 1402 | } |
| 1403 | /* |
| 1404 | * Allocate a size of 4096 for the interface stats comprising |
| 1405 | * sizeof (tpSirWifiIfaceStat).The size of 4096 is considered |
| 1406 | * assuming that all these fit with in the limit.Please take |
| 1407 | * a call on the limit based on the data requirements on |
| 1408 | * interface statistics. |
| 1409 | */ |
| 1410 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1411 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1412 | QCA_NL80211_VENDOR_SUBCMD_LL_IFACE_STATS_INDEX, |
| 1413 | GFP_KERNEL); |
| 1414 | if (!vendor_event) |
| 1415 | { |
| 1416 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1417 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1418 | return; |
| 1419 | } |
| 1420 | |
| 1421 | pWifiIfaceStat = (tpSirWifiIfaceStat) pData; |
| 1422 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1423 | |
| 1424 | if (FALSE == hdd_get_interface_info( pAdapter, |
| 1425 | &pWifiIfaceStat->info)) |
| 1426 | { |
| 1427 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1428 | FL("hdd_get_interface_info get fail") ); |
| 1429 | kfree_skb(vendor_event); |
| 1430 | return; |
| 1431 | } |
| 1432 | |
| 1433 | if (FALSE == put_wifi_iface_stats( pAdapter, pWifiIfaceStat, |
| 1434 | vendor_event)) |
| 1435 | { |
| 1436 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1437 | FL("put_wifi_iface_stats fail") ); |
| 1438 | kfree_skb(vendor_event); |
| 1439 | return; |
| 1440 | } |
| 1441 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1442 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1443 | "WMI_LINK_STATS_IFACE Data"); |
| 1444 | |
| 1445 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1446 | "LL_STATS_IFACE: " |
| 1447 | " Mode %u " |
| 1448 | " MAC %pM " |
| 1449 | " State %u " |
| 1450 | " Roaming %u " |
| 1451 | " capabilities 0x%x " |
| 1452 | " SSID %s " |
| 1453 | " BSSID %pM", |
| 1454 | pWifiIfaceStat->info.mode, |
| 1455 | pWifiIfaceStat->info.macAddr, |
| 1456 | pWifiIfaceStat->info.state, |
| 1457 | pWifiIfaceStat->info.roaming, |
| 1458 | pWifiIfaceStat->info.capabilities, |
| 1459 | pWifiIfaceStat->info.ssid, |
| 1460 | pWifiIfaceStat->info.bssid); |
| 1461 | |
| 1462 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1463 | " AP country str: %c%c%c", |
| 1464 | pWifiIfaceStat->info.apCountryStr[0], |
| 1465 | pWifiIfaceStat->info.apCountryStr[1], |
| 1466 | pWifiIfaceStat->info.apCountryStr[2]); |
| 1467 | |
| 1468 | |
| 1469 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1470 | " Country Str Association: %c%c%c", |
| 1471 | pWifiIfaceStat->info.countryStr[0], |
| 1472 | pWifiIfaceStat->info.countryStr[1], |
| 1473 | pWifiIfaceStat->info.countryStr[2]); |
| 1474 | |
| 1475 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1476 | " beaconRx %u " |
| 1477 | " mgmtRx %u " |
| 1478 | " mgmtActionRx %u " |
| 1479 | " mgmtActionTx %u " |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1480 | " rssiMgmt %d " |
| 1481 | " rssiData %d " |
| 1482 | " rssiAck %d", |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1483 | pWifiIfaceStat->beaconRx, |
| 1484 | pWifiIfaceStat->mgmtRx, |
| 1485 | pWifiIfaceStat->mgmtActionRx, |
| 1486 | pWifiIfaceStat->mgmtActionTx, |
| 1487 | pWifiIfaceStat->rssiMgmt, |
| 1488 | pWifiIfaceStat->rssiData, |
| 1489 | pWifiIfaceStat->rssiAck ); |
| 1490 | |
| 1491 | |
| 1492 | { |
| 1493 | int i; |
| 1494 | for (i = 0 ; i < WIFI_AC_MAX; i ++) |
| 1495 | { |
| 1496 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1497 | |
| 1498 | " %d) LL_STATS IFACE: " |
| 1499 | " ac: %u txMpdu: %u " |
| 1500 | " rxMpdu: %u txMcast: %u " |
| 1501 | " rxMcast: %u rxAmpdu: %u " |
| 1502 | " txAmpdu: %u mpduLost: %u " |
| 1503 | " retries: %u retriesShort: %u " |
| 1504 | " retriesLong: %u contentionTimeMin: %u " |
| 1505 | " contentionTimeMax: %u contentionTimeAvg: %u " |
| 1506 | " contentionNumSamples: %u", |
| 1507 | i, |
| 1508 | pWifiIfaceStat->AccessclassStats[i].ac, |
| 1509 | pWifiIfaceStat->AccessclassStats[i].txMpdu, |
| 1510 | pWifiIfaceStat->AccessclassStats[i].rxMpdu, |
| 1511 | pWifiIfaceStat->AccessclassStats[i].txMcast, |
| 1512 | pWifiIfaceStat->AccessclassStats[i].rxMcast, |
| 1513 | pWifiIfaceStat->AccessclassStats[i].rxAmpdu, |
| 1514 | pWifiIfaceStat->AccessclassStats[i].txAmpdu, |
| 1515 | pWifiIfaceStat->AccessclassStats[i].mpduLost, |
| 1516 | pWifiIfaceStat->AccessclassStats[i].retries, |
| 1517 | pWifiIfaceStat-> |
| 1518 | AccessclassStats[i].retriesShort, |
| 1519 | pWifiIfaceStat->AccessclassStats[i].retriesLong, |
| 1520 | pWifiIfaceStat-> |
| 1521 | AccessclassStats[i].contentionTimeMin, |
| 1522 | pWifiIfaceStat-> |
| 1523 | AccessclassStats[i].contentionTimeMax, |
| 1524 | pWifiIfaceStat-> |
| 1525 | AccessclassStats[i].contentionTimeAvg, |
| 1526 | pWifiIfaceStat-> |
| 1527 | AccessclassStats[i].contentionNumSamples); |
| 1528 | |
| 1529 | } |
| 1530 | } |
| 1531 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1532 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1533 | |
| 1534 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1535 | } |
| 1536 | |
| 1537 | /* |
| 1538 | * hdd_link_layer_process_radio_stats () - This function is called after |
| 1539 | * receiving Link Layer Radio statistics from FW.This function converts |
| 1540 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1541 | * layers. |
| 1542 | */ |
| 1543 | static v_VOID_t hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, |
| 1544 | v_VOID_t *pData) |
| 1545 | { |
| 1546 | int status, i; |
| 1547 | tpSirWifiRadioStat pWifiRadioStat; |
| 1548 | tpSirWifiChannelStats pWifiChannelStats; |
| 1549 | struct sk_buff *vendor_event; |
| 1550 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1551 | struct nlattr *chList; |
| 1552 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1553 | ENTER(); |
| 1554 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1555 | status = wlan_hdd_validate_context(pHddCtx); |
| 1556 | if (0 != status) |
| 1557 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1558 | return; |
| 1559 | } |
| 1560 | pWifiRadioStat = (tpSirWifiRadioStat) pData; |
| 1561 | |
| 1562 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1563 | "LL_STATS_RADIO" |
| 1564 | " radio is %d onTime is %u " |
| 1565 | " txTime is %u rxTime is %u " |
| 1566 | " onTimeScan is %u onTimeNbd is %u " |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1567 | " onTimeEXTScan is %u onTimeRoamScan is %u " |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1568 | " onTimePnoScan is %u onTimeHs20 is %u " |
| 1569 | " numChannels is %u", |
| 1570 | pWifiRadioStat->radio, pWifiRadioStat->onTime, |
| 1571 | pWifiRadioStat->txTime, pWifiRadioStat->rxTime, |
| 1572 | pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1573 | pWifiRadioStat->onTimeEXTScan, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1574 | pWifiRadioStat->onTimeRoamScan, |
| 1575 | pWifiRadioStat->onTimePnoScan, |
| 1576 | pWifiRadioStat->onTimeHs20, |
| 1577 | pWifiRadioStat->numChannels); |
| 1578 | /* |
| 1579 | * Allocate a size of 4096 for the Radio stats comprising |
| 1580 | * sizeof (tSirWifiRadioStat) + numChannels * sizeof |
| 1581 | * (tSirWifiChannelStats).Each channel data is put with an |
| 1582 | * NL attribute.The size of 4096 is considered assuming that |
| 1583 | * number of channels shall not exceed beyond 60 with the |
| 1584 | * sizeof (tSirWifiChannelStats) being 24 bytes. |
| 1585 | */ |
| 1586 | |
| 1587 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1588 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN , |
| 1589 | QCA_NL80211_VENDOR_SUBCMD_LL_RADIO_STATS_INDEX, |
| 1590 | GFP_KERNEL); |
| 1591 | |
| 1592 | if (!vendor_event) |
| 1593 | { |
| 1594 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1595 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1596 | return; |
| 1597 | } |
| 1598 | |
| 1599 | if (nla_put_u32(vendor_event, |
| 1600 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID, |
| 1601 | pWifiRadioStat->radio) || |
| 1602 | nla_put_u32(vendor_event, |
| 1603 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME, |
| 1604 | pWifiRadioStat->onTime) || |
| 1605 | nla_put_u32(vendor_event, |
| 1606 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME, |
| 1607 | pWifiRadioStat->txTime) || |
| 1608 | nla_put_u32(vendor_event, |
| 1609 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME, |
| 1610 | pWifiRadioStat->rxTime) || |
| 1611 | nla_put_u32(vendor_event, |
| 1612 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN, |
| 1613 | pWifiRadioStat->onTimeScan) || |
| 1614 | nla_put_u32(vendor_event, |
| 1615 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD, |
| 1616 | pWifiRadioStat->onTimeNbd) || |
| 1617 | nla_put_u32(vendor_event, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1618 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_EXTSCAN, |
| 1619 | pWifiRadioStat->onTimeEXTScan)|| |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1620 | nla_put_u32(vendor_event, |
| 1621 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN, |
| 1622 | pWifiRadioStat->onTimeRoamScan) || |
| 1623 | nla_put_u32(vendor_event, |
| 1624 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN, |
| 1625 | pWifiRadioStat->onTimePnoScan) || |
| 1626 | nla_put_u32(vendor_event, |
| 1627 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20, |
| 1628 | pWifiRadioStat->onTimeHs20) || |
| 1629 | nla_put_u32(vendor_event, |
| 1630 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS, |
| 1631 | pWifiRadioStat->numChannels)) |
| 1632 | { |
| 1633 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1634 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1635 | kfree_skb(vendor_event); |
| 1636 | return ; |
| 1637 | } |
| 1638 | |
| 1639 | chList = nla_nest_start(vendor_event, |
| 1640 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1641 | if(!chList) |
| 1642 | { |
| 1643 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1644 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO put fail", |
| 1645 | __func__); |
| 1646 | kfree_skb(vendor_event); |
| 1647 | return; |
| 1648 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1649 | for (i = 0; i < pWifiRadioStat->numChannels; i++) |
| 1650 | { |
| 1651 | struct nlattr *chInfo; |
| 1652 | |
| 1653 | pWifiChannelStats = (tpSirWifiChannelStats) ((uint8*) |
| 1654 | pWifiRadioStat->channels + |
| 1655 | (i * sizeof(tSirWifiChannelStats))); |
| 1656 | |
| 1657 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1658 | " %d) Channel Info" |
| 1659 | " width is %u " |
| 1660 | " CenterFreq %u " |
| 1661 | " CenterFreq0 %u " |
| 1662 | " CenterFreq1 %u " |
| 1663 | " onTime %u " |
| 1664 | " ccaBusyTime %u", |
| 1665 | i, |
| 1666 | pWifiChannelStats->channel.width, |
| 1667 | pWifiChannelStats->channel.centerFreq, |
| 1668 | pWifiChannelStats->channel.centerFreq0, |
| 1669 | pWifiChannelStats->channel.centerFreq1, |
| 1670 | pWifiChannelStats->onTime, |
| 1671 | pWifiChannelStats->ccaBusyTime); |
| 1672 | |
| 1673 | |
| 1674 | chInfo = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1675 | if(!chInfo) |
| 1676 | { |
| 1677 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1678 | "%s: failed to put chInfo", |
| 1679 | __func__); |
| 1680 | kfree_skb(vendor_event); |
| 1681 | return; |
| 1682 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1683 | |
| 1684 | if (nla_put_u32(vendor_event, |
| 1685 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH, |
| 1686 | pWifiChannelStats->channel.width) || |
| 1687 | nla_put_u32(vendor_event, |
| 1688 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ, |
| 1689 | pWifiChannelStats->channel.centerFreq) || |
| 1690 | nla_put_u32(vendor_event, |
| 1691 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ0, |
| 1692 | pWifiChannelStats->channel.centerFreq0) || |
| 1693 | nla_put_u32(vendor_event, |
| 1694 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ1, |
| 1695 | pWifiChannelStats->channel.centerFreq1) || |
| 1696 | nla_put_u32(vendor_event, |
| 1697 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME, |
| 1698 | pWifiChannelStats->onTime) || |
| 1699 | nla_put_u32(vendor_event, |
| 1700 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME, |
| 1701 | pWifiChannelStats->ccaBusyTime)) |
| 1702 | { |
| 1703 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1704 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1705 | kfree_skb(vendor_event); |
| 1706 | return ; |
| 1707 | } |
| 1708 | nla_nest_end(vendor_event, chInfo); |
| 1709 | } |
| 1710 | nla_nest_end(vendor_event, chList); |
| 1711 | |
| 1712 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1713 | |
| 1714 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1715 | return; |
| 1716 | } |
| 1717 | |
| 1718 | /* |
| 1719 | * hdd_link_layer_stats_ind_callback () - This function is called after |
| 1720 | * receiving Link Layer indications from FW.This callback converts the firmware |
| 1721 | * data to the NL data and send the same to the kernel/upper layers. |
| 1722 | */ |
| 1723 | static void hdd_link_layer_stats_ind_callback ( void *pCtx, |
| 1724 | int indType, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1725 | void *pRsp, u8 *macAddr) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1726 | { |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1727 | hdd_context_t *pHddCtx = (hdd_context_t *)pCtx; |
| 1728 | hdd_adapter_t *pAdapter = NULL; |
| 1729 | tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults)pRsp; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1730 | int status; |
| 1731 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1732 | ENTER(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1733 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1734 | status = wlan_hdd_validate_context(pHddCtx); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1735 | if (0 != status) |
| 1736 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1737 | return; |
| 1738 | } |
| 1739 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1740 | pAdapter = hdd_get_adapter_by_macaddr(pHddCtx, macAddr); |
| 1741 | if (NULL == pAdapter) |
| 1742 | { |
| 1743 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1744 | FL(" MAC address %pM does not exist with host"), |
| 1745 | macAddr); |
| 1746 | return; |
| 1747 | } |
| 1748 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1749 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1750 | "%s: Interface: %s LLStats indType: %d", __func__, |
| 1751 | pAdapter->dev->name, indType); |
| 1752 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1753 | switch (indType) |
| 1754 | { |
| 1755 | case SIR_HAL_LL_STATS_RESULTS_RSP: |
| 1756 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1757 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1758 | FL("RESPONSE SIR_HAL_LL_STATS_RESULTS_RSP") ); |
| 1759 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1760 | "LL_STATS RESULTS RESPONSE paramID = 0x%x", |
| 1761 | linkLayerStatsResults->paramId); |
| 1762 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1763 | "LL_STATS RESULTS RESPONSE ifaceId = %u MAC: %pM", |
| 1764 | linkLayerStatsResults->ifaceId, macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1765 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1766 | "LL_STATS RESULTS RESPONSE respId = %u", |
| 1767 | linkLayerStatsResults->respId); |
| 1768 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1769 | "LL_STATS RESULTS RESPONSE moreResultToFollow = %u", |
| 1770 | linkLayerStatsResults->moreResultToFollow); |
| 1771 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1772 | "LL_STATS RESULTS RESPONSE result = %p", |
| 1773 | linkLayerStatsResults->result); |
| 1774 | if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO ) |
| 1775 | { |
| 1776 | hdd_link_layer_process_radio_stats(pAdapter, |
| 1777 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1778 | } |
| 1779 | else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE ) |
| 1780 | { |
| 1781 | hdd_link_layer_process_iface_stats(pAdapter, |
| 1782 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1783 | } |
| 1784 | else if ( linkLayerStatsResults->paramId & |
| 1785 | WMI_LINK_STATS_ALL_PEER ) |
| 1786 | { |
| 1787 | hdd_link_layer_process_peer_stats(pAdapter, |
| 1788 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1789 | } /* WMI_LINK_STATS_ALL_PEER */ |
| 1790 | else |
| 1791 | { |
| 1792 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1793 | FL("INVALID LL_STATS_NOTIFY RESPONSE ***********")); |
| 1794 | } |
| 1795 | |
| 1796 | break; |
| 1797 | } |
| 1798 | default: |
| 1799 | hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType); |
| 1800 | break; |
| 1801 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1802 | |
| 1803 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1804 | return; |
| 1805 | } |
| 1806 | |
| 1807 | const struct |
| 1808 | nla_policy |
| 1809 | qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX +1] = |
| 1810 | { |
| 1811 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = |
| 1812 | { .type = NLA_U32 }, |
| 1813 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = |
| 1814 | { .type = NLA_U32 }, |
| 1815 | }; |
| 1816 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1817 | static int __wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1818 | struct wireless_dev *wdev, |
| 1819 | const void *data, |
| 1820 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1821 | { |
| 1822 | int status; |
| 1823 | 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] | 1824 | tSirLLStatsSetReq linkLayerStatsSetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1825 | struct net_device *dev = wdev->netdev; |
| 1826 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1827 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1828 | hdd_station_ctx_t *pHddStaCtx; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1829 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1830 | ENTER(); |
| 1831 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1832 | status = wlan_hdd_validate_context(pHddCtx); |
| 1833 | if (0 != status) |
| 1834 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1835 | return -EINVAL; |
| 1836 | } |
| 1837 | |
| 1838 | if (NULL == pAdapter) |
| 1839 | { |
| 1840 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1841 | FL("HDD adapter is Null")); |
| 1842 | return -ENODEV; |
| 1843 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1844 | /* check the LLStats Capability */ |
| 1845 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1846 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1847 | { |
| 1848 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1849 | FL("Link Layer Statistics not supported by Firmware")); |
| 1850 | return -EINVAL; |
| 1851 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1852 | |
| 1853 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, |
| 1854 | (struct nlattr *)data, |
| 1855 | data_len, qca_wlan_vendor_ll_set_policy)) |
| 1856 | { |
| 1857 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1858 | return -EINVAL; |
| 1859 | } |
| 1860 | if (!tb_vendor |
| 1861 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]) |
| 1862 | { |
| 1863 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MPDU size Not present")); |
| 1864 | return -EINVAL; |
| 1865 | } |
| 1866 | if (!tb_vendor[ |
| 1867 | QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]) |
| 1868 | { |
| 1869 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Stats Gathering Not Present")); |
| 1870 | return -EINVAL; |
| 1871 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1872 | // 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] | 1873 | linkLayerStatsSetReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1874 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1875 | linkLayerStatsSetReq.mpduSizeThreshold = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1876 | nla_get_u32( |
| 1877 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]); |
| 1878 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1879 | linkLayerStatsSetReq.aggressiveStatisticsGathering = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1880 | nla_get_u32( |
| 1881 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]); |
| 1882 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1883 | vos_mem_copy(linkLayerStatsSetReq.macAddr, |
| 1884 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1885 | |
| 1886 | |
| 1887 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1888 | "LL_STATS_SET reqId = %d", linkLayerStatsSetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1889 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1890 | "LL_STATS_SET MAC = %pM", linkLayerStatsSetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1891 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1892 | "LL_STATS_SET mpduSizeThreshold = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1893 | linkLayerStatsSetReq.mpduSizeThreshold); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1894 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1895 | "LL_STATS_SET aggressive Statistics Gathering = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1896 | linkLayerStatsSetReq.aggressiveStatisticsGathering); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1897 | |
| 1898 | if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB( |
| 1899 | pHddCtx->hHal, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1900 | hdd_link_layer_stats_ind_callback)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1901 | { |
| 1902 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1903 | "sme_SetLinkLayerStatsIndCB Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1904 | return -EINVAL; |
| 1905 | |
| 1906 | } |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1907 | |
| 1908 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1909 | if (VOS_STATUS_SUCCESS != |
| 1910 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1911 | pHddStaCtx->conn_info.staId[0], WIFI_STATS_IFACE)) |
| 1912 | { |
| 1913 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1914 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 1915 | return -EINVAL; |
| 1916 | } |
| 1917 | |
| 1918 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 1919 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 1920 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 1921 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 1922 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1923 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1924 | &linkLayerStatsSetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1925 | { |
| 1926 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1927 | "sme_LLStatsSetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1928 | return -EINVAL; |
| 1929 | } |
| 1930 | |
| 1931 | pAdapter->isLinkLayerStatsSet = 1; |
| 1932 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1933 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1934 | return 0; |
| 1935 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1936 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1937 | struct wireless_dev *wdev, |
| 1938 | const void *data, |
| 1939 | int data_len) |
| 1940 | { |
| 1941 | int ret = 0; |
| 1942 | |
| 1943 | vos_ssr_protect(__func__); |
| 1944 | ret = __wlan_hdd_cfg80211_ll_stats_set(wiphy, wdev, data, data_len); |
| 1945 | vos_ssr_unprotect(__func__); |
| 1946 | |
| 1947 | return ret; |
| 1948 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1949 | |
| 1950 | const struct |
| 1951 | nla_policy |
| 1952 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 1953 | { |
| 1954 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 1955 | * command. When reporting |
| 1956 | * the stats results, the driver uses the same value to indicate |
| 1957 | * which GET request the results |
| 1958 | * correspond to. |
| 1959 | */ |
| 1960 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 1961 | |
| 1962 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 1963 | requested for retrieval */ |
| 1964 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 1965 | }; |
| 1966 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1967 | static int __wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1968 | struct wireless_dev *wdev, |
| 1969 | const void *data, |
| 1970 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1971 | { |
| 1972 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1973 | 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] | 1974 | tSirLLStatsGetReq linkLayerStatsGetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1975 | struct net_device *dev = wdev->netdev; |
| 1976 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1977 | int status; |
| 1978 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1979 | ENTER(); |
| 1980 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1981 | status = wlan_hdd_validate_context(pHddCtx); |
| 1982 | if (0 != status) |
| 1983 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1984 | return -EINVAL ; |
| 1985 | } |
| 1986 | |
| 1987 | if (NULL == pAdapter) |
| 1988 | { |
| 1989 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1990 | "%s: HDD adapter is Null", __func__); |
| 1991 | return -ENODEV; |
| 1992 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1993 | /* check the LLStats Capability */ |
| 1994 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1995 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1996 | { |
| 1997 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1998 | FL("Link Layer Statistics not supported by Firmware")); |
| 1999 | return -EINVAL; |
| 2000 | } |
| 2001 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2002 | |
| 2003 | if (!pAdapter->isLinkLayerStatsSet) |
| 2004 | { |
| 2005 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2006 | "%s: isLinkLayerStatsSet : %d", |
| 2007 | __func__, pAdapter->isLinkLayerStatsSet); |
| 2008 | return -EINVAL; |
| 2009 | } |
| 2010 | |
| 2011 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 2012 | (struct nlattr *)data, |
| 2013 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 2014 | { |
| 2015 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 2016 | return -EINVAL; |
| 2017 | } |
| 2018 | |
| 2019 | if (!tb_vendor |
| 2020 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 2021 | { |
| 2022 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 2023 | return -EINVAL; |
| 2024 | } |
| 2025 | |
| 2026 | if (!tb_vendor |
| 2027 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 2028 | { |
| 2029 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 2030 | return -EINVAL; |
| 2031 | } |
| 2032 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2033 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2034 | linkLayerStatsGetReq.reqId = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2035 | nla_get_u32( tb_vendor[ |
| 2036 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2037 | linkLayerStatsGetReq.paramIdMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2038 | nla_get_u32( tb_vendor[ |
| 2039 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 2040 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2041 | vos_mem_copy(linkLayerStatsGetReq.macAddr, |
| 2042 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2043 | |
| 2044 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2045 | "LL_STATS_GET reqId = %d", linkLayerStatsGetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2046 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2047 | "LL_STATS_GET MAC = %pM", linkLayerStatsGetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2048 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2049 | "LL_STATS_GET paramIdMask = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2050 | linkLayerStatsGetReq.paramIdMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2051 | |
| 2052 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2053 | &linkLayerStatsGetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2054 | { |
| 2055 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2056 | "sme_LLStatsGetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2057 | return -EINVAL; |
| 2058 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2059 | |
| 2060 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2061 | return 0; |
| 2062 | } |
| 2063 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2064 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 2065 | struct wireless_dev *wdev, |
| 2066 | const void *data, |
| 2067 | int data_len) |
| 2068 | { |
| 2069 | int ret = 0; |
| 2070 | |
| 2071 | vos_ssr_protect(__func__); |
| 2072 | ret = __wlan_hdd_cfg80211_ll_stats_get(wiphy, wdev, data, data_len); |
| 2073 | vos_ssr_unprotect(__func__); |
| 2074 | |
| 2075 | return ret; |
| 2076 | } |
| 2077 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2078 | const struct |
| 2079 | nla_policy |
| 2080 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 2081 | { |
| 2082 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 2083 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 2084 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 2085 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 2086 | }; |
| 2087 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2088 | static int __wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 2089 | struct wireless_dev *wdev, |
| 2090 | const void *data, |
| 2091 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2092 | { |
| 2093 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 2094 | 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] | 2095 | tSirLLStatsClearReq linkLayerStatsClearReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2096 | struct net_device *dev = wdev->netdev; |
| 2097 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2098 | u32 statsClearReqMask; |
| 2099 | u8 stopReq; |
| 2100 | int status; |
| 2101 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2102 | ENTER(); |
| 2103 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2104 | status = wlan_hdd_validate_context(pHddCtx); |
| 2105 | if (0 != status) |
| 2106 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2107 | return -EINVAL; |
| 2108 | } |
| 2109 | |
| 2110 | if (NULL == pAdapter) |
| 2111 | { |
| 2112 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2113 | "%s: HDD adapter is Null", __func__); |
| 2114 | return -ENODEV; |
| 2115 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2116 | /* check the LLStats Capability */ |
| 2117 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 2118 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 2119 | { |
| 2120 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2121 | FL("Enable LLStats Capability")); |
| 2122 | return -EINVAL; |
| 2123 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2124 | |
| 2125 | if (!pAdapter->isLinkLayerStatsSet) |
| 2126 | { |
| 2127 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2128 | "%s: isLinkLayerStatsSet : %d", |
| 2129 | __func__, pAdapter->isLinkLayerStatsSet); |
| 2130 | return -EINVAL; |
| 2131 | } |
| 2132 | |
| 2133 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 2134 | (struct nlattr *)data, |
| 2135 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 2136 | { |
| 2137 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 2138 | return -EINVAL; |
| 2139 | } |
| 2140 | |
| 2141 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 2142 | |
| 2143 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 2144 | { |
| 2145 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 2146 | return -EINVAL; |
| 2147 | |
| 2148 | } |
| 2149 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2150 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2151 | statsClearReqMask = linkLayerStatsClearReq.statsClearReqMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2152 | nla_get_u32( |
| 2153 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 2154 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2155 | stopReq = linkLayerStatsClearReq.stopReq = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2156 | nla_get_u8( |
| 2157 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 2158 | |
| 2159 | // 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] | 2160 | linkLayerStatsClearReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2161 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2162 | vos_mem_copy(linkLayerStatsClearReq.macAddr, |
| 2163 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2164 | |
| 2165 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2166 | "LL_STATS_CLEAR reqId = %d", linkLayerStatsClearReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2167 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2168 | "LL_STATS_CLEAR MAC = %pM", linkLayerStatsClearReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2169 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2170 | "LL_STATS_CLEAR statsClearReqMask = 0x%X", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2171 | linkLayerStatsClearReq.statsClearReqMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2172 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2173 | "LL_STATS_CLEAR stopReq = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2174 | linkLayerStatsClearReq.stopReq); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2175 | |
| 2176 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2177 | &linkLayerStatsClearReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2178 | { |
| 2179 | struct sk_buff *temp_skbuff; |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 2180 | hdd_station_ctx_t *pHddStaCtx; |
| 2181 | |
| 2182 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2183 | if (VOS_STATUS_SUCCESS != |
| 2184 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 2185 | pHddStaCtx->conn_info.staId[0], statsClearReqMask)) |
| 2186 | { |
| 2187 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2188 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 2189 | return -EINVAL; |
| 2190 | } |
| 2191 | if ((statsClearReqMask & WIFI_STATS_IFACE_AC) || |
| 2192 | (statsClearReqMask & WIFI_STATS_IFACE)) { |
| 2193 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 2194 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 2195 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 2196 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 2197 | } |
| 2198 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2199 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 2200 | 2 * sizeof(u32) + |
| 2201 | NLMSG_HDRLEN); |
| 2202 | |
| 2203 | if (temp_skbuff != NULL) |
| 2204 | { |
| 2205 | |
| 2206 | if (nla_put_u32(temp_skbuff, |
| 2207 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 2208 | statsClearReqMask) || |
| 2209 | nla_put_u32(temp_skbuff, |
| 2210 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 2211 | stopReq)) |
| 2212 | { |
| 2213 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 2214 | kfree_skb(temp_skbuff); |
| 2215 | return -EINVAL; |
| 2216 | } |
| 2217 | /* If the ask is to stop the stats collection as part of clear |
| 2218 | * (stopReq = 1) , ensure that no further requests of get |
| 2219 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 2220 | * However it the stopReq as part of the clear request is 0 , |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2221 | * the request to get the statistics are honoured as in this |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2222 | * case the firmware is just asked to clear the statistics. |
| 2223 | */ |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2224 | if (linkLayerStatsClearReq.stopReq == 1) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2225 | pAdapter->isLinkLayerStatsSet = 0; |
| 2226 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 2227 | } |
| 2228 | return -ENOMEM; |
| 2229 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2230 | |
| 2231 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2232 | return -EINVAL; |
| 2233 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2234 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 2235 | struct wireless_dev *wdev, |
| 2236 | const void *data, |
| 2237 | int data_len) |
| 2238 | { |
| 2239 | int ret = 0; |
| 2240 | |
| 2241 | vos_ssr_protect(__func__); |
| 2242 | ret = __wlan_hdd_cfg80211_ll_stats_clear(wiphy, wdev, data, data_len); |
| 2243 | vos_ssr_unprotect(__func__); |
| 2244 | |
| 2245 | return ret; |
| 2246 | |
| 2247 | |
| 2248 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2249 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 2250 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2251 | #ifdef WLAN_FEATURE_EXTSCAN |
| 2252 | static const struct nla_policy |
| 2253 | wlan_hdd_extscan_config_policy |
| 2254 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = |
| 2255 | { |
| 2256 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = |
| 2257 | { .type = NLA_U32 }, |
| 2258 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = |
| 2259 | { .type = NLA_U32 }, |
| 2260 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 }, |
| 2261 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = |
| 2262 | { .type = NLA_U32 }, |
| 2263 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = { .type = NLA_U8 }, |
| 2264 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = { .type = NLA_U8 }, |
| 2265 | |
| 2266 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = { .type = NLA_U8 }, |
| 2267 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = { .type = NLA_U8 }, |
| 2268 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 }, |
| 2269 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = |
| 2270 | { .type = NLA_U8 }, |
| 2271 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = |
| 2272 | { .type = NLA_U32 }, |
| 2273 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = |
| 2274 | { .type = NLA_U32 }, |
| 2275 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = |
| 2276 | { .type = NLA_U32 }, |
| 2277 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD] = |
| 2278 | { .type = NLA_U8 }, |
| 2279 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = |
| 2280 | { .type = NLA_U8 }, |
| 2281 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = |
| 2282 | { .type = NLA_U8 }, |
| 2283 | |
| 2284 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = |
| 2285 | { .type = NLA_U32 }, |
| 2286 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = |
| 2287 | { .type = NLA_UNSPEC }, |
| 2288 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = |
| 2289 | { .type = NLA_S32 }, |
| 2290 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = |
| 2291 | { .type = NLA_S32 }, |
| 2292 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = |
| 2293 | { .type = NLA_U32 }, |
| 2294 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = |
| 2295 | { .type = NLA_U32 }, |
| 2296 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE] = |
| 2297 | { .type = NLA_U32 }, |
| 2298 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE] |
| 2299 | = { .type = NLA_U32 }, |
| 2300 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING] = |
| 2301 | { .type = NLA_U32 }, |
| 2302 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP] = { .type = |
| 2303 | NLA_U32 }, |
| 2304 | }; |
| 2305 | |
| 2306 | static void wlan_hdd_cfg80211_extscan_get_capabilities_ind(void *ctx, void *pMsg) |
| 2307 | { |
| 2308 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2309 | struct sk_buff *skb = NULL; |
| 2310 | tpSirEXTScanCapabilitiesEvent pData = |
| 2311 | (tpSirEXTScanCapabilitiesEvent) pMsg; |
| 2312 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2313 | ENTER(); |
| 2314 | |
| 2315 | if (wlan_hdd_validate_context(pHddCtx)) |
| 2316 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2317 | return; |
| 2318 | } |
| 2319 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2320 | if (!pMsg) |
| 2321 | { |
| 2322 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2323 | return; |
| 2324 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2325 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2326 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2327 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES_INDEX, |
| 2328 | GFP_KERNEL); |
| 2329 | |
| 2330 | if (!skb) { |
| 2331 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2332 | FL("cfg80211_vendor_event_alloc failed")); |
| 2333 | return; |
| 2334 | } |
| 2335 | |
| 2336 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2337 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan cache size (%u)", pData->scanCacheSize); |
| 2338 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan buckets (%u)", pData->scanBuckets); |
| 2339 | hddLog(VOS_TRACE_LEVEL_INFO, "Max AP per scan (%u)", pData->maxApPerScan); |
| 2340 | hddLog(VOS_TRACE_LEVEL_INFO, "maxRssiSampleSize (%u)", |
| 2341 | pData->maxRssiSampleSize); |
| 2342 | hddLog(VOS_TRACE_LEVEL_INFO, "maxScanReportingThreshold (%u)", |
| 2343 | pData->maxScanReportingThreshold); |
| 2344 | hddLog(VOS_TRACE_LEVEL_INFO, "maxHotlistAPs (%u)", pData->maxHotlistAPs); |
| 2345 | hddLog(VOS_TRACE_LEVEL_INFO, "maxSignificantWifiChangeAPs (%u)", |
| 2346 | pData->maxSignificantWifiChangeAPs); |
| 2347 | hddLog(VOS_TRACE_LEVEL_INFO, "maxBsidHistoryEntries (%u)", |
| 2348 | pData->maxBsidHistoryEntries); |
| 2349 | |
| 2350 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2351 | pData->requestId) || |
| 2352 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status) || |
| 2353 | nla_put_u32(skb, |
| 2354 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE, |
| 2355 | pData->scanCacheSize) || |
| 2356 | nla_put_u32(skb, |
| 2357 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS, |
| 2358 | pData->scanBuckets) || |
| 2359 | nla_put_u32(skb, |
| 2360 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN, |
| 2361 | pData->maxApPerScan) || |
| 2362 | nla_put_u32(skb, |
| 2363 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE, |
| 2364 | pData->maxRssiSampleSize) || |
| 2365 | nla_put_u32(skb, |
| 2366 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD, |
| 2367 | pData->maxScanReportingThreshold) || |
| 2368 | nla_put_u32(skb, |
| 2369 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_APS, |
| 2370 | pData->maxHotlistAPs) || |
| 2371 | nla_put_u32(skb, |
| 2372 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS, |
| 2373 | pData->maxSignificantWifiChangeAPs) || |
| 2374 | nla_put_u32(skb, |
| 2375 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES, |
| 2376 | pData->maxBsidHistoryEntries)) { |
| 2377 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2378 | goto nla_put_failure; |
| 2379 | } |
| 2380 | |
| 2381 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2382 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2383 | return; |
| 2384 | |
| 2385 | nla_put_failure: |
| 2386 | kfree_skb(skb); |
| 2387 | return; |
| 2388 | } |
| 2389 | |
| 2390 | |
| 2391 | static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg) |
| 2392 | { |
| 2393 | tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg; |
| 2394 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2395 | struct sk_buff *skb = NULL; |
| 2396 | tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal ); |
| 2397 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2398 | ENTER(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2399 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2400 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2401 | return; |
| 2402 | } |
| 2403 | if (!pMsg) |
| 2404 | { |
| 2405 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2406 | return; |
| 2407 | } |
| 2408 | |
| 2409 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2410 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2411 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START_INDEX, |
| 2412 | GFP_KERNEL); |
| 2413 | |
| 2414 | if (!skb) { |
| 2415 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2416 | FL("cfg80211_vendor_event_alloc failed")); |
| 2417 | return; |
| 2418 | } |
| 2419 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2420 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2421 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2422 | |
| 2423 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2424 | pData->requestId) || |
| 2425 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2426 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2427 | goto nla_put_failure; |
| 2428 | } |
| 2429 | |
| 2430 | /* |
| 2431 | * Store the Request ID for comparing with the requestID obtained |
| 2432 | * in other requests.HDD shall return a failure is the extscan_stop |
| 2433 | * request is issued with a different requestId as that of the |
| 2434 | * extscan_start request. Also, This requestId shall be used while |
| 2435 | * indicating the full scan results to the upper layers. |
| 2436 | * The requestId is stored with the assumption that the firmware |
| 2437 | * shall return the ext scan start request's requestId in ext scan |
| 2438 | * start response. |
| 2439 | */ |
| 2440 | if (pData->status == 0) |
| 2441 | pMac->sme.extScanStartReqId = pData->requestId; |
| 2442 | |
| 2443 | |
| 2444 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2445 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2446 | return; |
| 2447 | |
| 2448 | nla_put_failure: |
| 2449 | kfree_skb(skb); |
| 2450 | return; |
| 2451 | } |
| 2452 | |
| 2453 | |
| 2454 | static void wlan_hdd_cfg80211_extscan_stop_rsp(void *ctx, void *pMsg) |
| 2455 | { |
| 2456 | tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg; |
| 2457 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2458 | struct sk_buff *skb = NULL; |
| 2459 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2460 | ENTER(); |
| 2461 | |
| 2462 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2463 | return; |
| 2464 | } |
| 2465 | if (!pMsg) |
| 2466 | { |
| 2467 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2468 | return; |
| 2469 | } |
| 2470 | |
| 2471 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2472 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2473 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP_INDEX, |
| 2474 | GFP_KERNEL); |
| 2475 | |
| 2476 | if (!skb) { |
| 2477 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2478 | FL("cfg80211_vendor_event_alloc failed")); |
| 2479 | return; |
| 2480 | } |
| 2481 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2482 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2483 | |
| 2484 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2485 | pData->requestId) || |
| 2486 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2487 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2488 | goto nla_put_failure; |
| 2489 | } |
| 2490 | |
| 2491 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2492 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2493 | return; |
| 2494 | |
| 2495 | nla_put_failure: |
| 2496 | kfree_skb(skb); |
| 2497 | return; |
| 2498 | } |
| 2499 | |
| 2500 | |
| 2501 | static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx, |
| 2502 | void *pMsg) |
| 2503 | { |
| 2504 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2505 | struct sk_buff *skb = NULL; |
| 2506 | tpSirEXTScanSetBssidHotListRspParams pData = |
| 2507 | (tpSirEXTScanSetBssidHotListRspParams) pMsg; |
| 2508 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2509 | ENTER(); |
| 2510 | |
| 2511 | if (wlan_hdd_validate_context(pHddCtx)){ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2512 | return; |
| 2513 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2514 | if (!pMsg) |
| 2515 | { |
| 2516 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2517 | return; |
| 2518 | } |
| 2519 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2520 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2521 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2522 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST_INDEX, |
| 2523 | GFP_KERNEL); |
| 2524 | |
| 2525 | if (!skb) { |
| 2526 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2527 | FL("cfg80211_vendor_event_alloc failed")); |
| 2528 | return; |
| 2529 | } |
| 2530 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2531 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2532 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2533 | |
| 2534 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2535 | pData->requestId) || |
| 2536 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2537 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2538 | goto nla_put_failure; |
| 2539 | } |
| 2540 | |
| 2541 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2542 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2543 | return; |
| 2544 | |
| 2545 | nla_put_failure: |
| 2546 | kfree_skb(skb); |
| 2547 | return; |
| 2548 | } |
| 2549 | |
| 2550 | static void wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(void *ctx, |
| 2551 | void *pMsg) |
| 2552 | { |
| 2553 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2554 | struct sk_buff *skb = NULL; |
| 2555 | tpSirEXTScanResetBssidHotlistRspParams pData = |
| 2556 | (tpSirEXTScanResetBssidHotlistRspParams) pMsg; |
| 2557 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2558 | ENTER(); |
| 2559 | |
| 2560 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2561 | return; |
| 2562 | } |
| 2563 | if (!pMsg) |
| 2564 | { |
| 2565 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2566 | return; |
| 2567 | } |
| 2568 | |
| 2569 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2570 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2571 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST_INDEX, |
| 2572 | GFP_KERNEL); |
| 2573 | |
| 2574 | if (!skb) { |
| 2575 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2576 | FL("cfg80211_vendor_event_alloc failed")); |
| 2577 | return; |
| 2578 | } |
| 2579 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2580 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2581 | |
| 2582 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2583 | pData->requestId) || |
| 2584 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2585 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2586 | goto nla_put_failure; |
| 2587 | } |
| 2588 | |
| 2589 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2590 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2591 | return; |
| 2592 | |
| 2593 | nla_put_failure: |
| 2594 | kfree_skb(skb); |
| 2595 | return; |
| 2596 | } |
| 2597 | |
| 2598 | |
| 2599 | static void wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(void *ctx, |
| 2600 | void *pMsg) |
| 2601 | { |
| 2602 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2603 | struct sk_buff *skb = NULL; |
| 2604 | tpSirEXTScanSetSignificantChangeRspParams pData = |
| 2605 | (tpSirEXTScanSetSignificantChangeRspParams) pMsg; |
| 2606 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2607 | ENTER(); |
| 2608 | |
| 2609 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2610 | return; |
| 2611 | } |
| 2612 | if (!pMsg) |
| 2613 | { |
| 2614 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2615 | return; |
| 2616 | } |
| 2617 | |
| 2618 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2619 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2620 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE_INDEX, |
| 2621 | GFP_KERNEL); |
| 2622 | |
| 2623 | if (!skb) { |
| 2624 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2625 | FL("cfg80211_vendor_event_alloc failed")); |
| 2626 | return; |
| 2627 | } |
| 2628 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2629 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2630 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2631 | |
| 2632 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2633 | pData->requestId) || |
| 2634 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2635 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2636 | goto nla_put_failure; |
| 2637 | } |
| 2638 | |
| 2639 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2640 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2641 | return; |
| 2642 | |
| 2643 | nla_put_failure: |
| 2644 | kfree_skb(skb); |
| 2645 | return; |
| 2646 | } |
| 2647 | |
| 2648 | |
| 2649 | static void wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(void *ctx, |
| 2650 | void *pMsg) |
| 2651 | { |
| 2652 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2653 | struct sk_buff *skb = NULL; |
| 2654 | tpSirEXTScanResetSignificantChangeRspParams pData = |
| 2655 | (tpSirEXTScanResetSignificantChangeRspParams) pMsg; |
| 2656 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2657 | ENTER(); |
| 2658 | |
| 2659 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2660 | return; |
| 2661 | } |
| 2662 | if (!pMsg) |
| 2663 | { |
| 2664 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2665 | return; |
| 2666 | } |
| 2667 | |
| 2668 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2669 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2670 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE_INDEX, |
| 2671 | GFP_KERNEL); |
| 2672 | |
| 2673 | if (!skb) { |
| 2674 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2675 | FL("cfg80211_vendor_event_alloc failed")); |
| 2676 | return; |
| 2677 | } |
| 2678 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2679 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2680 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2681 | |
| 2682 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2683 | pData->requestId) || |
| 2684 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2685 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2686 | goto nla_put_failure; |
| 2687 | } |
| 2688 | |
| 2689 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2690 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2691 | return; |
| 2692 | |
| 2693 | nla_put_failure: |
| 2694 | kfree_skb(skb); |
| 2695 | return; |
| 2696 | } |
| 2697 | |
| 2698 | static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx, |
| 2699 | void *pMsg) |
| 2700 | { |
| 2701 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2702 | struct sk_buff *skb = NULL; |
| 2703 | tANI_U32 i = 0, j, resultsPerEvent; |
| 2704 | tANI_S32 totalResults; |
| 2705 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2706 | tpSirWifiScanResult pSirWifiScanResult; |
| 2707 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2708 | ENTER(); |
| 2709 | |
| 2710 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2711 | return; |
| 2712 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2713 | if (!pMsg) |
| 2714 | { |
| 2715 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2716 | return; |
| 2717 | } |
| 2718 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2719 | totalResults = pData->numOfAps; |
| 2720 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2721 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2722 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2723 | |
| 2724 | do{ |
| 2725 | resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ? |
| 2726 | EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults); |
| 2727 | totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND; |
| 2728 | |
| 2729 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2730 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2731 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS_INDEX, |
| 2732 | GFP_KERNEL); |
| 2733 | |
| 2734 | if (!skb) { |
| 2735 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2736 | FL("cfg80211_vendor_event_alloc failed")); |
| 2737 | return; |
| 2738 | } |
| 2739 | |
| 2740 | hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent); |
| 2741 | |
| 2742 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2743 | pData->requestId) || |
| 2744 | nla_put_u32(skb, |
| 2745 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2746 | resultsPerEvent)) { |
| 2747 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2748 | goto fail; |
| 2749 | } |
| 2750 | if (nla_put_u8(skb, |
| 2751 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2752 | pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 ))) |
| 2753 | { |
| 2754 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2755 | goto fail; |
| 2756 | } |
| 2757 | |
| 2758 | if (resultsPerEvent) { |
| 2759 | struct nlattr *aps; |
| 2760 | |
| 2761 | aps = nla_nest_start(skb, |
| 2762 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2763 | if (!aps) |
| 2764 | { |
| 2765 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2766 | goto fail; |
| 2767 | } |
| 2768 | |
| 2769 | for (j = 0; j < resultsPerEvent; j++, i++) { |
| 2770 | struct nlattr *ap; |
| 2771 | pSirWifiScanResult = (tpSirWifiScanResult) ((tANI_U8 *) |
| 2772 | pData->ap + ( i* sizeof(tSirWifiScanResult))); |
| 2773 | |
| 2774 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) " |
| 2775 | "Ssid (%s)" |
| 2776 | "Bssid: %pM " |
| 2777 | "Channel (%u)" |
| 2778 | "Rssi (%d)" |
| 2779 | "RTT (%u)" |
| 2780 | "RTT_SD (%u)", |
| 2781 | i, |
| 2782 | pSirWifiScanResult->ts, |
| 2783 | pSirWifiScanResult->ssid, |
| 2784 | pSirWifiScanResult->bssid, |
| 2785 | pSirWifiScanResult->channel, |
| 2786 | pSirWifiScanResult->rssi, |
| 2787 | pSirWifiScanResult->rtt, |
| 2788 | pSirWifiScanResult->rtt_sd); |
| 2789 | |
| 2790 | ap = nla_nest_start(skb, j + 1); |
| 2791 | if (!ap) |
| 2792 | { |
| 2793 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2794 | goto fail; |
| 2795 | } |
| 2796 | |
| 2797 | if (nla_put_u64(skb, |
| 2798 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2799 | pSirWifiScanResult->ts) ) |
| 2800 | { |
| 2801 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2802 | goto fail; |
| 2803 | } |
| 2804 | if (nla_put(skb, |
| 2805 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2806 | sizeof(pSirWifiScanResult->ssid), |
| 2807 | pSirWifiScanResult->ssid) ) |
| 2808 | { |
| 2809 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2810 | goto fail; |
| 2811 | } |
| 2812 | if (nla_put(skb, |
| 2813 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2814 | sizeof(pSirWifiScanResult->bssid), |
| 2815 | pSirWifiScanResult->bssid) ) |
| 2816 | { |
| 2817 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2818 | goto fail; |
| 2819 | } |
| 2820 | if (nla_put_u32(skb, |
| 2821 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2822 | pSirWifiScanResult->channel) ) |
| 2823 | { |
| 2824 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2825 | goto fail; |
| 2826 | } |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 2827 | if (nla_put_s32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2828 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2829 | pSirWifiScanResult->rssi) ) |
| 2830 | { |
| 2831 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2832 | goto fail; |
| 2833 | } |
| 2834 | if (nla_put_u32(skb, |
| 2835 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2836 | pSirWifiScanResult->rtt) ) |
| 2837 | { |
| 2838 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2839 | goto fail; |
| 2840 | } |
| 2841 | if (nla_put_u32(skb, |
| 2842 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2843 | pSirWifiScanResult->rtt_sd)) |
| 2844 | { |
| 2845 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2846 | goto fail; |
| 2847 | } |
| 2848 | |
| 2849 | nla_nest_end(skb, ap); |
| 2850 | } |
| 2851 | nla_nest_end(skb, aps); |
| 2852 | |
| 2853 | } |
| 2854 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2855 | } while (totalResults > 0); |
| 2856 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2857 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2858 | return; |
| 2859 | fail: |
| 2860 | kfree_skb(skb); |
| 2861 | return; |
| 2862 | } |
| 2863 | |
| 2864 | static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx, |
| 2865 | void *pMsg) |
| 2866 | { |
| 2867 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2868 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2869 | struct sk_buff *skb = NULL; |
| 2870 | tANI_U32 i; |
| 2871 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2872 | ENTER(); |
| 2873 | |
| 2874 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2875 | return; |
| 2876 | } |
| 2877 | if (!pMsg) |
| 2878 | { |
| 2879 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2880 | return; |
| 2881 | } |
| 2882 | |
| 2883 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2884 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2885 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX, |
| 2886 | GFP_KERNEL); |
| 2887 | |
| 2888 | if (!skb) { |
| 2889 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2890 | FL("cfg80211_vendor_event_alloc failed")); |
| 2891 | return; |
| 2892 | } |
| 2893 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2894 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2895 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2896 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2897 | |
| 2898 | for (i = 0; i < pData->numOfAps; i++) { |
| 2899 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) " |
| 2900 | "Ssid (%s) " |
| 2901 | "Bssid (" MAC_ADDRESS_STR ") " |
| 2902 | "Channel (%u) " |
| 2903 | "Rssi (%d) " |
| 2904 | "RTT (%u) " |
| 2905 | "RTT_SD (%u) ", |
| 2906 | i, |
| 2907 | pData->ap[i].ts, |
| 2908 | pData->ap[i].ssid, |
| 2909 | MAC_ADDR_ARRAY(pData->ap[i].bssid), |
| 2910 | pData->ap[i].channel, |
| 2911 | pData->ap[i].rssi, |
| 2912 | pData->ap[i].rtt, |
| 2913 | pData->ap[i].rtt_sd); |
| 2914 | } |
| 2915 | |
| 2916 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2917 | pData->requestId) || |
| 2918 | nla_put_u32(skb, |
| 2919 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2920 | pData->numOfAps)) { |
| 2921 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2922 | goto fail; |
| 2923 | } |
| 2924 | if (pData->numOfAps) { |
| 2925 | struct nlattr *aps; |
| 2926 | |
| 2927 | aps = nla_nest_start(skb, |
| 2928 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2929 | if (!aps) |
| 2930 | goto fail; |
| 2931 | |
| 2932 | for (i = 0; i < pData->numOfAps; i++) { |
| 2933 | struct nlattr *ap; |
| 2934 | |
| 2935 | ap = nla_nest_start(skb, i + 1); |
| 2936 | if (!ap) |
| 2937 | goto fail; |
| 2938 | |
| 2939 | if (nla_put_u64(skb, |
| 2940 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2941 | pData->ap[i].ts) || |
| 2942 | nla_put(skb, |
| 2943 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2944 | sizeof(pData->ap[i].ssid), |
| 2945 | pData->ap[i].ssid) || |
| 2946 | nla_put(skb, |
| 2947 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2948 | sizeof(pData->ap[i].bssid), |
| 2949 | pData->ap[i].bssid) || |
| 2950 | nla_put_u32(skb, |
| 2951 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2952 | pData->ap[i].channel) || |
| 2953 | nla_put_s32(skb, |
| 2954 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2955 | pData->ap[i].rssi) || |
| 2956 | nla_put_u32(skb, |
| 2957 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2958 | pData->ap[i].rtt) || |
| 2959 | nla_put_u32(skb, |
| 2960 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2961 | pData->ap[i].rtt_sd)) |
| 2962 | goto fail; |
| 2963 | |
| 2964 | nla_nest_end(skb, ap); |
| 2965 | } |
| 2966 | nla_nest_end(skb, aps); |
| 2967 | |
| 2968 | if (nla_put_u8(skb, |
| 2969 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2970 | pData->moreData)) |
| 2971 | goto fail; |
| 2972 | } |
| 2973 | |
| 2974 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2975 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2976 | return; |
| 2977 | |
| 2978 | fail: |
| 2979 | kfree_skb(skb); |
| 2980 | return; |
| 2981 | |
| 2982 | } |
| 2983 | static void wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(void *ctx, |
| 2984 | void *pMsg) |
| 2985 | { |
| 2986 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2987 | struct sk_buff *skb = NULL; |
| 2988 | tANI_U32 i, j; |
| 2989 | tpSirWifiSignificantChangeEvent pData = |
| 2990 | (tpSirWifiSignificantChangeEvent) pMsg; |
| 2991 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2992 | ENTER(); |
| 2993 | |
| 2994 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2995 | return; |
| 2996 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2997 | if (!pMsg) |
| 2998 | { |
| 2999 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 3000 | return; |
| 3001 | } |
| 3002 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3003 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 3004 | EXTSCAN_EVENT_BUF_SIZE, |
| 3005 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE_INDEX, |
| 3006 | GFP_KERNEL); |
| 3007 | |
| 3008 | if (!skb) { |
| 3009 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3010 | FL("cfg80211_vendor_event_alloc failed")); |
| 3011 | return; |
| 3012 | } |
| 3013 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3014 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 3015 | hddLog(VOS_TRACE_LEVEL_INFO, "total List Size %u ", pData->numSigRssiBss); |
| 3016 | hddLog(VOS_TRACE_LEVEL_INFO, " CUrrent List size (%u)", |
| 3017 | pData->numSigRssiBss); |
| 3018 | hddLog(VOS_TRACE_LEVEL_INFO, "moreData (%u)", pData->moreData); |
| 3019 | |
| 3020 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 3021 | hddLog(VOS_TRACE_LEVEL_INFO , "Rssi List [%d] BSSID: (%pM) Channel %u " |
| 3022 | " num RSSI %u ", |
| 3023 | i, pData->sigRssiResult[i].bssid, |
| 3024 | pData->sigRssiResult[i].channel, |
| 3025 | pData->sigRssiResult[i].numRssi); |
| 3026 | |
| 3027 | for (j = 0; j < pData->sigRssiResult[i].numRssi; j++){ |
| 3028 | |
| 3029 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3030 | " [%d]", |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 3031 | pData->sigRssiResult[i].rssi[j]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3032 | |
| 3033 | } |
| 3034 | } |
| 3035 | |
| 3036 | |
| 3037 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3038 | pData->requestId) || |
| 3039 | nla_put_u32(skb, |
| 3040 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3041 | pData->numSigRssiBss)) { |
| 3042 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3043 | goto fail; |
| 3044 | } |
| 3045 | |
| 3046 | if (pData->numSigRssiBss) { |
| 3047 | struct nlattr *aps; |
| 3048 | aps = nla_nest_start(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 3049 | if (!aps) |
| 3050 | goto fail; |
| 3051 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 3052 | struct nlattr *ap; |
| 3053 | |
| 3054 | ap = nla_nest_start(skb, i); |
| 3055 | if (!ap) |
| 3056 | goto fail; |
| 3057 | if (nla_put(skb, |
| 3058 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_BSSID, |
| 3059 | sizeof(tSirMacAddr), pData->sigRssiResult[i].bssid) || |
| 3060 | nla_put_u32(skb, |
| 3061 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_CHANNEL, |
| 3062 | pData->sigRssiResult[i].channel) || |
| 3063 | nla_put_u32(skb, |
| 3064 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_NUM_RSSI, |
| 3065 | pData->sigRssiResult[i].numRssi) || |
| 3066 | nla_put(skb, |
| 3067 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_RSSI_LIST, |
| 3068 | sizeof(s32) * pData->sigRssiResult[i].numRssi, |
| 3069 | pData->sigRssiResult[i].rssi)) |
| 3070 | goto fail; |
| 3071 | nla_nest_end(skb, ap); |
| 3072 | } |
| 3073 | nla_nest_end(skb, aps); |
| 3074 | if (nla_put_u8(skb, |
| 3075 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 3076 | pData->moreData)) |
| 3077 | goto fail; |
| 3078 | } |
| 3079 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3080 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3081 | return; |
| 3082 | fail: |
| 3083 | kfree_skb(skb); |
| 3084 | return; |
| 3085 | } |
| 3086 | |
| 3087 | static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx, |
| 3088 | void *pMsg) |
| 3089 | { |
| 3090 | struct sk_buff *skb; |
| 3091 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3092 | tpSirWifiFullScanResultEvent pData = |
| 3093 | (tpSirWifiFullScanResultEvent) (pMsg); |
| 3094 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3095 | ENTER(); |
| 3096 | |
| 3097 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 3098 | return; |
| 3099 | } |
| 3100 | if (!pMsg) |
| 3101 | { |
| 3102 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3103 | return; |
| 3104 | } |
| 3105 | |
| 3106 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 3107 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3108 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX, |
| 3109 | GFP_KERNEL); |
| 3110 | |
| 3111 | if (!skb) { |
| 3112 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3113 | FL("cfg80211_vendor_event_alloc failed")); |
| 3114 | return; |
| 3115 | } |
| 3116 | |
| 3117 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3118 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId); |
| 3119 | hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData); |
| 3120 | hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) " |
| 3121 | "Ssid (%s)" |
| 3122 | "Bssid (" MAC_ADDRESS_STR ")" |
| 3123 | "Channel (%u)" |
| 3124 | "Rssi (%d)" |
| 3125 | "RTT (%u)" |
| 3126 | "RTT_SD (%u)"), |
| 3127 | pData->ap.ts, |
| 3128 | pData->ap.ssid, |
| 3129 | MAC_ADDR_ARRAY(pData->ap.bssid), |
| 3130 | pData->ap.channel, |
| 3131 | pData->ap.rssi, |
| 3132 | pData->ap.rtt, |
| 3133 | pData->ap.rtt_sd); |
| 3134 | hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength); |
| 3135 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3136 | pData->requestId) || |
| 3137 | nla_put_u64(skb, |
| 3138 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 3139 | pData->ap.ts) || |
| 3140 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 3141 | sizeof(pData->ap.ssid), |
| 3142 | pData->ap.ssid) || |
| 3143 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 3144 | WNI_CFG_BSSID_LEN, |
| 3145 | pData->ap.bssid) || |
| 3146 | nla_put_u32(skb, |
| 3147 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 3148 | pData->ap.channel) || |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 3149 | 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] | 3150 | pData->ap.rssi) || |
| 3151 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 3152 | pData->ap.rtt) || |
| 3153 | nla_put_u32(skb, |
| 3154 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 3155 | pData->ap.rtt_sd) || |
| 3156 | nla_put_u16(skb, |
| 3157 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 3158 | pData->ap.beaconPeriod) || |
| 3159 | nla_put_u16(skb, |
| 3160 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 3161 | pData->ap.capability) || |
| 3162 | nla_put_u32(skb, |
| 3163 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
| 3164 | pData->ieLength)) |
| 3165 | { |
| 3166 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3167 | goto nla_put_failure; |
| 3168 | } |
| 3169 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 3170 | pData->ieLength, |
| 3171 | pData->ie)) |
| 3172 | { |
| 3173 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3174 | goto nla_put_failure; |
| 3175 | } |
| 3176 | |
| 3177 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3178 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3179 | return; |
| 3180 | |
| 3181 | nla_put_failure: |
| 3182 | kfree_skb(skb); |
| 3183 | return; |
| 3184 | } |
| 3185 | |
| 3186 | static void wlan_hdd_cfg80211_extscan_scan_res_available_event(void *ctx, |
| 3187 | void *pMsg) |
| 3188 | { |
| 3189 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3190 | struct sk_buff *skb = NULL; |
| 3191 | tpSirEXTScanResultsAvailableIndParams pData = |
| 3192 | (tpSirEXTScanResultsAvailableIndParams) pMsg; |
| 3193 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3194 | ENTER(); |
| 3195 | |
| 3196 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 3197 | return; |
| 3198 | } |
| 3199 | if (!pMsg) |
| 3200 | { |
| 3201 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3202 | return; |
| 3203 | } |
| 3204 | |
| 3205 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 3206 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3207 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX, |
| 3208 | GFP_KERNEL); |
| 3209 | |
| 3210 | if (!skb) { |
| 3211 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3212 | FL("cfg80211_vendor_event_alloc failed")); |
| 3213 | return; |
| 3214 | } |
| 3215 | |
| 3216 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3217 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 3218 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", |
| 3219 | pData->numResultsAvailable); |
| 3220 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3221 | pData->requestId) || |
| 3222 | nla_put_u32(skb, |
| 3223 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3224 | pData->numResultsAvailable)) { |
| 3225 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3226 | goto nla_put_failure; |
| 3227 | } |
| 3228 | |
| 3229 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3230 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3231 | return; |
| 3232 | |
| 3233 | nla_put_failure: |
| 3234 | kfree_skb(skb); |
| 3235 | return; |
| 3236 | } |
| 3237 | |
| 3238 | static void wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx, void *pMsg) |
| 3239 | { |
| 3240 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3241 | struct sk_buff *skb = NULL; |
| 3242 | tpSirEXTScanProgressIndParams pData = |
| 3243 | (tpSirEXTScanProgressIndParams) pMsg; |
| 3244 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3245 | ENTER(); |
| 3246 | |
| 3247 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 3248 | return; |
| 3249 | } |
| 3250 | if (!pMsg) |
| 3251 | { |
| 3252 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3253 | return; |
| 3254 | } |
| 3255 | |
| 3256 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 3257 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3258 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX, |
| 3259 | GFP_KERNEL); |
| 3260 | |
| 3261 | if (!skb) { |
| 3262 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3263 | FL("cfg80211_vendor_event_alloc failed")); |
| 3264 | return; |
| 3265 | } |
| 3266 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3267 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)", |
| 3268 | pData->extScanEventType); |
| 3269 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)", |
| 3270 | pData->status); |
| 3271 | |
| 3272 | if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE, |
| 3273 | pData->extScanEventType) || |
| 3274 | nla_put_u32(skb, |
Dasari Srinivas | 5a28865 | 2014-06-30 17:13:22 +0530 | [diff] [blame] | 3275 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3276 | pData->requestId) || |
| 3277 | nla_put_u32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3278 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS, |
| 3279 | pData->status)) { |
| 3280 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3281 | goto nla_put_failure; |
| 3282 | } |
| 3283 | |
| 3284 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3285 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3286 | return; |
| 3287 | |
| 3288 | nla_put_failure: |
| 3289 | kfree_skb(skb); |
| 3290 | return; |
| 3291 | } |
| 3292 | |
| 3293 | void wlan_hdd_cfg80211_extscan_callback(void *ctx, const tANI_U16 evType, |
| 3294 | void *pMsg) |
| 3295 | { |
| 3296 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3297 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3298 | ENTER(); |
| 3299 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3300 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3301 | return; |
| 3302 | } |
| 3303 | |
| 3304 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 3305 | |
| 3306 | |
| 3307 | switch(evType) { |
| 3308 | case SIR_HAL_EXTSCAN_START_RSP: |
| 3309 | wlan_hdd_cfg80211_extscan_start_rsp(ctx, pMsg); |
| 3310 | break; |
| 3311 | |
| 3312 | case SIR_HAL_EXTSCAN_STOP_RSP: |
| 3313 | wlan_hdd_cfg80211_extscan_stop_rsp(ctx, pMsg); |
| 3314 | break; |
| 3315 | case SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP: |
| 3316 | /* There is no need to send this response to upper layer |
| 3317 | Just log the message */ |
| 3318 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3319 | FL("Rcvd SIR_HAL_EXTSCAN_CACHED_RESULTS_RSP")); |
| 3320 | break; |
| 3321 | case SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP: |
| 3322 | wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(ctx, pMsg); |
| 3323 | break; |
| 3324 | |
| 3325 | case SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP: |
| 3326 | wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg); |
| 3327 | break; |
| 3328 | |
| 3329 | case SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP: |
| 3330 | wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(ctx, pMsg); |
| 3331 | break; |
| 3332 | |
| 3333 | case SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP: |
| 3334 | wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(ctx, pMsg); |
| 3335 | break; |
| 3336 | case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP: |
| 3337 | wlan_hdd_cfg80211_extscan_get_capabilities_ind(ctx, pMsg); |
| 3338 | break; |
| 3339 | case SIR_HAL_EXTSCAN_PROGRESS_IND: |
| 3340 | wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg); |
| 3341 | break; |
| 3342 | case SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND: |
| 3343 | wlan_hdd_cfg80211_extscan_scan_res_available_event(ctx, pMsg); |
| 3344 | break; |
| 3345 | case SIR_HAL_EXTSCAN_SCAN_RESULT_IND: |
| 3346 | wlan_hdd_cfg80211_extscan_cached_results_ind(ctx, pMsg); |
| 3347 | break; |
| 3348 | case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND: |
| 3349 | wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg); |
| 3350 | break; |
| 3351 | case SIR_HAL_EXTSCAN_SIGNF_WIFI_CHANGE_IND: |
| 3352 | wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(ctx, pMsg); |
| 3353 | break; |
| 3354 | case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 3355 | wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg); |
| 3356 | break; |
| 3357 | default: |
| 3358 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 3359 | break; |
| 3360 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3361 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3362 | } |
| 3363 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3364 | static int __wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3365 | struct wireless_dev *wdev, |
| 3366 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3367 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3368 | tSirGetEXTScanCapabilitiesReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3369 | struct net_device *dev = wdev->netdev; |
| 3370 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3371 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3372 | struct nlattr |
| 3373 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3374 | eHalStatus status; |
| 3375 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3376 | ENTER(); |
| 3377 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3378 | status = wlan_hdd_validate_context(pHddCtx); |
| 3379 | if (0 != status) |
| 3380 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3381 | return -EINVAL; |
| 3382 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3383 | /* check the EXTScan Capability */ |
| 3384 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3385 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3386 | { |
| 3387 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3388 | FL("EXTScan not enabled/supported by Firmware")); |
| 3389 | return -EINVAL; |
| 3390 | } |
| 3391 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3392 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3393 | data, dataLen, |
| 3394 | wlan_hdd_extscan_config_policy)) { |
| 3395 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3396 | return -EINVAL; |
| 3397 | } |
| 3398 | |
| 3399 | /* Parse and fetch request Id */ |
| 3400 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3401 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3402 | return -EINVAL; |
| 3403 | } |
| 3404 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3405 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3406 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3407 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3408 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3409 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3410 | reqMsg.sessionId = pAdapter->sessionId; |
| 3411 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3412 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3413 | status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3414 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3415 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3416 | FL("sme_EXTScanGetCapabilities failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3417 | return -EINVAL; |
| 3418 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3419 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3420 | return 0; |
| 3421 | } |
| 3422 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3423 | static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3424 | struct wireless_dev *wdev, |
| 3425 | const void *data, int dataLen) |
| 3426 | { |
| 3427 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3428 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3429 | vos_ssr_protect(__func__); |
| 3430 | ret = __wlan_hdd_cfg80211_extscan_get_capabilities(wiphy, wdev, data, dataLen); |
| 3431 | vos_ssr_unprotect(__func__); |
| 3432 | |
| 3433 | return ret; |
| 3434 | } |
| 3435 | |
| 3436 | static int __wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3437 | struct wireless_dev *wdev, |
| 3438 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3439 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3440 | tSirEXTScanGetCachedResultsReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3441 | struct net_device *dev = wdev->netdev; |
| 3442 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3443 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3444 | struct nlattr |
| 3445 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3446 | eHalStatus status; |
| 3447 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3448 | ENTER(); |
| 3449 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3450 | status = wlan_hdd_validate_context(pHddCtx); |
| 3451 | if (0 != status) |
| 3452 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3453 | return -EINVAL; |
| 3454 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3455 | /* check the EXTScan Capability */ |
| 3456 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3457 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3458 | { |
| 3459 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3460 | FL("EXTScan not enabled/supported by Firmware")); |
| 3461 | return -EINVAL; |
| 3462 | } |
| 3463 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3464 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3465 | data, dataLen, |
| 3466 | wlan_hdd_extscan_config_policy)) { |
| 3467 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3468 | return -EINVAL; |
| 3469 | } |
| 3470 | /* Parse and fetch request Id */ |
| 3471 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3472 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3473 | return -EINVAL; |
| 3474 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3475 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3476 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3477 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3478 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3479 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3480 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3481 | reqMsg.sessionId = pAdapter->sessionId; |
| 3482 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3483 | |
| 3484 | /* Parse and fetch flush parameter */ |
| 3485 | if (!tb |
| 3486 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]) |
| 3487 | { |
| 3488 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed")); |
| 3489 | goto failed; |
| 3490 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3491 | reqMsg.flush = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3492 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]); |
| 3493 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3494 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3495 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3496 | status = sme_getCachedResults(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3497 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3498 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3499 | FL("sme_getCachedResults failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3500 | return -EINVAL; |
| 3501 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3502 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3503 | return 0; |
| 3504 | |
| 3505 | failed: |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3506 | return -EINVAL; |
| 3507 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3508 | static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3509 | struct wireless_dev *wdev, |
| 3510 | const void *data, int dataLen) |
| 3511 | { |
| 3512 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3513 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3514 | vos_ssr_protect(__func__); |
| 3515 | ret = __wlan_hdd_cfg80211_extscan_get_cached_results(wiphy, wdev, data, dataLen); |
| 3516 | vos_ssr_unprotect(__func__); |
| 3517 | |
| 3518 | return ret; |
| 3519 | } |
| 3520 | |
| 3521 | static int __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3522 | struct wireless_dev *wdev, |
Edhar, Mahesh Kumar | ed8631f | 2015-01-20 14:31:47 +0530 | [diff] [blame] | 3523 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3524 | { |
| 3525 | tpSirEXTScanSetBssidHotListReqParams pReqMsg = NULL; |
| 3526 | struct net_device *dev = wdev->netdev; |
| 3527 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3528 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3529 | struct nlattr |
| 3530 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3531 | struct nlattr |
| 3532 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3533 | struct nlattr *apTh; |
| 3534 | eHalStatus status; |
| 3535 | tANI_U8 i = 0; |
| 3536 | int rem; |
| 3537 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3538 | ENTER(); |
| 3539 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3540 | status = wlan_hdd_validate_context(pHddCtx); |
| 3541 | if (0 != status) |
| 3542 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3543 | return -EINVAL; |
| 3544 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3545 | /* check the EXTScan Capability */ |
| 3546 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3547 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3548 | { |
| 3549 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3550 | FL("EXTScan not enabled/supported by Firmware")); |
| 3551 | return -EINVAL; |
| 3552 | } |
| 3553 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3554 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3555 | data, dataLen, |
| 3556 | wlan_hdd_extscan_config_policy)) { |
| 3557 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3558 | return -EINVAL; |
| 3559 | } |
| 3560 | |
| 3561 | /* Parse and fetch request Id */ |
| 3562 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3563 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3564 | return -EINVAL; |
| 3565 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3566 | pReqMsg = (tpSirEXTScanSetBssidHotListReqParams) |
| 3567 | vos_mem_malloc(sizeof(*pReqMsg)); |
| 3568 | if (!pReqMsg) { |
| 3569 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3570 | return -ENOMEM; |
| 3571 | } |
| 3572 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3573 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3574 | pReqMsg->requestId = nla_get_u32( |
| 3575 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3576 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3577 | |
| 3578 | /* Parse and fetch number of APs */ |
| 3579 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]) { |
| 3580 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3581 | goto fail; |
| 3582 | } |
| 3583 | |
| 3584 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3585 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3586 | |
| 3587 | pReqMsg->numAp = nla_get_u32( |
| 3588 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]); |
| 3589 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3590 | |
| 3591 | nla_for_each_nested(apTh, |
| 3592 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3593 | if(nla_parse(tb2, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3594 | nla_data(apTh), nla_len(apTh), |
| 3595 | NULL)) { |
| 3596 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3597 | goto fail; |
| 3598 | } |
| 3599 | |
| 3600 | /* Parse and fetch MAC address */ |
| 3601 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3602 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3603 | goto fail; |
| 3604 | } |
| 3605 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3606 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3607 | sizeof(tSirMacAddr)); |
| 3608 | hddLog(VOS_TRACE_LEVEL_INFO, FL("BSSID: %pM "), pReqMsg->ap[i].bssid); |
| 3609 | |
| 3610 | /* Parse and fetch low RSSI */ |
| 3611 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3612 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3613 | goto fail; |
| 3614 | } |
| 3615 | pReqMsg->ap[i].low = nla_get_s32( |
| 3616 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3617 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3618 | |
| 3619 | /* Parse and fetch high RSSI */ |
| 3620 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3621 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3622 | goto fail; |
| 3623 | } |
| 3624 | pReqMsg->ap[i].high = nla_get_s32( |
| 3625 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3626 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"), |
| 3627 | pReqMsg->ap[i].high); |
| 3628 | |
| 3629 | /* Parse and fetch channel */ |
| 3630 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3631 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3632 | goto fail; |
| 3633 | } |
| 3634 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3635 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3636 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3637 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3638 | i++; |
| 3639 | } |
| 3640 | status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg); |
| 3641 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3642 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3643 | FL("sme_SetBssHotlist failed(err=%d)"), status); |
| 3644 | vos_mem_free(pReqMsg); |
| 3645 | return -EINVAL; |
| 3646 | } |
| 3647 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3648 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3649 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3650 | return 0; |
| 3651 | |
| 3652 | fail: |
| 3653 | vos_mem_free(pReqMsg); |
| 3654 | return -EINVAL; |
| 3655 | } |
| 3656 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3657 | static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
| 3658 | struct wireless_dev *wdev, |
| 3659 | const void *data, int dataLen) |
| 3660 | { |
| 3661 | int ret = 0; |
| 3662 | |
| 3663 | vos_ssr_protect(__func__); |
| 3664 | ret = __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(wiphy, wdev, data, |
| 3665 | dataLen); |
| 3666 | vos_ssr_unprotect(__func__); |
| 3667 | |
| 3668 | return ret; |
| 3669 | } |
| 3670 | |
| 3671 | static int __wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3672 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3673 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3674 | { |
| 3675 | tpSirEXTScanSetSignificantChangeReqParams pReqMsg = NULL; |
| 3676 | struct net_device *dev = wdev->netdev; |
| 3677 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3678 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3679 | struct nlattr |
| 3680 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3681 | struct nlattr |
| 3682 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3683 | struct nlattr *apTh; |
| 3684 | eHalStatus status; |
| 3685 | int i = 0; |
| 3686 | int rem; |
| 3687 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3688 | ENTER(); |
| 3689 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3690 | status = wlan_hdd_validate_context(pHddCtx); |
| 3691 | if (0 != status) |
| 3692 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3693 | return -EINVAL; |
| 3694 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3695 | /* check the EXTScan Capability */ |
| 3696 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3697 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3698 | { |
| 3699 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3700 | FL("EXTScan not enabled/supported by Firmware")); |
| 3701 | return -EINVAL; |
| 3702 | } |
| 3703 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3704 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3705 | data, dataLen, |
| 3706 | wlan_hdd_extscan_config_policy)) { |
| 3707 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3708 | return -EINVAL; |
| 3709 | } |
| 3710 | |
| 3711 | /* Parse and fetch request Id */ |
| 3712 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3713 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3714 | return -EINVAL; |
| 3715 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3716 | pReqMsg = (tpSirEXTScanSetSignificantChangeReqParams) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3717 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3718 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3719 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3720 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3721 | } |
| 3722 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3723 | |
| 3724 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3725 | pReqMsg->requestId = nla_get_u32( |
| 3726 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3727 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3728 | |
| 3729 | /* Parse and fetch RSSI sample size */ |
| 3730 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]) |
| 3731 | { |
| 3732 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr RSSI sample size failed")); |
| 3733 | goto fail; |
| 3734 | } |
| 3735 | pReqMsg->rssiSampleSize = nla_get_u32( |
| 3736 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]); |
| 3737 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3738 | FL("RSSI sample size (%u)"), pReqMsg->rssiSampleSize); |
| 3739 | |
| 3740 | /* Parse and fetch lost AP sample size */ |
| 3741 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]) |
| 3742 | { |
| 3743 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr lost AP sample size failed")); |
| 3744 | goto fail; |
| 3745 | } |
| 3746 | pReqMsg->lostApSampleSize = nla_get_u32( |
| 3747 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]); |
| 3748 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3749 | FL("Lost AP sample size (%u)"), pReqMsg->lostApSampleSize); |
| 3750 | /* Parse and fetch minimum Breaching */ |
| 3751 | if (!tb |
| 3752 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]) { |
| 3753 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr minBreaching failed")); |
| 3754 | goto fail; |
| 3755 | } |
| 3756 | pReqMsg->minBreaching = nla_get_u32( |
| 3757 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]); |
| 3758 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Breaching (%d)"), pReqMsg->minBreaching); |
| 3759 | |
| 3760 | /* Parse and fetch number of APs */ |
| 3761 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]) { |
| 3762 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3763 | goto fail; |
| 3764 | } |
| 3765 | pReqMsg->numAp = nla_get_u32( |
| 3766 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]); |
| 3767 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3768 | |
| 3769 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3770 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3771 | |
| 3772 | nla_for_each_nested(apTh, |
| 3773 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3774 | if(nla_parse(tb2, |
| 3775 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3776 | nla_data(apTh), nla_len(apTh), |
| 3777 | NULL)) { |
| 3778 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3779 | goto fail; |
| 3780 | } |
| 3781 | |
| 3782 | /* Parse and fetch MAC address */ |
| 3783 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3784 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3785 | goto fail; |
| 3786 | } |
| 3787 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3788 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3789 | sizeof(tSirMacAddr)); |
| 3790 | |
| 3791 | /* Parse and fetch low RSSI */ |
| 3792 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3793 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3794 | goto fail; |
| 3795 | } |
| 3796 | pReqMsg->ap[i].low = nla_get_s32( |
| 3797 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3798 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3799 | |
| 3800 | /* Parse and fetch high RSSI */ |
| 3801 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3802 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3803 | goto fail; |
| 3804 | } |
| 3805 | pReqMsg->ap[i].high = nla_get_s32( |
| 3806 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3807 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3808 | FL("RSSI High (%d)"), pReqMsg->ap[i].high); |
| 3809 | |
| 3810 | /* Parse and fetch channel */ |
| 3811 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3812 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3813 | goto fail; |
| 3814 | } |
| 3815 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3816 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3817 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3818 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3819 | i++; |
| 3820 | } |
| 3821 | |
| 3822 | status = sme_SetSignificantChange(pHddCtx->hHal, pReqMsg); |
| 3823 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3824 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3825 | FL("sme_SetSignificantChange failed(err=%d)"), status); |
| 3826 | vos_mem_free(pReqMsg); |
| 3827 | return -EINVAL; |
| 3828 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3829 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3830 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3831 | return 0; |
| 3832 | |
| 3833 | fail: |
| 3834 | vos_mem_free(pReqMsg); |
| 3835 | return -EINVAL; |
| 3836 | } |
| 3837 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3838 | static int wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
| 3839 | struct wireless_dev *wdev, |
| 3840 | const void *data, int dataLen) |
| 3841 | { |
| 3842 | int ret = 0; |
| 3843 | |
| 3844 | vos_ssr_protect(__func__); |
| 3845 | ret = __wlan_hdd_cfg80211_extscan_set_significant_change(wiphy, wdev, data, |
| 3846 | dataLen); |
| 3847 | vos_ssr_unprotect(__func__); |
| 3848 | |
| 3849 | return ret; |
| 3850 | } |
| 3851 | |
| 3852 | static int __wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3853 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3854 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3855 | { |
| 3856 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3857 | tANI_U32 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 3858 | tANI_U8 numChannels = 0; |
| 3859 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3860 | tANI_U32 requestId; |
| 3861 | tWifiBand wifiBand; |
| 3862 | eHalStatus status; |
| 3863 | struct sk_buff *replySkb; |
| 3864 | tANI_U8 i; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3865 | int ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3866 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3867 | ENTER(); |
| 3868 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3869 | status = wlan_hdd_validate_context(pHddCtx); |
| 3870 | if (0 != status) |
| 3871 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3872 | return -EINVAL; |
| 3873 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3874 | /* check the EXTScan Capability */ |
| 3875 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3876 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3877 | { |
| 3878 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3879 | FL("EXTScan not enabled/supported by Firmware")); |
| 3880 | return -EINVAL; |
| 3881 | } |
| 3882 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3883 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3884 | data, dataLen, |
| 3885 | wlan_hdd_extscan_config_policy)) { |
| 3886 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3887 | return -EINVAL; |
| 3888 | } |
| 3889 | |
| 3890 | /* Parse and fetch request Id */ |
| 3891 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3892 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3893 | return -EINVAL; |
| 3894 | } |
| 3895 | requestId = nla_get_u32( |
| 3896 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3897 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); |
| 3898 | |
| 3899 | /* Parse and fetch wifi band */ |
| 3900 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) |
| 3901 | { |
| 3902 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3903 | return -EINVAL; |
| 3904 | } |
| 3905 | wifiBand = nla_get_u32( |
| 3906 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); |
| 3907 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); |
| 3908 | |
| 3909 | status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), |
| 3910 | wifiBand, ChannelList, |
| 3911 | &numChannels); |
| 3912 | if (eHAL_STATUS_SUCCESS != status) { |
| 3913 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3914 | FL("sme_GetValidChannelsByBand failed (err=%d)"), status); |
| 3915 | return -EINVAL; |
| 3916 | } |
| 3917 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of channels (%d)"), numChannels); |
| 3918 | for (i = 0; i < numChannels; i++) |
| 3919 | hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %u ", ChannelList[i]); |
| 3920 | |
| 3921 | replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 3922 | sizeof(u32) * numChannels + |
| 3923 | NLMSG_HDRLEN); |
| 3924 | |
| 3925 | if (!replySkb) { |
| 3926 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3927 | FL("valid channels: buffer alloc fail")); |
| 3928 | return -EINVAL; |
| 3929 | } |
| 3930 | if (nla_put_u32(replySkb, |
| 3931 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS, |
| 3932 | numChannels) || |
| 3933 | nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS, |
| 3934 | sizeof(u32) * numChannels, ChannelList)) { |
| 3935 | |
| 3936 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3937 | kfree_skb(replySkb); |
| 3938 | return -EINVAL; |
| 3939 | } |
| 3940 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3941 | ret = cfg80211_vendor_cmd_reply(replySkb); |
| 3942 | |
| 3943 | EXIT(); |
| 3944 | return ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3945 | } |
| 3946 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3947 | static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
| 3948 | struct wireless_dev *wdev, |
| 3949 | const void *data, int dataLen) |
| 3950 | { |
| 3951 | int ret = 0; |
| 3952 | |
| 3953 | vos_ssr_protect(__func__); |
| 3954 | ret = __wlan_hdd_cfg80211_extscan_get_valid_channels(wiphy, wdev, data, |
| 3955 | dataLen); |
| 3956 | vos_ssr_unprotect(__func__); |
| 3957 | |
| 3958 | return ret; |
| 3959 | } |
| 3960 | |
| 3961 | static int __wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3962 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3963 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3964 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3965 | tpSirEXTScanStartReqParams pReqMsg = NULL; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3966 | struct net_device *dev = wdev->netdev; |
| 3967 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3968 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3969 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3970 | struct nlattr *bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3971 | struct nlattr *channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3972 | struct nlattr *buckets; |
| 3973 | struct nlattr *channels; |
| 3974 | int rem1; |
| 3975 | int rem2; |
| 3976 | eHalStatus status; |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3977 | tANI_U32 j = 0, index = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3978 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3979 | ENTER(); |
| 3980 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3981 | status = wlan_hdd_validate_context(pHddCtx); |
| 3982 | if (0 != status) |
| 3983 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3984 | return -EINVAL; |
| 3985 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3986 | /* check the EXTScan Capability */ |
| 3987 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3988 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3989 | { |
| 3990 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3991 | FL("EXTScan not enabled/supported by Firmware")); |
| 3992 | return -EINVAL; |
| 3993 | } |
| 3994 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3995 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3996 | data, dataLen, |
| 3997 | wlan_hdd_extscan_config_policy)) { |
| 3998 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3999 | return -EINVAL; |
| 4000 | } |
| 4001 | |
| 4002 | /* Parse and fetch request Id */ |
| 4003 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4004 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4005 | return -EINVAL; |
| 4006 | } |
| 4007 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4008 | pReqMsg = (tpSirEXTScanStartReqParams) |
| 4009 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4010 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4011 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 4012 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4013 | } |
| 4014 | |
| 4015 | pReqMsg->requestId = nla_get_u32( |
| 4016 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 4017 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 4018 | |
| 4019 | pReqMsg->sessionId = pAdapter->sessionId; |
| 4020 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 4021 | |
| 4022 | /* Parse and fetch base period */ |
| 4023 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]) { |
| 4024 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed")); |
| 4025 | goto fail; |
| 4026 | } |
| 4027 | pReqMsg->basePeriod = nla_get_u32( |
| 4028 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]); |
| 4029 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"), |
| 4030 | pReqMsg->basePeriod); |
| 4031 | |
| 4032 | /* Parse and fetch max AP per scan */ |
| 4033 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]) { |
| 4034 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed")); |
| 4035 | goto fail; |
| 4036 | } |
| 4037 | pReqMsg->maxAPperScan = nla_get_u32( |
| 4038 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]); |
| 4039 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"), |
| 4040 | pReqMsg->maxAPperScan); |
| 4041 | |
| 4042 | /* Parse and fetch report threshold */ |
| 4043 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]) { |
| 4044 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed")); |
| 4045 | goto fail; |
| 4046 | } |
| 4047 | pReqMsg->reportThreshold = nla_get_u8( |
| 4048 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]); |
| 4049 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"), |
| 4050 | pReqMsg->reportThreshold); |
| 4051 | |
| 4052 | /* Parse and fetch number of buckets */ |
| 4053 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]) { |
| 4054 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed")); |
| 4055 | goto fail; |
| 4056 | } |
| 4057 | pReqMsg->numBuckets = nla_get_u8( |
| 4058 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]); |
| 4059 | if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) { |
| 4060 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets " |
| 4061 | "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS); |
| 4062 | pReqMsg->numBuckets = WLAN_EXTSCAN_MAX_BUCKETS; |
| 4063 | } |
| 4064 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"), |
| 4065 | pReqMsg->numBuckets); |
| 4066 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) { |
| 4067 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed")); |
| 4068 | goto fail; |
| 4069 | } |
| 4070 | |
| 4071 | nla_for_each_nested(buckets, |
| 4072 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) { |
| 4073 | if(nla_parse(bucket, |
| 4074 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4075 | nla_data(buckets), nla_len(buckets), NULL)) { //policy |
| 4076 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 4077 | goto fail; |
| 4078 | } |
| 4079 | |
| 4080 | /* Parse and fetch bucket spec */ |
| 4081 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) { |
| 4082 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket index failed")); |
| 4083 | goto fail; |
| 4084 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4085 | |
| 4086 | pReqMsg->buckets[index].bucket = nla_get_u8( |
| 4087 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]); |
| 4088 | |
| 4089 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bucket spec Index (%d)"), |
| 4090 | pReqMsg->buckets[index].bucket); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4091 | |
| 4092 | /* Parse and fetch wifi band */ |
| 4093 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) { |
| 4094 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 4095 | goto fail; |
| 4096 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4097 | pReqMsg->buckets[index].band = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4098 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]); |
| 4099 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4100 | pReqMsg->buckets[index].band); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4101 | |
| 4102 | /* Parse and fetch period */ |
| 4103 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) { |
| 4104 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr period failed")); |
| 4105 | goto fail; |
| 4106 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4107 | pReqMsg->buckets[index].period = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4108 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]); |
| 4109 | hddLog(VOS_TRACE_LEVEL_INFO, FL("period (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4110 | pReqMsg->buckets[index].period); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4111 | |
| 4112 | /* Parse and fetch report events */ |
| 4113 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) { |
| 4114 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report events failed")); |
| 4115 | goto fail; |
| 4116 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4117 | pReqMsg->buckets[index].reportEvents = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4118 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]); |
| 4119 | hddLog(VOS_TRACE_LEVEL_INFO, FL("report events (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4120 | pReqMsg->buckets[index].reportEvents); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4121 | |
| 4122 | /* Parse and fetch number of channels */ |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4123 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) |
| 4124 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4125 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr num channels failed")); |
| 4126 | goto fail; |
| 4127 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4128 | pReqMsg->buckets[index].numChannels = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4129 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]); |
| 4130 | hddLog(VOS_TRACE_LEVEL_INFO, FL("num channels (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4131 | pReqMsg->buckets[index].numChannels); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4132 | |
| 4133 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) { |
| 4134 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel spec failed")); |
| 4135 | goto fail; |
| 4136 | } |
| 4137 | |
| 4138 | j = 0; |
| 4139 | nla_for_each_nested(channels, |
| 4140 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) { |
| 4141 | if(nla_parse(channel, |
| 4142 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4143 | nla_data(channels), nla_len(channels), |
| 4144 | NULL)) { //wlan_hdd_extscan_config_policy here |
| 4145 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 4146 | goto fail; |
| 4147 | } |
| 4148 | |
| 4149 | /* Parse and fetch channel */ |
| 4150 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) { |
| 4151 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 4152 | goto fail; |
| 4153 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4154 | pReqMsg->buckets[index].channels[j].channel = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4155 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]); |
| 4156 | hddLog(VOS_TRACE_LEVEL_INFO, FL("channel (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4157 | pReqMsg->buckets[index].channels[j].channel); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4158 | |
| 4159 | /* Parse and fetch dwell time */ |
| 4160 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) { |
| 4161 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dwelltime failed")); |
| 4162 | goto fail; |
| 4163 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4164 | pReqMsg->buckets[index].channels[j].dwellTimeMs = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4165 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]); |
| 4166 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Dwell time (%u ms)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4167 | pReqMsg->buckets[index].channels[j].dwellTimeMs); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4168 | |
| 4169 | /* Parse and fetch channel spec passive */ |
| 4170 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) { |
| 4171 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4172 | FL("attr channel spec passive failed")); |
| 4173 | goto fail; |
| 4174 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4175 | pReqMsg->buckets[index].channels[j].passive = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4176 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]); |
| 4177 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Chnl spec passive (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4178 | pReqMsg->buckets[index].channels[j].passive); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4179 | j++; |
| 4180 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4181 | index++; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4182 | } |
| 4183 | status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg); |
| 4184 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4185 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4186 | FL("sme_EXTScanStart failed(err=%d)"), status); |
| 4187 | vos_mem_free(pReqMsg); |
| 4188 | return -EINVAL; |
| 4189 | } |
| 4190 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4191 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4192 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4193 | return 0; |
| 4194 | |
| 4195 | fail: |
| 4196 | vos_mem_free(pReqMsg); |
| 4197 | return -EINVAL; |
| 4198 | } |
| 4199 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4200 | static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
| 4201 | struct wireless_dev *wdev, |
| 4202 | const void *data, int dataLen) |
| 4203 | { |
| 4204 | int ret = 0; |
| 4205 | |
| 4206 | vos_ssr_protect(__func__); |
| 4207 | ret = __wlan_hdd_cfg80211_extscan_start(wiphy, wdev, data, dataLen); |
| 4208 | vos_ssr_unprotect(__func__); |
| 4209 | |
| 4210 | return ret; |
| 4211 | } |
| 4212 | |
| 4213 | static int __wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4214 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4215 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4216 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4217 | tSirEXTScanStopReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4218 | struct net_device *dev = wdev->netdev; |
| 4219 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4220 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4221 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4222 | eHalStatus status; |
| 4223 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4224 | ENTER(); |
| 4225 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4226 | status = wlan_hdd_validate_context(pHddCtx); |
| 4227 | if (0 != status) |
| 4228 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4229 | return -EINVAL; |
| 4230 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4231 | /* check the EXTScan Capability */ |
| 4232 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4233 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4234 | { |
| 4235 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4236 | FL("EXTScan not enabled/supported by Firmware")); |
| 4237 | return -EINVAL; |
| 4238 | } |
| 4239 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4240 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4241 | data, dataLen, |
| 4242 | wlan_hdd_extscan_config_policy)) { |
| 4243 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4244 | return -EINVAL; |
| 4245 | } |
| 4246 | |
| 4247 | /* Parse and fetch request Id */ |
| 4248 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4249 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4250 | return -EINVAL; |
| 4251 | } |
| 4252 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4253 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4254 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4255 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4256 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4257 | reqMsg.sessionId = pAdapter->sessionId; |
| 4258 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4259 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4260 | status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4261 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4262 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4263 | FL("sme_EXTScanStop failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4264 | return -EINVAL; |
| 4265 | } |
| 4266 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4267 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4268 | return 0; |
| 4269 | } |
| 4270 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4271 | static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
| 4272 | struct wireless_dev *wdev, |
| 4273 | const void *data, int dataLen) |
| 4274 | { |
| 4275 | int ret = 0; |
| 4276 | |
| 4277 | vos_ssr_protect(__func__); |
| 4278 | ret = __wlan_hdd_cfg80211_extscan_stop(wiphy, wdev, data, dataLen); |
| 4279 | vos_ssr_unprotect(__func__); |
| 4280 | |
| 4281 | return ret; |
| 4282 | } |
| 4283 | |
| 4284 | static int __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4285 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4286 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4287 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4288 | tSirEXTScanResetBssidHotlistReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4289 | struct net_device *dev = wdev->netdev; |
| 4290 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4291 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4292 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4293 | eHalStatus status; |
| 4294 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4295 | ENTER(); |
| 4296 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4297 | status = wlan_hdd_validate_context(pHddCtx); |
| 4298 | if (0 != status) |
| 4299 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4300 | return -EINVAL; |
| 4301 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4302 | /* check the EXTScan Capability */ |
| 4303 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4304 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4305 | { |
| 4306 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4307 | FL("EXTScan not enabled/supported by Firmware")); |
| 4308 | return -EINVAL; |
| 4309 | } |
| 4310 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4311 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4312 | data, dataLen, |
| 4313 | wlan_hdd_extscan_config_policy)) { |
| 4314 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4315 | return -EINVAL; |
| 4316 | } |
| 4317 | |
| 4318 | /* Parse and fetch request Id */ |
| 4319 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4320 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4321 | return -EINVAL; |
| 4322 | } |
| 4323 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4324 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4325 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4326 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4327 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4328 | reqMsg.sessionId = pAdapter->sessionId; |
| 4329 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4330 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4331 | status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4332 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4333 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4334 | FL("sme_ResetBssHotlist failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4335 | return -EINVAL; |
| 4336 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4337 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4338 | return 0; |
| 4339 | } |
| 4340 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4341 | static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
| 4342 | struct wireless_dev *wdev, |
| 4343 | const void *data, int dataLen) |
| 4344 | { |
| 4345 | int ret = 0; |
| 4346 | |
| 4347 | vos_ssr_protect(__func__); |
| 4348 | ret = __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(wiphy, wdev, data, dataLen); |
| 4349 | vos_ssr_unprotect(__func__); |
| 4350 | |
| 4351 | return ret; |
| 4352 | } |
| 4353 | |
| 4354 | static int __wlan_hdd_cfg80211_extscan_reset_significant_change( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4355 | struct wiphy *wiphy, |
| 4356 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4357 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4358 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4359 | tSirEXTScanResetSignificantChangeReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4360 | struct net_device *dev = wdev->netdev; |
| 4361 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4362 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4363 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4364 | eHalStatus status; |
| 4365 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4366 | ENTER(); |
| 4367 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4368 | status = wlan_hdd_validate_context(pHddCtx); |
| 4369 | if (0 != status) |
| 4370 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4371 | return -EINVAL; |
| 4372 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4373 | /* check the EXTScan Capability */ |
| 4374 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4375 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4376 | { |
| 4377 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4378 | FL("EXTScan not enabled/supported by Firmware")); |
| 4379 | return -EINVAL; |
| 4380 | } |
| 4381 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4382 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4383 | data, dataLen, |
| 4384 | wlan_hdd_extscan_config_policy)) { |
| 4385 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4386 | return -EINVAL; |
| 4387 | } |
| 4388 | |
| 4389 | /* Parse and fetch request Id */ |
| 4390 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4391 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4392 | return -EINVAL; |
| 4393 | } |
| 4394 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4395 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4396 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4397 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4398 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4399 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4400 | reqMsg.sessionId = pAdapter->sessionId; |
| 4401 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4402 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4403 | status = sme_ResetSignificantChange(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4404 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4405 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4406 | FL("sme_ResetSignificantChange failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4407 | return -EINVAL; |
| 4408 | } |
| 4409 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4410 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4411 | return 0; |
| 4412 | } |
| 4413 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4414 | static int wlan_hdd_cfg80211_extscan_reset_significant_change( |
| 4415 | struct wiphy *wiphy, |
| 4416 | struct wireless_dev *wdev, |
| 4417 | const void *data, int dataLen) |
| 4418 | { |
| 4419 | int ret = 0; |
| 4420 | |
| 4421 | vos_ssr_protect(__func__); |
| 4422 | ret = __wlan_hdd_cfg80211_extscan_reset_significant_change(wiphy, |
| 4423 | wdev, data, |
| 4424 | dataLen); |
| 4425 | vos_ssr_unprotect(__func__); |
| 4426 | |
| 4427 | return ret; |
| 4428 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4429 | #endif /* WLAN_FEATURE_EXTSCAN */ |
| 4430 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4431 | /*EXT TDLS*/ |
| 4432 | static const struct nla_policy |
| 4433 | wlan_hdd_tdls_config_enable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX +1] = |
| 4434 | { |
| 4435 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4436 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL] = {.type = NLA_S32 }, |
| 4437 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS] = |
| 4438 | {.type = NLA_S32 }, |
| 4439 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS] = {.type = NLA_S32 }, |
| 4440 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS] = {.type = NLA_S32 }, |
| 4441 | |
| 4442 | }; |
| 4443 | |
| 4444 | static const struct nla_policy |
| 4445 | wlan_hdd_tdls_config_disable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX +1] = |
| 4446 | { |
| 4447 | [QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4448 | |
| 4449 | }; |
| 4450 | |
| 4451 | static const struct nla_policy |
| 4452 | wlan_hdd_tdls_config_state_change_policy[ |
| 4453 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAX +1] = |
| 4454 | { |
| 4455 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4456 | [QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE] = {.type = NLA_S32 }, |
| 4457 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4458 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL] = {.type = NLA_S32 }, |
| 4459 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS] = |
| 4460 | {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4461 | |
| 4462 | }; |
| 4463 | |
| 4464 | static const struct nla_policy |
| 4465 | wlan_hdd_tdls_config_get_status_policy[ |
| 4466 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX +1] = |
| 4467 | { |
| 4468 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4469 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE] = {.type = NLA_S32 }, |
| 4470 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4471 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL] = {.type = NLA_S32 }, |
| 4472 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS] |
| 4473 | = {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4474 | |
| 4475 | }; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4476 | |
| 4477 | static const struct nla_policy |
| 4478 | wlan_hdd_mac_config[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX+1] = |
| 4479 | { |
| 4480 | [QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI] = {.type = NLA_UNSPEC }, |
| 4481 | }; |
| 4482 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4483 | static int __wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4484 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4485 | const void *data, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4486 | int data_len) |
| 4487 | { |
| 4488 | |
| 4489 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4490 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX + 1]; |
| 4491 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4492 | ENTER(); |
| 4493 | |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4494 | if (0 != wlan_hdd_validate_context(pHddCtx)){ |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4495 | return -EINVAL; |
| 4496 | } |
| 4497 | if (FALSE == pHddCtx->cfg_ini->enableMacSpoofing) { |
| 4498 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN disabled in ini")); |
| 4499 | return -ENOTSUPP; |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4500 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4501 | if (TRUE != sme_IsFeatureSupportedByFW(MAC_SPOOFED_SCAN)){ |
| 4502 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN not supported by FW")); |
| 4503 | return -ENOTSUPP; |
| 4504 | } |
| 4505 | |
| 4506 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX, |
| 4507 | data, data_len, wlan_hdd_mac_config)) { |
| 4508 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4509 | return -EINVAL; |
| 4510 | } |
| 4511 | |
| 4512 | /* Parse and fetch mac address */ |
| 4513 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]) { |
| 4514 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4515 | return -EINVAL; |
| 4516 | } |
| 4517 | |
| 4518 | memcpy(pHddCtx->spoofMacAddr.randomMacAddr.bytes, nla_data( |
| 4519 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4520 | VOS_MAC_ADDR_LAST_3_BYTES); |
| 4521 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4522 | pHddCtx->spoofMacAddr.isEnabled = TRUE; |
| 4523 | |
| 4524 | 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] | 4525 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4526 | VOS_MAC_ADDR_FIRST_3_BYTES); |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4527 | if ((pHddCtx->spoofMacAddr.randomMacAddr.bytes[0] == 0) && |
| 4528 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[1] == 0) && |
| 4529 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[2] == 0)) |
| 4530 | { |
| 4531 | hddLog(LOG1, FL("ZERO MAC OUI Recieved. Disabling Spoofing")); |
| 4532 | vos_mem_zero(pHddCtx->spoofMacAddr.randomMacAddr.bytes, |
| 4533 | VOS_MAC_ADDRESS_LEN); |
| 4534 | pHddCtx->spoofMacAddr.isEnabled = FALSE; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4535 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4536 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4537 | if (VOS_STATUS_SUCCESS != hdd_processSpoofMacAddrRequest(pHddCtx)) |
| 4538 | { |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4539 | hddLog(LOGE, FL("Failed to send Spoof Mac Addr to FW")); |
| 4540 | } |
| 4541 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4542 | EXIT(); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4543 | return 0; |
| 4544 | } |
| 4545 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4546 | static int wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
| 4547 | struct wireless_dev *wdev, |
| 4548 | const void *data, |
| 4549 | int data_len) |
| 4550 | { |
| 4551 | int ret = 0; |
| 4552 | |
| 4553 | vos_ssr_protect(__func__); |
| 4554 | ret = __wlan_hdd_cfg80211_set_spoofed_mac_oui(wiphy, wdev, data, data_len); |
| 4555 | vos_ssr_unprotect(__func__); |
| 4556 | |
| 4557 | return ret; |
| 4558 | } |
| 4559 | |
| 4560 | static int __wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4561 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4562 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4563 | int data_len) |
| 4564 | { |
| 4565 | u8 peer[6] = {0}; |
| 4566 | struct net_device *dev = wdev->netdev; |
| 4567 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4568 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4569 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; |
| 4570 | eHalStatus ret; |
| 4571 | tANI_S32 state; |
| 4572 | tANI_S32 reason; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4573 | tANI_S32 global_operating_class = 0; |
| 4574 | tANI_S32 channel = 0; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4575 | struct sk_buff *skb = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4576 | int retVal; |
| 4577 | |
| 4578 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4579 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4580 | if (!pAdapter) { |
| 4581 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 4582 | return -EINVAL; |
| 4583 | } |
| 4584 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4585 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4586 | if (0 != ret) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4587 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4588 | return -EINVAL; |
| 4589 | } |
| 4590 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4591 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4592 | return -ENOTSUPP; |
| 4593 | } |
| 4594 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, |
| 4595 | data, data_len, |
| 4596 | wlan_hdd_tdls_config_get_status_policy)) { |
| 4597 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4598 | return -EINVAL; |
| 4599 | } |
| 4600 | |
| 4601 | /* Parse and fetch mac address */ |
| 4602 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]) { |
| 4603 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4604 | return -EINVAL; |
| 4605 | } |
| 4606 | |
| 4607 | memcpy(peer, nla_data( |
| 4608 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]), |
| 4609 | sizeof(peer)); |
| 4610 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4611 | |
| 4612 | ret = wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason); |
| 4613 | |
| 4614 | if (0 != ret) { |
| 4615 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4616 | FL("get status Failed")); |
| 4617 | return -EINVAL; |
| 4618 | } |
| 4619 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4620 | 4 * sizeof(s32) + |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4621 | NLMSG_HDRLEN); |
| 4622 | |
| 4623 | if (!skb) { |
| 4624 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4625 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 4626 | return -EINVAL; |
| 4627 | } |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4628 | 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] | 4629 | reason, |
| 4630 | state, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4631 | global_operating_class, |
| 4632 | channel, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4633 | MAC_ADDR_ARRAY(peer)); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4634 | if (nla_put_s32(skb, |
| 4635 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE, |
| 4636 | state) || |
| 4637 | nla_put_s32(skb, |
| 4638 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON, |
| 4639 | reason) || |
| 4640 | nla_put_s32(skb, |
| 4641 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS, |
| 4642 | global_operating_class) || |
| 4643 | nla_put_s32(skb, |
| 4644 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL, |
| 4645 | channel)) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4646 | |
| 4647 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4648 | goto nla_put_failure; |
| 4649 | } |
| 4650 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4651 | retVal = cfg80211_vendor_cmd_reply(skb); |
| 4652 | EXIT(); |
| 4653 | return retVal; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4654 | |
| 4655 | nla_put_failure: |
| 4656 | kfree_skb(skb); |
| 4657 | return -EINVAL; |
| 4658 | } |
| 4659 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4660 | static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
| 4661 | struct wireless_dev *wdev, |
| 4662 | const void *data, |
| 4663 | int data_len) |
| 4664 | { |
| 4665 | int ret = 0; |
| 4666 | |
| 4667 | vos_ssr_protect(__func__); |
| 4668 | ret = __wlan_hdd_cfg80211_exttdls_get_status(wiphy, wdev, data, data_len); |
| 4669 | vos_ssr_unprotect(__func__); |
| 4670 | |
| 4671 | return ret; |
| 4672 | } |
| 4673 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4674 | static int wlan_hdd_cfg80211_exttdls_callback(tANI_U8* mac, |
| 4675 | tANI_S32 state, |
| 4676 | tANI_S32 reason, |
| 4677 | void *ctx) |
| 4678 | { |
| 4679 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)ctx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4680 | struct sk_buff *skb = NULL; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4681 | tANI_S32 global_operating_class = 0; |
| 4682 | tANI_S32 channel = 0; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4683 | hdd_context_t *pHddCtx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4684 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4685 | ENTER(); |
| 4686 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4687 | if (!pAdapter) { |
| 4688 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 4689 | return -EINVAL; |
| 4690 | } |
| 4691 | |
| 4692 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4693 | if (wlan_hdd_validate_context(pHddCtx)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4694 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4695 | return -EINVAL; |
| 4696 | } |
| 4697 | |
| 4698 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4699 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4700 | return -ENOTSUPP; |
| 4701 | } |
| 4702 | skb = cfg80211_vendor_event_alloc( |
| 4703 | pHddCtx->wiphy, |
| 4704 | EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 4705 | QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX, |
| 4706 | GFP_KERNEL); |
| 4707 | |
| 4708 | if (!skb) { |
| 4709 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4710 | FL("cfg80211_vendor_event_alloc failed")); |
| 4711 | return -EINVAL; |
| 4712 | } |
| 4713 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4714 | hddLog(VOS_TRACE_LEVEL_INFO, "Reason: (%d) Status: (%d) Class: (%d) Channel: (%d)", |
| 4715 | reason, |
| 4716 | state, |
| 4717 | global_operating_class, |
| 4718 | channel); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4719 | hddLog(VOS_TRACE_LEVEL_WARN, "tdls peer " MAC_ADDRESS_STR, |
| 4720 | MAC_ADDR_ARRAY(mac)); |
| 4721 | |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4722 | if (nla_put(skb, |
| 4723 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR, |
| 4724 | VOS_MAC_ADDR_SIZE, mac) || |
| 4725 | nla_put_s32(skb, |
| 4726 | QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE, |
| 4727 | state) || |
| 4728 | nla_put_s32(skb, |
| 4729 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON, |
| 4730 | reason) || |
| 4731 | nla_put_s32(skb, |
| 4732 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL, |
| 4733 | channel) || |
| 4734 | nla_put_s32(skb, |
| 4735 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS, |
| 4736 | global_operating_class) |
| 4737 | ) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4738 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4739 | goto nla_put_failure; |
| 4740 | } |
| 4741 | |
| 4742 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4743 | EXIT(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4744 | return (0); |
| 4745 | |
| 4746 | nla_put_failure: |
| 4747 | kfree_skb(skb); |
| 4748 | return -EINVAL; |
| 4749 | } |
| 4750 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4751 | static int __wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4752 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4753 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4754 | int data_len) |
| 4755 | { |
| 4756 | u8 peer[6] = {0}; |
| 4757 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4758 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4759 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1]; |
| 4760 | eHalStatus status; |
| 4761 | tdls_req_params_t pReqMsg = {0}; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4762 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4763 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4764 | |
| 4765 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4766 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4767 | if (!dev) { |
| 4768 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 4769 | return -EINVAL; |
| 4770 | } |
| 4771 | |
| 4772 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4773 | if (!pAdapter) { |
| 4774 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 4775 | return -EINVAL; |
| 4776 | } |
| 4777 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4778 | status = wlan_hdd_validate_context(pHddCtx); |
| 4779 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4780 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4781 | return -EINVAL; |
| 4782 | } |
| 4783 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4784 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4785 | return -ENOTSUPP; |
| 4786 | } |
| 4787 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX, |
| 4788 | data, data_len, |
| 4789 | wlan_hdd_tdls_config_enable_policy)) { |
| 4790 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4791 | return -EINVAL; |
| 4792 | } |
| 4793 | |
| 4794 | /* Parse and fetch mac address */ |
| 4795 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]) { |
| 4796 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4797 | return -EINVAL; |
| 4798 | } |
| 4799 | |
| 4800 | memcpy(peer, nla_data( |
| 4801 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]), |
| 4802 | sizeof(peer)); |
| 4803 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4804 | |
| 4805 | /* Parse and fetch channel */ |
| 4806 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]) { |
| 4807 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 4808 | return -EINVAL; |
| 4809 | } |
| 4810 | pReqMsg.channel = nla_get_s32( |
| 4811 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]); |
| 4812 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Channel Num (%d)"), pReqMsg.channel); |
| 4813 | |
| 4814 | /* Parse and fetch global operating class */ |
| 4815 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]) { |
| 4816 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr operating class failed")); |
| 4817 | return -EINVAL; |
| 4818 | } |
| 4819 | pReqMsg.global_operating_class = nla_get_s32( |
| 4820 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]); |
| 4821 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Operating class (%d)"), |
| 4822 | pReqMsg.global_operating_class); |
| 4823 | |
| 4824 | /* Parse and fetch latency ms */ |
| 4825 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]) { |
| 4826 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr latency failed")); |
| 4827 | return -EINVAL; |
| 4828 | } |
| 4829 | pReqMsg.max_latency_ms = nla_get_s32( |
| 4830 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]); |
| 4831 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Latency (%d)"), |
| 4832 | pReqMsg.max_latency_ms); |
| 4833 | |
| 4834 | /* Parse and fetch required bandwidth kbps */ |
| 4835 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]) { |
| 4836 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bandwidth failed")); |
| 4837 | return -EINVAL; |
| 4838 | } |
| 4839 | |
| 4840 | pReqMsg.min_bandwidth_kbps = nla_get_s32( |
| 4841 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]); |
| 4842 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bandwidth (%d)"), |
| 4843 | pReqMsg.min_bandwidth_kbps); |
| 4844 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4845 | ret = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4846 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 4847 | &pReqMsg, |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4848 | wlan_hdd_cfg80211_exttdls_callback); |
| 4849 | |
| 4850 | EXIT(); |
| 4851 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4852 | } |
| 4853 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4854 | static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
| 4855 | struct wireless_dev *wdev, |
| 4856 | const void *data, |
| 4857 | int data_len) |
| 4858 | { |
| 4859 | int ret = 0; |
| 4860 | |
| 4861 | vos_ssr_protect(__func__); |
| 4862 | ret = __wlan_hdd_cfg80211_exttdls_enable(wiphy, wdev, data, data_len); |
| 4863 | vos_ssr_unprotect(__func__); |
| 4864 | |
| 4865 | return ret; |
| 4866 | } |
| 4867 | |
| 4868 | static int __wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4869 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4870 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4871 | int data_len) |
| 4872 | { |
| 4873 | u8 peer[6] = {0}; |
| 4874 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4875 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4876 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1]; |
| 4877 | eHalStatus status; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4878 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4879 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4880 | |
| 4881 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4882 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4883 | if (!dev) { |
| 4884 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 4885 | return -EINVAL; |
| 4886 | } |
| 4887 | |
| 4888 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4889 | if (!pAdapter) { |
| 4890 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 4891 | return -EINVAL; |
| 4892 | } |
| 4893 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4894 | status = wlan_hdd_validate_context(pHddCtx); |
| 4895 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4896 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4897 | return -EINVAL; |
| 4898 | } |
| 4899 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4900 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4901 | return -ENOTSUPP; |
| 4902 | } |
| 4903 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX, |
| 4904 | data, data_len, |
| 4905 | wlan_hdd_tdls_config_disable_policy)) { |
| 4906 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4907 | return -EINVAL; |
| 4908 | } |
| 4909 | /* Parse and fetch mac address */ |
| 4910 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]) { |
| 4911 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4912 | return -EINVAL; |
| 4913 | } |
| 4914 | |
| 4915 | memcpy(peer, nla_data( |
| 4916 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]), |
| 4917 | sizeof(peer)); |
| 4918 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4919 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4920 | ret = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
| 4921 | |
| 4922 | EXIT(); |
| 4923 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4924 | } |
| 4925 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4926 | static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
| 4927 | struct wireless_dev *wdev, |
| 4928 | const void *data, |
| 4929 | int data_len) |
| 4930 | { |
| 4931 | int ret = 0; |
| 4932 | |
| 4933 | vos_ssr_protect(__func__); |
| 4934 | ret = __wlan_hdd_cfg80211_exttdls_disable(wiphy, wdev, data, data_len); |
| 4935 | vos_ssr_unprotect(__func__); |
| 4936 | |
| 4937 | return ret; |
| 4938 | } |
| 4939 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4940 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4941 | __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4942 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4943 | const void *data, int data_len) |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4944 | { |
| 4945 | struct net_device *dev = wdev->netdev; |
| 4946 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4947 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4948 | struct sk_buff *skb = NULL; |
| 4949 | tANI_U32 fset = 0; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4950 | int ret = 0; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4951 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4952 | ENTER(); |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4953 | |
| 4954 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4955 | if (0 != ret) |
| 4956 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4957 | return ret; |
| 4958 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4959 | if (wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { |
| 4960 | hddLog(LOG1, FL("Infra Station mode is supported by driver")); |
| 4961 | fset |= WIFI_FEATURE_INFRA; |
| 4962 | } |
| 4963 | |
| 4964 | if (TRUE == hdd_is_5g_supported(pHddCtx)) { |
| 4965 | hddLog(LOG1, FL("INFRA_5G is supported by firmware")); |
| 4966 | fset |= WIFI_FEATURE_INFRA_5G; |
| 4967 | } |
| 4968 | |
| 4969 | #ifdef WLAN_FEATURE_P2P |
| 4970 | if ((wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) && |
| 4971 | (wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_GO))) { |
| 4972 | hddLog(LOG1, FL("WiFi-Direct is supported by driver")); |
| 4973 | fset |= WIFI_FEATURE_P2P; |
| 4974 | } |
| 4975 | #endif |
| 4976 | |
| 4977 | /* Soft-AP is supported currently by default */ |
| 4978 | fset |= WIFI_FEATURE_SOFT_AP; |
| 4979 | |
Kanchanapally, Vidyullatha | 683aed0 | 2015-03-24 16:58:38 +0530 | [diff] [blame] | 4980 | /* HOTSPOT is a supplicant feature, enable it by default */ |
| 4981 | fset |= WIFI_FEATURE_HOTSPOT; |
| 4982 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4983 | #ifdef WLAN_FEATURE_EXTSCAN |
| 4984 | if ((TRUE == pHddCtx->cfg_ini->fEnableEXTScan) && |
| 4985 | sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) { |
| 4986 | hddLog(LOG1, FL("EXTScan is supported by firmware")); |
| 4987 | fset |= WIFI_FEATURE_EXTSCAN; |
| 4988 | } |
| 4989 | #endif |
| 4990 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4991 | if (sme_IsFeatureSupportedByFW(NAN)) { |
| 4992 | hddLog(LOG1, FL("NAN is supported by firmware")); |
| 4993 | fset |= WIFI_FEATURE_NAN; |
| 4994 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4995 | |
| 4996 | /* D2D RTT is not supported currently by default */ |
| 4997 | if (sme_IsFeatureSupportedByFW(RTT)) { |
| 4998 | hddLog(LOG1, FL("RTT is supported by firmware")); |
| 4999 | fset |= WIFI_FEATURE_D2AP_RTT; |
| 5000 | } |
| 5001 | |
| 5002 | #ifdef FEATURE_WLAN_BATCH_SCAN |
| 5003 | if (fset & WIFI_FEATURE_EXTSCAN) { |
| 5004 | hddLog(LOG1, FL("Batch scan is supported as extscan is supported")); |
| 5005 | fset &= ~WIFI_FEATURE_BATCH_SCAN; |
| 5006 | } else if (sme_IsFeatureSupportedByFW(BATCH_SCAN)) { |
| 5007 | hddLog(LOG1, FL("Batch scan is supported by firmware")); |
| 5008 | fset |= WIFI_FEATURE_BATCH_SCAN; |
| 5009 | } |
| 5010 | #endif |
| 5011 | |
| 5012 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 5013 | if (pHddCtx->cfg_ini->configPNOScanSupport && |
| 5014 | (eHAL_STATUS_SUCCESS == wlan_hdd_is_pno_allowed(pAdapter))) { |
| 5015 | hddLog(LOG1, FL("PNO is supported by firmware")); |
| 5016 | fset |= WIFI_FEATURE_PNO; |
| 5017 | } |
| 5018 | #endif |
| 5019 | |
| 5020 | /* STA+STA is supported currently by default */ |
| 5021 | fset |= WIFI_FEATURE_ADDITIONAL_STA; |
| 5022 | |
| 5023 | #ifdef FEATURE_WLAN_TDLS |
| 5024 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSSupport) && |
| 5025 | sme_IsFeatureSupportedByFW(TDLS)) { |
| 5026 | hddLog(LOG1, FL("TDLS is supported by firmware")); |
| 5027 | fset |= WIFI_FEATURE_TDLS; |
| 5028 | } |
| 5029 | |
| 5030 | /* TDLS_OFFCHANNEL is not supported currently by default */ |
| 5031 | #endif |
| 5032 | |
| 5033 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 5034 | /* AP+STA concurrency is supported currently by default */ |
| 5035 | fset |= WIFI_FEATURE_AP_STA; |
| 5036 | #endif |
| 5037 | |
| 5038 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) + |
| 5039 | NLMSG_HDRLEN); |
| 5040 | |
| 5041 | if (!skb) { |
| 5042 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 5043 | return -EINVAL; |
| 5044 | } |
| 5045 | hddLog(LOG1, FL("Supported Features : 0x%x"), fset); |
| 5046 | |
| 5047 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_FEATURE_SET, fset)) { |
| 5048 | hddLog(LOGE, FL("nla put fail")); |
| 5049 | goto nla_put_failure; |
| 5050 | } |
| 5051 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5052 | ret = cfg80211_vendor_cmd_reply(skb); |
| 5053 | EXIT(); |
| 5054 | return ret; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5055 | |
| 5056 | nla_put_failure: |
| 5057 | kfree_skb(skb); |
| 5058 | return -EINVAL; |
| 5059 | } |
| 5060 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5061 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5062 | wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
| 5063 | struct wireless_dev *wdev, |
| 5064 | const void *data, int data_len) |
| 5065 | { |
| 5066 | int ret = 0; |
| 5067 | |
| 5068 | vos_ssr_protect(__func__); |
| 5069 | ret = __wlan_hdd_cfg80211_get_supported_features(wiphy, wdev, data, data_len); |
| 5070 | vos_ssr_unprotect(__func__); |
| 5071 | |
| 5072 | return ret; |
| 5073 | } |
| 5074 | |
| 5075 | static int |
| 5076 | __wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5077 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5078 | const void *data, int data_len) |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5079 | { |
| 5080 | uint32_t feature_set_matrix[WLAN_HDD_MAX_FEATURE_SET] = {0}; |
| 5081 | uint8_t i, feature_sets, max_feature_sets; |
| 5082 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX + 1]; |
| 5083 | struct sk_buff *reply_skb; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5084 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5085 | int ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5086 | |
| 5087 | ENTER(); |
| 5088 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5089 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5090 | if (0 != ret) |
| 5091 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5092 | return ret; |
| 5093 | } |
| 5094 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5095 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX, |
| 5096 | data, data_len, NULL)) { |
| 5097 | hddLog(LOGE, FL("Invalid ATTR")); |
| 5098 | return -EINVAL; |
| 5099 | } |
| 5100 | |
| 5101 | /* Parse and fetch max feature set */ |
| 5102 | if (!tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]) { |
| 5103 | hddLog(LOGE, FL("Attr max feature set size failed")); |
| 5104 | return -EINVAL; |
| 5105 | } |
| 5106 | max_feature_sets = nla_get_u32( |
| 5107 | tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]); |
| 5108 | hddLog(LOG1, FL("Max feature set size (%d)"), max_feature_sets); |
| 5109 | |
| 5110 | /* Fill feature combination matrix */ |
| 5111 | feature_sets = 0; |
| 5112 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 5113 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5114 | WIFI_FEATURE_P2P; |
| 5115 | |
| 5116 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 5117 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5118 | WIFI_FEATURE_SOFT_AP; |
| 5119 | |
| 5120 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 5121 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_P2P | |
| 5122 | WIFI_FEATURE_SOFT_AP; |
| 5123 | |
| 5124 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 5125 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5126 | WIFI_FEATURE_SOFT_AP | |
| 5127 | WIFI_FEATURE_P2P; |
| 5128 | |
| 5129 | /* Add more feature combinations here */ |
| 5130 | |
| 5131 | feature_sets = VOS_MIN(feature_sets, max_feature_sets); |
| 5132 | hddLog(LOG1, FL("Number of feature sets (%d)"), feature_sets); |
| 5133 | hddLog(LOG1, "Feature set matrix"); |
| 5134 | for (i = 0; i < feature_sets; i++) |
| 5135 | hddLog(LOG1, "[%d] 0x%02X", i, feature_set_matrix[i]); |
| 5136 | |
| 5137 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 5138 | sizeof(u32) * feature_sets + |
| 5139 | NLMSG_HDRLEN); |
| 5140 | |
| 5141 | if (reply_skb) { |
| 5142 | if (nla_put_u32(reply_skb, |
| 5143 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET_SIZE, |
| 5144 | feature_sets) || |
| 5145 | nla_put(reply_skb, |
| 5146 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET, |
| 5147 | sizeof(u32) * feature_sets, feature_set_matrix)) { |
| 5148 | hddLog(LOGE, FL("nla put fail")); |
| 5149 | kfree_skb(reply_skb); |
| 5150 | return -EINVAL; |
| 5151 | } |
| 5152 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5153 | ret = cfg80211_vendor_cmd_reply(reply_skb); |
| 5154 | EXIT(); |
| 5155 | return ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5156 | } |
| 5157 | hddLog(LOGE, FL("Feature set matrix: buffer alloc fail")); |
| 5158 | return -ENOMEM; |
| 5159 | |
| 5160 | max_buffer_err: |
| 5161 | hddLog(LOGE, FL("Feature set max buffer size reached. feature_sets(%d) max(%d)"), |
| 5162 | feature_sets, WLAN_HDD_MAX_FEATURE_SET); |
| 5163 | return -EINVAL; |
| 5164 | } |
| 5165 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5166 | static int |
| 5167 | wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
| 5168 | struct wireless_dev *wdev, |
| 5169 | const void *data, int data_len) |
| 5170 | { |
| 5171 | int ret = 0; |
| 5172 | |
| 5173 | vos_ssr_protect(__func__); |
| 5174 | ret = __wlan_hdd_cfg80211_get_concurrency_matrix(wiphy, wdev, data, |
| 5175 | data_len); |
| 5176 | vos_ssr_unprotect(__func__); |
| 5177 | |
| 5178 | return ret; |
| 5179 | } |
| 5180 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5181 | static const struct nla_policy |
| 5182 | wlan_hdd_set_no_dfs_flag_config_policy[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX |
| 5183 | +1] = |
| 5184 | { |
| 5185 | [QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG] = {.type = NLA_U32 }, |
| 5186 | }; |
| 5187 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5188 | static int __wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5189 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5190 | const void *data, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5191 | int data_len) |
| 5192 | { |
| 5193 | struct net_device *dev = wdev->netdev; |
| 5194 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5195 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5196 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5197 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX + 1]; |
| 5198 | eHalStatus status; |
| 5199 | u32 dfsFlag = 0; |
| 5200 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5201 | ENTER(); |
| 5202 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5203 | status = wlan_hdd_validate_context(pHddCtx); |
| 5204 | if (0 != status) { |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5205 | return -EINVAL; |
| 5206 | } |
| 5207 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX, |
| 5208 | data, data_len, |
| 5209 | wlan_hdd_set_no_dfs_flag_config_policy)) { |
| 5210 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5211 | return -EINVAL; |
| 5212 | } |
| 5213 | |
| 5214 | /* Parse and fetch required bandwidth kbps */ |
| 5215 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]) { |
| 5216 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dfs flag failed")); |
| 5217 | return -EINVAL; |
| 5218 | } |
| 5219 | |
| 5220 | dfsFlag = nla_get_u32( |
| 5221 | tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]); |
| 5222 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" DFS flag (%d)"), |
| 5223 | dfsFlag); |
| 5224 | |
| 5225 | pHddCtx->disable_dfs_flag = dfsFlag; |
| 5226 | |
| 5227 | sme_disable_dfs_channel(hHal, dfsFlag); |
| 5228 | sme_FilterScanResults(hHal, pAdapter->sessionId); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5229 | |
| 5230 | EXIT(); |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5231 | return 0; |
| 5232 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5233 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5234 | static int wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
| 5235 | struct wireless_dev *wdev, |
| 5236 | const void *data, |
| 5237 | int data_len) |
| 5238 | { |
| 5239 | int ret = 0; |
| 5240 | |
| 5241 | vos_ssr_protect(__func__); |
| 5242 | ret = __wlan_hdd_cfg80211_disable_dfs_channels(wiphy, wdev, data, data_len); |
| 5243 | vos_ssr_unprotect(__func__); |
| 5244 | |
| 5245 | return ret; |
| 5246 | |
| 5247 | } |
| 5248 | |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5249 | const struct |
| 5250 | nla_policy qca_wlan_vendor_attr[QCA_WLAN_VENDOR_ATTR_MAX+1] = |
| 5251 | { |
| 5252 | [QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY] = { .type = NLA_U32 }, |
| 5253 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { .type = NLA_UNSPEC }, |
| 5254 | }; |
| 5255 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5256 | static int __wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5257 | struct wireless_dev *wdev, const void *data, int data_len) |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5258 | { |
| 5259 | |
| 5260 | u8 bssid[6] = {0}; |
| 5261 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5262 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 5263 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5264 | v_U32_t isFwrRoamEnabled = FALSE; |
| 5265 | int ret; |
| 5266 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5267 | ENTER(); |
| 5268 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5269 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5270 | if (0 != ret) { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5271 | return ret; |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5272 | } |
| 5273 | |
| 5274 | ret = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, |
| 5275 | data, data_len, |
| 5276 | qca_wlan_vendor_attr); |
| 5277 | if (ret){ |
| 5278 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5279 | return -EINVAL; |
| 5280 | } |
| 5281 | |
| 5282 | /* Parse and fetch Enable flag */ |
| 5283 | if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]) { |
| 5284 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr enable failed")); |
| 5285 | return -EINVAL; |
| 5286 | } |
| 5287 | |
| 5288 | isFwrRoamEnabled = nla_get_u32( |
| 5289 | tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]); |
| 5290 | |
| 5291 | hddLog(VOS_TRACE_LEVEL_INFO, FL("isFwrRoamEnabled (%d)"), isFwrRoamEnabled); |
| 5292 | |
| 5293 | /* Parse and fetch bssid */ |
| 5294 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 5295 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bss id failed")); |
| 5296 | return -EINVAL; |
| 5297 | } |
| 5298 | |
| 5299 | memcpy(bssid, nla_data( |
| 5300 | tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 5301 | sizeof(bssid)); |
| 5302 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(bssid)); |
| 5303 | |
| 5304 | //Update roaming |
| 5305 | status = sme_ConfigFwrRoaming((tHalHandle)(pHddCtx->hHal), isFwrRoamEnabled); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5306 | EXIT(); |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5307 | return status; |
| 5308 | } |
| 5309 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5310 | static int wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
| 5311 | struct wireless_dev *wdev, const void *data, int data_len) |
| 5312 | { |
| 5313 | int ret = 0; |
| 5314 | |
| 5315 | vos_ssr_protect(__func__); |
| 5316 | ret = __wlan_hdd_cfg80211_firmware_roaming(wiphy, wdev, data, data_len); |
| 5317 | vos_ssr_unprotect(__func__); |
| 5318 | |
| 5319 | return ret; |
| 5320 | } |
| 5321 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5322 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 5323 | { |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5324 | { |
| 5325 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5326 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAMING, |
| 5327 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5328 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5329 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5330 | .doit = wlan_hdd_cfg80211_firmware_roaming |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5331 | }, |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 5332 | |
| 5333 | { |
| 5334 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5335 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN, |
| 5336 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5337 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5338 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 5339 | .doit = wlan_hdd_cfg80211_nan_request |
| 5340 | }, |
| 5341 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5342 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5343 | { |
| 5344 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5345 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 5346 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5347 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5348 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5349 | .doit = wlan_hdd_cfg80211_ll_stats_clear |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5350 | }, |
| 5351 | |
| 5352 | { |
| 5353 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5354 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 5355 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5356 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5357 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5358 | .doit = wlan_hdd_cfg80211_ll_stats_set |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5359 | }, |
| 5360 | |
| 5361 | { |
| 5362 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5363 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 5364 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5365 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5366 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5367 | .doit = wlan_hdd_cfg80211_ll_stats_get |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5368 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5369 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5370 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5371 | { |
| 5372 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5373 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START, |
| 5374 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5375 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5376 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5377 | .doit = wlan_hdd_cfg80211_extscan_start |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5378 | }, |
| 5379 | { |
| 5380 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5381 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP, |
| 5382 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5383 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5384 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5385 | .doit = wlan_hdd_cfg80211_extscan_stop |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5386 | }, |
| 5387 | { |
| 5388 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5389 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS, |
| 5390 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5391 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5392 | .doit = wlan_hdd_cfg80211_extscan_get_valid_channels |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5393 | }, |
| 5394 | { |
| 5395 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5396 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES, |
| 5397 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5398 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5399 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5400 | .doit = wlan_hdd_cfg80211_extscan_get_capabilities |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5401 | }, |
| 5402 | { |
| 5403 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5404 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS, |
| 5405 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5406 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5407 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5408 | .doit = wlan_hdd_cfg80211_extscan_get_cached_results |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5409 | }, |
| 5410 | { |
| 5411 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5412 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST, |
| 5413 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5414 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5415 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5416 | .doit = wlan_hdd_cfg80211_extscan_set_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5417 | }, |
| 5418 | { |
| 5419 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5420 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST, |
| 5421 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5422 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5423 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5424 | .doit = wlan_hdd_cfg80211_extscan_reset_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5425 | }, |
| 5426 | { |
| 5427 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5428 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE, |
| 5429 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5430 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5431 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5432 | .doit = wlan_hdd_cfg80211_extscan_set_significant_change |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5433 | }, |
| 5434 | { |
| 5435 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5436 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE, |
| 5437 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5438 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5439 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5440 | .doit = wlan_hdd_cfg80211_extscan_reset_significant_change |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5441 | }, |
| 5442 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5443 | /*EXT TDLS*/ |
| 5444 | { |
| 5445 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5446 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE, |
| 5447 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5448 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5449 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5450 | .doit = wlan_hdd_cfg80211_exttdls_enable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5451 | }, |
| 5452 | { |
| 5453 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5454 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE, |
| 5455 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5456 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5457 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5458 | .doit = wlan_hdd_cfg80211_exttdls_disable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5459 | }, |
| 5460 | { |
| 5461 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5462 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS, |
| 5463 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5464 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5465 | .doit = wlan_hdd_cfg80211_exttdls_get_status |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5466 | }, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5467 | { |
| 5468 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5469 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES, |
| 5470 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5471 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5472 | .doit = wlan_hdd_cfg80211_get_supported_features |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5473 | }, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5474 | { |
| 5475 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5476 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG, |
| 5477 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5478 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5479 | .doit = wlan_hdd_cfg80211_disable_dfs_channels |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5480 | }, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5481 | { |
| 5482 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5483 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MAC_OUI, |
| 5484 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5485 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5486 | .doit = wlan_hdd_cfg80211_set_spoofed_mac_oui |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5487 | }, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5488 | { |
| 5489 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5490 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX, |
| 5491 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5492 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5493 | .doit = wlan_hdd_cfg80211_get_concurrency_matrix |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5494 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5495 | }; |
| 5496 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5497 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5498 | static const |
| 5499 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5500 | { |
| 5501 | #ifdef FEATURE_WLAN_CH_AVOID |
| 5502 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5503 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5504 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5505 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5506 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 5507 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5508 | { |
| 5509 | /* Index = 1*/ |
| 5510 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5511 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 5512 | }, |
| 5513 | { |
| 5514 | /* Index = 2*/ |
| 5515 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5516 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 5517 | }, |
| 5518 | { |
| 5519 | /* Index = 3*/ |
| 5520 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5521 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 5522 | }, |
| 5523 | { |
| 5524 | /* Index = 4*/ |
| 5525 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5526 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 5527 | }, |
| 5528 | { |
| 5529 | /* Index = 5*/ |
| 5530 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5531 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 5532 | }, |
| 5533 | { |
| 5534 | /* Index = 6*/ |
| 5535 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5536 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 5537 | }, |
| 5538 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5539 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5540 | { |
| 5541 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5542 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START |
| 5543 | }, |
| 5544 | { |
| 5545 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5546 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP |
| 5547 | }, |
| 5548 | { |
| 5549 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5550 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES |
| 5551 | }, |
| 5552 | { |
| 5553 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5554 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS |
| 5555 | }, |
| 5556 | { |
| 5557 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5558 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE |
| 5559 | }, |
| 5560 | { |
| 5561 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5562 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT |
| 5563 | }, |
| 5564 | { |
| 5565 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5566 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT |
| 5567 | }, |
| 5568 | { |
| 5569 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5570 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND |
| 5571 | }, |
| 5572 | { |
| 5573 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5574 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST |
| 5575 | }, |
| 5576 | { |
| 5577 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5578 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST |
| 5579 | }, |
| 5580 | { |
| 5581 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5582 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE |
| 5583 | }, |
| 5584 | { |
| 5585 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5586 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE |
| 5587 | }, |
| 5588 | { |
| 5589 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5590 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE |
| 5591 | }, |
| 5592 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5593 | /*EXT TDLS*/ |
| 5594 | { |
| 5595 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5596 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE |
| 5597 | }, |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 5598 | |
| 5599 | { |
| 5600 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5601 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN |
| 5602 | }, |
| 5603 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5604 | }; |
| 5605 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5606 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5607 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5608 | * This function is called by hdd_wlan_startup() |
| 5609 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5610 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5611 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5612 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5613 | { |
| 5614 | struct wiphy *wiphy; |
| 5615 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5616 | /* |
| 5617 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5618 | */ |
| 5619 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 5620 | |
| 5621 | if (!wiphy) |
| 5622 | { |
| 5623 | /* Print error and jump into err label and free the memory */ |
| 5624 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 5625 | return NULL; |
| 5626 | } |
| 5627 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5628 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5629 | return wiphy; |
| 5630 | } |
| 5631 | |
| 5632 | /* |
| 5633 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5634 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5635 | * private ioctl to change the band value |
| 5636 | */ |
| 5637 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 5638 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5639 | int i, j; |
| 5640 | eNVChannelEnabledType channelEnabledState; |
| 5641 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5642 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5643 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5644 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5645 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5646 | |
| 5647 | if (NULL == wiphy->bands[i]) |
| 5648 | { |
| 5649 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 5650 | __func__, i); |
| 5651 | continue; |
| 5652 | } |
| 5653 | |
| 5654 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 5655 | { |
| 5656 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 5657 | |
| 5658 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 5659 | band->channels[j].hw_value); |
| 5660 | |
| 5661 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 5662 | { |
Abhishek Singh | 678227a | 2014-11-04 10:52:38 +0530 | [diff] [blame] | 5663 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5664 | continue; |
| 5665 | } |
| 5666 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 5667 | { |
| 5668 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5669 | continue; |
| 5670 | } |
| 5671 | |
| 5672 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 5673 | NV_CHANNEL_INVALID == channelEnabledState) |
| 5674 | { |
| 5675 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5676 | } |
| 5677 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 5678 | { |
| 5679 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 5680 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 5681 | } |
| 5682 | else |
| 5683 | { |
| 5684 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 5685 | |IEEE80211_CHAN_RADAR); |
| 5686 | } |
| 5687 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5688 | } |
| 5689 | return 0; |
| 5690 | } |
| 5691 | /* |
| 5692 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5693 | * This function is called by hdd_wlan_startup() |
| 5694 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5695 | * This function is used to initialize and register wiphy structure. |
| 5696 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5697 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5698 | struct wiphy *wiphy, |
| 5699 | hdd_config_t *pCfg |
| 5700 | ) |
| 5701 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5702 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 5703 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5704 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5705 | ENTER(); |
| 5706 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5707 | /* Now bind the underlying wlan device with wiphy */ |
| 5708 | set_wiphy_dev(wiphy, dev); |
| 5709 | |
| 5710 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5711 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5712 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 5713 | /* the flag for the other case would be initialzed in |
| 5714 | vos_init_wiphy_from_nv_bin */ |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 5715 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5716 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5717 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5718 | /* This will disable updating of NL channels from passive to |
| 5719 | * active if a beacon is received on passive channel. */ |
| 5720 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Amar Singhal | f007319 | 2013-09-20 12:34:56 -0700 | [diff] [blame] | 5721 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5722 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5723 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5724 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 5725 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 5726 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 5727 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5728 | | WIPHY_FLAG_OFFCHAN_TX; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5729 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5730 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5731 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5732 | #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] | 5733 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 5734 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 5735 | || pCfg->isFastRoamIniFeatureEnabled |
| 5736 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5737 | #ifdef FEATURE_WLAN_ESE |
| 5738 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 5739 | #endif |
| 5740 | ) |
| 5741 | { |
| 5742 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 5743 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 5744 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5745 | #ifdef FEATURE_WLAN_TDLS |
| 5746 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 5747 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 5748 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 5749 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 5750 | if (pCfg->configPNOScanSupport) |
| 5751 | { |
| 5752 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 5753 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 5754 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 5755 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 5756 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 5757 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5758 | |
Abhishek Singh | 10d8597 | 2015-04-17 10:27:23 +0530 | [diff] [blame] | 5759 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 5760 | wiphy->features |= NL80211_FEATURE_HT_IBSS; |
| 5761 | #endif |
| 5762 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5763 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 5764 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 5765 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5766 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 5767 | driver need to determine what to do with both |
| 5768 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5769 | |
| 5770 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5771 | #else |
| 5772 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5773 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5774 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5775 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 5776 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 5777 | wiphy->max_scan_ie_len = SIR_MAC_MAX_ADD_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5778 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 5779 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 5780 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5781 | /* Supports STATION & AD-HOC modes right now */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5782 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5783 | | BIT(NL80211_IFTYPE_ADHOC) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5784 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 5785 | | BIT(NL80211_IFTYPE_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5786 | | BIT(NL80211_IFTYPE_AP); |
| 5787 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5788 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5789 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5790 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 5791 | if( pCfg->enableMCC ) |
| 5792 | { |
| 5793 | /* Currently, supports up to two channels */ |
| 5794 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5795 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5796 | if( !pCfg->allowMCCGODiffBI ) |
| 5797 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5798 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5799 | } |
| 5800 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 5801 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5802 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5803 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5804 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5805 | /* Before registering we need to update the ht capabilitied based |
| 5806 | * on ini values*/ |
| 5807 | if( !pCfg->ShortGI20MhzEnable ) |
| 5808 | { |
| 5809 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5810 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5811 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5812 | } |
| 5813 | |
| 5814 | if( !pCfg->ShortGI40MhzEnable ) |
| 5815 | { |
| 5816 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 5817 | } |
| 5818 | |
| 5819 | if( !pCfg->nChannelBondingMode5GHz ) |
| 5820 | { |
| 5821 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 5822 | } |
| 5823 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5824 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 5825 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 5826 | { |
| 5827 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 5828 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5829 | |
| 5830 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 5831 | { |
| 5832 | |
| 5833 | if (NULL == wiphy->bands[i]) |
| 5834 | { |
| 5835 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 5836 | __func__, i); |
| 5837 | continue; |
| 5838 | } |
| 5839 | |
| 5840 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 5841 | { |
| 5842 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 5843 | |
| 5844 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 5845 | { |
| 5846 | // Enable social channels for P2P |
| 5847 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 5848 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 5849 | else |
| 5850 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5851 | continue; |
| 5852 | } |
| 5853 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 5854 | { |
| 5855 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5856 | continue; |
| 5857 | } |
| 5858 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5859 | } |
| 5860 | /*Initialise the supported cipher suite details*/ |
| 5861 | wiphy->cipher_suites = hdd_cipher_suites; |
| 5862 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 5863 | |
| 5864 | /*signal strength in mBm (100*dBm) */ |
| 5865 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 5866 | |
| 5867 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 5868 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5869 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5870 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5871 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 5872 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5873 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 5874 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 5875 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5876 | EXIT(); |
| 5877 | return 0; |
| 5878 | } |
| 5879 | |
| 5880 | /* In this function we are registering wiphy. */ |
| 5881 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 5882 | { |
| 5883 | ENTER(); |
| 5884 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5885 | if (0 > wiphy_register(wiphy)) |
| 5886 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5887 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5888 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 5889 | return -EIO; |
| 5890 | } |
| 5891 | |
| 5892 | EXIT(); |
| 5893 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5894 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5895 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5896 | /* In this function we are updating channel list when, |
| 5897 | regulatory domain is FCC and country code is US. |
| 5898 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 5899 | As per FCC smart phone is not a indoor device. |
| 5900 | GO should not opeate on indoor channels */ |
| 5901 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 5902 | { |
| 5903 | int j; |
| 5904 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5905 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 5906 | //Default counrtycode from NV at the time of wiphy initialization. |
| 5907 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 5908 | &defaultCountryCode[0])) |
| 5909 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 5910 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5911 | } |
| 5912 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 5913 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5914 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 5915 | { |
| 5916 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 5917 | return; |
| 5918 | } |
| 5919 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 5920 | { |
| 5921 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 5922 | // Mark UNII -1 band channel as passive |
| 5923 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 5924 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 5925 | } |
| 5926 | } |
| 5927 | } |
| 5928 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 5929 | /* This function registers for all frame which supplicant is interested in */ |
| 5930 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5931 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5932 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5933 | /* Register for all P2P action, public action etc frames */ |
| 5934 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 5935 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5936 | ENTER(); |
| 5937 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5938 | /* Right now we are registering these frame when driver is getting |
| 5939 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 5940 | frame register ops, we will move this code as a part of that */ |
| 5941 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5942 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5943 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 5944 | |
| 5945 | /* GAS Initial Response */ |
| 5946 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5947 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5948 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5949 | /* GAS Comeback Request */ |
| 5950 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5951 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 5952 | |
| 5953 | /* GAS Comeback Response */ |
| 5954 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5955 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 5956 | |
| 5957 | /* P2P Public Action */ |
| 5958 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5959 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5960 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 5961 | |
| 5962 | /* P2P Action */ |
| 5963 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5964 | (v_U8_t*)P2P_ACTION_FRAME, |
| 5965 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5966 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 5967 | /* WNM BSS Transition Request frame */ |
| 5968 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5969 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 5970 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 5971 | |
| 5972 | /* WNM-Notification */ |
| 5973 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5974 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 5975 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5976 | } |
| 5977 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 5978 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5979 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5980 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5981 | /* Register for all P2P action, public action etc frames */ |
| 5982 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 5983 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5984 | ENTER(); |
| 5985 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5986 | /* Right now we are registering these frame when driver is getting |
| 5987 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 5988 | frame register ops, we will move this code as a part of that */ |
| 5989 | /* GAS Initial Request */ |
| 5990 | |
| 5991 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5992 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 5993 | |
| 5994 | /* GAS Initial Response */ |
| 5995 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5996 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5997 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5998 | /* GAS Comeback Request */ |
| 5999 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6000 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 6001 | |
| 6002 | /* GAS Comeback Response */ |
| 6003 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6004 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 6005 | |
| 6006 | /* P2P Public Action */ |
| 6007 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6008 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6009 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 6010 | |
| 6011 | /* P2P Action */ |
| 6012 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6013 | (v_U8_t*)P2P_ACTION_FRAME, |
| 6014 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 6015 | /* WNM-Notification */ |
| 6016 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6017 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 6018 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6019 | } |
| 6020 | |
| 6021 | #ifdef FEATURE_WLAN_WAPI |
| 6022 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
| 6023 | const u8 *mac_addr, u8 *key , int key_Len) |
| 6024 | { |
| 6025 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6026 | tCsrRoamSetKey setKey; |
| 6027 | v_BOOL_t isConnected = TRUE; |
| 6028 | int status = 0; |
| 6029 | v_U32_t roamId= 0xFF; |
| 6030 | tANI_U8 *pKeyPtr = NULL; |
| 6031 | int n = 0; |
| 6032 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6033 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 6034 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6035 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6036 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 6037 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6038 | setKey.keyId = key_index; // Store Key ID |
| 6039 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 6040 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 6041 | setKey.paeRole = 0 ; // the PAE role |
| 6042 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 6043 | { |
| 6044 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 6045 | } |
| 6046 | else |
| 6047 | { |
| 6048 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 6049 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 6050 | } |
| 6051 | setKey.keyLength = key_Len; |
| 6052 | pKeyPtr = setKey.Key; |
| 6053 | memcpy( pKeyPtr, key, key_Len); |
| 6054 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6055 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6056 | __func__, key_Len); |
| 6057 | for (n = 0 ; n < key_Len; n++) |
| 6058 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 6059 | __func__,n,setKey.Key[n]); |
| 6060 | |
| 6061 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 6062 | if ( isConnected ) |
| 6063 | { |
| 6064 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6065 | pAdapter->sessionId, &setKey, &roamId ); |
| 6066 | } |
| 6067 | if ( status != 0 ) |
| 6068 | { |
| 6069 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6070 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 6071 | __LINE__, status ); |
| 6072 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 6073 | } |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 6074 | /* Need to clear any trace of key value in the memory. |
| 6075 | * Thus zero out the memory even though it is local |
| 6076 | * variable. |
| 6077 | */ |
| 6078 | vos_mem_zero(&setKey, sizeof(setKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6079 | } |
| 6080 | #endif /* FEATURE_WLAN_WAPI*/ |
| 6081 | |
| 6082 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6083 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6084 | beacon_data_t **ppBeacon, |
| 6085 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6086 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6087 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6088 | beacon_data_t **ppBeacon, |
| 6089 | struct cfg80211_beacon_data *params, |
| 6090 | int dtim_period) |
| 6091 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6092 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6093 | int size; |
| 6094 | beacon_data_t *beacon = NULL; |
| 6095 | beacon_data_t *old = NULL; |
| 6096 | int head_len,tail_len; |
| 6097 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6098 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6099 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6100 | { |
| 6101 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6102 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6103 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6104 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6105 | |
| 6106 | old = pAdapter->sessionCtx.ap.beacon; |
| 6107 | |
| 6108 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6109 | { |
| 6110 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6111 | FL("session(%d) old and new heads points to NULL"), |
| 6112 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6113 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6114 | } |
| 6115 | |
| 6116 | if (params->tail && !params->tail_len) |
| 6117 | { |
| 6118 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6119 | FL("tail_len is zero but tail is not NULL")); |
| 6120 | return -EINVAL; |
| 6121 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6122 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6123 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 6124 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 6125 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6126 | { |
| 6127 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6128 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6129 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6130 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6131 | #endif |
| 6132 | |
| 6133 | if(params->head) |
| 6134 | head_len = params->head_len; |
| 6135 | else |
| 6136 | head_len = old->head_len; |
| 6137 | |
| 6138 | if(params->tail || !old) |
| 6139 | tail_len = params->tail_len; |
| 6140 | else |
| 6141 | tail_len = old->tail_len; |
| 6142 | |
| 6143 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 6144 | |
| 6145 | beacon = kzalloc(size, GFP_KERNEL); |
| 6146 | |
| 6147 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6148 | { |
| 6149 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6150 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6151 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6152 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6153 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6154 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6155 | if(params->dtim_period || !old ) |
| 6156 | beacon->dtim_period = params->dtim_period; |
| 6157 | else |
| 6158 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6159 | #else |
| 6160 | if(dtim_period || !old ) |
| 6161 | beacon->dtim_period = dtim_period; |
| 6162 | else |
| 6163 | beacon->dtim_period = old->dtim_period; |
| 6164 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6165 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6166 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 6167 | beacon->tail = beacon->head + head_len; |
| 6168 | beacon->head_len = head_len; |
| 6169 | beacon->tail_len = tail_len; |
| 6170 | |
| 6171 | if(params->head) { |
| 6172 | memcpy (beacon->head,params->head,beacon->head_len); |
| 6173 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6174 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6175 | if(old) |
| 6176 | memcpy (beacon->head,old->head,beacon->head_len); |
| 6177 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6178 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6179 | if(params->tail) { |
| 6180 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 6181 | } |
| 6182 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6183 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6184 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 6185 | } |
| 6186 | |
| 6187 | *ppBeacon = beacon; |
| 6188 | |
| 6189 | kfree(old); |
| 6190 | |
| 6191 | return 0; |
| 6192 | |
| 6193 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6194 | |
| 6195 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid) |
| 6196 | { |
| 6197 | int left = length; |
| 6198 | v_U8_t *ptr = pIes; |
| 6199 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6200 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6201 | while(left >= 2) |
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 | elem_id = ptr[0]; |
| 6204 | elem_len = ptr[1]; |
| 6205 | left -= 2; |
| 6206 | if(elem_len > left) |
| 6207 | { |
| 6208 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 6209 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6210 | eid,elem_len,left); |
| 6211 | return NULL; |
| 6212 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6213 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6214 | { |
| 6215 | return ptr; |
| 6216 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6217 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6218 | left -= elem_len; |
| 6219 | ptr += (elem_len + 2); |
| 6220 | } |
| 6221 | return NULL; |
| 6222 | } |
| 6223 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6224 | /* Check if rate is 11g rate or not */ |
| 6225 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 6226 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 6227 | 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] | 6228 | u8 i; |
| 6229 | for (i = 0; i < 8; i++) |
| 6230 | { |
| 6231 | if(rate == gRateArray[i]) |
| 6232 | return TRUE; |
| 6233 | } |
| 6234 | return FALSE; |
| 6235 | } |
| 6236 | |
| 6237 | /* Check for 11g rate and set proper 11g only mode */ |
| 6238 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 6239 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 6240 | { |
| 6241 | u8 i, num_rates = pIe[0]; |
| 6242 | |
| 6243 | pIe += 1; |
| 6244 | for ( i = 0; i < num_rates; i++) |
| 6245 | { |
| 6246 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 6247 | { |
| 6248 | /* If rate set have 11g rate than change the mode to 11G */ |
| 6249 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 6250 | if (pIe[i] & BASIC_RATE_MASK) |
| 6251 | { |
| 6252 | /* If we have 11g rate as basic rate, it means mode |
| 6253 | is 11g only mode. |
| 6254 | */ |
| 6255 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 6256 | *pCheckRatesfor11g = FALSE; |
| 6257 | } |
| 6258 | } |
| 6259 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 6260 | { |
| 6261 | *require_ht = TRUE; |
| 6262 | } |
| 6263 | } |
| 6264 | return; |
| 6265 | } |
| 6266 | |
| 6267 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 6268 | { |
| 6269 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 6270 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6271 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 6272 | u8 checkRatesfor11g = TRUE; |
| 6273 | u8 require_ht = FALSE; |
| 6274 | u8 *pIe=NULL; |
| 6275 | |
| 6276 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 6277 | |
| 6278 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 6279 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 6280 | if (pIe != NULL) |
| 6281 | { |
| 6282 | pIe += 1; |
| 6283 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 6284 | &pConfig->SapHw_mode); |
| 6285 | } |
| 6286 | |
| 6287 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 6288 | WLAN_EID_EXT_SUPP_RATES); |
| 6289 | if (pIe != NULL) |
| 6290 | { |
| 6291 | |
| 6292 | pIe += 1; |
| 6293 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 6294 | &pConfig->SapHw_mode); |
| 6295 | } |
| 6296 | |
| 6297 | if( pConfig->channel > 14 ) |
| 6298 | { |
| 6299 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 6300 | } |
| 6301 | |
| 6302 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 6303 | WLAN_EID_HT_CAPABILITY); |
| 6304 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6305 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6306 | { |
| 6307 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 6308 | if(require_ht) |
| 6309 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 6310 | } |
| 6311 | } |
| 6312 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6313 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 6314 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 6315 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6316 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6317 | v_U8_t *pIe = NULL; |
| 6318 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6319 | |
| 6320 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 6321 | pBeacon->tail, pBeacon->tail_len); |
| 6322 | |
| 6323 | if (pIe) |
| 6324 | { |
| 6325 | ielen = pIe[1] + 2; |
| 6326 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 6327 | { |
| 6328 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 6329 | } |
| 6330 | else |
| 6331 | { |
| 6332 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 6333 | return -EINVAL; |
| 6334 | } |
| 6335 | *total_ielen += ielen; |
| 6336 | } |
| 6337 | return 0; |
| 6338 | } |
| 6339 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6340 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 6341 | v_U8_t *genie, v_U8_t *total_ielen) |
| 6342 | { |
| 6343 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6344 | int left = pBeacon->tail_len; |
| 6345 | v_U8_t *ptr = pBeacon->tail; |
| 6346 | v_U8_t elem_id, elem_len; |
| 6347 | v_U16_t ielen = 0; |
| 6348 | |
| 6349 | if ( NULL == ptr || 0 == left ) |
| 6350 | return; |
| 6351 | |
| 6352 | while (left >= 2) |
| 6353 | { |
| 6354 | elem_id = ptr[0]; |
| 6355 | elem_len = ptr[1]; |
| 6356 | left -= 2; |
| 6357 | if (elem_len > left) |
| 6358 | { |
| 6359 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 6360 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 6361 | elem_id, elem_len, left); |
| 6362 | return; |
| 6363 | } |
| 6364 | if (IE_EID_VENDOR == elem_id) |
| 6365 | { |
| 6366 | /* skipping the VSIE's which we don't want to include or |
| 6367 | * it will be included by existing code |
| 6368 | */ |
| 6369 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 6370 | #ifdef WLAN_FEATURE_WFD |
| 6371 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 6372 | #endif |
| 6373 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6374 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6375 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 6376 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6377 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 6378 | { |
| 6379 | ielen = ptr[1] + 2; |
| 6380 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 6381 | { |
| 6382 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 6383 | *total_ielen += ielen; |
| 6384 | } |
| 6385 | else |
| 6386 | { |
| 6387 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 6388 | "IE Length is too big " |
| 6389 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 6390 | elem_id, elem_len, *total_ielen); |
| 6391 | } |
| 6392 | } |
| 6393 | } |
| 6394 | |
| 6395 | left -= elem_len; |
| 6396 | ptr += (elem_len + 2); |
| 6397 | } |
| 6398 | return; |
| 6399 | } |
| 6400 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6401 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6402 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 6403 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6404 | #else |
| 6405 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 6406 | struct cfg80211_beacon_data *params) |
| 6407 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6408 | { |
| 6409 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6410 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6411 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6412 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6413 | |
| 6414 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 6415 | |
| 6416 | if(genie == NULL) { |
| 6417 | |
| 6418 | return -ENOMEM; |
| 6419 | } |
| 6420 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6421 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6422 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6423 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6424 | hddLog(LOGE, |
| 6425 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6426 | ret = -EINVAL; |
| 6427 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6428 | } |
| 6429 | |
| 6430 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6431 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6432 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 6433 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6434 | hddLog(LOGE, |
| 6435 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6436 | ret = -EINVAL; |
| 6437 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6438 | } |
| 6439 | #endif |
| 6440 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6441 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6442 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6443 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6444 | hddLog(LOGE, |
| 6445 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6446 | ret = -EINVAL; |
| 6447 | goto done; |
| 6448 | } |
| 6449 | |
| 6450 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 6451 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6452 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6453 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6454 | |
| 6455 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6456 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 6457 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 6458 | { |
| 6459 | hddLog(LOGE, |
| 6460 | "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] | 6461 | ret = -EINVAL; |
| 6462 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6463 | } |
| 6464 | |
| 6465 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6466 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 6467 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6468 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6469 | ==eHAL_STATUS_FAILURE) |
| 6470 | { |
| 6471 | hddLog(LOGE, |
| 6472 | "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] | 6473 | ret = -EINVAL; |
| 6474 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6475 | } |
| 6476 | |
| 6477 | // Added for ProResp IE |
| 6478 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 6479 | { |
| 6480 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 6481 | u8 probe_rsp_ie_len[3] = {0}; |
| 6482 | u8 counter = 0; |
| 6483 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 6484 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 6485 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 6486 | Store More then 255 bytes into One Variable. |
| 6487 | */ |
| 6488 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 6489 | { |
| 6490 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 6491 | { |
| 6492 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 6493 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 6494 | } |
| 6495 | else |
| 6496 | { |
| 6497 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 6498 | rem_probe_resp_ie_len = 0; |
| 6499 | } |
| 6500 | } |
| 6501 | |
| 6502 | rem_probe_resp_ie_len = 0; |
| 6503 | |
| 6504 | if (probe_rsp_ie_len[0] > 0) |
| 6505 | { |
| 6506 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6507 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 6508 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6509 | probe_rsp_ie_len[0], NULL, |
| 6510 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6511 | { |
| 6512 | hddLog(LOGE, |
| 6513 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6514 | ret = -EINVAL; |
| 6515 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6516 | } |
| 6517 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 6518 | } |
| 6519 | |
| 6520 | if (probe_rsp_ie_len[1] > 0) |
| 6521 | { |
| 6522 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6523 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 6524 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6525 | probe_rsp_ie_len[1], NULL, |
| 6526 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6527 | { |
| 6528 | hddLog(LOGE, |
| 6529 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6530 | ret = -EINVAL; |
| 6531 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6532 | } |
| 6533 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 6534 | } |
| 6535 | |
| 6536 | if (probe_rsp_ie_len[2] > 0) |
| 6537 | { |
| 6538 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6539 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 6540 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6541 | probe_rsp_ie_len[2], NULL, |
| 6542 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6543 | { |
| 6544 | hddLog(LOGE, |
| 6545 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6546 | ret = -EINVAL; |
| 6547 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6548 | } |
| 6549 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 6550 | } |
| 6551 | |
| 6552 | if (probe_rsp_ie_len[1] == 0 ) |
| 6553 | { |
| 6554 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6555 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 6556 | eANI_BOOLEAN_FALSE) ) |
| 6557 | { |
| 6558 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6559 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6560 | } |
| 6561 | } |
| 6562 | |
| 6563 | if (probe_rsp_ie_len[2] == 0 ) |
| 6564 | { |
| 6565 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6566 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 6567 | eANI_BOOLEAN_FALSE) ) |
| 6568 | { |
| 6569 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6570 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6571 | } |
| 6572 | } |
| 6573 | |
| 6574 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6575 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 6576 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6577 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6578 | == eHAL_STATUS_FAILURE) |
| 6579 | { |
| 6580 | hddLog(LOGE, |
| 6581 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6582 | ret = -EINVAL; |
| 6583 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6584 | } |
| 6585 | } |
| 6586 | else |
| 6587 | { |
| 6588 | // Reset WNI_CFG_PROBE_RSP Flags |
| 6589 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 6590 | |
| 6591 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6592 | "%s: No Probe Response IE received in set beacon", |
| 6593 | __func__); |
| 6594 | } |
| 6595 | |
| 6596 | // Added for AssocResp IE |
| 6597 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 6598 | { |
| 6599 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6600 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 6601 | params->assocresp_ies_len, NULL, |
| 6602 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6603 | { |
| 6604 | hddLog(LOGE, |
| 6605 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6606 | ret = -EINVAL; |
| 6607 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6608 | } |
| 6609 | |
| 6610 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6611 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 6612 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6613 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6614 | == eHAL_STATUS_FAILURE) |
| 6615 | { |
| 6616 | hddLog(LOGE, |
| 6617 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6618 | ret = -EINVAL; |
| 6619 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6620 | } |
| 6621 | } |
| 6622 | else |
| 6623 | { |
| 6624 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6625 | "%s: No Assoc Response IE received in set beacon", |
| 6626 | __func__); |
| 6627 | |
| 6628 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6629 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 6630 | eANI_BOOLEAN_FALSE) ) |
| 6631 | { |
| 6632 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6633 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6634 | } |
| 6635 | } |
| 6636 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6637 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6638 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6639 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6640 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6641 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6642 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6643 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 6644 | * called by wlan_hdd_cfg80211_start_bss() and |
| 6645 | * wlan_hdd_cfg80211_set_channel() |
| 6646 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6647 | * channel list. |
| 6648 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 6649 | 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] | 6650 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6651 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6652 | v_U32_t num_ch = 0; |
| 6653 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 6654 | u32 indx = 0; |
| 6655 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6656 | v_U8_t fValidChannel = FALSE, count = 0; |
| 6657 | 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] | 6658 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6659 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6660 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6661 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6662 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6663 | /* Validate the channel */ |
| 6664 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6665 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6666 | if ( channel == rfChannels[count].channelNum ) |
| 6667 | { |
| 6668 | fValidChannel = TRUE; |
| 6669 | break; |
| 6670 | } |
| 6671 | } |
| 6672 | if (fValidChannel != TRUE) |
| 6673 | { |
| 6674 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6675 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6676 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6677 | } |
| 6678 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6679 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6680 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6681 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 6682 | valid_ch, &num_ch)) |
| 6683 | { |
| 6684 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6685 | "%s: failed to get valid channel list", __func__); |
| 6686 | return VOS_STATUS_E_FAILURE; |
| 6687 | } |
| 6688 | for (indx = 0; indx < num_ch; indx++) |
| 6689 | { |
| 6690 | if (channel == valid_ch[indx]) |
| 6691 | { |
| 6692 | break; |
| 6693 | } |
| 6694 | } |
| 6695 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6696 | if (indx >= num_ch) |
| 6697 | { |
| 6698 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6699 | { |
| 6700 | eCsrBand band; |
| 6701 | unsigned int freq; |
| 6702 | |
| 6703 | sme_GetFreqBand(hHal, &band); |
| 6704 | |
| 6705 | if (eCSR_BAND_5G == band) |
| 6706 | { |
| 6707 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 6708 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 6709 | { |
| 6710 | freq = ieee80211_channel_to_frequency(channel, |
| 6711 | IEEE80211_BAND_2GHZ); |
| 6712 | } |
| 6713 | else |
| 6714 | { |
| 6715 | freq = ieee80211_channel_to_frequency(channel, |
| 6716 | IEEE80211_BAND_5GHZ); |
| 6717 | } |
| 6718 | #else |
| 6719 | freq = ieee80211_channel_to_frequency(channel); |
| 6720 | #endif |
| 6721 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 6722 | return VOS_STATUS_SUCCESS; |
| 6723 | } |
| 6724 | } |
| 6725 | |
| 6726 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6727 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6728 | return VOS_STATUS_E_FAILURE; |
| 6729 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6730 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6731 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6732 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6733 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6734 | } |
| 6735 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6736 | /** |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6737 | * FUNCTION: __wlan_hdd_cfg80211_set_channel |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6738 | * This function is used to set the channel number |
| 6739 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6740 | 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] | 6741 | struct ieee80211_channel *chan, |
| 6742 | enum nl80211_channel_type channel_type |
| 6743 | ) |
| 6744 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6745 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6746 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6747 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6748 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6749 | hdd_context_t *pHddCtx; |
| 6750 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6751 | |
| 6752 | ENTER(); |
| 6753 | |
| 6754 | if( NULL == dev ) |
| 6755 | { |
| 6756 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6757 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6758 | return -ENODEV; |
| 6759 | } |
| 6760 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6761 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6762 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6763 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 6764 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6765 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6766 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 6767 | hdd_device_modetoString(pAdapter->device_mode), |
| 6768 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6769 | |
| 6770 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6771 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6772 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6773 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6774 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6775 | } |
| 6776 | |
| 6777 | /* |
| 6778 | * Do freq to chan conversion |
| 6779 | * TODO: for 11a |
| 6780 | */ |
| 6781 | |
| 6782 | channel = ieee80211_frequency_to_channel(freq); |
| 6783 | |
| 6784 | /* Check freq range */ |
| 6785 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 6786 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 6787 | { |
| 6788 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6789 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6790 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 6791 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 6792 | return -EINVAL; |
| 6793 | } |
| 6794 | |
| 6795 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6796 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 6797 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 6798 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6799 | { |
| 6800 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6801 | { |
| 6802 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6803 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6804 | return -EINVAL; |
| 6805 | } |
| 6806 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 6807 | "%s: set channel to [%d] for device mode =%d", |
| 6808 | __func__, channel,pAdapter->device_mode); |
| 6809 | } |
| 6810 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6811 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6812 | ) |
| 6813 | { |
| 6814 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6815 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 6816 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6817 | |
| 6818 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 6819 | { |
| 6820 | /* Link is up then return cant set channel*/ |
| 6821 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6822 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6823 | return -EINVAL; |
| 6824 | } |
| 6825 | |
| 6826 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 6827 | pHddStaCtx->conn_info.operationChannel = channel; |
| 6828 | pRoamProfile->ChannelInfo.ChannelList = |
| 6829 | &pHddStaCtx->conn_info.operationChannel; |
| 6830 | } |
| 6831 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6832 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6833 | ) |
| 6834 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6835 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6836 | { |
| 6837 | if(VOS_STATUS_SUCCESS != |
| 6838 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6839 | { |
| 6840 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6841 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6842 | return -EINVAL; |
| 6843 | } |
| 6844 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 6845 | } |
| 6846 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6847 | { |
| 6848 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 6849 | |
| 6850 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 6851 | channel set by supplicant |
| 6852 | */ |
| 6853 | if ( cfg_param->apAutoChannelSelection ) |
| 6854 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6855 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 6856 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6857 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6858 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 6859 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6860 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6861 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6862 | else |
| 6863 | { |
| 6864 | if(VOS_STATUS_SUCCESS != |
| 6865 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6866 | { |
| 6867 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6868 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6869 | return -EINVAL; |
| 6870 | } |
| 6871 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 6872 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6873 | } |
| 6874 | } |
| 6875 | else |
| 6876 | { |
| 6877 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 6878 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 6879 | return -EINVAL; |
| 6880 | } |
| 6881 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6882 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6883 | } |
| 6884 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6885 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, |
| 6886 | struct net_device *dev, |
| 6887 | struct ieee80211_channel *chan, |
| 6888 | enum nl80211_channel_type channel_type |
| 6889 | ) |
| 6890 | { |
| 6891 | int ret; |
| 6892 | |
| 6893 | vos_ssr_protect(__func__); |
| 6894 | ret = __wlan_hdd_cfg80211_set_channel(wiphy, dev, chan, channel_type); |
| 6895 | vos_ssr_unprotect(__func__); |
| 6896 | |
| 6897 | return ret; |
| 6898 | } |
| 6899 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6900 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 6901 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 6902 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6903 | #else |
| 6904 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 6905 | struct cfg80211_beacon_data *params, |
| 6906 | const u8 *ssid, size_t ssid_len, |
| 6907 | enum nl80211_hidden_ssid hidden_ssid) |
| 6908 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6909 | { |
| 6910 | tsap_Config_t *pConfig; |
| 6911 | beacon_data_t *pBeacon = NULL; |
| 6912 | struct ieee80211_mgmt *pMgmt_frame; |
| 6913 | v_U8_t *pIe=NULL; |
| 6914 | v_U16_t capab_info; |
| 6915 | eCsrAuthType RSNAuthType; |
| 6916 | eCsrEncryptionType RSNEncryptType; |
| 6917 | eCsrEncryptionType mcRSNEncryptType; |
| 6918 | int status = VOS_STATUS_SUCCESS; |
| 6919 | tpWLAN_SAPEventCB pSapEventCallback; |
| 6920 | hdd_hostapd_state_t *pHostapdState; |
| 6921 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 6922 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6923 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6924 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6925 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6926 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 6927 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6928 | tSmeConfigParams *psmeConfig; |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 6929 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 6930 | v_BOOL_t MFPRequired = VOS_FALSE; |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 6931 | v_BOOL_t sapEnable11AC = |
| 6932 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapEnable11AC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6933 | ENTER(); |
| 6934 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6935 | iniConfig = pHddCtx->cfg_ini; |
| 6936 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6937 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 6938 | |
| 6939 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 6940 | |
| 6941 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6942 | |
| 6943 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 6944 | |
| 6945 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 6946 | |
| 6947 | //channel is already set in the set_channel Call back |
| 6948 | //pConfig->channel = pCommitConfig->channel; |
| 6949 | |
| 6950 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6951 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6952 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 6953 | |
| 6954 | pConfig->dtim_period = pBeacon->dtim_period; |
| 6955 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6956 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6957 | pConfig->dtim_period); |
| 6958 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 6959 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6960 | { |
| 6961 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6962 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 6963 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 6964 | { |
| 6965 | tANI_BOOLEAN restartNeeded; |
| 6966 | pConfig->ieee80211d = 1; |
| 6967 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 6968 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 6969 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 6970 | } |
| 6971 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6972 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6973 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6974 | pConfig->ieee80211d = 1; |
| 6975 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 6976 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 6977 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6978 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6979 | else |
| 6980 | { |
| 6981 | pConfig->ieee80211d = 0; |
| 6982 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6983 | /* |
| 6984 | * If auto channel is configured i.e. channel is 0, |
| 6985 | * so skip channel validation. |
| 6986 | */ |
| 6987 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 6988 | { |
| 6989 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 6990 | { |
| 6991 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6992 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6993 | return -EINVAL; |
| 6994 | } |
| 6995 | } |
| 6996 | else |
| 6997 | { |
| 6998 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 6999 | { |
| 7000 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 7001 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 7002 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 7003 | } |
| 7004 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 7005 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7006 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7007 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7008 | { |
| 7009 | pConfig->ieee80211d = 0; |
| 7010 | } |
| 7011 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 7012 | |
| 7013 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7014 | |
| 7015 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7016 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 7017 | |
| 7018 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 7019 | |
| 7020 | /*Set wps station to configured*/ |
| 7021 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 7022 | |
| 7023 | if(pIe) |
| 7024 | { |
| 7025 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 7026 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7027 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7028 | return -EINVAL; |
| 7029 | } |
| 7030 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 7031 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 7032 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7033 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 7034 | * WPS state |
| 7035 | */ |
| 7036 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 7037 | { |
| 7038 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 7039 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 7040 | { |
| 7041 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 7042 | } |
| 7043 | } |
| 7044 | } |
| 7045 | else |
| 7046 | { |
| 7047 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 7048 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7049 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7050 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 7051 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 7052 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 7053 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 7054 | eCSR_ENCRYPT_TYPE_NONE; |
| 7055 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7056 | pConfig->RSNWPAReqIELength = 0; |
| 7057 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7058 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7059 | WLAN_EID_RSN); |
| 7060 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7061 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7062 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 7063 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 7064 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7065 | /* The actual processing may eventually be more extensive than |
| 7066 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7067 | * by the app. |
| 7068 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7069 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7070 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 7071 | &RSNEncryptType, |
| 7072 | &mcRSNEncryptType, |
| 7073 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7074 | &MFPCapable, |
| 7075 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7076 | pConfig->pRSNWPAReqIE[1]+2, |
| 7077 | pConfig->pRSNWPAReqIE ); |
| 7078 | |
| 7079 | if( VOS_STATUS_SUCCESS == status ) |
| 7080 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7081 | /* Now copy over all the security attributes you have |
| 7082 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7083 | * */ |
| 7084 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 7085 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 7086 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 7087 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 7088 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7089 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7090 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 7091 | } |
| 7092 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7093 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7094 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7095 | pBeacon->tail, pBeacon->tail_len); |
| 7096 | |
| 7097 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 7098 | { |
| 7099 | if (pConfig->pRSNWPAReqIE) |
| 7100 | { |
| 7101 | /*Mixed mode WPA/WPA2*/ |
| 7102 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 7103 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 7104 | } |
| 7105 | else |
| 7106 | { |
| 7107 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 7108 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 7109 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7110 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7111 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 7112 | &RSNEncryptType, |
| 7113 | &mcRSNEncryptType, |
| 7114 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7115 | &MFPCapable, |
| 7116 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7117 | pConfig->pRSNWPAReqIE[1]+2, |
| 7118 | pConfig->pRSNWPAReqIE ); |
| 7119 | |
| 7120 | if( VOS_STATUS_SUCCESS == status ) |
| 7121 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7122 | /* Now copy over all the security attributes you have |
| 7123 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7124 | * */ |
| 7125 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 7126 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 7127 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 7128 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 7129 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7130 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7131 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 7132 | } |
| 7133 | } |
| 7134 | } |
| 7135 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7136 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 7137 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 7138 | return -EINVAL; |
| 7139 | } |
| 7140 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7141 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 7142 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7143 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7144 | if (params->ssid != NULL) |
| 7145 | { |
| 7146 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 7147 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 7148 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 7149 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 7150 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7151 | #else |
| 7152 | if (ssid != NULL) |
| 7153 | { |
| 7154 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 7155 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 7156 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 7157 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 7158 | } |
| 7159 | #endif |
| 7160 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7161 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7162 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7163 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7164 | /* default value */ |
| 7165 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 7166 | pConfig->num_accept_mac = 0; |
| 7167 | pConfig->num_deny_mac = 0; |
| 7168 | |
| 7169 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7170 | pBeacon->tail, pBeacon->tail_len); |
| 7171 | |
| 7172 | /* pIe for black list is following form: |
| 7173 | type : 1 byte |
| 7174 | length : 1 byte |
| 7175 | OUI : 4 bytes |
| 7176 | acl type : 1 byte |
| 7177 | no of mac addr in black list: 1 byte |
| 7178 | 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] | 7179 | */ |
| 7180 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7181 | { |
| 7182 | pConfig->SapMacaddr_acl = pIe[6]; |
| 7183 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7184 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7185 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7186 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 7187 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7188 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 7189 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 7190 | { |
| 7191 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 7192 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7193 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7194 | } |
| 7195 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7196 | pBeacon->tail, pBeacon->tail_len); |
| 7197 | |
| 7198 | /* pIe for white list is following form: |
| 7199 | type : 1 byte |
| 7200 | length : 1 byte |
| 7201 | OUI : 4 bytes |
| 7202 | acl type : 1 byte |
| 7203 | no of mac addr in white list: 1 byte |
| 7204 | 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] | 7205 | */ |
| 7206 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7207 | { |
| 7208 | pConfig->SapMacaddr_acl = pIe[6]; |
| 7209 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7210 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7211 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7212 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 7213 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7214 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 7215 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 7216 | { |
| 7217 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 7218 | acl_entry++; |
| 7219 | } |
| 7220 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7221 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7222 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 7223 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7224 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 7225 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 7226 | * This is valid only if mode is set to 11n in hostapd, sapEnable11AC |
| 7227 | * 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] | 7228 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 7229 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 7230 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 7231 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 7232 | (sapEnable11AC) && (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 7233 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7234 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7235 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7236 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7237 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7238 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 7239 | /* If ACS disable and selected channel <= 14 |
| 7240 | * OR |
| 7241 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 7242 | * AND |
| 7243 | * VHT in 2.4G Disabled |
| 7244 | * THEN |
| 7245 | * Fallback to 11N mode |
| 7246 | */ |
| 7247 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 7248 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 7249 | operatingBand == eSAP_RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 7250 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7251 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7252 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 7253 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7254 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 7255 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7256 | } |
| 7257 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7258 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7259 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 7260 | pConfig->ht_capab = |
| 7261 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 7262 | |
| 7263 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 7264 | { |
| 7265 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 7266 | return -EINVAL; |
| 7267 | } |
| 7268 | |
| 7269 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7270 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7271 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 7272 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7273 | pConfig->obssProtEnabled = |
| 7274 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7275 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7276 | #ifdef WLAN_FEATURE_11W |
| 7277 | pConfig->mfpCapable = MFPCapable; |
| 7278 | pConfig->mfpRequired = MFPRequired; |
| 7279 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 7280 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 7281 | #endif |
| 7282 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7283 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7284 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7285 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 7286 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 7287 | (int)pConfig->channel); |
| 7288 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 7289 | pConfig->SapHw_mode, pConfig->privacy, |
| 7290 | pConfig->authType); |
| 7291 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 7292 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 7293 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 7294 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7295 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7296 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7297 | { |
| 7298 | //Bss already started. just return. |
| 7299 | //TODO Probably it should update some beacon params. |
| 7300 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 7301 | EXIT(); |
| 7302 | return 0; |
| 7303 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7304 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7305 | if (vos_max_concurrent_connections_reached()) { |
| 7306 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7307 | return -EINVAL; |
| 7308 | } |
| 7309 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7310 | pConfig->persona = pHostapdAdapter->device_mode; |
| 7311 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7312 | psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams)); |
| 7313 | if ( NULL != psmeConfig) |
| 7314 | { |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 7315 | vos_mem_zero(psmeConfig, sizeof (tSmeConfigParams)); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7316 | sme_GetConfigParam(hHal, psmeConfig); |
| 7317 | pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference; |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 7318 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 7319 | if (((pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 7320 | || (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 7321 | && pHddCtx->cfg_ini->apHT40_24GEnabled) |
| 7322 | { |
| 7323 | psmeConfig->csrConfig.apHT40_24GEnabled = 1; |
| 7324 | sme_UpdateConfig (hHal, psmeConfig); |
| 7325 | } |
| 7326 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7327 | vos_mem_free(psmeConfig); |
| 7328 | } |
Peng Xu | afc34e3 | 2014-09-25 13:23:55 +0530 | [diff] [blame] | 7329 | pConfig->acsBandSwitchThreshold = iniConfig->acsBandSwitchThreshold; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7330 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7331 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 7332 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 7333 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 7334 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7335 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7336 | return -EINVAL; |
| 7337 | } |
| 7338 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7339 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7340 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 7341 | |
| 7342 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7343 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7344 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7345 | { |
| 7346 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7347 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 7348 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7349 | VOS_ASSERT(0); |
| 7350 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7351 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7352 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Kaushik, Sushant | f607080 | 2014-10-15 15:09:23 +0530 | [diff] [blame] | 7353 | /* Initialize WMM configuation */ |
| 7354 | hdd_wmm_init(pHostapdAdapter); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7355 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7356 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7357 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7358 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 7359 | { |
| 7360 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 7361 | { |
| 7362 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 7363 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 7364 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7365 | } |
| 7366 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 7367 | { |
| 7368 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 7369 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 7370 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7371 | } |
| 7372 | } |
| 7373 | #endif |
| 7374 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7375 | pHostapdState->bCommit = TRUE; |
| 7376 | EXIT(); |
| 7377 | |
| 7378 | return 0; |
| 7379 | } |
| 7380 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7381 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7382 | static int __wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7383 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7384 | struct beacon_parameters *params) |
| 7385 | { |
| 7386 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7387 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7388 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7389 | |
| 7390 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7391 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7392 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7393 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 7394 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7395 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 7396 | hdd_device_modetoString(pAdapter->device_mode), |
| 7397 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7398 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7399 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7400 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7401 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7402 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7403 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7404 | } |
| 7405 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7406 | if (vos_max_concurrent_connections_reached()) { |
| 7407 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7408 | return -EINVAL; |
| 7409 | } |
| 7410 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7411 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7412 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7413 | ) |
| 7414 | { |
| 7415 | beacon_data_t *old,*new; |
| 7416 | |
| 7417 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7418 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7419 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7420 | { |
| 7421 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 7422 | FL("already beacon info added to session(%d)"), |
| 7423 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7424 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7425 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7426 | |
| 7427 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 7428 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7429 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7430 | { |
| 7431 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7432 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7433 | return -EINVAL; |
| 7434 | } |
| 7435 | |
| 7436 | pAdapter->sessionCtx.ap.beacon = new; |
| 7437 | |
| 7438 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 7439 | } |
| 7440 | |
| 7441 | EXIT(); |
| 7442 | return status; |
| 7443 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7444 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7445 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 7446 | struct net_device *dev, |
| 7447 | struct beacon_parameters *params) |
| 7448 | { |
| 7449 | int ret; |
| 7450 | |
| 7451 | vos_ssr_protect(__func__); |
| 7452 | ret = __wlan_hdd_cfg80211_add_beacon(wiphy, dev, params); |
| 7453 | vos_ssr_unprotect(__func__); |
| 7454 | |
| 7455 | return ret; |
| 7456 | } |
| 7457 | |
| 7458 | static int __wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7459 | struct net_device *dev, |
| 7460 | struct beacon_parameters *params) |
| 7461 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7462 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7463 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7464 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7465 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7466 | |
| 7467 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 7468 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7469 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7470 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 7471 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 7472 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7473 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7474 | pAdapter->device_mode); |
| 7475 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7476 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7477 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7478 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7479 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7480 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7481 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7482 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7483 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7484 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7485 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7486 | { |
| 7487 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7488 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7489 | old = pAdapter->sessionCtx.ap.beacon; |
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 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7492 | { |
| 7493 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7494 | FL("session(%d) old and new heads points to NULL"), |
| 7495 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7496 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7497 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7498 | |
| 7499 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 7500 | |
| 7501 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7502 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7503 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7504 | return -EINVAL; |
| 7505 | } |
| 7506 | |
| 7507 | pAdapter->sessionCtx.ap.beacon = new; |
| 7508 | |
| 7509 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 7510 | } |
| 7511 | |
| 7512 | EXIT(); |
| 7513 | return status; |
| 7514 | } |
| 7515 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7516 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
| 7517 | struct net_device *dev, |
| 7518 | struct beacon_parameters *params) |
| 7519 | { |
| 7520 | int ret; |
| 7521 | |
| 7522 | vos_ssr_protect(__func__); |
| 7523 | ret = __wlan_hdd_cfg80211_set_beacon(wiphy, dev, params); |
| 7524 | vos_ssr_unprotect(__func__); |
| 7525 | |
| 7526 | return ret; |
| 7527 | } |
| 7528 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7529 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7530 | |
| 7531 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7532 | static int __wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7533 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7534 | #else |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7535 | static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7536 | struct net_device *dev) |
| 7537 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7538 | { |
| 7539 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7540 | hdd_context_t *pHddCtx = NULL; |
| 7541 | hdd_scaninfo_t *pScanInfo = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7542 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7543 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7544 | |
| 7545 | ENTER(); |
| 7546 | |
| 7547 | if (NULL == pAdapter) |
| 7548 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7549 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7550 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7551 | return -ENODEV; |
| 7552 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7553 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7554 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7555 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 7556 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7557 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7558 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7559 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7560 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7561 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7562 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7563 | |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7564 | pScanInfo = &pHddCtx->scan_info; |
| 7565 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7566 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7567 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7568 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7569 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7570 | ret = wlan_hdd_scan_abort(pAdapter); |
| 7571 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 7572 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7573 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7574 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7575 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7576 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7577 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7578 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7579 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7580 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 7581 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7582 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7583 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7584 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7585 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7586 | } |
| 7587 | |
Rashmi Ramanna | 1f0948d | 2014-08-28 15:33:48 +0530 | [diff] [blame] | 7588 | /* Delete all associated STAs before stopping AP/P2P GO */ |
| 7589 | hdd_del_all_sta(pAdapter); |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 7590 | hdd_hostapd_stop(dev); |
| 7591 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7592 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7593 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7594 | ) |
| 7595 | { |
| 7596 | beacon_data_t *old; |
| 7597 | |
| 7598 | old = pAdapter->sessionCtx.ap.beacon; |
| 7599 | |
| 7600 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7601 | { |
| 7602 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7603 | FL("session(%d) beacon data points to NULL"), |
| 7604 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7605 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7606 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7607 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7608 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7609 | |
| 7610 | mutex_lock(&pHddCtx->sap_lock); |
| 7611 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 7612 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7613 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7614 | { |
| 7615 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 7616 | |
| 7617 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 7618 | |
| 7619 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 7620 | { |
| 7621 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7622 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7623 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7624 | } |
| 7625 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7626 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7627 | /* BSS stopped, clear the active sessions for this device mode */ |
| 7628 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7629 | } |
| 7630 | mutex_unlock(&pHddCtx->sap_lock); |
| 7631 | |
| 7632 | if(status != VOS_STATUS_SUCCESS) |
| 7633 | { |
| 7634 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7635 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7636 | return -EINVAL; |
| 7637 | } |
| 7638 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7639 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7640 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 7641 | ==eHAL_STATUS_FAILURE) |
| 7642 | { |
| 7643 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7644 | "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] | 7645 | } |
| 7646 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7647 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7648 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 7649 | eANI_BOOLEAN_FALSE) ) |
| 7650 | { |
| 7651 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7652 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7653 | } |
| 7654 | |
| 7655 | // Reset WNI_CFG_PROBE_RSP Flags |
| 7656 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 7657 | |
| 7658 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 7659 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7660 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7661 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 7662 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 7663 | { |
| 7664 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 7665 | "GO got removed"); |
| 7666 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 7667 | } |
| 7668 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7669 | } |
| 7670 | EXIT(); |
| 7671 | return status; |
| 7672 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7673 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7674 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7675 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 7676 | struct net_device *dev) |
| 7677 | { |
| 7678 | int ret; |
| 7679 | |
| 7680 | vos_ssr_protect(__func__); |
| 7681 | ret = __wlan_hdd_cfg80211_del_beacon(wiphy, dev); |
| 7682 | vos_ssr_unprotect(__func__); |
| 7683 | |
| 7684 | return ret; |
| 7685 | } |
| 7686 | #else |
| 7687 | static int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, |
| 7688 | struct net_device *dev) |
| 7689 | { |
| 7690 | int ret; |
| 7691 | |
| 7692 | vos_ssr_protect(__func__); |
| 7693 | ret = __wlan_hdd_cfg80211_stop_ap(wiphy, dev); |
| 7694 | vos_ssr_unprotect(__func__); |
| 7695 | |
| 7696 | return ret; |
| 7697 | } |
| 7698 | #endif |
| 7699 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7700 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 7701 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7702 | static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7703 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7704 | struct cfg80211_ap_settings *params) |
| 7705 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7706 | hdd_adapter_t *pAdapter; |
| 7707 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7708 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7709 | |
| 7710 | ENTER(); |
| 7711 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7712 | if (NULL == dev || NULL == params) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7713 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7714 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7715 | "%s: Device or params is Null", __func__); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7716 | return -ENODEV; |
| 7717 | } |
| 7718 | |
| 7719 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7720 | if (NULL == pAdapter) |
| 7721 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7722 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7723 | "%s: HDD adapter is Null", __func__); |
| 7724 | return -ENODEV; |
| 7725 | } |
| 7726 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7727 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7728 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 7729 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7730 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 7731 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7732 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7733 | "%s: HDD adapter magic is invalid", __func__); |
| 7734 | return -ENODEV; |
| 7735 | } |
| 7736 | |
| 7737 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7738 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7739 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7740 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7741 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7742 | } |
| 7743 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7744 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 7745 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7746 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7747 | |
| 7748 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7749 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7750 | ) |
| 7751 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7752 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7753 | |
| 7754 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7755 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7756 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7757 | { |
| 7758 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 7759 | FL("already beacon info added to session(%d)"), |
| 7760 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7761 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7762 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7763 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7764 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7765 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 7766 | &new, |
| 7767 | ¶ms->beacon); |
| 7768 | #else |
| 7769 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 7770 | &new, |
| 7771 | ¶ms->beacon, |
| 7772 | params->dtim_period); |
| 7773 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7774 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7775 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7776 | { |
| 7777 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7778 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7779 | return -EINVAL; |
| 7780 | } |
| 7781 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7782 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 7783 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 7784 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 7785 | params->channel, params->channel_type); |
| 7786 | #else |
| 7787 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 7788 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7789 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7790 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
| 7791 | params->ssid_len, params->hidden_ssid); |
| 7792 | } |
| 7793 | |
| 7794 | EXIT(); |
| 7795 | return status; |
| 7796 | } |
| 7797 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7798 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 7799 | struct net_device *dev, |
| 7800 | struct cfg80211_ap_settings *params) |
| 7801 | { |
| 7802 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7803 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7804 | vos_ssr_protect(__func__); |
| 7805 | ret = __wlan_hdd_cfg80211_start_ap(wiphy, dev, params); |
| 7806 | vos_ssr_unprotect(__func__); |
| 7807 | |
| 7808 | return ret; |
| 7809 | } |
| 7810 | |
| 7811 | static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7812 | struct net_device *dev, |
| 7813 | struct cfg80211_beacon_data *params) |
| 7814 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7815 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7816 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7817 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7818 | |
| 7819 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7820 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7821 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7822 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 7823 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7824 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7825 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7826 | |
| 7827 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7828 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7829 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7830 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7831 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7832 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7833 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7834 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7835 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7836 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7837 | { |
| 7838 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7839 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7840 | old = pAdapter->sessionCtx.ap.beacon; |
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 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7843 | { |
| 7844 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7845 | FL("session(%d) beacon data points to NULL"), |
| 7846 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7847 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7848 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7849 | |
| 7850 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 7851 | |
| 7852 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7853 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7854 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7855 | return -EINVAL; |
| 7856 | } |
| 7857 | |
| 7858 | pAdapter->sessionCtx.ap.beacon = new; |
| 7859 | |
| 7860 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0); |
| 7861 | } |
| 7862 | |
| 7863 | EXIT(); |
| 7864 | return status; |
| 7865 | } |
| 7866 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7867 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
| 7868 | struct net_device *dev, |
| 7869 | struct cfg80211_beacon_data *params) |
| 7870 | { |
| 7871 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7872 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7873 | vos_ssr_protect(__func__); |
| 7874 | ret = __wlan_hdd_cfg80211_change_beacon(wiphy, dev, params); |
| 7875 | vos_ssr_unprotect(__func__); |
| 7876 | |
| 7877 | return ret; |
| 7878 | } |
| 7879 | |
| 7880 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7881 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 7882 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7883 | struct net_device *dev, |
| 7884 | struct bss_parameters *params) |
| 7885 | { |
| 7886 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7887 | hdd_context_t *pHddCtx; |
| 7888 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7889 | |
| 7890 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7891 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7892 | if (NULL == pAdapter) |
| 7893 | { |
| 7894 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7895 | "%s: HDD adapter is Null", __func__); |
| 7896 | return -ENODEV; |
| 7897 | } |
| 7898 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7899 | ret = wlan_hdd_validate_context(pHddCtx); |
| 7900 | if (0 != ret) |
| 7901 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7902 | return ret; |
| 7903 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7904 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7905 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 7906 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7907 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7908 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7909 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7910 | |
| 7911 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7912 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7913 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7914 | { |
| 7915 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 7916 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7917 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7918 | { |
| 7919 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7920 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7921 | } |
| 7922 | |
| 7923 | EXIT(); |
| 7924 | return 0; |
| 7925 | } |
| 7926 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 7927 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 7928 | struct net_device *dev, |
| 7929 | struct bss_parameters *params) |
| 7930 | { |
| 7931 | int ret; |
| 7932 | |
| 7933 | vos_ssr_protect(__func__); |
| 7934 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 7935 | vos_ssr_unprotect(__func__); |
| 7936 | |
| 7937 | return ret; |
| 7938 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7939 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 7940 | * to wait for contry code completion |
| 7941 | */ |
| 7942 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 7943 | { |
| 7944 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 7945 | complete(&call_back_pAdapter->change_country_code); |
| 7946 | return NULL; |
| 7947 | } |
| 7948 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7949 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7950 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7951 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 7952 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7953 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7954 | struct net_device *ndev, |
| 7955 | enum nl80211_iftype type, |
| 7956 | u32 *flags, |
| 7957 | struct vif_params *params |
| 7958 | ) |
| 7959 | { |
| 7960 | struct wireless_dev *wdev; |
| 7961 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7962 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7963 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7964 | tCsrRoamProfile *pRoamProfile = NULL; |
| 7965 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7966 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7967 | eMib_dot11DesiredBssType connectedBssType; |
| 7968 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7969 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7970 | |
| 7971 | ENTER(); |
| 7972 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7973 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7974 | { |
| 7975 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7976 | "%s: Adapter context is null", __func__); |
| 7977 | return VOS_STATUS_E_FAILURE; |
| 7978 | } |
| 7979 | |
| 7980 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7981 | if (!pHddCtx) |
| 7982 | { |
| 7983 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7984 | "%s: HDD context is null", __func__); |
| 7985 | return VOS_STATUS_E_FAILURE; |
| 7986 | } |
| 7987 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7988 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7989 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 7990 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7991 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7992 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7993 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7994 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7995 | } |
| 7996 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7997 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7998 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7999 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8000 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 8001 | if (vos_max_concurrent_connections_reached()) { |
| 8002 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 8003 | return -EINVAL; |
| 8004 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8005 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8006 | wdev = ndev->ieee80211_ptr; |
| 8007 | |
| 8008 | #ifdef WLAN_BTAMP_FEATURE |
| 8009 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 8010 | (NL80211_IFTYPE_ADHOC == type)|| |
| 8011 | (NL80211_IFTYPE_AP == type)|| |
| 8012 | (NL80211_IFTYPE_P2P_GO == type)) |
| 8013 | { |
| 8014 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 8015 | // stop AMP traffic |
| 8016 | status = WLANBAP_StopAmp(); |
| 8017 | if(VOS_STATUS_SUCCESS != status ) |
| 8018 | { |
| 8019 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 8020 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 8021 | "%s: Failed to stop AMP", __func__); |
| 8022 | return -EINVAL; |
| 8023 | } |
| 8024 | } |
| 8025 | #endif //WLAN_BTAMP_FEATURE |
| 8026 | /* Reset the current device mode bit mask*/ |
| 8027 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 8028 | |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 8029 | /* Notify Mode change in case of concurrency. |
| 8030 | * Below function invokes TDLS teardown Functionality Since TDLS is |
| 8031 | * not Supported in case of concurrency i.e Once P2P session |
| 8032 | * is detected disable offchannel and teardown TDLS links |
| 8033 | */ |
| 8034 | hdd_tdls_notify_mode_change(pAdapter, pHddCtx); |
| 8035 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8036 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8037 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8038 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8039 | ) |
| 8040 | { |
| 8041 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 8042 | if (!pWextState) |
| 8043 | { |
| 8044 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8045 | "%s: pWextState is null", __func__); |
| 8046 | return VOS_STATUS_E_FAILURE; |
| 8047 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8048 | pRoamProfile = &pWextState->roamProfile; |
| 8049 | LastBSSType = pRoamProfile->BSSType; |
| 8050 | |
| 8051 | switch (type) |
| 8052 | { |
| 8053 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8054 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8055 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8056 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 8057 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8058 | #ifdef WLAN_FEATURE_11AC |
| 8059 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 8060 | { |
| 8061 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 8062 | } |
| 8063 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8064 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8065 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8066 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8067 | //Check for sub-string p2p to confirm its a p2p interface |
| 8068 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8069 | { |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8070 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 8071 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 8072 | } |
| 8073 | else |
| 8074 | { |
| 8075 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8076 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8077 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8078 | break; |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 8079 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8080 | case NL80211_IFTYPE_ADHOC: |
| 8081 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8082 | "%s: setting interface Type to ADHOC", __func__); |
| 8083 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 8084 | pRoamProfile->phyMode = |
| 8085 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 8086 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8087 | wdev->iftype = type; |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 8088 | hdd_set_ibss_ops( pAdapter ); |
| 8089 | hdd_ibss_init_tx_rx( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8090 | break; |
| 8091 | |
| 8092 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8093 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8094 | { |
| 8095 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 8096 | "%s: setting interface Type to %s", __func__, |
| 8097 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 8098 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8099 | //Cancel any remain on channel for GO mode |
| 8100 | if (NL80211_IFTYPE_P2P_GO == type) |
| 8101 | { |
| 8102 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 8103 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8104 | if (NL80211_IFTYPE_AP == type) |
| 8105 | { |
| 8106 | /* As Loading WLAN Driver one interface being created for p2p device |
| 8107 | * address. This will take one HW STA and the max number of clients |
| 8108 | * that can connect to softAP will be reduced by one. so while changing |
| 8109 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 8110 | * interface as it is not required in SoftAP mode. |
| 8111 | */ |
| 8112 | |
| 8113 | // Get P2P Adapter |
| 8114 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 8115 | |
| 8116 | if (pP2pAdapter) |
| 8117 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 8118 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8119 | hdd_deinit_adapter(pHddCtx, pP2pAdapter, TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8120 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 8121 | } |
| 8122 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 8123 | //Disable IMPS & BMPS for SAP/GO |
| 8124 | if(VOS_STATUS_E_FAILURE == |
| 8125 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 8126 | { |
| 8127 | //Fail to Exit BMPS |
| 8128 | VOS_ASSERT(0); |
| 8129 | } |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 8130 | |
| 8131 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
| 8132 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8133 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8134 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8135 | /* A Mutex Lock is introduced while changing the mode to |
| 8136 | * protect the concurrent access for the Adapters by TDLS |
| 8137 | * module. |
| 8138 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8139 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8140 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8141 | //De-init the adapter. |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8142 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8143 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8144 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 8145 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8146 | #ifdef FEATURE_WLAN_TDLS |
| 8147 | mutex_unlock(&pHddCtx->tdls_lock); |
| 8148 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 8149 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 8150 | (pConfig->apRandomBssidEnabled)) |
| 8151 | { |
| 8152 | /* To meet Android requirements create a randomized |
| 8153 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 8154 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 8155 | ndev->dev_addr[0] = 0x02; |
| 8156 | ndev->dev_addr[1] = 0x1A; |
| 8157 | ndev->dev_addr[2] = 0x11; |
| 8158 | ndev->dev_addr[3] |= 0xF0; |
| 8159 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 8160 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 8161 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 8162 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 8163 | } |
| 8164 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8165 | hdd_set_ap_ops( pAdapter->dev ); |
| 8166 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8167 | /* This is for only SAP mode where users can |
| 8168 | * control country through ini. |
| 8169 | * P2P GO follows station country code |
| 8170 | * acquired during the STA scanning. */ |
| 8171 | if((NL80211_IFTYPE_AP == type) && |
| 8172 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 8173 | { |
| 8174 | int status = 0; |
| 8175 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 8176 | "%s: setting country code from INI ", __func__); |
| 8177 | init_completion(&pAdapter->change_country_code); |
| 8178 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 8179 | (void *)(tSmeChangeCountryCallback) |
| 8180 | wlan_hdd_change_country_code_cb, |
| 8181 | pConfig->apCntryCode, pAdapter, |
| 8182 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 8183 | eSIR_FALSE, |
| 8184 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8185 | if (eHAL_STATUS_SUCCESS == status) |
| 8186 | { |
| 8187 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8188 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8189 | &pAdapter->change_country_code, |
| 8190 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8191 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8192 | { |
| 8193 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8194 | FL("SME Timed out while setting country code %ld"), |
| 8195 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 8196 | |
| 8197 | if (pHddCtx->isLogpInProgress) |
| 8198 | { |
| 8199 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8200 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 8201 | return -EAGAIN; |
| 8202 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8203 | } |
| 8204 | } |
| 8205 | else |
| 8206 | { |
| 8207 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8208 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8209 | return -EINVAL; |
| 8210 | } |
| 8211 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8212 | status = hdd_init_ap_mode(pAdapter); |
| 8213 | if(status != VOS_STATUS_SUCCESS) |
| 8214 | { |
| 8215 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 8216 | "%s: Error initializing the ap mode", __func__); |
| 8217 | return -EINVAL; |
| 8218 | } |
| 8219 | hdd_set_conparam(1); |
| 8220 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8221 | /*interface type changed update in wiphy structure*/ |
| 8222 | if(wdev) |
| 8223 | { |
| 8224 | wdev->iftype = type; |
| 8225 | pHddCtx->change_iface = type; |
| 8226 | } |
| 8227 | else |
| 8228 | { |
| 8229 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8230 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 8231 | return -EINVAL; |
| 8232 | } |
| 8233 | goto done; |
| 8234 | } |
| 8235 | |
| 8236 | default: |
| 8237 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 8238 | __func__); |
| 8239 | return -EOPNOTSUPP; |
| 8240 | } |
| 8241 | } |
| 8242 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8243 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8244 | ) |
| 8245 | { |
| 8246 | switch(type) |
| 8247 | { |
| 8248 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8249 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8250 | case NL80211_IFTYPE_ADHOC: |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 8251 | |
| 8252 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8253 | #ifdef FEATURE_WLAN_TDLS |
| 8254 | |
| 8255 | /* A Mutex Lock is introduced while changing the mode to |
| 8256 | * protect the concurrent access for the Adapters by TDLS |
| 8257 | * module. |
| 8258 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8259 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8260 | #endif |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8261 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8262 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8263 | //Check for sub-string p2p to confirm its a p2p interface |
| 8264 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8265 | { |
| 8266 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 8267 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 8268 | } |
| 8269 | else |
| 8270 | { |
| 8271 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8272 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8273 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8274 | hdd_set_conparam(0); |
| 8275 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8276 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 8277 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8278 | #ifdef FEATURE_WLAN_TDLS |
| 8279 | mutex_unlock(&pHddCtx->tdls_lock); |
| 8280 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 8281 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8282 | if( VOS_STATUS_SUCCESS != status ) |
| 8283 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8284 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 8285 | * This is the right place to enable back bmps_imps() |
| 8286 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 8287 | if (pHddCtx->hdd_wlan_suspended) |
| 8288 | { |
| 8289 | hdd_set_pwrparams(pHddCtx); |
| 8290 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8291 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8292 | goto done; |
| 8293 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8294 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8295 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8296 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 8297 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8298 | goto done; |
| 8299 | default: |
| 8300 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 8301 | __func__); |
| 8302 | return -EOPNOTSUPP; |
| 8303 | |
| 8304 | } |
| 8305 | |
| 8306 | } |
| 8307 | else |
| 8308 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8309 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 8310 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8311 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8312 | return -EOPNOTSUPP; |
| 8313 | } |
| 8314 | |
| 8315 | |
| 8316 | if(pRoamProfile) |
| 8317 | { |
| 8318 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 8319 | { |
| 8320 | /*interface type changed update in wiphy structure*/ |
| 8321 | wdev->iftype = type; |
| 8322 | |
| 8323 | /*the BSS mode changed, We need to issue disconnect |
| 8324 | if connected or in IBSS disconnect state*/ |
| 8325 | if ( hdd_connGetConnectedBssType( |
| 8326 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 8327 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 8328 | { |
| 8329 | /*need to issue a disconnect to CSR.*/ |
| 8330 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 8331 | if( eHAL_STATUS_SUCCESS == |
| 8332 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8333 | pAdapter->sessionId, |
| 8334 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 8335 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8336 | ret = wait_for_completion_interruptible_timeout( |
| 8337 | &pAdapter->disconnect_comp_var, |
| 8338 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 8339 | if (ret <= 0) |
| 8340 | { |
| 8341 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8342 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 8343 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8344 | } |
| 8345 | } |
| 8346 | } |
| 8347 | } |
| 8348 | |
| 8349 | done: |
| 8350 | /*set bitmask based on updated value*/ |
| 8351 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 8352 | |
| 8353 | /* Only STA mode support TM now |
| 8354 | * all other mode, TM feature should be disabled */ |
| 8355 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 8356 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 8357 | { |
| 8358 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 8359 | } |
| 8360 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8361 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8362 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 8363 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8364 | { |
| 8365 | //we are ok to do AMP |
| 8366 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 8367 | } |
| 8368 | #endif //WLAN_BTAMP_FEATURE |
| 8369 | EXIT(); |
| 8370 | return 0; |
| 8371 | } |
| 8372 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 8373 | /* |
| 8374 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 8375 | * wrapper function to protect the actual implementation from SSR. |
| 8376 | */ |
| 8377 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 8378 | struct net_device *ndev, |
| 8379 | enum nl80211_iftype type, |
| 8380 | u32 *flags, |
| 8381 | struct vif_params *params |
| 8382 | ) |
| 8383 | { |
| 8384 | int ret; |
| 8385 | |
| 8386 | vos_ssr_protect(__func__); |
| 8387 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 8388 | vos_ssr_unprotect(__func__); |
| 8389 | |
| 8390 | return ret; |
| 8391 | } |
| 8392 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8393 | #ifdef FEATURE_WLAN_TDLS |
| 8394 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
| 8395 | struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams) |
| 8396 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8397 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8398 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8399 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8400 | tANI_U16 numCurrTdlsPeers; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 8401 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8402 | |
| 8403 | ENTER(); |
| 8404 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 8405 | if (!dev) { |
| 8406 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 8407 | return -EINVAL; |
| 8408 | } |
| 8409 | |
| 8410 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8411 | if (!pAdapter) { |
| 8412 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 8413 | return -EINVAL; |
| 8414 | } |
| 8415 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8416 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8417 | { |
| 8418 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8419 | "Invalid arguments"); |
| 8420 | return -EINVAL; |
| 8421 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8422 | |
| 8423 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 8424 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 8425 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8426 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8427 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 8428 | MAC_ADDRESS_STR " Request declined.", |
| 8429 | __func__, MAC_ADDR_ARRAY(mac)); |
| 8430 | return -ENOTSUPP; |
| 8431 | } |
| 8432 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8433 | if (pHddCtx->isLogpInProgress) |
| 8434 | { |
| 8435 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8436 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8437 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8438 | mac, |
| 8439 | eTDLS_LINK_IDLE, |
| 8440 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8441 | return -EBUSY; |
| 8442 | } |
| 8443 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 8444 | mutex_lock(&pHddCtx->tdls_lock); |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 8445 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8446 | |
| 8447 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8448 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8449 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 8450 | __func__, MAC_ADDR_ARRAY(mac), update); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 8451 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8452 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8453 | } |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 8454 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8455 | |
| 8456 | /* in add station, we accept existing valid staId if there is */ |
| 8457 | if ((0 == update) && |
| 8458 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 8459 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8460 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8461 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8462 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8463 | " link_status %d. staId %d. add station ignored.", |
| 8464 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 8465 | return 0; |
| 8466 | } |
| 8467 | /* in change station, we accept only when staId is valid */ |
| 8468 | if ((1 == update) && |
| 8469 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 8470 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 8471 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8472 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8473 | "%s: " MAC_ADDRESS_STR |
| 8474 | " link status %d. staId %d. change station %s.", |
| 8475 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 8476 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 8477 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8478 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8479 | |
| 8480 | /* 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] | 8481 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8482 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8483 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8484 | "%s: " MAC_ADDRESS_STR |
| 8485 | " TDLS setup is ongoing. Request declined.", |
| 8486 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8487 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8488 | } |
| 8489 | |
| 8490 | /* first to check if we reached to maximum supported TDLS peer. |
| 8491 | TODO: for now, return -EPERM looks working fine, |
| 8492 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8493 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 8494 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8495 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8496 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8497 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8498 | " TDLS Max peer already connected. Request declined." |
| 8499 | " Num of peers (%d), Max allowed (%d).", |
| 8500 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 8501 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8502 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8503 | } |
| 8504 | else |
| 8505 | { |
| 8506 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8507 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8508 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8509 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8510 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8511 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 8512 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8513 | return -EPERM; |
| 8514 | } |
| 8515 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8516 | if (0 == update) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8517 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8518 | mac, |
| 8519 | eTDLS_LINK_CONNECTING, |
| 8520 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8521 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 8522 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8523 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8524 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8525 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8526 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8527 | if(StaParams->htcap_present) |
| 8528 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8529 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8530 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8531 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8532 | "ht_capa->extended_capabilities: %0x", |
| 8533 | StaParams->HTCap.extendedHtCapInfo); |
| 8534 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8535 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8536 | "params->capability: %0x",StaParams->capability); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8537 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8538 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8539 | if(StaParams->vhtcap_present) |
| 8540 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8541 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8542 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 8543 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 8544 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 8545 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8546 | { |
| 8547 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8548 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8549 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8550 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8551 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 8552 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 8553 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8554 | else if ((1 == update) && (NULL == StaParams)) |
| 8555 | { |
| 8556 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8557 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 8558 | return -EPERM; |
| 8559 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8560 | |
| 8561 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 8562 | |
| 8563 | if (!update) |
| 8564 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8565 | ret = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8566 | pAdapter->sessionId, mac); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8567 | if (ret != eHAL_STATUS_SUCCESS) { |
| 8568 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to add TDLS peer STA")); |
| 8569 | return -EPERM; |
| 8570 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8571 | } |
| 8572 | else |
| 8573 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8574 | ret = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8575 | pAdapter->sessionId, mac, StaParams); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8576 | if (ret != eHAL_STATUS_SUCCESS) { |
| 8577 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to change TDLS peer STA params")); |
| 8578 | return -EPERM; |
| 8579 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8580 | } |
| 8581 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8582 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8583 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 8584 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8585 | if (ret <= 0) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8586 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8587 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8588 | "%s: timeout waiting for tdls add station indication %ld", |
| 8589 | __func__, ret); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8590 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8591 | } |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8592 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8593 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 8594 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8595 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8596 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8597 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8598 | } |
| 8599 | |
| 8600 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8601 | |
| 8602 | error: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8603 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8604 | mac, |
| 8605 | eTDLS_LINK_IDLE, |
| 8606 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8607 | return -EPERM; |
| 8608 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8609 | } |
| 8610 | #endif |
| 8611 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8612 | static int __wlan_hdd_change_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8613 | struct net_device *dev, |
| 8614 | u8 *mac, |
| 8615 | struct station_parameters *params) |
| 8616 | { |
| 8617 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8618 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8619 | hdd_context_t *pHddCtx; |
| 8620 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8621 | v_MACADDR_t STAMacAddress; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8622 | int ret = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8623 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8624 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8625 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8626 | tANI_U8 isOffChannelSupported = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8627 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8628 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8629 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8630 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8631 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8632 | if ((NULL == pAdapter)) |
| 8633 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8634 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8635 | "invalid adapter "); |
| 8636 | return -EINVAL; |
| 8637 | } |
| 8638 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8639 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8640 | TRACE_CODE_HDD_CHANGE_STATION, |
| 8641 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8642 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8643 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8644 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8645 | if (0 != ret) |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8646 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8647 | return ret; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8648 | } |
| 8649 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8650 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8651 | |
| 8652 | if (NULL == pHddStaCtx) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8653 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8654 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8655 | "invalid HDD station context"); |
| 8656 | return -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8657 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8658 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 8659 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8660 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 8661 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8662 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8663 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8664 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8665 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8666 | WLANTL_STA_AUTHENTICATED); |
| 8667 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8668 | if (status != VOS_STATUS_SUCCESS) |
| 8669 | { |
| 8670 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8671 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 8672 | return -EINVAL; |
| 8673 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8674 | } |
| 8675 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 8676 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 8677 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8678 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8679 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 8680 | StaParams.capability = params->capability; |
| 8681 | StaParams.uapsd_queues = params->uapsd_queues; |
| 8682 | StaParams.max_sp = params->max_sp; |
| 8683 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8684 | /* Convert (first channel , number of channels) tuple to |
| 8685 | * the total list of channels. This goes with the assumption |
| 8686 | * that if the first channel is < 14, then the next channels |
| 8687 | * are an incremental of 1 else an incremental of 4 till the number |
| 8688 | * of channels. |
| 8689 | */ |
| 8690 | if (0 != params->supported_channels_len) { |
| 8691 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 8692 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 8693 | { |
| 8694 | int wifi_chan_index; |
| 8695 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 8696 | wifi_chan_index = |
| 8697 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 8698 | no_of_channels = params->supported_channels[i+1]; |
| 8699 | for(k=1; k <= no_of_channels; k++) |
| 8700 | { |
| 8701 | StaParams.supported_channels[j+1] = |
| 8702 | StaParams.supported_channels[j] + wifi_chan_index; |
| 8703 | j+=1; |
| 8704 | } |
| 8705 | } |
| 8706 | StaParams.supported_channels_len = j; |
| 8707 | } |
| 8708 | vos_mem_copy(StaParams.supported_oper_classes, |
| 8709 | params->supported_oper_classes, |
| 8710 | params->supported_oper_classes_len); |
| 8711 | StaParams.supported_oper_classes_len = |
| 8712 | params->supported_oper_classes_len; |
| 8713 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8714 | if (0 != params->ext_capab_len) |
| 8715 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 8716 | sizeof(StaParams.extn_capability)); |
| 8717 | |
| 8718 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8719 | { |
| 8720 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8721 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8722 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8723 | |
| 8724 | StaParams.supported_rates_len = params->supported_rates_len; |
| 8725 | |
| 8726 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 8727 | * The supported_rates array , for all the structures propogating till Add Sta |
| 8728 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 8729 | * modified to send more rates. |
| 8730 | */ |
| 8731 | |
| 8732 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 8733 | */ |
| 8734 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 8735 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 8736 | |
| 8737 | if (0 != StaParams.supported_rates_len) { |
| 8738 | int i = 0; |
| 8739 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 8740 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8741 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8742 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 8743 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8744 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8745 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 8746 | } |
| 8747 | |
| 8748 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8749 | { |
| 8750 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8751 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8752 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8753 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8754 | if (0 != params->ext_capab_len ) { |
| 8755 | /*Define A Macro : TODO Sunil*/ |
| 8756 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 8757 | isBufSta = 1; |
| 8758 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8759 | /* TDLS Channel Switching Support */ |
| 8760 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 8761 | isOffChannelSupported = 1; |
| 8762 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8763 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8764 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 8765 | &StaParams, isBufSta, |
| 8766 | isOffChannelSupported); |
| 8767 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8768 | if (VOS_STATUS_SUCCESS != status) { |
| 8769 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8770 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 8771 | return -EINVAL; |
| 8772 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8773 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 8774 | |
| 8775 | if (VOS_STATUS_SUCCESS != status) { |
| 8776 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8777 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 8778 | return -EINVAL; |
| 8779 | } |
| 8780 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8781 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 8782 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8783 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8784 | return status; |
| 8785 | } |
| 8786 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8787 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 8788 | struct net_device *dev, |
| 8789 | u8 *mac, |
| 8790 | struct station_parameters *params) |
| 8791 | { |
| 8792 | int ret; |
| 8793 | |
| 8794 | vos_ssr_protect(__func__); |
| 8795 | ret = __wlan_hdd_change_station(wiphy, dev, mac, params); |
| 8796 | vos_ssr_unprotect(__func__); |
| 8797 | |
| 8798 | return ret; |
| 8799 | } |
| 8800 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8801 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8802 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8803 | * This function is used to initialize the key information |
| 8804 | */ |
| 8805 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8806 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8807 | struct net_device *ndev, |
| 8808 | u8 key_index, bool pairwise, |
| 8809 | const u8 *mac_addr, |
| 8810 | struct key_params *params |
| 8811 | ) |
| 8812 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8813 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8814 | struct net_device *ndev, |
| 8815 | u8 key_index, const u8 *mac_addr, |
| 8816 | struct key_params *params |
| 8817 | ) |
| 8818 | #endif |
| 8819 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8820 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8821 | tCsrRoamSetKey setKey; |
| 8822 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8823 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8824 | v_U32_t roamId= 0xFF; |
| 8825 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8826 | hdd_hostapd_state_t *pHostapdState; |
| 8827 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8828 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8829 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8830 | |
| 8831 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8832 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8833 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8834 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 8835 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8836 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8837 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8838 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8839 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8840 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8841 | } |
| 8842 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8843 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8844 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8845 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8846 | |
| 8847 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8848 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8849 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8850 | key_index); |
| 8851 | |
| 8852 | return -EINVAL; |
| 8853 | } |
| 8854 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8855 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 8856 | { |
| 8857 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 8858 | params->key_len); |
| 8859 | |
| 8860 | return -EINVAL; |
| 8861 | } |
| 8862 | |
| 8863 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8864 | "%s: called with key index = %d & key length %d", |
| 8865 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8866 | |
| 8867 | /*extract key idx, key len and key*/ |
| 8868 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8869 | setKey.keyId = key_index; |
| 8870 | setKey.keyLength = params->key_len; |
| 8871 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 8872 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8873 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8874 | { |
| 8875 | case WLAN_CIPHER_SUITE_WEP40: |
| 8876 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 8877 | break; |
| 8878 | |
| 8879 | case WLAN_CIPHER_SUITE_WEP104: |
| 8880 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 8881 | break; |
| 8882 | |
| 8883 | case WLAN_CIPHER_SUITE_TKIP: |
| 8884 | { |
| 8885 | u8 *pKey = &setKey.Key[0]; |
| 8886 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 8887 | |
| 8888 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 8889 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8890 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8891 | |
| 8892 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8893 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8894 | |--------------|----------|----------| |
| 8895 | <---16bytes---><--8bytes--><--8bytes--> |
| 8896 | |
| 8897 | */ |
| 8898 | /*Sme expects the 32 bytes key to be in the below order |
| 8899 | |
| 8900 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8901 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8902 | |--------------|----------|----------| |
| 8903 | <---16bytes---><--8bytes--><--8bytes--> |
| 8904 | */ |
| 8905 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8906 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8907 | |
| 8908 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8909 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8910 | |
| 8911 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8912 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8913 | |
| 8914 | |
| 8915 | break; |
| 8916 | } |
| 8917 | |
| 8918 | case WLAN_CIPHER_SUITE_CCMP: |
| 8919 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 8920 | break; |
| 8921 | |
| 8922 | #ifdef FEATURE_WLAN_WAPI |
| 8923 | case WLAN_CIPHER_SUITE_SMS4: |
| 8924 | { |
| 8925 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8926 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 8927 | params->key, params->key_len); |
| 8928 | return 0; |
| 8929 | } |
| 8930 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8931 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8932 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8933 | case WLAN_CIPHER_SUITE_KRK: |
| 8934 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 8935 | break; |
| 8936 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8937 | |
| 8938 | #ifdef WLAN_FEATURE_11W |
| 8939 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 8940 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 8941 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8942 | #endif |
| 8943 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8944 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8945 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8946 | __func__, params->cipher); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8947 | status = -EOPNOTSUPP; |
| 8948 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8949 | } |
| 8950 | |
| 8951 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 8952 | __func__, setKey.encType); |
| 8953 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8954 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8955 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8956 | (!pairwise) |
| 8957 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8958 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8959 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8960 | ) |
| 8961 | { |
| 8962 | /* set group key*/ |
| 8963 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8964 | "%s- %d: setting Broadcast key", |
| 8965 | __func__, __LINE__); |
| 8966 | setKey.keyDirection = eSIR_RX_ONLY; |
| 8967 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 8968 | } |
| 8969 | else |
| 8970 | { |
| 8971 | /* set pairwise key*/ |
| 8972 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8973 | "%s- %d: setting pairwise key", |
| 8974 | __func__, __LINE__); |
| 8975 | setKey.keyDirection = eSIR_TX_RX; |
| 8976 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 8977 | } |
| 8978 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 8979 | { |
| 8980 | setKey.keyDirection = eSIR_TX_RX; |
| 8981 | /*Set the group key*/ |
| 8982 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8983 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8984 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8985 | if ( 0 != status ) |
| 8986 | { |
| 8987 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8988 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8989 | status = -EINVAL; |
| 8990 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8991 | } |
| 8992 | /*Save the keys here and call sme_RoamSetKey for setting |
| 8993 | the PTK after peer joins the IBSS network*/ |
| 8994 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 8995 | &setKey, sizeof(tCsrRoamSetKey)); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8996 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8997 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8998 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 8999 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 9000 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9001 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9002 | if( pHostapdState->bssState == BSS_START ) |
| 9003 | { |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9004 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9005 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 9006 | |
| 9007 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 9008 | { |
| 9009 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9010 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 9011 | __LINE__, vos_status ); |
| 9012 | |
| 9013 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 9014 | |
| 9015 | status = -EINVAL; |
| 9016 | goto end; |
| 9017 | } |
| 9018 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9019 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 9020 | |
| 9021 | if ( status != eHAL_STATUS_SUCCESS ) |
| 9022 | { |
| 9023 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9024 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 9025 | __LINE__, status ); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9026 | status = -EINVAL; |
| 9027 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9028 | } |
| 9029 | } |
| 9030 | |
| 9031 | /* Saving WEP keys */ |
| 9032 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 9033 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 9034 | { |
| 9035 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 9036 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 9037 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 9038 | } |
| 9039 | else |
| 9040 | { |
| 9041 | //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] | 9042 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9043 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 9044 | } |
| 9045 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9046 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 9047 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9048 | { |
| 9049 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9050 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9051 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9052 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9053 | if (!pairwise) |
| 9054 | #else |
| 9055 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 9056 | #endif |
| 9057 | { |
| 9058 | /* set group key*/ |
| 9059 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 9060 | { |
| 9061 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9062 | "%s- %d: Perform Set key Complete", |
| 9063 | __func__, __LINE__); |
| 9064 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 9065 | } |
| 9066 | } |
| 9067 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9068 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 9069 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 9070 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 9071 | |
| 9072 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9073 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9074 | params->key, params->key_len); |
| 9075 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9076 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9077 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 9078 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9079 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9080 | "%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] | 9081 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9082 | setKey.peerMac[2], setKey.peerMac[3], |
| 9083 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9084 | setKey.keyDirection); |
| 9085 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9086 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 9087 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9088 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 9089 | { |
| 9090 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9091 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 9092 | __LINE__, vos_status ); |
| 9093 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9094 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9095 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9096 | status = -EINVAL; |
| 9097 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9098 | |
| 9099 | } |
| 9100 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9101 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9102 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 9103 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 9104 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9105 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9106 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9107 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9108 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 9109 | "%s: Update PreAuth Key success", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9110 | status = 0; |
| 9111 | goto end; |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9112 | } |
| 9113 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 9114 | { |
| 9115 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9116 | "%s: Update PreAuth Key failed", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9117 | status = -EINVAL; |
| 9118 | goto end; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9119 | } |
| 9120 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9121 | |
| 9122 | /* issue set key request to SME*/ |
| 9123 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9124 | pAdapter->sessionId, &setKey, &roamId ); |
| 9125 | |
| 9126 | if ( 0 != status ) |
| 9127 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9128 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9129 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 9130 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9131 | status = -EINVAL; |
| 9132 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9133 | } |
| 9134 | |
| 9135 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9136 | /* in case of IBSS as there was no information available about WEP keys during |
| 9137 | * 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] | 9138 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9139 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 9140 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 9141 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9142 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 9143 | ) |
| 9144 | && |
| 9145 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 9146 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 9147 | ) |
| 9148 | ) |
| 9149 | { |
| 9150 | setKey.keyDirection = eSIR_RX_ONLY; |
| 9151 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 9152 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9153 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9154 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9155 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9156 | setKey.peerMac[2], setKey.peerMac[3], |
| 9157 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9158 | setKey.keyDirection); |
| 9159 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9160 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9161 | pAdapter->sessionId, &setKey, &roamId ); |
| 9162 | |
| 9163 | if ( 0 != status ) |
| 9164 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9165 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9166 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9167 | __func__, status); |
| 9168 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9169 | status = -EINVAL; |
| 9170 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9171 | } |
| 9172 | } |
| 9173 | } |
| 9174 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9175 | end: |
| 9176 | /* Need to clear any trace of key value in the memory. |
| 9177 | * Thus zero out the memory even though it is local |
| 9178 | * variable. |
| 9179 | */ |
| 9180 | vos_mem_zero(&setKey, sizeof(setKey)); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9181 | EXIT(); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9182 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9183 | } |
| 9184 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9185 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9186 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 9187 | struct net_device *ndev, |
| 9188 | u8 key_index, bool pairwise, |
| 9189 | const u8 *mac_addr, |
| 9190 | struct key_params *params |
| 9191 | ) |
| 9192 | #else |
| 9193 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 9194 | struct net_device *ndev, |
| 9195 | u8 key_index, const u8 *mac_addr, |
| 9196 | struct key_params *params |
| 9197 | ) |
| 9198 | #endif |
| 9199 | { |
| 9200 | int ret; |
| 9201 | vos_ssr_protect(__func__); |
| 9202 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9203 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 9204 | mac_addr, params); |
| 9205 | #else |
| 9206 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 9207 | params); |
| 9208 | #endif |
| 9209 | vos_ssr_unprotect(__func__); |
| 9210 | |
| 9211 | return ret; |
| 9212 | } |
| 9213 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9214 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9215 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9216 | * This function is used to get the key information |
| 9217 | */ |
| 9218 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9219 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9220 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9221 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9222 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9223 | const u8 *mac_addr, void *cookie, |
| 9224 | void (*callback)(void *cookie, struct key_params*) |
| 9225 | ) |
| 9226 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9227 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9228 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9229 | struct net_device *ndev, |
| 9230 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 9231 | void (*callback)(void *cookie, struct key_params*) |
| 9232 | ) |
| 9233 | #endif |
| 9234 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9235 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9236 | hdd_wext_state_t *pWextState = NULL; |
| 9237 | tCsrRoamProfile *pRoamProfile = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9238 | struct key_params params; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9239 | hdd_context_t *pHddCtx; |
| 9240 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9241 | |
| 9242 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9243 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9244 | if (NULL == pAdapter) |
| 9245 | { |
| 9246 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9247 | "%s: HDD adapter is Null", __func__); |
| 9248 | return -ENODEV; |
| 9249 | } |
| 9250 | |
| 9251 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9252 | ret = wlan_hdd_validate_context(pHddCtx); |
| 9253 | if (0 != ret) |
| 9254 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9255 | return ret; |
| 9256 | } |
| 9257 | |
| 9258 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9259 | pRoamProfile = &(pWextState->roamProfile); |
| 9260 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9261 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 9262 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9263 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9264 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9265 | memset(¶ms, 0, sizeof(params)); |
| 9266 | |
| 9267 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9268 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9269 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9270 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9271 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9272 | |
| 9273 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 9274 | { |
| 9275 | case eCSR_ENCRYPT_TYPE_NONE: |
| 9276 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 9277 | break; |
| 9278 | |
| 9279 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 9280 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 9281 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 9282 | break; |
| 9283 | |
| 9284 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 9285 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 9286 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 9287 | break; |
| 9288 | |
| 9289 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 9290 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 9291 | break; |
| 9292 | |
| 9293 | case eCSR_ENCRYPT_TYPE_AES: |
| 9294 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 9295 | break; |
| 9296 | |
| 9297 | default: |
| 9298 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 9299 | break; |
| 9300 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9301 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 9302 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9303 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 9304 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9305 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9306 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 9307 | params.seq_len = 0; |
| 9308 | params.seq = NULL; |
| 9309 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 9310 | callback(cookie, ¶ms); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9311 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9312 | return 0; |
| 9313 | } |
| 9314 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9315 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9316 | static int wlan_hdd_cfg80211_get_key( |
| 9317 | struct wiphy *wiphy, |
| 9318 | struct net_device *ndev, |
| 9319 | u8 key_index, bool pairwise, |
| 9320 | const u8 *mac_addr, void *cookie, |
| 9321 | void (*callback)(void *cookie, struct key_params*) |
| 9322 | ) |
| 9323 | #else |
| 9324 | static int wlan_hdd_cfg80211_get_key( |
| 9325 | struct wiphy *wiphy, |
| 9326 | struct net_device *ndev, |
| 9327 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 9328 | void (*callback)(void *cookie, struct key_params*) |
| 9329 | ) |
| 9330 | #endif |
| 9331 | { |
| 9332 | int ret; |
| 9333 | |
| 9334 | vos_ssr_protect(__func__); |
| 9335 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9336 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 9337 | mac_addr, cookie, callback); |
| 9338 | #else |
| 9339 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 9340 | callback); |
| 9341 | #endif |
| 9342 | vos_ssr_unprotect(__func__); |
| 9343 | |
| 9344 | return ret; |
| 9345 | } |
| 9346 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9347 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9348 | * FUNCTION: __wlan_hdd_cfg80211_del_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9349 | * This function is used to delete the key information |
| 9350 | */ |
| 9351 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9352 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9353 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9354 | u8 key_index, |
| 9355 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9356 | const u8 *mac_addr |
| 9357 | ) |
| 9358 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9359 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9360 | struct net_device *ndev, |
| 9361 | u8 key_index, |
| 9362 | const u8 *mac_addr |
| 9363 | ) |
| 9364 | #endif |
| 9365 | { |
| 9366 | int status = 0; |
| 9367 | |
| 9368 | //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] | 9369 | //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] | 9370 | //it is observed that this is invalidating peer |
| 9371 | //key index whenever re-key is done. This is affecting data link. |
| 9372 | //It should be ok to ignore del_key. |
| 9373 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9374 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 9375 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9376 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 9377 | tCsrRoamSetKey setKey; |
| 9378 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9379 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9380 | ENTER(); |
| 9381 | |
| 9382 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 9383 | __func__,pAdapter->device_mode); |
| 9384 | |
| 9385 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9386 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9387 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9388 | key_index); |
| 9389 | |
| 9390 | return -EINVAL; |
| 9391 | } |
| 9392 | |
| 9393 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9394 | setKey.keyId = key_index; |
| 9395 | |
| 9396 | if (mac_addr) |
| 9397 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 9398 | else |
| 9399 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 9400 | |
| 9401 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 9402 | |
| 9403 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9404 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9405 | ) |
| 9406 | { |
| 9407 | |
| 9408 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9409 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 9410 | if( pHostapdState->bssState == BSS_START) |
| 9411 | { |
| 9412 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9413 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9414 | if ( status != eHAL_STATUS_SUCCESS ) |
| 9415 | { |
| 9416 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9417 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 9418 | __LINE__, status ); |
| 9419 | } |
| 9420 | } |
| 9421 | } |
| 9422 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9423 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9424 | ) |
| 9425 | { |
| 9426 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9427 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9428 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 9429 | |
| 9430 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9431 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9432 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9433 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9434 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9435 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 9436 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9437 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9438 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9439 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9440 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9441 | if ( 0 != status ) |
| 9442 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9443 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9444 | "%s: sme_RoamSetKey failure, returned %d", |
| 9445 | __func__, status); |
| 9446 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 9447 | return -EINVAL; |
| 9448 | } |
| 9449 | } |
| 9450 | } |
| 9451 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9452 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9453 | return status; |
| 9454 | } |
| 9455 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9456 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9457 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 9458 | struct net_device *ndev, |
| 9459 | u8 key_index, |
| 9460 | bool pairwise, |
| 9461 | const u8 *mac_addr |
| 9462 | ) |
| 9463 | #else |
| 9464 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 9465 | struct net_device *ndev, |
| 9466 | u8 key_index, |
| 9467 | const u8 *mac_addr |
| 9468 | ) |
| 9469 | #endif |
| 9470 | { |
| 9471 | int ret; |
| 9472 | |
| 9473 | vos_ssr_protect(__func__); |
| 9474 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9475 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, pairwise, |
| 9476 | mac_addr); |
| 9477 | #else |
| 9478 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, mac_addr); |
| 9479 | #endif |
| 9480 | vos_ssr_unprotect(__func__); |
| 9481 | |
| 9482 | return ret; |
| 9483 | } |
| 9484 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9485 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9486 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9487 | * This function is used to set the default tx key index |
| 9488 | */ |
| 9489 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9490 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9491 | struct net_device *ndev, |
| 9492 | u8 key_index, |
| 9493 | bool unicast, bool multicast) |
| 9494 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9495 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9496 | struct net_device *ndev, |
| 9497 | u8 key_index) |
| 9498 | #endif |
| 9499 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9500 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9501 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9502 | hdd_wext_state_t *pWextState; |
| 9503 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9504 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9505 | |
| 9506 | ENTER(); |
| 9507 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9508 | if ((NULL == pAdapter)) |
| 9509 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9510 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9511 | "invalid adapter"); |
| 9512 | return -EINVAL; |
| 9513 | } |
| 9514 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9515 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9516 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 9517 | pAdapter->sessionId, key_index)); |
| 9518 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9519 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9520 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9521 | |
| 9522 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 9523 | { |
| 9524 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9525 | "invalid Wext state or HDD context"); |
| 9526 | return -EINVAL; |
| 9527 | } |
| 9528 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9529 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9530 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9531 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9532 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9533 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9534 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9535 | key_index); |
| 9536 | |
| 9537 | return -EINVAL; |
| 9538 | } |
| 9539 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9540 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9541 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9542 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9543 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9544 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9545 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9546 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9547 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9548 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9549 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9550 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9551 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 9552 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9553 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 9554 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9555 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9556 | { |
| 9557 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9558 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9559 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9560 | tCsrRoamSetKey setKey; |
| 9561 | v_U32_t roamId= 0xFF; |
| 9562 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9563 | |
| 9564 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9565 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9566 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9567 | Keys->defaultIndex = (u8)key_index; |
| 9568 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9569 | setKey.keyId = key_index; |
| 9570 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9571 | |
| 9572 | vos_mem_copy(&setKey.Key[0], |
| 9573 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9574 | Keys->KeyLength[key_index]); |
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 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9577 | |
| 9578 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9579 | &pHddStaCtx->conn_info.bssId[0], |
| 9580 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9581 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9582 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 9583 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 9584 | eCSR_ENCRYPT_TYPE_WEP104) |
| 9585 | { |
| 9586 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 9587 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 9588 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 9589 | type(104) and switching encryption type to 40*/ |
| 9590 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 9591 | eCSR_ENCRYPT_TYPE_WEP40; |
| 9592 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 9593 | eCSR_ENCRYPT_TYPE_WEP40; |
| 9594 | } |
| 9595 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9596 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9597 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9598 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9599 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9600 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9601 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9602 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9603 | if ( 0 != status ) |
| 9604 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9605 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9606 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9607 | status); |
| 9608 | return -EINVAL; |
| 9609 | } |
| 9610 | } |
| 9611 | } |
| 9612 | |
| 9613 | /* In SoftAp mode setting key direction for default mode */ |
| 9614 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 9615 | { |
| 9616 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 9617 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 9618 | (eCSR_ENCRYPT_TYPE_AES != |
| 9619 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 9620 | ) |
| 9621 | { |
| 9622 | /* Saving key direction for default key index to TX default */ |
| 9623 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 9624 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 9625 | } |
| 9626 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9627 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9628 | return status; |
| 9629 | } |
| 9630 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9631 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9632 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 9633 | struct net_device *ndev, |
| 9634 | u8 key_index, |
| 9635 | bool unicast, bool multicast) |
| 9636 | #else |
| 9637 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 9638 | struct net_device *ndev, |
| 9639 | u8 key_index) |
| 9640 | #endif |
| 9641 | { |
| 9642 | int ret; |
| 9643 | vos_ssr_protect(__func__); |
| 9644 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9645 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 9646 | multicast); |
| 9647 | #else |
| 9648 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 9649 | #endif |
| 9650 | vos_ssr_unprotect(__func__); |
| 9651 | |
| 9652 | return ret; |
| 9653 | } |
| 9654 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9655 | /* |
| 9656 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 9657 | * This function is used to inform the BSS details to nl80211 interface. |
| 9658 | */ |
| 9659 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 9660 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 9661 | { |
| 9662 | struct net_device *dev = pAdapter->dev; |
| 9663 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 9664 | struct wiphy *wiphy = wdev->wiphy; |
| 9665 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 9666 | int chan_no; |
| 9667 | int ie_length; |
| 9668 | const char *ie; |
| 9669 | unsigned int freq; |
| 9670 | struct ieee80211_channel *chan; |
| 9671 | int rssi = 0; |
| 9672 | struct cfg80211_bss *bss = NULL; |
| 9673 | |
| 9674 | ENTER(); |
| 9675 | |
| 9676 | if( NULL == pBssDesc ) |
| 9677 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9678 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9679 | return bss; |
| 9680 | } |
| 9681 | |
| 9682 | chan_no = pBssDesc->channelId; |
| 9683 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 9684 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 9685 | |
| 9686 | if( NULL == ie ) |
| 9687 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9688 | 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] | 9689 | return bss; |
| 9690 | } |
| 9691 | |
| 9692 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 9693 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 9694 | { |
| 9695 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9696 | } |
| 9697 | else |
| 9698 | { |
| 9699 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9700 | } |
| 9701 | #else |
| 9702 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9703 | #endif |
| 9704 | |
| 9705 | chan = __ieee80211_get_channel(wiphy, freq); |
| 9706 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 9707 | if (!chan) { |
| 9708 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 9709 | return NULL; |
| 9710 | } |
| 9711 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9712 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9713 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9714 | return cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9715 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9716 | pBssDesc->capabilityInfo, |
| 9717 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9718 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9719 | } |
| 9720 | |
| 9721 | |
| 9722 | |
| 9723 | /* |
| 9724 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 9725 | * This function is used to inform the BSS details to nl80211 interface. |
| 9726 | */ |
| 9727 | struct cfg80211_bss* |
| 9728 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 9729 | tSirBssDescription *bss_desc |
| 9730 | ) |
| 9731 | { |
| 9732 | /* |
| 9733 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 9734 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 9735 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 9736 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 9737 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 9738 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 9739 | cfg80211_inform_bss_frame. |
| 9740 | */ |
| 9741 | struct net_device *dev = pAdapter->dev; |
| 9742 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 9743 | struct wiphy *wiphy = wdev->wiphy; |
| 9744 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 9745 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 9746 | qcom_ie_age *qie_age = NULL; |
| 9747 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 9748 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9749 | 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] | 9750 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9751 | const char *ie = |
| 9752 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 9753 | unsigned int freq; |
| 9754 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 9755 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9756 | struct cfg80211_bss *bss_status = NULL; |
| 9757 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 9758 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9759 | hdd_context_t *pHddCtx; |
| 9760 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9761 | #ifdef WLAN_OPEN_SOURCE |
| 9762 | struct timespec ts; |
| 9763 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9764 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9765 | ENTER(); |
| 9766 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9767 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9768 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9769 | if (0 != status) |
| 9770 | { |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 9771 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9772 | } |
| 9773 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 9774 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9775 | if (!mgmt) |
| 9776 | { |
| 9777 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9778 | "%s: memory allocation failed ", __func__); |
| 9779 | return NULL; |
| 9780 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 9781 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9782 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9783 | |
| 9784 | #ifdef WLAN_OPEN_SOURCE |
| 9785 | /* Android does not want the timestamp from the frame. |
| 9786 | Instead it wants a monotonic increasing value */ |
| 9787 | get_monotonic_boottime(&ts); |
| 9788 | mgmt->u.probe_resp.timestamp = |
| 9789 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 9790 | #else |
| 9791 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9792 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 9793 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9794 | |
| 9795 | #endif |
| 9796 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9797 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 9798 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 9799 | |
| 9800 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 9801 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 9802 | /* Assuming this is the last IE, copy at the end */ |
| 9803 | ie_length -=sizeof(qcom_ie_age); |
| 9804 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 9805 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 9806 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 9807 | qie_age->oui_1 = QCOM_OUI1; |
| 9808 | qie_age->oui_2 = QCOM_OUI2; |
| 9809 | qie_age->oui_3 = QCOM_OUI3; |
| 9810 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 9811 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 9812 | #endif |
| 9813 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9814 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 9815 | if (bss_desc->fProbeRsp) |
| 9816 | { |
| 9817 | mgmt->frame_control |= |
| 9818 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 9819 | } |
| 9820 | else |
| 9821 | { |
| 9822 | mgmt->frame_control |= |
| 9823 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 9824 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9825 | |
| 9826 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9827 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9828 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 9829 | { |
| 9830 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9831 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9832 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9833 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 9834 | |
| 9835 | { |
| 9836 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9837 | } |
| 9838 | else |
| 9839 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9840 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 9841 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9842 | kfree(mgmt); |
| 9843 | return NULL; |
| 9844 | } |
| 9845 | #else |
| 9846 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9847 | #endif |
| 9848 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 9849 | /*when the band is changed on the fly using the GUI, three things are done |
| 9850 | * 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) |
| 9851 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 9852 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 9853 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 9854 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 9855 | * 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 |
| 9856 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 9857 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 9858 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 9859 | * So drop the bss and continue to next bss. |
| 9860 | */ |
| 9861 | if(chan == NULL) |
| 9862 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9863 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 9864 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 9865 | return NULL; |
| 9866 | } |
Sachin Ahuja | 40530ed | 2015-04-20 00:20:58 +0530 | [diff] [blame] | 9867 | /* Supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 9868 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0)) * 100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9869 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9870 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
| 9871 | "RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 9872 | chan->center_freq, (int)(rssi/100)); |
| 9873 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9874 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 9875 | frame_len, rssi, GFP_KERNEL); |
| 9876 | kfree(mgmt); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9877 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9878 | return bss_status; |
| 9879 | } |
| 9880 | |
| 9881 | /* |
| 9882 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 9883 | * This function is used to update the BSS data base of CFG8011 |
| 9884 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9885 | 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] | 9886 | tCsrRoamInfo *pRoamInfo |
| 9887 | ) |
| 9888 | { |
| 9889 | tCsrRoamConnectedProfile roamProfile; |
| 9890 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9891 | struct cfg80211_bss *bss = NULL; |
| 9892 | |
| 9893 | ENTER(); |
| 9894 | |
| 9895 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 9896 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 9897 | |
| 9898 | if (NULL != roamProfile.pBssDesc) |
| 9899 | { |
Girish Gowli | f4b6802 | 2014-08-28 23:18:57 +0530 | [diff] [blame] | 9900 | bss = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 9901 | roamProfile.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9902 | |
| 9903 | if (NULL == bss) |
| 9904 | { |
| 9905 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 9906 | __func__); |
| 9907 | } |
| 9908 | |
| 9909 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 9910 | } |
| 9911 | else |
| 9912 | { |
| 9913 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 9914 | __func__); |
| 9915 | } |
| 9916 | return bss; |
| 9917 | } |
| 9918 | |
| 9919 | /* |
| 9920 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 9921 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9922 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 9923 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9924 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9925 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9926 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9927 | tCsrScanResultInfo *pScanResult; |
| 9928 | eHalStatus status = 0; |
| 9929 | tScanResultHandle pResult; |
| 9930 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9931 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9932 | |
| 9933 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9934 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9935 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9936 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 9937 | NO_SESSION, pAdapter->sessionId)); |
| 9938 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9939 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9940 | |
| 9941 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9942 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9943 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9944 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 9945 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9946 | } |
| 9947 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9948 | |
| 9949 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 9950 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9951 | { |
| 9952 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9953 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 9954 | return VOS_STATUS_E_PERM; |
| 9955 | } |
| 9956 | |
| 9957 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9958 | /* |
| 9959 | * start getting scan results and populate cgf80211 BSS database |
| 9960 | */ |
| 9961 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 9962 | |
| 9963 | /* no scan results */ |
| 9964 | if (NULL == pResult) |
| 9965 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9966 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 9967 | __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9968 | return status; |
| 9969 | } |
| 9970 | |
| 9971 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 9972 | |
| 9973 | while (pScanResult) |
| 9974 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9975 | /* |
| 9976 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 9977 | * entry already exists in bss data base of cfg80211 for that |
| 9978 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 9979 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 9980 | * mgmt packet as input. As of now there is no possibility to get |
| 9981 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9982 | * ieee80211_mgmt(probe response) and passing to c |
| 9983 | * fg80211_inform_bss_frame. |
| 9984 | * */ |
| 9985 | |
| 9986 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 9987 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9988 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9989 | |
| 9990 | if (NULL == bss_status) |
| 9991 | { |
| 9992 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9993 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9994 | } |
| 9995 | else |
| 9996 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 9997 | cfg80211_put_bss( |
| 9998 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 9999 | wiphy, |
| 10000 | #endif |
| 10001 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10002 | } |
| 10003 | |
| 10004 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 10005 | } |
| 10006 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10007 | sme_ScanResultPurge(hHal, pResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10008 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10009 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10010 | } |
| 10011 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10012 | void |
| 10013 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 10014 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10015 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 10016 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10017 | } /****** end hddPrintMacAddr() ******/ |
| 10018 | |
| 10019 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 10020 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10021 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10022 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10023 | "%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] | 10024 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 10025 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 10026 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10027 | } /****** end hddPrintPmkId() ******/ |
| 10028 | |
| 10029 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 10030 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 10031 | |
| 10032 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 10033 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 10034 | |
| 10035 | #define dump_bssid(bssid) \ |
| 10036 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10037 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 10038 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10039 | } |
| 10040 | |
| 10041 | #define dump_pmkid(pMac, pmkid) \ |
| 10042 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10043 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 10044 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10045 | } |
| 10046 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 10047 | #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] | 10048 | /* |
| 10049 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 10050 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 10051 | */ |
| 10052 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10053 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10054 | int index, bool preauth ) |
| 10055 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10056 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10057 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10058 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10059 | |
| 10060 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10061 | 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] | 10062 | |
| 10063 | if( NULL == pRoamInfo ) |
| 10064 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10065 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10066 | return -EINVAL; |
| 10067 | } |
| 10068 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10069 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 10070 | { |
| 10071 | dump_bssid(pRoamInfo->bssid); |
| 10072 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10073 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10074 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10075 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10076 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10077 | } |
| 10078 | #endif //FEATURE_WLAN_LFR |
| 10079 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 10080 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 10081 | /* |
| 10082 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 10083 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 10084 | * |
| 10085 | */ |
| 10086 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 10087 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 10088 | tCsrRoamInfo *pRoamInfo) |
| 10089 | { |
| 10090 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10091 | union iwreq_data wrqu; |
| 10092 | |
| 10093 | ENTER(); |
| 10094 | |
| 10095 | if (NULL == pAdapter) |
| 10096 | { |
| 10097 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10098 | return VOS_STATUS_E_FAILURE; |
| 10099 | } |
| 10100 | |
| 10101 | /* create the event */ |
| 10102 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10103 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10104 | |
| 10105 | wrqu.data.pointer = metrics_notification; |
| 10106 | wrqu.data.length = scnprintf(metrics_notification, |
| 10107 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 10108 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10109 | |
| 10110 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10111 | |
| 10112 | EXIT(); |
| 10113 | |
| 10114 | return VOS_STATUS_SUCCESS; |
| 10115 | } |
| 10116 | |
| 10117 | /* |
| 10118 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 10119 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 10120 | * or failure |
| 10121 | */ |
| 10122 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 10123 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 10124 | { |
| 10125 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10126 | union iwreq_data wrqu; |
| 10127 | |
| 10128 | ENTER(); |
| 10129 | |
| 10130 | if (NULL == pAdapter) |
| 10131 | { |
| 10132 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10133 | return VOS_STATUS_E_FAILURE; |
| 10134 | } |
| 10135 | |
| 10136 | /* create the event */ |
| 10137 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10138 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10139 | |
| 10140 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 10141 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 10142 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10143 | |
| 10144 | if (1 == preauth_status) |
| 10145 | strncat(metrics_notification, " TRUE", 5); |
| 10146 | else |
| 10147 | strncat(metrics_notification, " FALSE", 6); |
| 10148 | |
| 10149 | wrqu.data.pointer = metrics_notification; |
| 10150 | wrqu.data.length = strlen(metrics_notification); |
| 10151 | |
| 10152 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10153 | |
| 10154 | EXIT(); |
| 10155 | |
| 10156 | return VOS_STATUS_SUCCESS; |
| 10157 | } |
| 10158 | |
| 10159 | /* |
| 10160 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 10161 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 10162 | * |
| 10163 | */ |
| 10164 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 10165 | tCsrRoamInfo *pRoamInfo) |
| 10166 | { |
| 10167 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10168 | union iwreq_data wrqu; |
| 10169 | |
| 10170 | ENTER(); |
| 10171 | |
| 10172 | if (NULL == pAdapter) |
| 10173 | { |
| 10174 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10175 | return VOS_STATUS_E_FAILURE; |
| 10176 | } |
| 10177 | |
| 10178 | /* create the event */ |
| 10179 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10180 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10181 | |
| 10182 | wrqu.data.pointer = metrics_notification; |
| 10183 | wrqu.data.length = scnprintf(metrics_notification, |
| 10184 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 10185 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10186 | |
| 10187 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10188 | |
| 10189 | EXIT(); |
| 10190 | |
| 10191 | return VOS_STATUS_SUCCESS; |
| 10192 | } |
| 10193 | #endif |
| 10194 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10195 | /* |
| 10196 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 10197 | * scanning callback function, called after finishing scan |
| 10198 | * |
| 10199 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10200 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10201 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 10202 | { |
| 10203 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10204 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10205 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10206 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10207 | struct cfg80211_scan_request *req = NULL; |
| 10208 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10209 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10210 | long waitRet = 0; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10211 | tANI_U8 i; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10212 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10213 | |
| 10214 | ENTER(); |
| 10215 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10216 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Siddharth Bhal | 5c2e02d | 2015-05-05 17:35:29 +0530 | [diff] [blame] | 10217 | if (NULL == pHddCtx) { |
| 10218 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is Null")); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10219 | goto allow_suspend; |
| 10220 | } |
| 10221 | |
| 10222 | pScanInfo = &pHddCtx->scan_info; |
| 10223 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10224 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10225 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10226 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10227 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 10228 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10229 | pScanInfo->mScanPendingCounter = 0; |
| 10230 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10231 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10232 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10233 | &pScanInfo->scan_req_completion_event, |
| 10234 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10235 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10236 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10237 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10238 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 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 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 10243 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10244 | { |
| 10245 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10246 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10247 | } |
| 10248 | |
| 10249 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10250 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10251 | { |
| 10252 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10253 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10254 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10255 | (int) scanId); |
| 10256 | } |
| 10257 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10258 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10259 | pAdapter); |
| 10260 | |
| 10261 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10262 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10263 | |
| 10264 | |
| 10265 | /* If any client wait scan result through WEXT |
| 10266 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10267 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10268 | { |
| 10269 | /* The other scan request waiting for current scan finish |
| 10270 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10271 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10272 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10273 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10274 | } |
| 10275 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10276 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10277 | { |
| 10278 | struct net_device *dev = pAdapter->dev; |
| 10279 | union iwreq_data wrqu; |
| 10280 | int we_event; |
| 10281 | char *msg; |
| 10282 | |
| 10283 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 10284 | we_event = SIOCGIWSCAN; |
| 10285 | msg = NULL; |
| 10286 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 10287 | } |
| 10288 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10289 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10290 | |
| 10291 | /* Get the Scan Req */ |
| 10292 | req = pAdapter->request; |
| 10293 | |
| 10294 | if (!req) |
| 10295 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10296 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10297 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10298 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10299 | } |
| 10300 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10301 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10302 | /* Scan is no longer pending */ |
| 10303 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10304 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10305 | /* last_scan_timestamp is used to decide if new scan |
| 10306 | * is needed or not on station interface. If last station |
| 10307 | * scan time and new station scan time is less then |
| 10308 | * last_scan_timestamp ; driver will return cached scan. |
| 10309 | */ |
| 10310 | if (req->no_cck == FALSE && status == eCSR_SCAN_SUCCESS) // no_cck will be set during p2p find |
| 10311 | { |
| 10312 | pScanInfo->last_scan_timestamp = vos_timer_get_system_time(); |
| 10313 | |
| 10314 | if ( req->n_channels ) |
| 10315 | { |
| 10316 | for (i = 0; i < req->n_channels ; i++ ) |
| 10317 | { |
| 10318 | pHddCtx->scan_info.last_scan_channelList[i] = req->channels[i]->hw_value; |
| 10319 | } |
| 10320 | /* store no of channel scanned */ |
| 10321 | pHddCtx->scan_info.last_scan_numChannels= req->n_channels; |
| 10322 | } |
| 10323 | |
| 10324 | } |
| 10325 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 10326 | /* |
| 10327 | * cfg80211_scan_done informing NL80211 about completion |
| 10328 | * of scanning |
| 10329 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10330 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 10331 | { |
| 10332 | aborted = true; |
| 10333 | } |
| 10334 | cfg80211_scan_done(req, aborted); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 10335 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10336 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10337 | if (pHddCtx->spoofMacAddr.isEnabled || pHddCtx->spoofMacAddr.isReqDeferred) { |
| 10338 | /* Generate new random mac addr for next scan */ |
| 10339 | hddLog(VOS_TRACE_LEVEL_INFO, "scan completed - generate new spoof mac addr"); |
| 10340 | hdd_processSpoofMacAddrRequest(pHddCtx); |
| 10341 | } |
| 10342 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10343 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10344 | /* release the wake lock at the end of the scan*/ |
| 10345 | hdd_allow_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10346 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 10347 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 10348 | * immediatly after the driver gets connect request(i.e after scan) |
| 10349 | * from supplicant, this result in app's is suspending and not able |
| 10350 | * to process the connect request to AP */ |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 10351 | hdd_prevent_suspend_timeout(1000); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 10352 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 10353 | #ifdef FEATURE_WLAN_TDLS |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10354 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 10355 | #endif |
| 10356 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10357 | EXIT(); |
| 10358 | return 0; |
| 10359 | } |
| 10360 | |
| 10361 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10362 | * FUNCTION: hdd_isConnectionInProgress |
| 10363 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10364 | * |
| 10365 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10366 | v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10367 | { |
| 10368 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 10369 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 10370 | hdd_adapter_t *pAdapter = NULL; |
| 10371 | VOS_STATUS status = 0; |
| 10372 | v_U8_t staId = 0; |
| 10373 | v_U8_t *staMac = NULL; |
| 10374 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 10375 | if (TRUE == pHddCtx->btCoexModeSet) |
| 10376 | { |
| 10377 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10378 | FL("BTCoex Mode operation in progress")); |
| 10379 | return VOS_TRUE; |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 10380 | } |
| 10381 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10382 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 10383 | |
| 10384 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 10385 | { |
| 10386 | pAdapter = pAdapterNode->pAdapter; |
| 10387 | |
| 10388 | if( pAdapter ) |
| 10389 | { |
| 10390 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10391 | "%s: Adapter with device mode %s (%d) exists", |
| 10392 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10393 | pAdapter->device_mode); |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10394 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10395 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10396 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 10397 | (eConnectionState_Connecting == |
| 10398 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 10399 | { |
| 10400 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10401 | "%s: %p(%d) Connection is in progress", __func__, |
| 10402 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 10403 | return VOS_TRUE; |
| 10404 | } |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10405 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Padma, Santhosh Kumar | 3b9657d | 2015-02-04 19:37:32 +0530 | [diff] [blame] | 10406 | smeNeighborMiddleOfRoaming(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10407 | { |
| 10408 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10409 | "%s: %p(%d) Reassociation is in progress", __func__, |
| 10410 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 10411 | return VOS_TRUE; |
| 10412 | } |
| 10413 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10414 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10415 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10416 | { |
| 10417 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10418 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10419 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10420 | { |
| 10421 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 10422 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10423 | "%s: client " MAC_ADDRESS_STR |
| 10424 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 10425 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10426 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10427 | } |
| 10428 | } |
| 10429 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 10430 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 10431 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10432 | v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 10433 | ptSapContext pSapCtx = NULL; |
| 10434 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 10435 | if(pSapCtx == NULL){ |
| 10436 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10437 | FL("psapCtx is NULL")); |
| 10438 | return VOS_FALSE; |
| 10439 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10440 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 10441 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10442 | if ((pSapCtx->aStaInfo[staId].isUsed) && |
| 10443 | (WLANTL_STA_CONNECTED == pSapCtx->aStaInfo[staId].tlSTAState)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10444 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10445 | staMac = (v_U8_t *) &(pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10446 | |
| 10447 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10448 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 10449 | "middle of WPS/EAPOL exchange.", __func__, |
| 10450 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10451 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10452 | } |
| 10453 | } |
| 10454 | } |
| 10455 | } |
| 10456 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 10457 | pAdapterNode = pNext; |
| 10458 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10459 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10460 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10461 | |
| 10462 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10463 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10464 | * this scan respond to scan trigger and update cfg80211 scan database |
| 10465 | * later, scan dump command can be used to recieve scan results |
| 10466 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10467 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 10468 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10469 | struct net_device *dev, |
| 10470 | #endif |
| 10471 | struct cfg80211_scan_request *request) |
| 10472 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10473 | hdd_adapter_t *pAdapter = NULL; |
| 10474 | hdd_context_t *pHddCtx = NULL; |
| 10475 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10476 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10477 | tCsrScanRequest scanRequest; |
| 10478 | tANI_U8 *channelList = NULL, i; |
| 10479 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10480 | int status; |
| 10481 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10482 | v_U8_t* pP2pIe = NULL; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10483 | int ret = 0; |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 10484 | v_U8_t *pWpsIe=NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10485 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10486 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 10487 | struct net_device *dev = NULL; |
| 10488 | if (NULL == request) |
| 10489 | { |
| 10490 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10491 | "%s: scan req param null", __func__); |
| 10492 | return -EINVAL; |
| 10493 | } |
| 10494 | dev = request->wdev->netdev; |
| 10495 | #endif |
| 10496 | |
| 10497 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 10498 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 10499 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10500 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10501 | ENTER(); |
| 10502 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10503 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 10504 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10505 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10506 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10507 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10508 | if (0 != status) |
| 10509 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10510 | return status; |
| 10511 | } |
| 10512 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10513 | if (NULL == pwextBuf) |
| 10514 | { |
| 10515 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 10516 | __func__); |
| 10517 | return -EIO; |
| 10518 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10519 | cfg_param = pHddCtx->cfg_ini; |
| 10520 | pScanInfo = &pHddCtx->scan_info; |
| 10521 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10522 | #ifdef WLAN_BTAMP_FEATURE |
| 10523 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10524 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10525 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 10526 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10527 | "%s: No scanning when AMP is on", __func__); |
| 10528 | return -EOPNOTSUPP; |
| 10529 | } |
| 10530 | #endif |
| 10531 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10532 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10533 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10534 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10535 | "%s: Not scanning on device_mode = %s (%d)", |
| 10536 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10537 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10538 | return -EOPNOTSUPP; |
| 10539 | } |
| 10540 | |
| 10541 | if (TRUE == pScanInfo->mScanPending) |
| 10542 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10543 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 10544 | { |
| 10545 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 10546 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10547 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10548 | } |
| 10549 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10550 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10551 | //Channel and action frame is pending |
| 10552 | //Otherwise Cancel Remain On Channel and allow Scan |
| 10553 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10554 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10555 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10556 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10557 | return -EBUSY; |
| 10558 | } |
| 10559 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10560 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 10561 | { |
| 10562 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 10563 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10564 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10565 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10566 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 10567 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10568 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10569 | "%s: MAX TM Level Scan not allowed", __func__); |
| 10570 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10571 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10572 | } |
| 10573 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 10574 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10575 | /* Check if scan is allowed at this point of time. |
| 10576 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10577 | if (hdd_isConnectionInProgress(pHddCtx)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10578 | { |
| 10579 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 10580 | return -EBUSY; |
| 10581 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10582 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10583 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 10584 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10585 | hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d", |
| 10586 | (int)request->n_ssids); |
| 10587 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10588 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10589 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 10590 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 10591 | * is not aging out the scan results. |
| 10592 | */ |
| 10593 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10594 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10595 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10596 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10597 | |
| 10598 | if ((request->ssids) && (0 < request->n_ssids)) |
| 10599 | { |
| 10600 | tCsrSSIDInfo *SsidInfo; |
| 10601 | int j; |
| 10602 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 10603 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 10604 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 10605 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 10606 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 10607 | |
| 10608 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 10609 | { |
| 10610 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10611 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 10612 | return -ENOMEM; |
| 10613 | } |
| 10614 | |
| 10615 | /* copy all the ssid's and their length */ |
| 10616 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 10617 | { |
| 10618 | /* get the ssid length */ |
| 10619 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 10620 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 10621 | SsidInfo->SSID.length); |
| 10622 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 10623 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 10624 | j, SsidInfo->SSID.ssId); |
| 10625 | } |
| 10626 | /* set the scan type to active */ |
| 10627 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 10628 | } |
| 10629 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10630 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10631 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10632 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 10633 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10634 | /* set the scan type to active */ |
| 10635 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10636 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10637 | else |
| 10638 | { |
| 10639 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 10640 | scanRequest.scanType = pScanInfo->scan_mode; |
| 10641 | } |
| 10642 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 10643 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10644 | |
| 10645 | /* set BSSType to default type */ |
| 10646 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 10647 | |
| 10648 | /*TODO: scan the requested channels only*/ |
| 10649 | |
| 10650 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10651 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10652 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10653 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10654 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 10655 | request->n_channels = MAX_CHANNEL; |
| 10656 | } |
| 10657 | |
| 10658 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10659 | "No of Scan Channels: %d", request->n_channels); |
| 10660 | |
| 10661 | |
| 10662 | if( request->n_channels ) |
| 10663 | { |
| 10664 | char chList [(request->n_channels*5)+1]; |
| 10665 | int len; |
| 10666 | channelList = vos_mem_malloc( request->n_channels ); |
| 10667 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10668 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10669 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10670 | "%s: memory alloc failed channelList", __func__); |
| 10671 | status = -ENOMEM; |
| 10672 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10673 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10674 | |
| 10675 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 10676 | { |
| 10677 | channelList[i] = request->channels[i]->hw_value; |
| 10678 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 10679 | } |
| 10680 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10681 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10682 | "Channel-List: %s ", chList); |
| 10683 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10684 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10685 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 10686 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 10687 | |
| 10688 | /* set requestType to full scan */ |
| 10689 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 10690 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10691 | /* if there is back to back scan happening in driver with in |
| 10692 | * nDeferScanTimeInterval interval driver should defer new scan request |
| 10693 | * and should provide last cached scan results instead of new channel list. |
| 10694 | * This rule is not applicable if scan is p2p scan. |
| 10695 | * This condition will work only in case when last request no of channels |
| 10696 | * and channels are exactly same as new request. |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10697 | * This should be done only in connected state |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 10698 | * Scan shouldn't be defered for WPS scan case. |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10699 | */ |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10700 | |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 10701 | pWpsIe = wlan_hdd_get_wps_ie_ptr((v_U8_t*)request->ie,request->ie_len); |
| 10702 | /* if wps ie is NULL , then only defer scan */ |
| 10703 | if ( pWpsIe == NULL && |
| 10704 | (VOS_STATUS_SUCCESS == hdd_is_any_session_connected(pHddCtx))) |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10705 | { |
| 10706 | if ( pScanInfo->last_scan_timestamp !=0 && |
| 10707 | ((vos_timer_get_system_time() - pScanInfo->last_scan_timestamp ) < pHddCtx->cfg_ini->nDeferScanTimeInterval)) |
| 10708 | { |
| 10709 | if ( request->no_cck == FALSE && scanRequest.ChannelInfo.numOfChannels != 1 && |
| 10710 | (pScanInfo->last_scan_numChannels == scanRequest.ChannelInfo.numOfChannels) && |
| 10711 | vos_mem_compare(pScanInfo->last_scan_channelList, |
| 10712 | channelList, pScanInfo->last_scan_numChannels)) |
| 10713 | { |
| 10714 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10715 | " New and old station scan time differ is less then %u", |
| 10716 | pHddCtx->cfg_ini->nDeferScanTimeInterval); |
| 10717 | |
| 10718 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10719 | pAdapter); |
| 10720 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10721 | hddLog(VOS_TRACE_LEVEL_WARN, |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 10722 | "Return old cached scan as all channels and no of channels are same"); |
| 10723 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10724 | if (0 > ret) |
| 10725 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10726 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10727 | cfg80211_scan_done(request, eCSR_SCAN_SUCCESS); |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 10728 | |
| 10729 | status = eHAL_STATUS_SUCCESS; |
| 10730 | goto free_mem; |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10731 | } |
| 10732 | } |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10733 | } |
| 10734 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10735 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 10736 | * search (Flush on both full scan and social scan but not on single |
| 10737 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 10738 | */ |
| 10739 | |
| 10740 | /* Supplicant does single channel scan after 8-way handshake |
| 10741 | * and in that case driver shoudnt flush scan results. If |
| 10742 | * driver flushes the scan results here and unfortunately if |
| 10743 | * the AP doesnt respond to our probe req then association |
| 10744 | * fails which is not desired |
| 10745 | */ |
| 10746 | |
| 10747 | if( request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN ) |
| 10748 | { |
| 10749 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 10750 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10751 | pAdapter->sessionId ); |
| 10752 | } |
| 10753 | |
| 10754 | if( request->ie_len ) |
| 10755 | { |
| 10756 | /* save this for future association (join requires this) */ |
| 10757 | /*TODO: Array needs to be converted to dynamic allocation, |
| 10758 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 10759 | * CR 597966 |
| 10760 | */ |
| 10761 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 10762 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 10763 | pScanInfo->scanAddIE.length = request->ie_len; |
| 10764 | |
| 10765 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 10766 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10767 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10768 | { |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 10769 | if (request->ie_len <= SIR_MAC_MAX_ADD_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10770 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10771 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 10772 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 10773 | request->ie, request->ie_len); |
| 10774 | } |
| 10775 | else |
| 10776 | { |
| 10777 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 10778 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10779 | } |
| 10780 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10781 | } |
| 10782 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 10783 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 10784 | |
| 10785 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 10786 | request->ie_len); |
| 10787 | if (pP2pIe != NULL) |
| 10788 | { |
| 10789 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 10790 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 10791 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 10792 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10793 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10794 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 10795 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 10796 | "Go nego completed to Connection is started"); |
| 10797 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 10798 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10799 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10800 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 10801 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10802 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10803 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 10804 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 10805 | "Disconnected state to Connection is started"); |
| 10806 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 10807 | "for 4way Handshake"); |
| 10808 | } |
| 10809 | #endif |
| 10810 | |
| 10811 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 10812 | if(TRUE == request->no_cck) |
| 10813 | { |
| 10814 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10815 | "%s: This is a P2P Search", __func__); |
| 10816 | scanRequest.p2pSearch = 1; |
| 10817 | |
| 10818 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10819 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10820 | /* set requestType to P2P Discovery */ |
| 10821 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 10822 | } |
| 10823 | |
| 10824 | /* |
| 10825 | Skip Dfs Channel in case of P2P Search |
| 10826 | if it is set in ini file |
| 10827 | */ |
| 10828 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 10829 | { |
| 10830 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10831 | } |
| 10832 | else |
| 10833 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10834 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10835 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10836 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10837 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10838 | } |
| 10839 | } |
| 10840 | |
| 10841 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 10842 | |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10843 | #ifdef FEATURE_WLAN_TDLS |
| 10844 | /* if tdls disagree scan right now, return immediately. |
| 10845 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 10846 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 10847 | */ |
| 10848 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 10849 | wiphy, |
| 10850 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10851 | dev, |
| 10852 | #endif |
| 10853 | request); |
| 10854 | if(status <= 0) |
| 10855 | { |
| 10856 | if(!status) |
| 10857 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 10858 | "scan rejected %d", __func__, status); |
| 10859 | else |
| 10860 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 10861 | __func__, status); |
| 10862 | |
| 10863 | return status; |
| 10864 | } |
| 10865 | #endif |
| 10866 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10867 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 10868 | * address the following issues. |
| 10869 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 10870 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 10871 | * for long time, this result in apps running at full power for long time. |
| 10872 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 10873 | * be stuck in full power because of resume BMPS |
| 10874 | */ |
| 10875 | hdd_prevent_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10876 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10877 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 10878 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10879 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 10880 | scanRequest.requestType, scanRequest.scanType, |
| 10881 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10882 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 10883 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10884 | if (pHddCtx->spoofMacAddr.isEnabled) |
| 10885 | { |
| 10886 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10887 | "%s: MAC Spoofing enabled for current scan", __func__); |
| 10888 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 10889 | * to fill TxBds for probe request during current scan |
| 10890 | */ |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 10891 | status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10892 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 10893 | |
| 10894 | if(status != VOS_STATUS_SUCCESS) |
| 10895 | { |
| 10896 | hdd_allow_suspend(); |
| 10897 | status = -EFAULT; |
Ganesh Kondabattini | 6d3b490 | 2015-05-12 23:19:22 +0530 | [diff] [blame] | 10898 | #ifdef FEATURE_WLAN_TDLS |
| 10899 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 10900 | #endif |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 10901 | goto free_mem; |
| 10902 | } |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10903 | } |
| 10904 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10905 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10906 | pAdapter->sessionId, &scanRequest, &scanId, |
| 10907 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10908 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10909 | if (eHAL_STATUS_SUCCESS != status) |
| 10910 | { |
| 10911 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10912 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 10913 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 10914 | if(eHAL_STATUS_RESOURCES == status) |
| 10915 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10916 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 10917 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 10918 | status = -EBUSY; |
| 10919 | } else { |
| 10920 | status = -EIO; |
| 10921 | } |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10922 | hdd_allow_suspend(); |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10923 | |
| 10924 | #ifdef FEATURE_WLAN_TDLS |
| 10925 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 10926 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10927 | goto free_mem; |
| 10928 | } |
| 10929 | |
| 10930 | pScanInfo->mScanPending = TRUE; |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 10931 | pScanInfo->sessionId = pAdapter->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10932 | pAdapter->request = request; |
| 10933 | pScanInfo->scanId = scanId; |
| 10934 | |
| 10935 | complete(&pScanInfo->scan_req_completion_event); |
| 10936 | |
| 10937 | free_mem: |
| 10938 | if( scanRequest.SSIDs.SSIDList ) |
| 10939 | { |
| 10940 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 10941 | } |
| 10942 | |
| 10943 | if( channelList ) |
| 10944 | vos_mem_free( channelList ); |
| 10945 | |
| 10946 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10947 | return status; |
| 10948 | } |
| 10949 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10950 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 10951 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10952 | struct net_device *dev, |
| 10953 | #endif |
| 10954 | struct cfg80211_scan_request *request) |
| 10955 | { |
| 10956 | int ret; |
| 10957 | |
| 10958 | vos_ssr_protect(__func__); |
| 10959 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 10960 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10961 | dev, |
| 10962 | #endif |
| 10963 | request); |
| 10964 | vos_ssr_unprotect(__func__); |
| 10965 | |
| 10966 | return ret; |
| 10967 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10968 | |
| 10969 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 10970 | { |
| 10971 | v_U8_t iniDot11Mode = |
| 10972 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 10973 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 10974 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10975 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 10976 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10977 | switch ( iniDot11Mode ) |
| 10978 | { |
| 10979 | case eHDD_DOT11_MODE_AUTO: |
| 10980 | case eHDD_DOT11_MODE_11ac: |
| 10981 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 10982 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 4b1d235 | 2014-08-01 21:59:28 +0530 | [diff] [blame] | 10983 | if ( sme_IsFeatureSupportedByDriver(DOT11AC) && |
| 10984 | sme_IsFeatureSupportedByFW(DOT11AC) ) |
| 10985 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 10986 | else |
| 10987 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10988 | #else |
| 10989 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 10990 | #endif |
| 10991 | break; |
| 10992 | case eHDD_DOT11_MODE_11n: |
| 10993 | case eHDD_DOT11_MODE_11n_ONLY: |
| 10994 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 10995 | break; |
| 10996 | default: |
| 10997 | hddDot11Mode = iniDot11Mode; |
| 10998 | break; |
| 10999 | } |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 11000 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 11001 | if (operationChannel > SIR_11B_CHANNEL_END) |
| 11002 | #endif |
| 11003 | { |
| 11004 | /* This call decides required channel bonding mode */ |
| 11005 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11006 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 11007 | operationChannel); |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 11008 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11009 | } |
| 11010 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11011 | /* |
| 11012 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11013 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11014 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11015 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11016 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11017 | { |
| 11018 | int status = 0; |
| 11019 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11020 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11021 | v_U32_t roamId; |
| 11022 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11023 | eCsrAuthType RSNAuthType; |
| 11024 | |
| 11025 | ENTER(); |
| 11026 | |
| 11027 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11028 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11029 | |
| 11030 | status = wlan_hdd_validate_context(pHddCtx); |
| 11031 | if (status) |
| 11032 | { |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11033 | return status; |
| 11034 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11035 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11036 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 11037 | { |
| 11038 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 11039 | return -EINVAL; |
| 11040 | } |
| 11041 | |
| 11042 | pRoamProfile = &pWextState->roamProfile; |
| 11043 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11044 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11045 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11046 | hdd_station_ctx_t *pHddStaCtx; |
| 11047 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11048 | |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 11049 | wlan_hdd_get_frame_logs(pAdapter, WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR); |
| 11050 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11051 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11052 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 11053 | { |
| 11054 | /*QoS not enabled in cfg file*/ |
| 11055 | pRoamProfile->uapsd_mask = 0; |
| 11056 | } |
| 11057 | else |
| 11058 | { |
| 11059 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11060 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11061 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 11062 | } |
| 11063 | |
| 11064 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 11065 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 11066 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11067 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11068 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 11069 | ssid, ssid_len); |
| 11070 | |
| 11071 | if (bssid) |
| 11072 | { |
| 11073 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 11074 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 11075 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11076 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 11077 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11078 | case of join failure we should send valid BSSID to supplicant |
| 11079 | */ |
| 11080 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 11081 | WNI_CFG_BSSID_LEN); |
| 11082 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 11083 | else |
| 11084 | { |
| 11085 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 11086 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11087 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11088 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 11089 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11090 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 11091 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11092 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11093 | /*set gen ie*/ |
| 11094 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 11095 | /*set auth*/ |
| 11096 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 11097 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11098 | #ifdef FEATURE_WLAN_WAPI |
| 11099 | if (pAdapter->wapi_info.nWapiMode) |
| 11100 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11101 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11102 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 11103 | { |
| 11104 | case WAPI_AUTH_MODE_PSK: |
| 11105 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11106 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11107 | pAdapter->wapi_info.wapiAuthMode); |
| 11108 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 11109 | break; |
| 11110 | } |
| 11111 | case WAPI_AUTH_MODE_CERT: |
| 11112 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11113 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11114 | pAdapter->wapi_info.wapiAuthMode); |
| 11115 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 11116 | break; |
| 11117 | } |
| 11118 | } // End of switch |
| 11119 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 11120 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 11121 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11122 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11123 | pRoamProfile->AuthType.numEntries = 1; |
| 11124 | pRoamProfile->EncryptionType.numEntries = 1; |
| 11125 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 11126 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 11127 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 11128 | } |
| 11129 | } |
| 11130 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11131 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11132 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11133 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 11134 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 11135 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11136 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 11137 | sizeof (tSirGtkOffloadParams)); |
| 11138 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11139 | } |
| 11140 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11141 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 11142 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11143 | if( operatingChannel ) |
| 11144 | { |
| 11145 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 11146 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 11147 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11148 | else |
| 11149 | { |
| 11150 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 11151 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 11152 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11153 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 11154 | { |
| 11155 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 11156 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11157 | |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11158 | /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect() |
| 11159 | * 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] | 11160 | * 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] | 11161 | * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback() |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11162 | * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. |
| 11163 | */ |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 11164 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 11165 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 11166 | { |
| 11167 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11168 | "%s: Set HDD connState to eConnectionState_Connecting", |
| 11169 | __func__); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11170 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 11171 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 11172 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11173 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11174 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 11175 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 11176 | if ((eHAL_STATUS_SUCCESS != status) && |
| 11177 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 11178 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11179 | |
| 11180 | { |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11181 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with " |
| 11182 | "status %d. -> NotConnected", __func__, pAdapter->sessionId, status); |
| 11183 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11184 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11185 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11186 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11187 | |
| 11188 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 11189 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 11190 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11191 | } |
| 11192 | else |
| 11193 | { |
| 11194 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 11195 | return -EINVAL; |
| 11196 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 11197 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11198 | return status; |
| 11199 | } |
| 11200 | |
| 11201 | /* |
| 11202 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 11203 | * This function is used to set the authentication type (OPEN/SHARED). |
| 11204 | * |
| 11205 | */ |
| 11206 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 11207 | enum nl80211_auth_type auth_type) |
| 11208 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11209 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11210 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11211 | |
| 11212 | ENTER(); |
| 11213 | |
| 11214 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11215 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11216 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11217 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11218 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11219 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 11220 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 11221 | break; |
| 11222 | |
| 11223 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11224 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11225 | case NL80211_AUTHTYPE_FT: |
| 11226 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11227 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11228 | "%s: set authentication type to OPEN", __func__); |
| 11229 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 11230 | break; |
| 11231 | |
| 11232 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11233 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11234 | "%s: set authentication type to SHARED", __func__); |
| 11235 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 11236 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11237 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11238 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11239 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11240 | "%s: set authentication type to CCKM WPA", __func__); |
| 11241 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 11242 | break; |
| 11243 | #endif |
| 11244 | |
| 11245 | |
| 11246 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11247 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11248 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11249 | auth_type); |
| 11250 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 11251 | return -EINVAL; |
| 11252 | } |
| 11253 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11254 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11255 | pHddStaCtx->conn_info.authType; |
| 11256 | return 0; |
| 11257 | } |
| 11258 | |
| 11259 | /* |
| 11260 | * FUNCTION: wlan_hdd_set_akm_suite |
| 11261 | * This function is used to set the key mgmt type(PSK/8021x). |
| 11262 | * |
| 11263 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11264 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11265 | u32 key_mgmt |
| 11266 | ) |
| 11267 | { |
| 11268 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11269 | ENTER(); |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11270 | /* Should be in ieee802_11_defs.h */ |
| 11271 | #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05 |
| 11272 | #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11273 | /*set key mgmt type*/ |
| 11274 | switch(key_mgmt) |
| 11275 | { |
| 11276 | case WLAN_AKM_SUITE_PSK: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11277 | case WLAN_AKM_SUITE_PSK_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 11278 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11279 | case WLAN_AKM_SUITE_FT_PSK: |
| 11280 | #endif |
| 11281 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11282 | __func__); |
| 11283 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 11284 | break; |
| 11285 | |
| 11286 | case WLAN_AKM_SUITE_8021X: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11287 | case WLAN_AKM_SUITE_8021X_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 11288 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11289 | case WLAN_AKM_SUITE_FT_8021X: |
| 11290 | #endif |
| 11291 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11292 | __func__); |
| 11293 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 11294 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11295 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11296 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 11297 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 11298 | case WLAN_AKM_SUITE_CCKM: |
| 11299 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 11300 | __func__); |
| 11301 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 11302 | break; |
| 11303 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 11304 | #ifndef WLAN_AKM_SUITE_OSEN |
| 11305 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 11306 | case WLAN_AKM_SUITE_OSEN: |
| 11307 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 11308 | __func__); |
| 11309 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 11310 | break; |
| 11311 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11312 | |
| 11313 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11314 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11315 | __func__, key_mgmt); |
| 11316 | return -EINVAL; |
| 11317 | |
| 11318 | } |
| 11319 | return 0; |
| 11320 | } |
| 11321 | |
| 11322 | /* |
| 11323 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11324 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11325 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 11326 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11327 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 11328 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11329 | bool ucast |
| 11330 | ) |
| 11331 | { |
| 11332 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11333 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11334 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11335 | |
| 11336 | ENTER(); |
| 11337 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11338 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11339 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11340 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11341 | __func__, cipher); |
| 11342 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11343 | } |
| 11344 | else |
| 11345 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11346 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11347 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11348 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11349 | { |
| 11350 | case IW_AUTH_CIPHER_NONE: |
| 11351 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11352 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11353 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11354 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11355 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11356 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11357 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11358 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11359 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11360 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11361 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11362 | case WLAN_CIPHER_SUITE_TKIP: |
| 11363 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 11364 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11365 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11366 | case WLAN_CIPHER_SUITE_CCMP: |
| 11367 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 11368 | break; |
| 11369 | #ifdef FEATURE_WLAN_WAPI |
| 11370 | case WLAN_CIPHER_SUITE_SMS4: |
| 11371 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 11372 | break; |
| 11373 | #endif |
| 11374 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11375 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11376 | case WLAN_CIPHER_SUITE_KRK: |
| 11377 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 11378 | break; |
| 11379 | #endif |
| 11380 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11381 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11382 | __func__, cipher); |
| 11383 | return -EOPNOTSUPP; |
| 11384 | } |
| 11385 | } |
| 11386 | |
| 11387 | if (ucast) |
| 11388 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11389 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11390 | __func__, encryptionType); |
| 11391 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 11392 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11393 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11394 | encryptionType; |
| 11395 | } |
| 11396 | else |
| 11397 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11398 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11399 | __func__, encryptionType); |
| 11400 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 11401 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 11402 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 11403 | } |
| 11404 | |
| 11405 | return 0; |
| 11406 | } |
| 11407 | |
| 11408 | |
| 11409 | /* |
| 11410 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 11411 | * This function is used to parse WPA/RSN IE's. |
| 11412 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11413 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
| 11414 | u8 *ie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11415 | size_t ie_len |
| 11416 | ) |
| 11417 | { |
| 11418 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11419 | u8 *genie = ie; |
| 11420 | v_U16_t remLen = ie_len; |
| 11421 | #ifdef FEATURE_WLAN_WAPI |
| 11422 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 11423 | u16 *tmp; |
| 11424 | v_U16_t akmsuiteCount; |
| 11425 | int *akmlist; |
| 11426 | #endif |
| 11427 | ENTER(); |
| 11428 | |
| 11429 | /* clear previous assocAddIE */ |
| 11430 | pWextState->assocAddIE.length = 0; |
| 11431 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11432 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11433 | |
| 11434 | while (remLen >= 2) |
| 11435 | { |
| 11436 | v_U16_t eLen = 0; |
| 11437 | v_U8_t elementId; |
| 11438 | elementId = *genie++; |
| 11439 | eLen = *genie++; |
| 11440 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11441 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11442 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11443 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11444 | |
| 11445 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11446 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11447 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11448 | 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] | 11449 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11450 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11451 | "%s: Invalid WPA IE", __func__); |
| 11452 | return -EINVAL; |
| 11453 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11454 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11455 | { |
| 11456 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11457 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11458 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11459 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11460 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11461 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11462 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 11463 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11464 | VOS_ASSERT(0); |
| 11465 | return -ENOMEM; |
| 11466 | } |
| 11467 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 11468 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11469 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11470 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11471 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 11472 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11473 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11474 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11475 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 11476 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11477 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 11478 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 11479 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 11480 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 11481 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 11482 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11483 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 11484 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11485 | { |
| 11486 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11487 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11488 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11489 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11490 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11491 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11492 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11493 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11494 | VOS_ASSERT(0); |
| 11495 | return -ENOMEM; |
| 11496 | } |
| 11497 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 11498 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11499 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11500 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11501 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11502 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11503 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11504 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11505 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 11506 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11507 | /*Consider WFD IE, only for P2P Client */ |
| 11508 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 11509 | { |
| 11510 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11511 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11512 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11513 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11514 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11515 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11516 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11517 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11518 | VOS_ASSERT(0); |
| 11519 | return -ENOMEM; |
| 11520 | } |
| 11521 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 11522 | // WPS IE + P2P IE + WFD IE |
| 11523 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11524 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11525 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11526 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11527 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11528 | } |
| 11529 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11530 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11531 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11532 | HS20_OUI_TYPE_SIZE)) ) |
| 11533 | { |
| 11534 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11535 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11536 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11537 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11538 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11539 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11540 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11541 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11542 | VOS_ASSERT(0); |
| 11543 | return -ENOMEM; |
| 11544 | } |
| 11545 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11546 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11547 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11548 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11549 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11550 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11551 | /* Appending OSEN Information Element in Assiciation Request */ |
| 11552 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 11553 | OSEN_OUI_TYPE_SIZE)) ) |
| 11554 | { |
| 11555 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 11556 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 11557 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11558 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11559 | 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] | 11560 | { |
| 11561 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11562 | "Need bigger buffer space"); |
| 11563 | VOS_ASSERT(0); |
| 11564 | return -ENOMEM; |
| 11565 | } |
| 11566 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11567 | pWextState->assocAddIE.length += eLen + 2; |
| 11568 | |
| 11569 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 11570 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11571 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11572 | } |
| 11573 | |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 11574 | if (WLAN_HDD_IBSS == pAdapter->device_mode) { |
| 11575 | |
| 11576 | /* populating as ADDIE in beacon frames */ |
| 11577 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11578 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie - 2, eLen + 2, |
| 11579 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 11580 | { |
| 11581 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11582 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 11583 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 11584 | { |
| 11585 | hddLog(LOGE, |
| 11586 | "Coldn't pass " |
| 11587 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 11588 | } |
| 11589 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 11590 | else |
| 11591 | hddLog(LOGE, |
| 11592 | "Could not pass on " |
| 11593 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 11594 | |
| 11595 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 11596 | beaconIE's need to be populated in probe response frames */ |
| 11597 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 11598 | { |
| 11599 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 11600 | u8 probe_rsp_ie_len[3] = {0}; |
| 11601 | u8 counter = 0; |
| 11602 | |
| 11603 | /* Check Probe Resp Length if it is greater then 255 then |
| 11604 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 11605 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 11606 | not able Store More then 255 bytes into One Variable */ |
| 11607 | |
| 11608 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 11609 | { |
| 11610 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 11611 | { |
| 11612 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 11613 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 11614 | } |
| 11615 | else |
| 11616 | { |
| 11617 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 11618 | rem_probe_resp_ie_len = 0; |
| 11619 | } |
| 11620 | } |
| 11621 | |
| 11622 | rem_probe_resp_ie_len = 0; |
| 11623 | |
| 11624 | if (probe_rsp_ie_len[0] > 0) |
| 11625 | { |
| 11626 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11627 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 11628 | (tANI_U8*)(genie - 2), |
| 11629 | probe_rsp_ie_len[0], NULL, |
| 11630 | eANI_BOOLEAN_FALSE) |
| 11631 | == eHAL_STATUS_FAILURE) |
| 11632 | { |
| 11633 | hddLog(LOGE, |
| 11634 | "Could not pass" |
| 11635 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 11636 | } |
| 11637 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 11638 | } |
| 11639 | |
| 11640 | if (probe_rsp_ie_len[1] > 0) |
| 11641 | { |
| 11642 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11643 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 11644 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 11645 | probe_rsp_ie_len[1], NULL, |
| 11646 | eANI_BOOLEAN_FALSE) |
| 11647 | == eHAL_STATUS_FAILURE) |
| 11648 | { |
| 11649 | hddLog(LOGE, |
| 11650 | "Could not pass" |
| 11651 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 11652 | } |
| 11653 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 11654 | } |
| 11655 | |
| 11656 | if (probe_rsp_ie_len[2] > 0) |
| 11657 | { |
| 11658 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11659 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 11660 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 11661 | probe_rsp_ie_len[2], NULL, |
| 11662 | eANI_BOOLEAN_FALSE) |
| 11663 | == eHAL_STATUS_FAILURE) |
| 11664 | { |
| 11665 | hddLog(LOGE, |
| 11666 | "Could not pass" |
| 11667 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 11668 | } |
| 11669 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 11670 | } |
| 11671 | |
| 11672 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11673 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 11674 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 11675 | { |
| 11676 | hddLog(LOGE, |
| 11677 | "Could not pass" |
| 11678 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 11679 | } |
| 11680 | } |
| 11681 | else |
| 11682 | { |
| 11683 | // Reset WNI_CFG_PROBE_RSP Flags |
| 11684 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 11685 | |
| 11686 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11687 | "%s: No Probe Response IE received in set beacon", |
| 11688 | __func__); |
| 11689 | } |
| 11690 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11691 | break; |
| 11692 | case DOT11F_EID_RSN: |
| 11693 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 11694 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 11695 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 11696 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 11697 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 11698 | break; |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 11699 | |
| 11700 | /* Appending Extended Capabilities with Interworking bit set |
| 11701 | * in Assoc Req. |
| 11702 | * |
| 11703 | * In assoc req this EXT Cap will only be taken into account if |
| 11704 | * interworkingService bit is set to 1. Currently |
| 11705 | * driver is only interested in interworkingService capability |
| 11706 | * from supplicant. If in future any other EXT Cap info is |
| 11707 | * required from supplicat, it needs to be handled while |
| 11708 | * sending Assoc Req in LIM. |
| 11709 | */ |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11710 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11711 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11712 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11713 | 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] | 11714 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11715 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11716 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11717 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11718 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11719 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11720 | VOS_ASSERT(0); |
| 11721 | return -ENOMEM; |
| 11722 | } |
| 11723 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11724 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11725 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11726 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11727 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11728 | break; |
| 11729 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11730 | #ifdef FEATURE_WLAN_WAPI |
| 11731 | case WLAN_EID_WAPI: |
| 11732 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 11733 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11734 | pAdapter->wapi_info.nWapiMode); |
| 11735 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11736 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11737 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 11738 | tmp = tmp + 1; |
| 11739 | akmlist = (int *)(tmp); |
| 11740 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 11741 | { |
| 11742 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 11743 | } |
| 11744 | else |
| 11745 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11746 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11747 | VOS_ASSERT(0); |
| 11748 | return -EINVAL; |
| 11749 | } |
| 11750 | |
| 11751 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 11752 | { |
| 11753 | 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] | 11754 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11755 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11756 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11757 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11758 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11759 | 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] | 11760 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11761 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 11762 | } |
| 11763 | break; |
| 11764 | #endif |
| 11765 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11766 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11767 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11768 | /* when Unknown IE is received we should break and continue |
| 11769 | * to the next IE in the buffer instead we were returning |
| 11770 | * so changing this to break */ |
| 11771 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11772 | } |
| 11773 | genie += eLen; |
| 11774 | remLen -= eLen; |
| 11775 | } |
| 11776 | EXIT(); |
| 11777 | return 0; |
| 11778 | } |
| 11779 | |
| 11780 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 11781 | * FUNCTION: hdd_isWPAIEPresent |
| 11782 | * Parse the received IE to find the WPA IE |
| 11783 | * |
| 11784 | */ |
| 11785 | static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len) |
| 11786 | { |
| 11787 | v_U8_t eLen = 0; |
| 11788 | v_U16_t remLen = ie_len; |
| 11789 | v_U8_t elementId = 0; |
| 11790 | |
| 11791 | while (remLen >= 2) |
| 11792 | { |
| 11793 | elementId = *ie++; |
| 11794 | eLen = *ie++; |
| 11795 | remLen -= 2; |
| 11796 | if (eLen > remLen) |
| 11797 | { |
| 11798 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11799 | "%s: IE length is wrong %d", __func__, eLen); |
| 11800 | return FALSE; |
| 11801 | } |
| 11802 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 11803 | { |
| 11804 | /* OUI - 0x00 0X50 0XF2 |
| 11805 | WPA Information Element - 0x01 |
| 11806 | WPA version - 0x01*/ |
| 11807 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 11808 | return TRUE; |
| 11809 | } |
| 11810 | ie += eLen; |
| 11811 | remLen -= eLen; |
| 11812 | } |
| 11813 | return FALSE; |
| 11814 | } |
| 11815 | |
| 11816 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11817 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11818 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11819 | * parameters during connect operation. |
| 11820 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11821 | int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11822 | struct cfg80211_connect_params *req |
| 11823 | ) |
| 11824 | { |
| 11825 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11826 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11827 | ENTER(); |
| 11828 | |
| 11829 | /*set wpa version*/ |
| 11830 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 11831 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11832 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11833 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 11834 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11835 | { |
| 11836 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 11837 | } |
| 11838 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 11839 | { |
| 11840 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 11841 | } |
| 11842 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11843 | |
| 11844 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11845 | pWextState->wpaVersion); |
| 11846 | |
| 11847 | /*set authentication type*/ |
| 11848 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 11849 | |
| 11850 | if (0 > status) |
| 11851 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11852 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11853 | "%s: failed to set authentication type ", __func__); |
| 11854 | return status; |
| 11855 | } |
| 11856 | |
| 11857 | /*set key mgmt type*/ |
| 11858 | if (req->crypto.n_akm_suites) |
| 11859 | { |
| 11860 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 11861 | if (0 > status) |
| 11862 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11863 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11864 | __func__); |
| 11865 | return status; |
| 11866 | } |
| 11867 | } |
| 11868 | |
| 11869 | /*set pairwise cipher type*/ |
| 11870 | if (req->crypto.n_ciphers_pairwise) |
| 11871 | { |
| 11872 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 11873 | req->crypto.ciphers_pairwise[0], true); |
| 11874 | if (0 > status) |
| 11875 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11876 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11877 | "%s: failed to set unicast cipher type", __func__); |
| 11878 | return status; |
| 11879 | } |
| 11880 | } |
| 11881 | else |
| 11882 | { |
| 11883 | /*Reset previous cipher suite to none*/ |
| 11884 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 11885 | if (0 > status) |
| 11886 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11887 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11888 | "%s: failed to set unicast cipher type", __func__); |
| 11889 | return status; |
| 11890 | } |
| 11891 | } |
| 11892 | |
| 11893 | /*set group cipher type*/ |
| 11894 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 11895 | false); |
| 11896 | |
| 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 set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11900 | __func__); |
| 11901 | return status; |
| 11902 | } |
| 11903 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11904 | #ifdef WLAN_FEATURE_11W |
| 11905 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 11906 | #endif |
| 11907 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11908 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 11909 | if (req->ie_len) |
| 11910 | { |
| 11911 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 11912 | if ( 0 > status) |
| 11913 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11914 | 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] | 11915 | __func__); |
| 11916 | return status; |
| 11917 | } |
| 11918 | } |
| 11919 | |
| 11920 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11921 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11922 | { |
| 11923 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 11924 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 11925 | ) |
| 11926 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11927 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11928 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 11929 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11930 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11931 | __func__); |
| 11932 | return -EOPNOTSUPP; |
| 11933 | } |
| 11934 | else |
| 11935 | { |
| 11936 | u8 key_len = req->key_len; |
| 11937 | u8 key_idx = req->key_idx; |
| 11938 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11939 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11940 | && (CSR_MAX_NUM_KEY > key_idx) |
| 11941 | ) |
| 11942 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11943 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11944 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11945 | __func__, key_idx, key_len); |
| 11946 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11947 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11948 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11949 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11950 | (u8)key_len; |
| 11951 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 11952 | } |
| 11953 | } |
| 11954 | } |
| 11955 | } |
| 11956 | |
| 11957 | return status; |
| 11958 | } |
| 11959 | |
| 11960 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 11961 | * FUNCTION: wlan_hdd_try_disconnect |
| 11962 | * This function is used to disconnect from previous |
| 11963 | * connection |
| 11964 | */ |
| 11965 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 11966 | { |
| 11967 | long ret = 0; |
| 11968 | hdd_station_ctx_t *pHddStaCtx; |
| 11969 | eMib_dot11DesiredBssType connectedBssType; |
| 11970 | |
| 11971 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11972 | |
| 11973 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 11974 | |
| 11975 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 11976 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 11977 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 11978 | { |
| 11979 | /* Issue disconnect to CSR */ |
| 11980 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 11981 | if( eHAL_STATUS_SUCCESS == |
| 11982 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11983 | pAdapter->sessionId, |
| 11984 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 11985 | { |
| 11986 | ret = wait_for_completion_interruptible_timeout( |
| 11987 | &pAdapter->disconnect_comp_var, |
| 11988 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 11989 | if (0 >= ret) |
| 11990 | { |
| 11991 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 11992 | return -EALREADY; |
| 11993 | } |
| 11994 | } |
| 11995 | } |
| 11996 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 11997 | { |
| 11998 | ret = wait_for_completion_interruptible_timeout( |
| 11999 | &pAdapter->disconnect_comp_var, |
| 12000 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 12001 | if (0 >= ret) |
| 12002 | { |
| 12003 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 12004 | return -EALREADY; |
| 12005 | } |
| 12006 | } |
| 12007 | |
| 12008 | return 0; |
| 12009 | } |
| 12010 | |
| 12011 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12012 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 12013 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12014 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12015 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12016 | struct net_device *ndev, |
| 12017 | struct cfg80211_connect_params *req |
| 12018 | ) |
| 12019 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12020 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12021 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12022 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 12023 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12024 | |
| 12025 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12026 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12027 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12028 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 12029 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12030 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12031 | "%s: device_mode = %s (%d)", __func__, |
| 12032 | hdd_device_modetoString(pAdapter->device_mode), |
| 12033 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12034 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12035 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 12036 | if (!pHddCtx) |
| 12037 | { |
| 12038 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12039 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12040 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 12041 | } |
| 12042 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12043 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12044 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12045 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12046 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12047 | } |
| 12048 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12049 | if (vos_max_concurrent_connections_reached()) { |
| 12050 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 12051 | return -ECONNREFUSED; |
| 12052 | } |
| 12053 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12054 | #ifdef WLAN_BTAMP_FEATURE |
| 12055 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12056 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12057 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12058 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12059 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 12060 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12061 | } |
| 12062 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12063 | |
| 12064 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 12065 | //P2P Mode will be taken care in Open/close adapter |
| 12066 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12067 | (vos_concurrent_open_sessions_running())) { |
| 12068 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 12069 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12070 | } |
| 12071 | |
| 12072 | /*Try disconnecting if already in connected state*/ |
| 12073 | status = wlan_hdd_try_disconnect(pAdapter); |
| 12074 | if ( 0 > status) |
| 12075 | { |
| 12076 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 12077 | " connection")); |
| 12078 | return -EALREADY; |
| 12079 | } |
| 12080 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12081 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12082 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12083 | |
| 12084 | if ( 0 > status) |
| 12085 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12086 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12087 | __func__); |
| 12088 | return status; |
| 12089 | } |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 12090 | if ( req->channel ) |
| 12091 | { |
| 12092 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 12093 | req->ssid_len, req->bssid, |
| 12094 | req->channel->hw_value); |
| 12095 | } |
| 12096 | else |
| 12097 | { |
| 12098 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12099 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 12100 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12101 | |
Sushant Kaushik | d708398 | 2015-03-18 14:33:24 +0530 | [diff] [blame] | 12102 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12103 | { |
| 12104 | //ReEnable BMPS if disabled |
| 12105 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 12106 | (NULL != pHddCtx)) |
| 12107 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 12108 | if (pHddCtx->hdd_wlan_suspended) |
| 12109 | { |
| 12110 | hdd_set_pwrparams(pHddCtx); |
| 12111 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12112 | //ReEnable Bmps and Imps back |
| 12113 | hdd_enable_bmps_imps(pHddCtx); |
| 12114 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12115 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12116 | return status; |
| 12117 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12118 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12119 | EXIT(); |
| 12120 | return status; |
| 12121 | } |
| 12122 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12123 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 12124 | struct net_device *ndev, |
| 12125 | struct cfg80211_connect_params *req) |
| 12126 | { |
| 12127 | int ret; |
| 12128 | vos_ssr_protect(__func__); |
| 12129 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 12130 | vos_ssr_unprotect(__func__); |
| 12131 | |
| 12132 | return ret; |
| 12133 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12134 | |
| 12135 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12136 | * FUNCTION: wlan_hdd_disconnect |
| 12137 | * This function is used to issue a disconnect request to SME |
| 12138 | */ |
| 12139 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 12140 | { |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12141 | int status, result = 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12142 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12143 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12144 | long ret; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12145 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12146 | ENTER(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12147 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12148 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12149 | if (0 != status) |
| 12150 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12151 | return status; |
| 12152 | } |
| 12153 | |
| 12154 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12155 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12156 | /* Need to apply spin lock before decreasing active sessions |
| 12157 | * as there can be chance for double decrement if context switch |
| 12158 | * Calls hdd_DisConnectHandler. |
| 12159 | */ |
| 12160 | |
| 12161 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12162 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 12163 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12164 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 12165 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12166 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 12167 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12168 | |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 12169 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12170 | FL( "Set HDD connState to eConnectionState_Disconnecting" )); |
| 12171 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12172 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12173 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12174 | /* |
| 12175 | * stop tx queues before deleting STA/BSS context from the firmware. |
| 12176 | * tx has to be disabled because the firmware can get busy dropping |
| 12177 | * the tx frames after BSS/STA has been deleted and will not send |
| 12178 | * back a response resulting in WDI timeout |
| 12179 | */ |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 12180 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12181 | netif_tx_disable(pAdapter->dev); |
| 12182 | netif_carrier_off(pAdapter->dev); |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 12183 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12184 | /*issue disconnect*/ |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12185 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12186 | pAdapter->sessionId, reason); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12187 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
| 12188 | { |
| 12189 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12190 | FL("status = %d, already disconnected"), |
| 12191 | (int)status ); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12192 | |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12193 | } |
| 12194 | else if ( 0 != status ) |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12195 | { |
| 12196 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12197 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12198 | __func__, (int)status ); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12199 | result = -EINVAL; |
| 12200 | goto disconnected; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12201 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12202 | ret = wait_for_completion_interruptible_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12203 | &pAdapter->disconnect_comp_var, |
| 12204 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12205 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status )) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12206 | { |
| 12207 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12208 | "%s: Failed to disconnect, timed out", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12209 | result = -ETIMEDOUT; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12210 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12211 | else if (ret == -ERESTARTSYS) |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12212 | { |
| 12213 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12214 | "%s: Failed to disconnect, wait interrupted", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12215 | result = -ERESTARTSYS; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12216 | } |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12217 | disconnected: |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12218 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12219 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 12220 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 12221 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12222 | EXIT(); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12223 | return result; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12224 | } |
| 12225 | |
| 12226 | |
| 12227 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12228 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12229 | * This function is used to issue a disconnect request to SME |
| 12230 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12231 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12232 | struct net_device *dev, |
| 12233 | u16 reason |
| 12234 | ) |
| 12235 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12236 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12237 | int status; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12238 | tCsrRoamProfile *pRoamProfile; |
| 12239 | hdd_station_ctx_t *pHddStaCtx; |
| 12240 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12241 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12242 | tANI_U8 staIdx; |
| 12243 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12244 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12245 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12246 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12247 | if (!pAdapter) { |
| 12248 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 12249 | return -EINVAL; |
| 12250 | } |
| 12251 | |
| 12252 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12253 | if (!pHddStaCtx) { |
| 12254 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD STA context is NULL")); |
| 12255 | return -EINVAL; |
| 12256 | } |
| 12257 | |
| 12258 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12259 | status = wlan_hdd_validate_context(pHddCtx); |
| 12260 | if (0 != status) |
| 12261 | { |
| 12262 | return status; |
| 12263 | } |
| 12264 | |
| 12265 | pRoamProfile = &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
| 12266 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12267 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12268 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 12269 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12270 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 12271 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12272 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12273 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12274 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 12275 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12276 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12277 | if (NULL != pRoamProfile) |
| 12278 | { |
| 12279 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 12280 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 12281 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12282 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12283 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12284 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12285 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12286 | switch(reason) |
| 12287 | { |
| 12288 | case WLAN_REASON_MIC_FAILURE: |
| 12289 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 12290 | break; |
| 12291 | |
| 12292 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 12293 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 12294 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 12295 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 12296 | break; |
| 12297 | |
| 12298 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 12299 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 12300 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12301 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 12302 | break; |
| 12303 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12304 | default: |
| 12305 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 12306 | break; |
| 12307 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12308 | pScanInfo = &pHddCtx->scan_info; |
| 12309 | if (pScanInfo->mScanPending) |
| 12310 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 12311 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12312 | "Aborting Scan"); |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 12313 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 12314 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12315 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12316 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12317 | #ifdef FEATURE_WLAN_TDLS |
| 12318 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12319 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12320 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12321 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 12322 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12323 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12324 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12325 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12326 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12327 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12328 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12329 | MAC_ADDR_ARRAY(mac)); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 12330 | status = sme_DeleteTdlsPeerSta( |
| 12331 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12332 | pAdapter->sessionId, |
| 12333 | mac); |
| 12334 | if (status != eHAL_STATUS_SUCCESS) { |
| 12335 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 12336 | return -EPERM; |
| 12337 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12338 | } |
| 12339 | } |
| 12340 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 12341 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12342 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 12343 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12344 | { |
| 12345 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12346 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12347 | __func__, (int)status ); |
| 12348 | return -EINVAL; |
| 12349 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12350 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 12351 | else |
| 12352 | { |
| 12353 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 12354 | "called while in %d state", __func__, |
| 12355 | pHddStaCtx->conn_info.connState); |
| 12356 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12357 | } |
| 12358 | else |
| 12359 | { |
| 12360 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 12361 | } |
| 12362 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12363 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12364 | return status; |
| 12365 | } |
| 12366 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12367 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 12368 | struct net_device *dev, |
| 12369 | u16 reason |
| 12370 | ) |
| 12371 | { |
| 12372 | int ret; |
| 12373 | vos_ssr_protect(__func__); |
| 12374 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 12375 | vos_ssr_unprotect(__func__); |
| 12376 | |
| 12377 | return ret; |
| 12378 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12379 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12380 | /* |
| 12381 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12382 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12383 | * settings in IBSS mode. |
| 12384 | */ |
| 12385 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12386 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12387 | struct cfg80211_ibss_params *params |
| 12388 | ) |
| 12389 | { |
| 12390 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12391 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12392 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 12393 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12394 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12395 | ENTER(); |
| 12396 | |
| 12397 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 12398 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12399 | |
| 12400 | if (params->ie_len && ( NULL != params->ie) ) |
| 12401 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12402 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 12403 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12404 | { |
| 12405 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 12406 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 12407 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12408 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12409 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12410 | tDot11fIEWPA dot11WPAIE; |
| 12411 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12412 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12413 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 12414 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12415 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 12416 | params->ie_len, DOT11F_EID_WPA); |
| 12417 | if ( NULL != ie ) |
| 12418 | { |
| 12419 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 12420 | // Unpack the WPA IE |
| 12421 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 12422 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 12423 | &ie[2+4], |
| 12424 | ie[1] - 4, |
| 12425 | &dot11WPAIE); |
| 12426 | /*Extract the multicast cipher, the encType for unicast |
| 12427 | cipher for wpa-none is none*/ |
| 12428 | encryptionType = |
| 12429 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 12430 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12431 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12432 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12433 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 12434 | |
| 12435 | if (0 > status) |
| 12436 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12437 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12438 | __func__); |
| 12439 | return status; |
| 12440 | } |
| 12441 | } |
| 12442 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12443 | pWextState->roamProfile.AuthType.authType[0] = |
| 12444 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12445 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 12446 | |
| 12447 | if (params->privacy) |
| 12448 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12449 | /* Security enabled IBSS, At this time there is no information available |
| 12450 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12451 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12452 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12453 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12454 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12455 | *enable privacy bit in beacons */ |
| 12456 | |
| 12457 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 12458 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12459 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 12460 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12461 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 12462 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 12463 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12464 | return status; |
| 12465 | } |
| 12466 | |
| 12467 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12468 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12469 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12470 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12471 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12472 | struct net_device *dev, |
| 12473 | struct cfg80211_ibss_params *params |
| 12474 | ) |
| 12475 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12476 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12477 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12478 | tCsrRoamProfile *pRoamProfile; |
| 12479 | int status; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12480 | bool alloc_bssid = VOS_FALSE; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12481 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12482 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12483 | |
| 12484 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12485 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12486 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12487 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 12488 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12489 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12490 | "%s: device_mode = %s (%d)", __func__, |
| 12491 | hdd_device_modetoString(pAdapter->device_mode), |
| 12492 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12493 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12494 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12495 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12496 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12497 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12498 | } |
| 12499 | |
| 12500 | if (NULL == pWextState) |
| 12501 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12502 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12503 | __func__); |
| 12504 | return -EIO; |
| 12505 | } |
| 12506 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12507 | if (vos_max_concurrent_connections_reached()) { |
| 12508 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 12509 | return -ECONNREFUSED; |
| 12510 | } |
| 12511 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12512 | /*Try disconnecting if already in connected state*/ |
| 12513 | status = wlan_hdd_try_disconnect(pAdapter); |
| 12514 | if ( 0 > status) |
| 12515 | { |
| 12516 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 12517 | " IBSS connection")); |
| 12518 | return -EALREADY; |
| 12519 | } |
| 12520 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12521 | pRoamProfile = &pWextState->roamProfile; |
| 12522 | |
| 12523 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 12524 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12525 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12526 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12527 | return -EINVAL; |
| 12528 | } |
| 12529 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12530 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 12531 | if (NULL != params->bssid) { |
| 12532 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 12533 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 12534 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12535 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 12536 | return -EIO; |
| 12537 | } |
| 12538 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12539 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 12540 | { |
| 12541 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 12542 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 12543 | { |
| 12544 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12545 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 12546 | return -EIO; |
| 12547 | } |
Sachin Ahuja | 46ff491 | 2015-03-23 22:48:43 +0530 | [diff] [blame] | 12548 | params->bssid = vos_mem_malloc(VOS_MAC_ADDR_SIZE); |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12549 | if (!params->bssid) |
| 12550 | { |
| 12551 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12552 | "%s:Failed memory allocation", __func__); |
| 12553 | return -EIO; |
| 12554 | } |
| 12555 | vos_mem_copy((v_U8_t *)params->bssid, |
| 12556 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
| 12557 | VOS_MAC_ADDR_SIZE); |
| 12558 | alloc_bssid = VOS_TRUE; |
| 12559 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12560 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12561 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12562 | if (NULL != |
| 12563 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 12564 | params->chandef.chan) |
| 12565 | #else |
| 12566 | params->channel) |
| 12567 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12568 | { |
| 12569 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12570 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 12571 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 12572 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12573 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12574 | |
| 12575 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12576 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12577 | ieee80211_frequency_to_channel( |
| 12578 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 12579 | params->chandef.chan->center_freq); |
| 12580 | #else |
| 12581 | params->channel->center_freq); |
| 12582 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12583 | |
| 12584 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 12585 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12586 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12587 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 12588 | __func__); |
| 12589 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12590 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12591 | |
| 12592 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12593 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12594 | if (channelNum == validChan[indx]) |
| 12595 | { |
| 12596 | break; |
| 12597 | } |
| 12598 | } |
| 12599 | if (indx >= numChans) |
| 12600 | { |
| 12601 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12602 | __func__, channelNum); |
| 12603 | return -EINVAL; |
| 12604 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12605 | /* Set the Operational Channel */ |
| 12606 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 12607 | channelNum); |
| 12608 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 12609 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 12610 | pRoamProfile->ChannelInfo.ChannelList = |
| 12611 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12612 | } |
| 12613 | |
| 12614 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12615 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12616 | if (status < 0) |
| 12617 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12618 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12619 | __func__); |
| 12620 | return status; |
| 12621 | } |
| 12622 | |
| 12623 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12624 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12625 | params->ssid_len, params->bssid, |
| 12626 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12627 | |
| 12628 | if (0 > status) |
| 12629 | { |
| 12630 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 12631 | return status; |
| 12632 | } |
| 12633 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12634 | if (NULL != params->bssid && |
| 12635 | pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0 && |
| 12636 | alloc_bssid == VOS_TRUE) |
| 12637 | { |
| 12638 | vos_mem_free(params->bssid); |
| 12639 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12640 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12641 | return 0; |
| 12642 | } |
| 12643 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12644 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 12645 | struct net_device *dev, |
| 12646 | struct cfg80211_ibss_params *params |
| 12647 | ) |
| 12648 | { |
| 12649 | int ret = 0; |
| 12650 | |
| 12651 | vos_ssr_protect(__func__); |
| 12652 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 12653 | vos_ssr_unprotect(__func__); |
| 12654 | |
| 12655 | return ret; |
| 12656 | } |
| 12657 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12658 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12659 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12660 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12661 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12662 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12663 | struct net_device *dev |
| 12664 | ) |
| 12665 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12666 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12667 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12668 | tCsrRoamProfile *pRoamProfile; |
| 12669 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12670 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12671 | |
| 12672 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12673 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12674 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12675 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 12676 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12677 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12678 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12679 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12680 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12681 | } |
| 12682 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12683 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 12684 | hdd_device_modetoString(pAdapter->device_mode), |
| 12685 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12686 | if (NULL == pWextState) |
| 12687 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12688 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12689 | __func__); |
| 12690 | return -EIO; |
| 12691 | } |
| 12692 | |
| 12693 | pRoamProfile = &pWextState->roamProfile; |
| 12694 | |
| 12695 | /* Issue disconnect only if interface type is set to IBSS */ |
| 12696 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 12697 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12698 | 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] | 12699 | __func__); |
| 12700 | return -EINVAL; |
| 12701 | } |
| 12702 | |
| 12703 | /* Issue Disconnect request */ |
| 12704 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 12705 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 12706 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 12707 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12708 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12709 | return 0; |
| 12710 | } |
| 12711 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12712 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 12713 | struct net_device *dev |
| 12714 | ) |
| 12715 | { |
| 12716 | int ret = 0; |
| 12717 | |
| 12718 | vos_ssr_protect(__func__); |
| 12719 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 12720 | vos_ssr_unprotect(__func__); |
| 12721 | |
| 12722 | return ret; |
| 12723 | } |
| 12724 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12725 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12726 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12727 | * This function is used to set the phy parameters |
| 12728 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 12729 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12730 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12731 | u32 changed) |
| 12732 | { |
| 12733 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 12734 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12735 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12736 | |
| 12737 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12738 | |
| 12739 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12740 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 12741 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12742 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12743 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12744 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12745 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12746 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12747 | } |
| 12748 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12749 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 12750 | { |
| 12751 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 12752 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 12753 | wiphy->rts_threshold; |
| 12754 | |
| 12755 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12756 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12757 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12758 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12759 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12760 | __func__, rts_threshold); |
| 12761 | return -EINVAL; |
| 12762 | } |
| 12763 | |
| 12764 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 12765 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12766 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12767 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12768 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12769 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12770 | __func__, rts_threshold); |
| 12771 | return -EIO; |
| 12772 | } |
| 12773 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12774 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12775 | rts_threshold); |
| 12776 | } |
| 12777 | |
| 12778 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 12779 | { |
| 12780 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 12781 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 12782 | wiphy->frag_threshold; |
| 12783 | |
| 12784 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12785 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12786 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12787 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12788 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12789 | frag_threshold); |
| 12790 | return -EINVAL; |
| 12791 | } |
| 12792 | |
| 12793 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 12794 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12795 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12796 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12797 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12798 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12799 | __func__, frag_threshold); |
| 12800 | return -EIO; |
| 12801 | } |
| 12802 | |
| 12803 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 12804 | frag_threshold); |
| 12805 | } |
| 12806 | |
| 12807 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 12808 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 12809 | { |
| 12810 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 12811 | wiphy->retry_short : |
| 12812 | wiphy->retry_long; |
| 12813 | |
| 12814 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 12815 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 12816 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12817 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12818 | __func__, retry_value); |
| 12819 | return -EINVAL; |
| 12820 | } |
| 12821 | |
| 12822 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 12823 | { |
| 12824 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 12825 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12826 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12827 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12828 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12829 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12830 | __func__, retry_value); |
| 12831 | return -EIO; |
| 12832 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12833 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12834 | __func__, retry_value); |
| 12835 | } |
| 12836 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 12837 | { |
| 12838 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 12839 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12840 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12841 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12842 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12843 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12844 | __func__, retry_value); |
| 12845 | return -EIO; |
| 12846 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12847 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12848 | __func__, retry_value); |
| 12849 | } |
| 12850 | } |
| 12851 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12852 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12853 | return 0; |
| 12854 | } |
| 12855 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12856 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 12857 | u32 changed) |
| 12858 | { |
| 12859 | int ret; |
| 12860 | |
| 12861 | vos_ssr_protect(__func__); |
| 12862 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 12863 | vos_ssr_unprotect(__func__); |
| 12864 | |
| 12865 | return ret; |
| 12866 | } |
| 12867 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12868 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12869 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12870 | * This function is used to set the txpower |
| 12871 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12872 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12873 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12874 | struct wireless_dev *wdev, |
| 12875 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12876 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12877 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12878 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12879 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12880 | #endif |
| 12881 | int dbm) |
| 12882 | { |
| 12883 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12884 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12885 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 12886 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12887 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12888 | |
| 12889 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12890 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12891 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12892 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 12893 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12894 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12895 | if (0 != status) |
| 12896 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12897 | return status; |
| 12898 | } |
| 12899 | |
| 12900 | hHal = pHddCtx->hHal; |
| 12901 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12902 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 12903 | dbm, ccmCfgSetCallback, |
| 12904 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12905 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12906 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12907 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 12908 | return -EIO; |
| 12909 | } |
| 12910 | |
| 12911 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 12912 | dbm); |
| 12913 | |
| 12914 | switch(type) |
| 12915 | { |
| 12916 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 12917 | /* Fall through */ |
| 12918 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 12919 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 12920 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12921 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 12922 | __func__); |
| 12923 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12924 | } |
| 12925 | break; |
| 12926 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12927 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12928 | __func__); |
| 12929 | return -EOPNOTSUPP; |
| 12930 | break; |
| 12931 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12932 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 12933 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12934 | return -EIO; |
| 12935 | } |
| 12936 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12937 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12938 | return 0; |
| 12939 | } |
| 12940 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12941 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 12942 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12943 | struct wireless_dev *wdev, |
| 12944 | #endif |
| 12945 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 12946 | enum tx_power_setting type, |
| 12947 | #else |
| 12948 | enum nl80211_tx_power_setting type, |
| 12949 | #endif |
| 12950 | int dbm) |
| 12951 | { |
| 12952 | int ret; |
| 12953 | vos_ssr_protect(__func__); |
| 12954 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 12955 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12956 | wdev, |
| 12957 | #endif |
| 12958 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 12959 | type, |
| 12960 | #else |
| 12961 | type, |
| 12962 | #endif |
| 12963 | dbm); |
| 12964 | vos_ssr_unprotect(__func__); |
| 12965 | |
| 12966 | return ret; |
| 12967 | } |
| 12968 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12969 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12970 | * FUNCTION: __wlan_hdd_cfg80211_get_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12971 | * This function is used to read the txpower |
| 12972 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12973 | static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12974 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12975 | struct wireless_dev *wdev, |
| 12976 | #endif |
| 12977 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12978 | { |
| 12979 | |
| 12980 | hdd_adapter_t *pAdapter; |
| 12981 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12982 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12983 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12984 | ENTER(); |
| 12985 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12986 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12987 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12988 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12989 | *dbm = 0; |
| 12990 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12991 | } |
| 12992 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12993 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 12994 | if (NULL == pAdapter) |
| 12995 | { |
| 12996 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 12997 | return -ENOENT; |
| 12998 | } |
| 12999 | |
| 13000 | wlan_hdd_get_classAstats(pAdapter); |
| 13001 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 13002 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13003 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13004 | return 0; |
| 13005 | } |
| 13006 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13007 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 13008 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13009 | struct wireless_dev *wdev, |
| 13010 | #endif |
| 13011 | int *dbm) |
| 13012 | { |
| 13013 | int ret; |
| 13014 | |
| 13015 | vos_ssr_protect(__func__); |
| 13016 | ret = __wlan_hdd_cfg80211_get_txpower(wiphy, |
| 13017 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13018 | wdev, |
| 13019 | #endif |
| 13020 | dbm); |
| 13021 | vos_ssr_unprotect(__func__); |
| 13022 | |
| 13023 | return ret; |
| 13024 | } |
| 13025 | |
| 13026 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13027 | 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] | 13028 | u8* mac, struct station_info *sinfo) |
| 13029 | { |
| 13030 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 13031 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13032 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13033 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13034 | |
| 13035 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 13036 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13037 | |
| 13038 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 13039 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 13040 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 13041 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 13042 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 13043 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 13044 | tANI_U16 maxRate = 0; |
| 13045 | tANI_U16 myRate; |
| 13046 | tANI_U16 currentRate = 0; |
| 13047 | tANI_U8 maxSpeedMCS = 0; |
| 13048 | tANI_U8 maxMCSIdx = 0; |
| 13049 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13050 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 13051 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13052 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13053 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13054 | #ifdef WLAN_FEATURE_11AC |
| 13055 | tANI_U32 vht_mcs_map; |
| 13056 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 13057 | #endif /* WLAN_FEATURE_11AC */ |
| 13058 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13059 | ENTER(); |
| 13060 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13061 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 13062 | (0 == ssidlen)) |
| 13063 | { |
| 13064 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 13065 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 13066 | /*To keep GUI happy*/ |
| 13067 | return 0; |
| 13068 | } |
| 13069 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 13070 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 13071 | { |
| 13072 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13073 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 13074 | return 0; |
| 13075 | } |
| 13076 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13077 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13078 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13079 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13080 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13081 | } |
| 13082 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13083 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 13084 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 13085 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 13086 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 13087 | wlan_hdd_get_station_stats(pAdapter); |
| 13088 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
| 13089 | |
| 13090 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13091 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 13092 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13093 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13094 | { |
| 13095 | rate_flags = pAdapter->maxRateFlags; |
| 13096 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13097 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13098 | //convert to the UI units of 100kbps |
| 13099 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 13100 | |
| 13101 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13102 | 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] | 13103 | sinfo->signal, |
| 13104 | pCfg->reportMaxLinkSpeed, |
| 13105 | myRate, |
| 13106 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13107 | (int) pCfg->linkSpeedRssiMid, |
| 13108 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13109 | (int) rate_flags, |
| 13110 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13111 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13112 | |
| 13113 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 13114 | { |
| 13115 | // we do not want to necessarily report the current speed |
| 13116 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 13117 | { |
| 13118 | // report the max possible speed |
| 13119 | rssidx = 0; |
| 13120 | } |
| 13121 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 13122 | { |
| 13123 | // report the max possible speed with RSSI scaling |
| 13124 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 13125 | { |
| 13126 | // report the max possible speed |
| 13127 | rssidx = 0; |
| 13128 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13129 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13130 | { |
| 13131 | // report middle speed |
| 13132 | rssidx = 1; |
| 13133 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13134 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 13135 | { |
| 13136 | // report middle speed |
| 13137 | rssidx = 2; |
| 13138 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13139 | else |
| 13140 | { |
| 13141 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13142 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13143 | } |
| 13144 | } |
| 13145 | else |
| 13146 | { |
| 13147 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 13148 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13149 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 13150 | __func__, pCfg->reportMaxLinkSpeed); |
| 13151 | rssidx = 0; |
| 13152 | } |
| 13153 | |
| 13154 | maxRate = 0; |
| 13155 | |
| 13156 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13157 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 13158 | OperationalRates, &ORLeng)) |
| 13159 | { |
| 13160 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13161 | /*To keep GUI happy*/ |
| 13162 | return 0; |
| 13163 | } |
| 13164 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13165 | for (i = 0; i < ORLeng; i++) |
| 13166 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13167 | 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] | 13168 | { |
| 13169 | /* Validate Rate Set */ |
| 13170 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 13171 | { |
| 13172 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 13173 | break; |
| 13174 | } |
| 13175 | } |
| 13176 | /* Update MAX rate */ |
| 13177 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 13178 | } |
| 13179 | |
| 13180 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13181 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 13182 | ExtendedRates, &ERLeng)) |
| 13183 | { |
| 13184 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13185 | /*To keep GUI happy*/ |
| 13186 | return 0; |
| 13187 | } |
| 13188 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13189 | for (i = 0; i < ERLeng; i++) |
| 13190 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13191 | 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] | 13192 | { |
| 13193 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 13194 | { |
| 13195 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 13196 | break; |
| 13197 | } |
| 13198 | } |
| 13199 | /* Update MAX rate */ |
| 13200 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 13201 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13202 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 13203 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 13204 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 13205 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13206 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13207 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13208 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13209 | mode = 2; |
| 13210 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 13211 | mode = 1; |
| 13212 | else |
| 13213 | mode = 0; |
| 13214 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13215 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 13216 | MCSRates, &MCSLeng)) |
| 13217 | { |
| 13218 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13219 | /*To keep GUI happy*/ |
| 13220 | return 0; |
| 13221 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13222 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13223 | #ifdef WLAN_FEATURE_11AC |
| 13224 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13225 | 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] | 13226 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13227 | 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] | 13228 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13229 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13230 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13231 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13232 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13233 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13234 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13235 | maxMCSIdx = 7; |
| 13236 | } |
| 13237 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 13238 | { |
| 13239 | maxMCSIdx = 8; |
| 13240 | } |
| 13241 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 13242 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13243 | //VHT20 is supporting 0~8 |
| 13244 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13245 | maxMCSIdx = 8; |
| 13246 | else |
| 13247 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13248 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13249 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13250 | if (0 != rssidx)/*check for scaled */ |
| 13251 | { |
| 13252 | //get middle rate MCS index if rssi=1/2 |
| 13253 | for (i=0; i <= maxMCSIdx; i++) |
| 13254 | { |
| 13255 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 13256 | { |
| 13257 | maxMCSIdx = i; |
| 13258 | break; |
| 13259 | } |
| 13260 | } |
| 13261 | } |
| 13262 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13263 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13264 | { |
| 13265 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 13266 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 13267 | } |
| 13268 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 13269 | { |
| 13270 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 13271 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 13272 | } |
| 13273 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13274 | { |
| 13275 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 13276 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 13277 | } |
| 13278 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13279 | maxSpeedMCS = 1; |
| 13280 | if (currentRate > maxRate) |
| 13281 | { |
| 13282 | maxRate = currentRate; |
| 13283 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13284 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13285 | } |
| 13286 | else |
| 13287 | #endif /* WLAN_FEATURE_11AC */ |
| 13288 | { |
| 13289 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13290 | { |
| 13291 | rateFlag |= 1; |
| 13292 | } |
| 13293 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13294 | { |
| 13295 | rateFlag |= 2; |
| 13296 | } |
| 13297 | |
Girish Gowli | 01abcee | 2014-07-31 20:18:55 +0530 | [diff] [blame] | 13298 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13299 | if (rssidx == 1 || rssidx == 2) |
| 13300 | { |
| 13301 | //get middle rate MCS index if rssi=1/2 |
| 13302 | for (i=0; i <= 7; i++) |
| 13303 | { |
| 13304 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 13305 | { |
| 13306 | temp = i+1; |
| 13307 | break; |
| 13308 | } |
| 13309 | } |
| 13310 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13311 | |
| 13312 | for (i = 0; i < MCSLeng; i++) |
| 13313 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13314 | for (j = 0; j < temp; j++) |
| 13315 | { |
| 13316 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 13317 | { |
| 13318 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
| 13319 | break; |
| 13320 | } |
| 13321 | } |
| 13322 | if ((j < temp) && (currentRate > maxRate)) |
| 13323 | { |
| 13324 | maxRate = currentRate; |
| 13325 | maxSpeedMCS = 1; |
| 13326 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
| 13327 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13328 | } |
| 13329 | } |
| 13330 | } |
| 13331 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13332 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 13333 | { |
| 13334 | maxRate = myRate; |
| 13335 | maxSpeedMCS = 1; |
| 13336 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 13337 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13338 | // 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] | 13339 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13340 | { |
| 13341 | maxRate = myRate; |
| 13342 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 13343 | { |
| 13344 | maxSpeedMCS = 0; |
| 13345 | } |
| 13346 | else |
| 13347 | { |
| 13348 | maxSpeedMCS = 1; |
| 13349 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 13350 | } |
| 13351 | } |
| 13352 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13353 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13354 | { |
| 13355 | sinfo->txrate.legacy = maxRate; |
| 13356 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13357 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 13358 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13359 | } |
| 13360 | else |
| 13361 | { |
| 13362 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13363 | #ifdef WLAN_FEATURE_11AC |
| 13364 | sinfo->txrate.nss = 1; |
| 13365 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13366 | { |
| 13367 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13368 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13369 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13370 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13371 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13372 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13373 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13374 | } |
| 13375 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13376 | { |
| 13377 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13378 | } |
| 13379 | #endif /* WLAN_FEATURE_11AC */ |
| 13380 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 13381 | { |
| 13382 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 13383 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13384 | { |
| 13385 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13386 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13387 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13388 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13389 | { |
| 13390 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 13391 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13392 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13393 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13394 | pr_info("Reporting MCS rate %d flags %x\n", |
| 13395 | sinfo->txrate.mcs, |
| 13396 | sinfo->txrate.flags ); |
| 13397 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13398 | } |
| 13399 | } |
| 13400 | else |
| 13401 | { |
| 13402 | // report current rate instead of max rate |
| 13403 | |
| 13404 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 13405 | { |
| 13406 | //provide to the UI in units of 100kbps |
| 13407 | sinfo->txrate.legacy = myRate; |
| 13408 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13409 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 13410 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13411 | } |
| 13412 | else |
| 13413 | { |
| 13414 | //must be MCS |
| 13415 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13416 | #ifdef WLAN_FEATURE_11AC |
| 13417 | sinfo->txrate.nss = 1; |
| 13418 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13419 | { |
| 13420 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13421 | } |
| 13422 | else |
| 13423 | #endif /* WLAN_FEATURE_11AC */ |
| 13424 | { |
| 13425 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 13426 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13427 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13428 | { |
| 13429 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 13430 | } |
| 13431 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13432 | { |
| 13433 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13434 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13435 | #ifdef WLAN_FEATURE_11AC |
| 13436 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13437 | { |
| 13438 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 13439 | } |
| 13440 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13441 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13442 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 13443 | sinfo->txrate.mcs, |
| 13444 | sinfo->txrate.flags ); |
| 13445 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13446 | } |
| 13447 | } |
| 13448 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 13449 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 13450 | sinfo->tx_packets = |
| 13451 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 13452 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 13453 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 13454 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 13455 | |
| 13456 | sinfo->tx_retries = |
| 13457 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 13458 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 13459 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 13460 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 13461 | |
| 13462 | sinfo->tx_failed = |
| 13463 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 13464 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 13465 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 13466 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 13467 | |
| 13468 | sinfo->filled |= |
| 13469 | STATION_INFO_TX_PACKETS | |
| 13470 | STATION_INFO_TX_RETRIES | |
| 13471 | STATION_INFO_TX_FAILED; |
| 13472 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13473 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13474 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 13475 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 13476 | EXIT(); |
| 13477 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13478 | } |
| 13479 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13480 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 13481 | u8* mac, struct station_info *sinfo) |
| 13482 | { |
| 13483 | int ret; |
| 13484 | |
| 13485 | vos_ssr_protect(__func__); |
| 13486 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 13487 | vos_ssr_unprotect(__func__); |
| 13488 | |
| 13489 | return ret; |
| 13490 | } |
| 13491 | |
| 13492 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 13493 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13494 | { |
| 13495 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13496 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13497 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13498 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13499 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13500 | ENTER(); |
| 13501 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13502 | if (NULL == pAdapter) |
| 13503 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13504 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13505 | return -ENODEV; |
| 13506 | } |
| 13507 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13508 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13509 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 13510 | pAdapter->sessionId, timeout)); |
| 13511 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13512 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13513 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13514 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13515 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13516 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13517 | } |
| 13518 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13519 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 13520 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 13521 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 13522 | (eConnectionState_Associated == |
| 13523 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 13524 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 13525 | |
| 13526 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13527 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 13528 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13529 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13530 | { |
| 13531 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13532 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13533 | __func__, vos_status); |
| 13534 | } |
| 13535 | } |
| 13536 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13537 | /**The get power cmd from the supplicant gets updated by the nl only |
| 13538 | *on successful execution of the function call |
| 13539 | *we are oppositely mapped w.r.t mode in the driver |
| 13540 | **/ |
| 13541 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 13542 | |
| 13543 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 13544 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13545 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13546 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13547 | return -EINVAL; |
| 13548 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13549 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13550 | return 0; |
| 13551 | } |
| 13552 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13553 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 13554 | struct net_device *dev, bool mode, int timeout) |
| 13555 | { |
| 13556 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13557 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13558 | vos_ssr_protect(__func__); |
| 13559 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 13560 | vos_ssr_unprotect(__func__); |
| 13561 | |
| 13562 | return ret; |
| 13563 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13564 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13565 | static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 13566 | struct net_device *netdev, |
| 13567 | u8 key_index) |
| 13568 | { |
| 13569 | ENTER(); |
| 13570 | return 0; |
| 13571 | } |
| 13572 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13573 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13574 | struct net_device *netdev, |
| 13575 | u8 key_index) |
| 13576 | { |
| 13577 | int ret; |
| 13578 | vos_ssr_protect(__func__); |
| 13579 | ret = __wlan_hdd_set_default_mgmt_key(wiphy, netdev, key_index); |
| 13580 | vos_ssr_unprotect(__func__); |
| 13581 | return ret; |
| 13582 | } |
| 13583 | #endif //LINUX_VERSION_CODE |
| 13584 | |
| 13585 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 13586 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13587 | struct net_device *dev, |
| 13588 | struct ieee80211_txq_params *params) |
| 13589 | { |
| 13590 | ENTER(); |
| 13591 | return 0; |
| 13592 | } |
| 13593 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13594 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13595 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13596 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13597 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13598 | return 0; |
| 13599 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13600 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13601 | |
| 13602 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 13603 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13604 | struct net_device *dev, |
| 13605 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13606 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13607 | int ret; |
| 13608 | |
| 13609 | vos_ssr_protect(__func__); |
| 13610 | ret = __wlan_hdd_set_txq_params(wiphy, dev, params); |
| 13611 | vos_ssr_unprotect(__func__); |
| 13612 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13613 | } |
| 13614 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13615 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13616 | struct ieee80211_txq_params *params) |
| 13617 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13618 | int ret; |
| 13619 | |
| 13620 | vos_ssr_protect(__func__); |
| 13621 | ret = __wlan_hdd_set_txq_params(wiphy, params); |
| 13622 | vos_ssr_unprotect(__func__); |
| 13623 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13624 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13625 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13626 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13627 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13628 | struct net_device *dev, |
| 13629 | struct tagCsrDelStaParams *pDelStaParams) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13630 | { |
| 13631 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13632 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13633 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13634 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13635 | v_U8_t staId; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13636 | v_CONTEXT_t pVosContext = NULL; |
| 13637 | ptSapContext pSapCtx = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13638 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13639 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13640 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13641 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13642 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13643 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13644 | return -EINVAL; |
| 13645 | } |
| 13646 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13647 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13648 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 13649 | pAdapter->sessionId, pAdapter->device_mode)); |
| 13650 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13651 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13652 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13653 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13654 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13655 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13656 | } |
| 13657 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13658 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13659 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13660 | ) |
| 13661 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13662 | pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 13663 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 13664 | if(pSapCtx == NULL){ |
| 13665 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13666 | FL("psapCtx is NULL")); |
| 13667 | return -ENOENT; |
| 13668 | } |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13669 | if (vos_is_macaddr_broadcast((v_MACADDR_t *)pDelStaParams->peerMacAddr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13670 | { |
| 13671 | v_U16_t i; |
| 13672 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 13673 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13674 | if ((pSapCtx->aStaInfo[i].isUsed) && |
| 13675 | (!pSapCtx->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13676 | { |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13677 | vos_mem_copy(pDelStaParams->peerMacAddr, |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13678 | pSapCtx->aStaInfo[i].macAddrSTA.bytes, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13679 | ETHER_ADDR_LEN); |
| 13680 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13681 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13682 | "%s: Delete STA with MAC::" |
| 13683 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13684 | __func__, |
| 13685 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
| 13686 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 13687 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13688 | pSapCtx->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13689 | } |
| 13690 | } |
| 13691 | } |
| 13692 | else |
| 13693 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13694 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13695 | vos_status = hdd_softap_GetStaId(pAdapter, |
| 13696 | (v_MACADDR_t *)pDelStaParams->peerMacAddr, &staId); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13697 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13698 | { |
| 13699 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13700 | "%s: Skip this DEL STA as this is not used::" |
| 13701 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13702 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13703 | return -ENOENT; |
| 13704 | } |
| 13705 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13706 | if( pSapCtx->aStaInfo[staId].isDeauthInProgress == TRUE) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13707 | { |
| 13708 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13709 | "%s: Skip this DEL STA as deauth is in progress::" |
| 13710 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13711 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13712 | return -ENOENT; |
| 13713 | } |
| 13714 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13715 | pSapCtx->aStaInfo[staId].isDeauthInProgress = TRUE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13716 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13717 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13718 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13719 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13720 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13721 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13722 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13723 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13724 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13725 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13726 | pSapCtx->aStaInfo[staId].isDeauthInProgress = FALSE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13727 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13728 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13729 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13730 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13731 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13732 | return -ENOENT; |
| 13733 | } |
| 13734 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13735 | } |
| 13736 | } |
| 13737 | |
| 13738 | EXIT(); |
| 13739 | |
| 13740 | return 0; |
| 13741 | } |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13742 | |
| 13743 | #ifdef CFG80211_DEL_STA_V2 |
| 13744 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 13745 | struct net_device *dev, |
| 13746 | struct station_del_parameters *param) |
| 13747 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13748 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 13749 | struct net_device *dev, u8 *mac) |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13750 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13751 | { |
| 13752 | int ret; |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13753 | struct tagCsrDelStaParams delStaParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13754 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13755 | vos_ssr_protect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13756 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13757 | #ifdef CFG80211_DEL_STA_V2 |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13758 | if (NULL == param) { |
| 13759 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid argumet passed", __func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13760 | vos_ssr_unprotect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13761 | return -EINVAL; |
| 13762 | } |
| 13763 | |
| 13764 | WLANSAP_PopulateDelStaParams(param->mac, param->reason_code, |
| 13765 | param->subtype, &delStaParams); |
| 13766 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13767 | #else |
Sushant Kaushik | 4cd28f6 | 2014-12-26 14:23:50 +0530 | [diff] [blame] | 13768 | WLANSAP_PopulateDelStaParams(mac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13769 | (SIR_MAC_MGMT_DEAUTH >> 4), &delStaParams); |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13770 | #endif |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13771 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, &delStaParams); |
| 13772 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13773 | vos_ssr_unprotect(__func__); |
| 13774 | |
| 13775 | return ret; |
| 13776 | } |
| 13777 | |
| 13778 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13779 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 13780 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13781 | hdd_adapter_t *pAdapter; |
| 13782 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13783 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13784 | #ifdef FEATURE_WLAN_TDLS |
| 13785 | u32 mask, set; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13786 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13787 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13788 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13789 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13790 | if (NULL == pAdapter) |
| 13791 | { |
| 13792 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13793 | "%s: Adapter is NULL",__func__); |
| 13794 | return -EINVAL; |
| 13795 | } |
| 13796 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13797 | status = wlan_hdd_validate_context(pHddCtx); |
| 13798 | if (0 != status) |
| 13799 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13800 | return status; |
| 13801 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13802 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13803 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13804 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 13805 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13806 | mask = params->sta_flags_mask; |
| 13807 | |
| 13808 | set = params->sta_flags_set; |
| 13809 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 13810 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13811 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 13812 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13813 | |
| 13814 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 13815 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13816 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13817 | } |
| 13818 | } |
| 13819 | #endif |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13820 | EXIT(); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13821 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13822 | } |
| 13823 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13824 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 13825 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 13826 | { |
| 13827 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13828 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13829 | vos_ssr_protect(__func__); |
| 13830 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 13831 | vos_ssr_unprotect(__func__); |
| 13832 | |
| 13833 | return ret; |
| 13834 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13835 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13836 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13837 | 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] | 13838 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13839 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13840 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13841 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13842 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13843 | int status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13844 | hdd_context_t *pHddCtx; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13845 | tPmkidCacheInfo pmk_id; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13846 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13847 | ENTER(); |
| 13848 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13849 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13850 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13851 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13852 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13853 | return -EINVAL; |
| 13854 | } |
| 13855 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13856 | if (!pmksa) { |
| 13857 | hddLog(LOGE, FL("pmksa is NULL")); |
| 13858 | return -EINVAL; |
| 13859 | } |
| 13860 | |
| 13861 | if (!pmksa->bssid || !pmksa->pmkid) { |
| 13862 | hddLog(LOGE, FL("pmksa->bssid(%p) or pmksa->pmkid(%p) is NULL"), |
| 13863 | pmksa->bssid, pmksa->pmkid); |
| 13864 | return -EINVAL; |
| 13865 | } |
| 13866 | |
| 13867 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 13868 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13869 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13870 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13871 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13872 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13873 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13874 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13875 | } |
| 13876 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13877 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13878 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13879 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13880 | vos_mem_copy(pmk_id.BSSID, pmksa->bssid, ETHER_ADDR_LEN); |
| 13881 | vos_mem_copy(pmk_id.PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13882 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13883 | /* Add to the PMKSA ID Cache in CSR */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13884 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13885 | &pmk_id, 1, FALSE); |
| 13886 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13887 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13888 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 13889 | pAdapter->sessionId, result)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13890 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13891 | EXIT(); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13892 | return HAL_STATUS_SUCCESS(result) ? 0 : -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13893 | } |
| 13894 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13895 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 13896 | struct cfg80211_pmksa *pmksa) |
| 13897 | { |
| 13898 | int ret; |
| 13899 | |
| 13900 | vos_ssr_protect(__func__); |
| 13901 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 13902 | vos_ssr_unprotect(__func__); |
| 13903 | |
| 13904 | return ret; |
| 13905 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13906 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13907 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13908 | 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] | 13909 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13910 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13911 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13912 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13913 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13914 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13915 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13916 | ENTER(); |
| 13917 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13918 | /* Validate pAdapter */ |
| 13919 | if (NULL == pAdapter) |
| 13920 | { |
| 13921 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 13922 | return -EINVAL; |
| 13923 | } |
| 13924 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13925 | if (!pmksa) { |
| 13926 | hddLog(LOGE, FL("pmksa is NULL")); |
| 13927 | return -EINVAL; |
| 13928 | } |
| 13929 | |
| 13930 | if (!pmksa->bssid) { |
| 13931 | hddLog(LOGE, FL("pmksa->bssid is NULL")); |
| 13932 | return -EINVAL; |
| 13933 | } |
| 13934 | |
Kiet Lam | 98c46a1 | 2014-10-31 15:34:57 -0700 | [diff] [blame] | 13935 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 13936 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13937 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13938 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13939 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13940 | if (0 != status) |
| 13941 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13942 | return status; |
| 13943 | } |
| 13944 | |
| 13945 | /*Retrieve halHandle*/ |
| 13946 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13947 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13948 | /* Delete the PMKID CSR cache */ |
| 13949 | if (eHAL_STATUS_SUCCESS != |
| 13950 | sme_RoamDelPMKIDfromCache(halHandle, |
| 13951 | pAdapter->sessionId, pmksa->bssid, FALSE)) { |
| 13952 | hddLog(LOGE, FL("Failed to delete PMKSA for "MAC_ADDRESS_STR), |
| 13953 | MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13954 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13955 | } |
| 13956 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13957 | EXIT(); |
| 13958 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13959 | } |
| 13960 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13961 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13962 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 13963 | struct cfg80211_pmksa *pmksa) |
| 13964 | { |
| 13965 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13966 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13967 | vos_ssr_protect(__func__); |
| 13968 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 13969 | vos_ssr_unprotect(__func__); |
| 13970 | |
| 13971 | return ret; |
| 13972 | |
| 13973 | } |
| 13974 | |
| 13975 | 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] | 13976 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13977 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13978 | tHalHandle halHandle; |
| 13979 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13980 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13981 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13982 | ENTER(); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13983 | |
| 13984 | /* Validate pAdapter */ |
| 13985 | if (NULL == pAdapter) |
| 13986 | { |
| 13987 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13988 | "%s: Invalid Adapter" ,__func__); |
| 13989 | return -EINVAL; |
| 13990 | } |
| 13991 | |
| 13992 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13993 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13994 | if (0 != status) |
| 13995 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13996 | return status; |
| 13997 | } |
| 13998 | |
| 13999 | /*Retrieve halHandle*/ |
| 14000 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14001 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14002 | /* Flush the PMKID cache in CSR */ |
| 14003 | if (eHAL_STATUS_SUCCESS != |
| 14004 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, NULL, TRUE)) { |
| 14005 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Cannot flush PMKIDCache")); |
| 14006 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14007 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14008 | EXIT(); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 14009 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14010 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 14011 | |
| 14012 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 14013 | { |
| 14014 | int ret; |
| 14015 | |
| 14016 | vos_ssr_protect(__func__); |
| 14017 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 14018 | vos_ssr_unprotect(__func__); |
| 14019 | |
| 14020 | return ret; |
| 14021 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14022 | #endif |
| 14023 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14024 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14025 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 14026 | struct net_device *dev, |
| 14027 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14028 | { |
| 14029 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14030 | hdd_station_ctx_t *pHddStaCtx; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14031 | hdd_context_t *pHddCtx; |
| 14032 | int ret = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14033 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14034 | ENTER(); |
| 14035 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14036 | if (NULL == pAdapter) |
| 14037 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14038 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14039 | return -ENODEV; |
| 14040 | } |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14041 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14042 | ret = wlan_hdd_validate_context(pHddCtx); |
| 14043 | if (0 != ret) |
| 14044 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14045 | return ret; |
| 14046 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14047 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14048 | if (NULL == pHddStaCtx) |
| 14049 | { |
| 14050 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: STA Context is NULL", __func__); |
| 14051 | return -EINVAL; |
| 14052 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14053 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14054 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14055 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 14056 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14057 | // Added for debug on reception of Re-assoc Req. |
| 14058 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 14059 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14060 | 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] | 14061 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14062 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14063 | } |
| 14064 | |
| 14065 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14066 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14067 | ftie->ie_len); |
| 14068 | #endif |
| 14069 | |
| 14070 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 14071 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 14072 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14073 | ftie->ie_len); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14074 | |
| 14075 | EXIT(); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14076 | return 0; |
| 14077 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14078 | |
| 14079 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 14080 | struct net_device *dev, |
| 14081 | struct cfg80211_update_ft_ies_params *ftie) |
| 14082 | { |
| 14083 | int ret; |
| 14084 | |
| 14085 | vos_ssr_protect(__func__); |
| 14086 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 14087 | vos_ssr_unprotect(__func__); |
| 14088 | |
| 14089 | return ret; |
| 14090 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14091 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14092 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14093 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 14094 | |
| 14095 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 14096 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 14097 | { |
| 14098 | int ret; |
| 14099 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 14100 | hdd_context_t *pHddCtx; |
| 14101 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14102 | ENTER(); |
| 14103 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14104 | if (NULL == pAdapter) |
| 14105 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 14106 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14107 | "%s: HDD adapter is Null", __func__); |
| 14108 | return ; |
| 14109 | } |
| 14110 | |
| 14111 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14112 | if (NULL == pHddCtx) |
| 14113 | { |
| 14114 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14115 | "%s: HDD context is Null!!!", __func__); |
| 14116 | return ; |
| 14117 | } |
| 14118 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14119 | spin_lock(&pHddCtx->schedScan_lock); |
| 14120 | if (TRUE == pHddCtx->isWiphySuspended) |
| 14121 | { |
| 14122 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 14123 | spin_unlock(&pHddCtx->schedScan_lock); |
| 14124 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14125 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 14126 | return ; |
| 14127 | } |
| 14128 | spin_unlock(&pHddCtx->schedScan_lock); |
| 14129 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14130 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 14131 | |
| 14132 | if (0 > ret) |
| 14133 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 14134 | |
| 14135 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14136 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14137 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14138 | } |
| 14139 | |
| 14140 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14141 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14142 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14143 | */ |
| 14144 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 14145 | { |
| 14146 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 14147 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14148 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14149 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14150 | int status = 0; |
| 14151 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 14152 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14153 | /* The current firmware design does not allow PNO during any |
| 14154 | * active sessions. Hence, determine the active sessions |
| 14155 | * and return a failure. |
| 14156 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14157 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 14158 | { |
| 14159 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14160 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14161 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14162 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 14163 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 14164 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 14165 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 14166 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
Siddharth Bhal | 63a19a7 | 2014-11-07 14:31:56 +0530 | [diff] [blame] | 14167 | || (WLAN_HDD_TM_LEVEL_4 == pHddCtx->tmInfo.currentTmLevel) |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14168 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14169 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14170 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14171 | } |
| 14172 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 14173 | pAdapterNode = pNext; |
| 14174 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14175 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14176 | } |
| 14177 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14178 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 14179 | { |
| 14180 | hdd_adapter_t *pAdapter = callbackContext; |
| 14181 | hdd_context_t *pHddCtx; |
| 14182 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14183 | ENTER(); |
| 14184 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14185 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 14186 | { |
| 14187 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14188 | FL("Invalid adapter or adapter has invalid magic")); |
| 14189 | return; |
| 14190 | } |
| 14191 | |
| 14192 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14193 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 14194 | { |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14195 | return; |
| 14196 | } |
| 14197 | |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 14198 | if (VOS_STATUS_SUCCESS != status) |
| 14199 | { |
| 14200 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14201 | FL("PNO enable response status = %d"), status); |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 14202 | pHddCtx->isPnoEnable = FALSE; |
| 14203 | } |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14204 | |
| 14205 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 14206 | complete(&pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14207 | EXIT(); |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14208 | } |
| 14209 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14210 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14211 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 14212 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14213 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14214 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14215 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 14216 | { |
| 14217 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14218 | tSirPNOScanReq pnoRequest = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14219 | hdd_context_t *pHddCtx; |
| 14220 | tHalHandle hHal; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14221 | v_U32_t i, indx, num_ch, tempInterval, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 14222 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 14223 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14224 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 14225 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14226 | int ret = 0; |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14227 | hdd_config_t *pConfig = NULL; |
| 14228 | v_U32_t num_ignore_dfs_ch = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14229 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14230 | ENTER(); |
| 14231 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14232 | if (NULL == pAdapter) |
| 14233 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14234 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14235 | "%s: HDD adapter is Null", __func__); |
| 14236 | return -ENODEV; |
| 14237 | } |
| 14238 | |
| 14239 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14240 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14241 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14242 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14243 | { |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14244 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14245 | } |
| 14246 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14247 | pConfig = pHddCtx->cfg_ini; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14248 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14249 | if (NULL == hHal) |
| 14250 | { |
| 14251 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14252 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14253 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14254 | } |
Sushant Kaushik | 2fe8993 | 2014-09-03 10:58:09 +0530 | [diff] [blame] | 14255 | sme_ScanFlushResult(hHal, pAdapter->sessionId); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 14256 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 14257 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 14258 | { |
| 14259 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14260 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 14261 | return -EBUSY; |
| 14262 | } |
| 14263 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14264 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14265 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14266 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14267 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14268 | return -EBUSY; |
| 14269 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14270 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14271 | if (TRUE == pHddCtx->isPnoEnable) |
| 14272 | { |
| 14273 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 14274 | FL("already PNO is enabled")); |
| 14275 | return -EBUSY; |
| 14276 | } |
c_hpothu | 225aa7c | 2014-10-22 17:45:13 +0530 | [diff] [blame] | 14277 | |
| 14278 | if (VOS_STATUS_SUCCESS != wlan_hdd_cancel_remain_on_channel(pHddCtx)) |
| 14279 | { |
| 14280 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14281 | "%s: abort ROC failed ", __func__); |
| 14282 | return -EBUSY; |
| 14283 | } |
| 14284 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14285 | pHddCtx->isPnoEnable = TRUE; |
| 14286 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14287 | pnoRequest.enable = 1; /*Enable PNO */ |
| 14288 | pnoRequest.ucNetworksCount = request->n_match_sets; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14289 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14290 | if (( !pnoRequest.ucNetworksCount ) || |
| 14291 | ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14292 | { |
| 14293 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14294 | "%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] | 14295 | __func__, pnoRequest.ucNetworksCount, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14296 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14297 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14298 | goto error; |
| 14299 | } |
| 14300 | |
| 14301 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 14302 | { |
| 14303 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14304 | "%s: Incorrect number of channels %d", |
| 14305 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14306 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14307 | goto error; |
| 14308 | } |
| 14309 | |
| 14310 | /* Framework provides one set of channels(all) |
| 14311 | * common for all saved profile */ |
| 14312 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 14313 | channels_allowed, &num_channels_allowed)) |
| 14314 | { |
| 14315 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14316 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14317 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14318 | goto error; |
| 14319 | } |
| 14320 | /* Checking each channel against allowed channel list */ |
| 14321 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14322 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14323 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14324 | char chList [(request->n_channels*5)+1]; |
| 14325 | int len; |
| 14326 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14327 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14328 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14329 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14330 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 14331 | { |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14332 | if ((!pConfig->enableDFSPnoChnlScan) && |
| 14333 | (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channels_allowed[indx]))) |
| 14334 | { |
| 14335 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14336 | "%s : Dropping DFS channel : %d", |
| 14337 | __func__,channels_allowed[indx]); |
| 14338 | num_ignore_dfs_ch++; |
| 14339 | break; |
| 14340 | } |
| 14341 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14342 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 14343 | len += snprintf(chList+len, 5, "%d ", |
| 14344 | request->channels[i]->hw_value); |
| 14345 | break ; |
| 14346 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14347 | } |
| 14348 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14349 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14350 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14351 | /*If all channels are DFS and dropped, then ignore the PNO request*/ |
| 14352 | if (num_ignore_dfs_ch == request->n_channels) |
| 14353 | { |
| 14354 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14355 | "%s : All requested channels are DFS channels", __func__); |
| 14356 | ret = -EINVAL; |
| 14357 | goto error; |
| 14358 | } |
| 14359 | } |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14360 | |
| 14361 | pnoRequest.aNetworks = |
| 14362 | vos_mem_malloc(sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14363 | if (pnoRequest.aNetworks == NULL) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14364 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14365 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14366 | FL("failed to allocate memory aNetworks %u"), |
| 14367 | (uint32)sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14368 | goto error; |
| 14369 | } |
| 14370 | vos_mem_zero(pnoRequest.aNetworks, |
| 14371 | sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14372 | |
| 14373 | /* Filling per profile params */ |
| 14374 | for (i = 0; i < pnoRequest.ucNetworksCount; i++) |
| 14375 | { |
| 14376 | pnoRequest.aNetworks[i].ssId.length = |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14377 | request->match_sets[i].ssid.ssid_len; |
| 14378 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14379 | if (( 0 == pnoRequest.aNetworks[i].ssId.length ) || |
| 14380 | ( pnoRequest.aNetworks[i].ssId.length > 32 ) ) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14381 | { |
| 14382 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14383 | "%s: SSID Len %d is not correct for network %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14384 | __func__, pnoRequest.aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14385 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14386 | goto error; |
| 14387 | } |
| 14388 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14389 | memcpy(pnoRequest.aNetworks[i].ssId.ssId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14390 | request->match_sets[i].ssid.ssid, |
| 14391 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14392 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14393 | "%s: SSID of network %d is %s ", __func__, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14394 | i, pnoRequest.aNetworks[i].ssId.ssId); |
| 14395 | pnoRequest.aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 14396 | pnoRequest.aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 14397 | pnoRequest.aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14398 | |
| 14399 | /*Copying list of valid channel into request */ |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14400 | memcpy(pnoRequest.aNetworks[i].aChannels, valid_ch, num_ch); |
| 14401 | pnoRequest.aNetworks[i].ucChannelCount = num_ch; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14402 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14403 | pnoRequest.aNetworks[i].rssiThreshold = 0; //Default value |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14404 | } |
| 14405 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14406 | for (i = 0; i < request->n_ssids; i++) |
| 14407 | { |
| 14408 | j = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14409 | while (j < pnoRequest.ucNetworksCount) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14410 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14411 | if ((pnoRequest.aNetworks[j].ssId.length == |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14412 | request->ssids[i].ssid_len) && |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14413 | (0 == memcmp(pnoRequest.aNetworks[j].ssId.ssId, |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14414 | request->ssids[i].ssid, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14415 | pnoRequest.aNetworks[j].ssId.length))) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14416 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14417 | pnoRequest.aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14418 | break; |
| 14419 | } |
| 14420 | j++; |
| 14421 | } |
| 14422 | } |
| 14423 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14424 | "Number of hidden networks being Configured = %d", |
| 14425 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14426 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 14427 | "request->ie_len = %zu", request->ie_len); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14428 | |
| 14429 | pnoRequest.p24GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 14430 | if (pnoRequest.p24GProbeTemplate == NULL) |
| 14431 | { |
| 14432 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14433 | FL("failed to allocate memory p24GProbeTemplate %u"), |
| 14434 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 14435 | goto error; |
| 14436 | } |
| 14437 | |
| 14438 | pnoRequest.p5GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 14439 | if (pnoRequest.p5GProbeTemplate == NULL) |
| 14440 | { |
| 14441 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14442 | FL("failed to allocate memory p5GProbeTemplate %u"), |
| 14443 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 14444 | goto error; |
| 14445 | } |
| 14446 | |
| 14447 | vos_mem_zero(pnoRequest.p24GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 14448 | vos_mem_zero(pnoRequest.p5GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 14449 | |
Hanumantha Reddy Pothula | 06e87b2 | 2015-03-02 18:02:23 +0530 | [diff] [blame] | 14450 | if ((0 < request->ie_len) && (request->ie_len <= SIR_PNO_MAX_PB_REQ_SIZE) && |
| 14451 | (NULL != request->ie)) |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14452 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14453 | pnoRequest.us24GProbeTemplateLen = request->ie_len; |
| 14454 | memcpy(pnoRequest.p24GProbeTemplate, request->ie, |
| 14455 | pnoRequest.us24GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14456 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14457 | pnoRequest.us5GProbeTemplateLen = request->ie_len; |
| 14458 | memcpy(pnoRequest.p5GProbeTemplate, request->ie, |
| 14459 | pnoRequest.us5GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14460 | } |
| 14461 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14462 | /* Driver gets only one time interval which is hardcoded in |
| 14463 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 14464 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 14465 | * 80,160,320 secs. And number of scan cycle for each timer |
| 14466 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 14467 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 14468 | * will be repeated after each interval specified by supplicant |
| 14469 | * till PNO is disabled. |
| 14470 | */ |
| 14471 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14472 | pnoRequest.scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14473 | else |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14474 | pnoRequest.scanTimers.ucScanTimersCount = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14475 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 14476 | |
| 14477 | tempInterval = (request->interval)/1000; |
| 14478 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14479 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 14480 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14481 | for ( i = 0; i < pnoRequest.scanTimers.ucScanTimersCount; i++) |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14482 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14483 | pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14484 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14485 | pnoRequest.scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14486 | tempInterval *= 2; |
| 14487 | } |
| 14488 | //Repeat last timer until pno disabled. |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14489 | pnoRequest.scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14490 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14491 | pnoRequest.modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14492 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14493 | INIT_COMPLETION(pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14494 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 14495 | pnoRequest.callbackContext = pAdapter; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14496 | pAdapter->pno_req_status = 0; |
| 14497 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14498 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14499 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14500 | pAdapter->sessionId, pnoRequest.enable, pnoRequest.modePNO, |
| 14501 | pnoRequest.scanTimers.ucScanTimersCount); |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14502 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14503 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14504 | &pnoRequest, pAdapter->sessionId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14505 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 14506 | if (eHAL_STATUS_SUCCESS != status) |
| 14507 | { |
| 14508 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14509 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14510 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14511 | goto error; |
| 14512 | } |
| 14513 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14514 | ret = wait_for_completion_timeout( |
| 14515 | &pAdapter->pno_comp_var, |
| 14516 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 14517 | if (0 >= ret) |
| 14518 | { |
| 14519 | // Did not receive the response for PNO enable in time. |
| 14520 | // Assuming the PNO enable was success. |
| 14521 | // Returning error from here, because we timeout, results |
| 14522 | // in side effect of Wifi (Wifi Setting) not to work. |
| 14523 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14524 | FL("Timed out waiting for PNO to be Enabled")); |
| 14525 | ret = 0; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14526 | } |
| 14527 | |
| 14528 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14529 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14530 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14531 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14532 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14533 | FL("PNO scanRequest offloaded ret = %d"), ret); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14534 | pHddCtx->isPnoEnable = FALSE; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14535 | if (pnoRequest.aNetworks) |
| 14536 | vos_mem_free(pnoRequest.aNetworks); |
| 14537 | if (pnoRequest.p24GProbeTemplate) |
| 14538 | vos_mem_free(pnoRequest.p24GProbeTemplate); |
| 14539 | if (pnoRequest.p5GProbeTemplate) |
| 14540 | vos_mem_free(pnoRequest.p5GProbeTemplate); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14541 | |
| 14542 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14543 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14544 | } |
| 14545 | |
| 14546 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14547 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 14548 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14549 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14550 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 14551 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 14552 | { |
| 14553 | int ret; |
| 14554 | |
| 14555 | vos_ssr_protect(__func__); |
| 14556 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 14557 | vos_ssr_unprotect(__func__); |
| 14558 | |
| 14559 | return ret; |
| 14560 | } |
| 14561 | |
| 14562 | /* |
| 14563 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 14564 | * Function to disable PNO |
| 14565 | */ |
| 14566 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14567 | struct net_device *dev) |
| 14568 | { |
| 14569 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14570 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14571 | hdd_context_t *pHddCtx; |
| 14572 | tHalHandle hHal; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14573 | tSirPNOScanReq pnoRequest = {0}; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14574 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14575 | |
| 14576 | ENTER(); |
| 14577 | |
| 14578 | if (NULL == pAdapter) |
| 14579 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14580 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14581 | "%s: HDD adapter is Null", __func__); |
| 14582 | return -ENODEV; |
| 14583 | } |
| 14584 | |
| 14585 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14586 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14587 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14588 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14589 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14590 | "%s: HDD context is Null", __func__); |
| 14591 | return -ENODEV; |
| 14592 | } |
| 14593 | |
| 14594 | /* The return 0 is intentional when isLogpInProgress and |
| 14595 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 14596 | * failure in sched_scan_stop , especially for a case where the unload |
| 14597 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 14598 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 14599 | * success. If it returns a failure , then its next invocation due to the |
| 14600 | * clean up of the second interface will have the dev pointer corresponding |
| 14601 | * to the first one leading to a crash. |
| 14602 | */ |
| 14603 | if (pHddCtx->isLogpInProgress) |
| 14604 | { |
| 14605 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14606 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14607 | return ret; |
| 14608 | } |
| 14609 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 14610 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14611 | { |
| 14612 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14613 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14614 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14615 | } |
| 14616 | |
| 14617 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14618 | if (NULL == hHal) |
| 14619 | { |
| 14620 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14621 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14622 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14623 | } |
| 14624 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14625 | pnoRequest.enable = 0; /* Disable PNO */ |
| 14626 | pnoRequest.ucNetworksCount = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14627 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14628 | status = sme_SetPreferredNetworkList(hHal, &pnoRequest, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14629 | pAdapter->sessionId, |
| 14630 | NULL, pAdapter); |
| 14631 | if (eHAL_STATUS_SUCCESS != status) |
| 14632 | { |
| 14633 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14634 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14635 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14636 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14637 | } |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14638 | pHddCtx->isPnoEnable = FALSE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14639 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14640 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14641 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14642 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14643 | |
| 14644 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14645 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14646 | } |
| 14647 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14648 | /* |
| 14649 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 14650 | * NL interface to disable PNO |
| 14651 | */ |
| 14652 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 14653 | struct net_device *dev) |
| 14654 | { |
| 14655 | int ret; |
| 14656 | |
| 14657 | vos_ssr_protect(__func__); |
| 14658 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 14659 | vos_ssr_unprotect(__func__); |
| 14660 | |
| 14661 | return ret; |
| 14662 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14663 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 14664 | |
| 14665 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14666 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14667 | #if TDLS_MGMT_VERSION2 |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14668 | 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] | 14669 | u8 *peer, u8 action_code, u8 dialog_token, |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14670 | u16 status_code, u32 peer_capability, const u8 *buf, size_t len) |
| 14671 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14672 | 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] | 14673 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14674 | u16 status_code, const u8 *buf, size_t len) |
| 14675 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14676 | { |
| 14677 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14678 | hdd_adapter_t *pAdapter; |
| 14679 | hdd_context_t *pHddCtx; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14680 | u8 peerMac[6]; |
| 14681 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14682 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14683 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14684 | long rc; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14685 | int ret; |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14686 | #if !(TDLS_MGMT_VERSION2) |
| 14687 | u32 peer_capability = 0; |
| 14688 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14689 | tANI_U16 numCurrTdlsPeers; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14690 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14691 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14692 | if (NULL == pAdapter) |
| 14693 | { |
| 14694 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14695 | "%s: Adapter is NULL",__func__); |
| 14696 | return -EINVAL; |
| 14697 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14698 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14699 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 14700 | pAdapter->sessionId, action_code)); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14701 | pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14702 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14703 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14704 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14705 | "Invalid arguments"); |
| 14706 | return -EINVAL; |
| 14707 | } |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14708 | if (pHddCtx->isLogpInProgress) |
| 14709 | { |
| 14710 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14711 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14712 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 14713 | peer, |
| 14714 | eTDLS_LINK_IDLE, |
| 14715 | eTDLS_LINK_UNSPECIFIED); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14716 | return -EBUSY; |
| 14717 | } |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14718 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
| 14719 | { |
| 14720 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14721 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14722 | return -EAGAIN; |
| 14723 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14724 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14725 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14726 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14727 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 14728 | MAC_ADDRESS_STR " action %d declined.", |
| 14729 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14730 | return -ENOTSUPP; |
| 14731 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14732 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14733 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 14734 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 14735 | { |
| 14736 | /* if tdls_mode is disabled to respond to peer's request */ |
| 14737 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 14738 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14739 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14740 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14741 | " TDLS mode is disabled. action %d declined.", |
| 14742 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14743 | |
| 14744 | return -ENOTSUPP; |
| 14745 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 14746 | |
| 14747 | if (vos_max_concurrent_connections_reached()) |
| 14748 | { |
| 14749 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 14750 | return -EINVAL; |
| 14751 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14752 | } |
| 14753 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14754 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 14755 | { |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 14756 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14757 | { |
| 14758 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14759 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14760 | " TDLS setup is ongoing. action %d declined.", |
| 14761 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 14762 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14763 | } |
| 14764 | } |
| 14765 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14766 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 14767 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14768 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14769 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 14770 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14771 | { |
| 14772 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 14773 | we return error code at 'add_station()'. Hence we have this |
| 14774 | check again in addtion to add_station(). |
| 14775 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14776 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14777 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14778 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14779 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14780 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 14781 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 14782 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 14783 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14784 | } |
| 14785 | else |
| 14786 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14787 | /* maximum reached. tweak to send error code to peer and return |
| 14788 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14789 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14790 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14791 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14792 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 14793 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 14794 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14795 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14796 | /* fall through to send setup resp with failure status |
| 14797 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14798 | } |
| 14799 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14800 | else |
| 14801 | { |
| 14802 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14803 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 14804 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14805 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14806 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14807 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 14808 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14809 | return -EPERM; |
| 14810 | } |
| 14811 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14812 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14813 | vos_mem_copy(peerMac, peer, 6); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14814 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14815 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 14816 | "%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] | 14817 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 14818 | action_code, dialog_token, status_code, len); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14819 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14820 | /*Except teardown responder will not be used so just make 0*/ |
| 14821 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14822 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14823 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14824 | |
| 14825 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14826 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14827 | |
| 14828 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 14829 | responder = pTdlsPeer->is_responder; |
| 14830 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14831 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14832 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 14833 | "%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] | 14834 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 14835 | dialog_token, status_code, len); |
| 14836 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14837 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14838 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14839 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14840 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 14841 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14842 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14843 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 14844 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14845 | { |
| 14846 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 14847 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14848 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14849 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14850 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 14851 | if (status != VOS_STATUS_SUCCESS) { |
| 14852 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
| 14853 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14854 | } |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14855 | if (SIR_MAC_TDLS_DIS_REQ != action_code) { |
| 14856 | if (0 != wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED)) { |
| 14857 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS capabilities")); |
| 14858 | } |
| 14859 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14860 | } |
| 14861 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14862 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 14863 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 14864 | { |
| 14865 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14866 | "%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] | 14867 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14868 | ret = -EBUSY; |
| 14869 | goto tx_failed; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14870 | } |
| 14871 | |
| 14872 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14873 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 14874 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14875 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 14876 | 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] | 14877 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14878 | if (VOS_STATUS_SUCCESS != status) |
| 14879 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14880 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14881 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14882 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14883 | ret = -EINVAL; |
| 14884 | goto tx_failed; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14885 | } |
| 14886 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14887 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 14888 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 14889 | |
| 14890 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14891 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14892 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 14893 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14894 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14895 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 14896 | |
| 14897 | if (pHddCtx->isLogpInProgress) |
| 14898 | { |
| 14899 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14900 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14901 | return -EAGAIN; |
| 14902 | } |
| 14903 | |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14904 | ret = -EINVAL; |
| 14905 | goto tx_failed; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14906 | } |
| 14907 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14908 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14909 | { |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14910 | ret = max_sta_failed; |
| 14911 | goto tx_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14912 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14913 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14914 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 14915 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14916 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE)) { |
| 14917 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 14918 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14919 | } |
| 14920 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 14921 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14922 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE)) { |
| 14923 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 14924 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14925 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14926 | |
| 14927 | return 0; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14928 | |
| 14929 | tx_failed: |
| 14930 | /* add_station will be called before sending TDLS_SETUP_REQ and |
| 14931 | * TDLS_SETUP_RSP and as part of add_station driver will enable |
| 14932 | * BMPS. NL80211_TDLS_DISABLE_LINK will be called if the tx of |
| 14933 | * TDLS_SETUP_REQ or TDLS_SETUP_RSP fails. BMPS will be enabled |
| 14934 | * as part of processing NL80211_TDLS_DISABLE_LINK. So need to |
| 14935 | * enable BMPS for TDLS_SETUP_REQ and TDLS_SETUP_RSP if tx fails. |
| 14936 | */ |
| 14937 | |
| 14938 | if ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 14939 | (SIR_MAC_TDLS_SETUP_RSP == action_code)) |
| 14940 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 14941 | return ret; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14942 | } |
| 14943 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14944 | #if TDLS_MGMT_VERSION2 |
| 14945 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 14946 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14947 | u16 status_code, u32 peer_capability, |
| 14948 | const u8 *buf, size_t len) |
| 14949 | #else |
| 14950 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 14951 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14952 | u16 status_code, const u8 *buf, size_t len) |
| 14953 | #endif |
| 14954 | { |
| 14955 | int ret; |
| 14956 | |
| 14957 | vos_ssr_protect(__func__); |
| 14958 | #if TDLS_MGMT_VERSION2 |
| 14959 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token, |
| 14960 | status_code, peer_capability, buf, len); |
| 14961 | #else |
| 14962 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token, |
| 14963 | status_code, buf, len); |
| 14964 | #endif |
| 14965 | vos_ssr_unprotect(__func__); |
| 14966 | |
| 14967 | return ret; |
| 14968 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14969 | |
| 14970 | int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter, |
| 14971 | u8 *peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14972 | tdls_req_params_t *tdls_peer_params, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14973 | cfg80211_exttdls_callback callback) |
| 14974 | { |
| 14975 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14976 | hddTdlsPeer_t *pTdlsPeer = NULL; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14977 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 14978 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14979 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14980 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 14981 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14982 | |
| 14983 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 14984 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 14985 | |
| 14986 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14987 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 14988 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 14989 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14990 | return -ENOTSUPP; |
| 14991 | } |
| 14992 | |
| 14993 | /* To cater the requirement of establishing the TDLS link |
| 14994 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 14995 | */ |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 14996 | mutex_lock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14997 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 14998 | if (pTdlsPeer == NULL) { |
| 14999 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15000 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 15001 | __func__, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 15002 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15003 | return -EINVAL; |
| 15004 | } |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 15005 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15006 | |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 15007 | /* check FW TDLS Off Channel capability */ |
| 15008 | if ((TRUE == sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)) && |
| 15009 | (NULL != tdls_peer_params)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15010 | { |
| 15011 | pTdlsPeer->peerParams.channel = tdls_peer_params->channel; |
| 15012 | pTdlsPeer->peerParams.global_operating_class = |
| 15013 | tdls_peer_params->global_operating_class; |
| 15014 | pTdlsPeer->peerParams.max_latency_ms = tdls_peer_params->max_latency_ms; |
| 15015 | pTdlsPeer->peerParams.min_bandwidth_kbps = |
| 15016 | tdls_peer_params->min_bandwidth_kbps; |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15017 | /* check configured channel is valid, non dfs and |
| 15018 | * not current operating channel */ |
| 15019 | if ((sme_IsTdlsOffChannelValid(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15020 | tdls_peer_params->channel)) && |
| 15021 | (pHddStaCtx) && |
| 15022 | (tdls_peer_params->channel != |
| 15023 | pHddStaCtx->conn_info.operationChannel)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15024 | { |
| 15025 | pTdlsPeer->isOffChannelConfigured = TRUE; |
| 15026 | } |
| 15027 | else |
| 15028 | { |
| 15029 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 15030 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15031 | "%s: Configured Tdls Off Channel is not valid", __func__); |
| 15032 | |
| 15033 | } |
| 15034 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15035 | "%s: tdls_off_channel %d isOffChannelConfigured %d " |
| 15036 | "current operating channel %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15037 | __func__, pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15038 | pTdlsPeer->isOffChannelConfigured, |
| 15039 | (pHddStaCtx ? pHddStaCtx->conn_info.operationChannel : 0)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15040 | } |
| 15041 | else |
| 15042 | { |
| 15043 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 15044 | "%s: TDLS off channel FW capability %d or " |
| 15045 | "Invalid TDLS Peer Params", __func__, |
| 15046 | sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15047 | } |
| 15048 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15049 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 15050 | |
| 15051 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15052 | " %s TDLS Add Force Peer Failed", |
| 15053 | __func__); |
| 15054 | return -EINVAL; |
| 15055 | } |
| 15056 | /*EXT TDLS*/ |
| 15057 | |
| 15058 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) { |
| 15059 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15060 | " %s TDLS set callback Failed", |
| 15061 | __func__); |
| 15062 | return -EINVAL; |
| 15063 | } |
| 15064 | |
| 15065 | return(0); |
| 15066 | |
| 15067 | } |
| 15068 | |
| 15069 | int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, u8 *peer) |
| 15070 | { |
| 15071 | |
| 15072 | hddTdlsPeer_t *pTdlsPeer; |
| 15073 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15074 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15075 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 15076 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15077 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 15078 | if (0 != wlan_hdd_validate_context(pHddCtx)) { |
| 15079 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is NULL")); |
| 15080 | return -EINVAL; |
| 15081 | } |
| 15082 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15083 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 15084 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 15085 | |
| 15086 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15087 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 15088 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 15089 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15090 | return -ENOTSUPP; |
| 15091 | } |
| 15092 | |
| 15093 | |
| 15094 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 15095 | |
| 15096 | if ( NULL == pTdlsPeer ) { |
| 15097 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
| 15098 | " peer not exsting", |
| 15099 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15100 | return -EINVAL; |
| 15101 | } |
| 15102 | else { |
| 15103 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 15104 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15105 | /* if channel switch is configured, reset |
| 15106 | the channel for this peer */ |
| 15107 | if (TRUE == pTdlsPeer->isOffChannelConfigured) |
| 15108 | { |
| 15109 | pTdlsPeer->peerParams.channel = 0; |
| 15110 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 15111 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15112 | } |
| 15113 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15114 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) { |
| 15115 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set force peer")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15116 | return -EINVAL; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15117 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15118 | |
| 15119 | /*EXT TDLS*/ |
| 15120 | |
| 15121 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) { |
| 15122 | |
| 15123 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15124 | " %s TDLS set callback Failed", |
| 15125 | __func__); |
| 15126 | return -EINVAL; |
| 15127 | } |
| 15128 | return(0); |
| 15129 | |
| 15130 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15131 | 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] | 15132 | u8 *peer, enum nl80211_tdls_operation oper) |
| 15133 | { |
| 15134 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15135 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15136 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15137 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15138 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15139 | ENTER(); |
| 15140 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 15141 | if (!pAdapter) { |
| 15142 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 15143 | return -EINVAL; |
| 15144 | } |
| 15145 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15146 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15147 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 15148 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15149 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15150 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15151 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 15152 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15153 | return -EINVAL; |
| 15154 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15155 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15156 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15157 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 15158 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15159 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 15160 | } |
| 15161 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15162 | |
| 15163 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15164 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15165 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15166 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15167 | "TDLS Disabled in INI (%d) OR not enabled in FW (%d) " |
| 15168 | "Cannot process TDLS commands", |
| 15169 | pHddCtx->cfg_ini->fEnableTDLSSupport, |
| 15170 | sme_IsFeatureSupportedByFW(TDLS)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15171 | return -ENOTSUPP; |
| 15172 | } |
| 15173 | |
| 15174 | switch (oper) { |
| 15175 | case NL80211_TDLS_ENABLE_LINK: |
| 15176 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15177 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15178 | long ret; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15179 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15180 | WLAN_STADescType staDesc; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15181 | tANI_U16 numCurrTdlsPeers = 0; |
| 15182 | hddTdlsPeer_t *connPeer = NULL; |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15183 | tANI_U8 suppChannelLen = 0; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15184 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15185 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15186 | memset(&staDesc, 0, sizeof(staDesc)); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15187 | if ( NULL == pTdlsPeer ) { |
| 15188 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 15189 | " (oper %d) not exsting. ignored", |
| 15190 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 15191 | return -EINVAL; |
| 15192 | } |
| 15193 | |
| 15194 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15195 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 15196 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 15197 | "NL80211_TDLS_ENABLE_LINK"); |
| 15198 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 15199 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 15200 | { |
| 15201 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 15202 | MAC_ADDRESS_STR " failed", |
| 15203 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 15204 | return -EINVAL; |
| 15205 | } |
| 15206 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 15207 | /* before starting tdls connection, set tdls |
| 15208 | * off channel established status to default value */ |
| 15209 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15210 | /* TDLS Off Channel, Disable tdls channel switch, |
| 15211 | when there are more than one tdls link */ |
| 15212 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 15213 | if (numCurrTdlsPeers == 2) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15214 | { |
| 15215 | /* get connected peer and send disable tdls off chan */ |
| 15216 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15217 | if ((connPeer) && |
| 15218 | (connPeer->isOffChannelSupported == TRUE) && |
| 15219 | (connPeer->isOffChannelConfigured == TRUE)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15220 | { |
| 15221 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15222 | "%s: More then one peer connected, Disable " |
| 15223 | "TDLS channel switch", __func__); |
| 15224 | |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15225 | connPeer->isOffChannelEstablished = FALSE; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15226 | ret = sme_SendTdlsChanSwitchReq( |
| 15227 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15228 | pAdapter->sessionId, |
| 15229 | connPeer->peerMac, |
| 15230 | connPeer->peerParams.channel, |
| 15231 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15232 | TDLS_CHANNEL_SWITCH_DISABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15233 | if (ret != VOS_STATUS_SUCCESS) { |
| 15234 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel request")); |
| 15235 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15236 | } |
| 15237 | else |
| 15238 | { |
| 15239 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15240 | "%s: No TDLS Connected Peer or " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15241 | "isOffChannelSupported %d " |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15242 | "isOffChannelConfigured %d", |
| 15243 | __func__, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15244 | (connPeer ? (connPeer->isOffChannelSupported) |
| 15245 | : -1), |
| 15246 | (connPeer ? (connPeer->isOffChannelConfigured) |
| 15247 | : -1)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15248 | } |
| 15249 | } |
| 15250 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15251 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15252 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15253 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 15254 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15255 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 15256 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15257 | 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] | 15258 | return -EINVAL; |
| 15259 | } |
| 15260 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15261 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15262 | ret = sme_SendTdlsLinkEstablishParams( |
| 15263 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15264 | pAdapter->sessionId, peer, |
| 15265 | &tdlsLinkEstablishParams); |
| 15266 | if (ret != VOS_STATUS_SUCCESS) { |
| 15267 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send link establishment params")); |
| 15268 | } |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15269 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 15270 | * register with the TL on after the response for this operation |
| 15271 | * is received . |
| 15272 | */ |
| 15273 | ret = wait_for_completion_interruptible_timeout( |
| 15274 | &pAdapter->tdls_link_establish_req_comp, |
| 15275 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 15276 | if (ret <= 0) |
| 15277 | { |
| 15278 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15279 | "%s: Link Establish Request Faled Status %ld", |
| 15280 | __func__, ret); |
| 15281 | return -EINVAL; |
| 15282 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15283 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15284 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 15285 | eTDLS_LINK_CONNECTED, |
| 15286 | eTDLS_LINK_SUCCESS); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15287 | staDesc.ucSTAId = pTdlsPeer->staId; |
| 15288 | staDesc.ucQosEnabled = tdlsLinkEstablishParams.qos; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15289 | ret = WLANTL_UpdateTdlsSTAClient( |
| 15290 | pHddCtx->pvosContext, |
| 15291 | &staDesc); |
| 15292 | if (ret != VOS_STATUS_SUCCESS) { |
| 15293 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to update TDLS STA params")); |
| 15294 | } |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15295 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 15296 | /* Mark TDLS client Authenticated .*/ |
| 15297 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 15298 | pTdlsPeer->staId, |
| 15299 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 15300 | if (VOS_STATUS_SUCCESS == status) |
| 15301 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15302 | if (pTdlsPeer->is_responder == 0) |
| 15303 | { |
| 15304 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 15305 | |
| 15306 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 15307 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 15308 | WAIT_TIME_TDLS_INITIATOR); |
| 15309 | /* suspend initiator TX until it receives direct packet from the |
| 15310 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15311 | ret = WLANTL_SuspendDataTx( |
| 15312 | (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 15313 | &staId, NULL); |
| 15314 | if (ret != VOS_STATUS_SUCCESS) { |
| 15315 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to suspend data tx")); |
| 15316 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15317 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15318 | |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15319 | if ((TRUE == pTdlsPeer->isOffChannelSupported) && |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15320 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15321 | { |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15322 | suppChannelLen = |
| 15323 | tdlsLinkEstablishParams.supportedChannelsLen; |
| 15324 | |
| 15325 | if ((suppChannelLen > 0) && |
| 15326 | (suppChannelLen <= SIR_MAC_MAX_SUPP_CHANNELS)) |
| 15327 | { |
| 15328 | tANI_U8 suppPeerChannel = 0; |
| 15329 | int i = 0; |
| 15330 | for (i = 0U; i < suppChannelLen; i++) |
| 15331 | { |
| 15332 | suppPeerChannel = |
| 15333 | tdlsLinkEstablishParams.supportedChannels[i]; |
| 15334 | |
| 15335 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 15336 | if (suppPeerChannel == |
| 15337 | pTdlsPeer->peerParams.channel) |
| 15338 | { |
| 15339 | pTdlsPeer->isOffChannelSupported = TRUE; |
| 15340 | break; |
| 15341 | } |
| 15342 | } |
| 15343 | } |
| 15344 | else |
| 15345 | { |
| 15346 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 15347 | } |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15348 | } |
| 15349 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15350 | "%s: TDLS channel switch request for channel " |
| 15351 | "%d isOffChannelConfigured %d suppChannelLen " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15352 | "%d isOffChannelSupported %d", __func__, |
| 15353 | pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15354 | pTdlsPeer->isOffChannelConfigured, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15355 | suppChannelLen, |
| 15356 | pTdlsPeer->isOffChannelSupported); |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15357 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15358 | /* TDLS Off Channel, Enable tdls channel switch, |
| 15359 | when their is only one tdls link and it supports */ |
| 15360 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15361 | if ((numCurrTdlsPeers == 1) && |
| 15362 | (TRUE == pTdlsPeer->isOffChannelSupported) && |
| 15363 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
| 15364 | { |
| 15365 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15366 | "%s: Send TDLS channel switch request for channel %d", |
| 15367 | __func__, pTdlsPeer->peerParams.channel); |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15368 | |
| 15369 | pTdlsPeer->isOffChannelEstablished = TRUE; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15370 | ret = sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15371 | pAdapter->sessionId, |
| 15372 | pTdlsPeer->peerMac, |
| 15373 | pTdlsPeer->peerParams.channel, |
| 15374 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15375 | TDLS_CHANNEL_SWITCH_ENABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15376 | if (ret != VOS_STATUS_SUCCESS) { |
| 15377 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS offchannel: Failed to send TDLS switch channel req")); |
| 15378 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15379 | } |
| 15380 | else |
| 15381 | { |
| 15382 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15383 | "%s: TDLS channel switch request not sent" |
| 15384 | " numCurrTdlsPeers %d " |
| 15385 | "isOffChannelSupported %d " |
| 15386 | "isOffChannelConfigured %d", |
| 15387 | __func__, numCurrTdlsPeers, |
| 15388 | pTdlsPeer->isOffChannelSupported, |
| 15389 | pTdlsPeer->isOffChannelConfigured); |
| 15390 | } |
| 15391 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 15392 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15393 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15394 | |
| 15395 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15396 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 15397 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15398 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15399 | int ac; |
| 15400 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 15401 | WLANTL_AC_VI, |
| 15402 | WLANTL_AC_BK, |
| 15403 | WLANTL_AC_BE }; |
| 15404 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 15405 | for(ac=0; ac < 4; ac++) |
| 15406 | { |
| 15407 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 15408 | pTdlsPeer->staId, ucAc[ac], |
| 15409 | tlTid[ac], tlTid[ac], 0, 0, |
| 15410 | WLANTL_BI_DIR ); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15411 | if (status != VOS_STATUS_SUCCESS) { |
| 15412 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to enable UAPSD for AC")); |
| 15413 | } |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15414 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15415 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15416 | } |
| 15417 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15418 | } |
| 15419 | break; |
| 15420 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15421 | { |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15422 | tANI_U16 numCurrTdlsPeers = 0; |
| 15423 | hddTdlsPeer_t *connPeer = NULL; |
| 15424 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15425 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 15426 | |
| 15427 | if ( NULL == pTdlsPeer ) { |
| 15428 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 15429 | " (oper %d) not exsting. ignored", |
| 15430 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 15431 | return -EINVAL; |
| 15432 | } |
| 15433 | |
| 15434 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15435 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 15436 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 15437 | "NL80211_TDLS_DISABLE_LINK"); |
| 15438 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15439 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15440 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15441 | long status; |
| 15442 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 15443 | /* set tdls off channel status to false for this peer */ |
| 15444 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 15445 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 15446 | eTDLS_LINK_TEARING, |
| 15447 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 15448 | eTDLS_LINK_UNSPECIFIED: |
| 15449 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15450 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 15451 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15452 | status = sme_DeleteTdlsPeerSta( |
| 15453 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15454 | pAdapter->sessionId, peer ); |
| 15455 | if (status != VOS_STATUS_SUCCESS) { |
| 15456 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 15457 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15458 | |
| 15459 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 15460 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 15461 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
Atul Mittal | 454664b | 2014-10-10 11:03:46 +0530 | [diff] [blame] | 15462 | eTDLS_LINK_IDLE, |
| 15463 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15464 | if (status <= 0) |
| 15465 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15466 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15467 | "%s: Del station failed status %ld", |
| 15468 | __func__, status); |
| 15469 | return -EPERM; |
| 15470 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15471 | |
| 15472 | /* TDLS Off Channel, Enable tdls channel switch, |
| 15473 | when their is only one tdls link and it supports */ |
| 15474 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15475 | if (numCurrTdlsPeers == 1) |
| 15476 | { |
| 15477 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
| 15478 | if ((connPeer) && |
| 15479 | (connPeer->isOffChannelSupported == TRUE) && |
| 15480 | (connPeer->isOffChannelConfigured == TRUE)) |
| 15481 | { |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15482 | connPeer->isOffChannelEstablished = TRUE; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15483 | status = sme_SendTdlsChanSwitchReq( |
| 15484 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15485 | pAdapter->sessionId, |
| 15486 | connPeer->peerMac, |
| 15487 | connPeer->peerParams.channel, |
| 15488 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15489 | TDLS_CHANNEL_SWITCH_ENABLE); |
| 15490 | if (status != VOS_STATUS_SUCCESS) { |
| 15491 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel req")); |
| 15492 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15493 | } |
| 15494 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15495 | "%s: TDLS channel switch " |
| 15496 | "isOffChannelSupported %d " |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15497 | "isOffChannelConfigured %d " |
| 15498 | "isOffChannelEstablished %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15499 | __func__, |
| 15500 | (connPeer ? connPeer->isOffChannelSupported : -1), |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15501 | (connPeer ? connPeer->isOffChannelConfigured : -1), |
| 15502 | (connPeer ? connPeer->isOffChannelEstablished : -1)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15503 | } |
| 15504 | else |
| 15505 | { |
| 15506 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15507 | "%s: TDLS channel switch request not sent " |
| 15508 | "numCurrTdlsPeers %d ", |
| 15509 | __func__, numCurrTdlsPeers); |
| 15510 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15511 | } |
| 15512 | else |
| 15513 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15514 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15515 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15516 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15517 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15518 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15519 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15520 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15521 | status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15522 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15523 | if (0 != status) |
| 15524 | { |
| 15525 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15526 | "%s: Error in TDLS Teardown", __func__); |
| 15527 | return status; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15528 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15529 | break; |
| 15530 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15531 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15532 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15533 | status = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 15534 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15535 | NULL, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15536 | NULL); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15537 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15538 | if (0 != status) |
| 15539 | { |
| 15540 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15541 | "%s: Error in TDLS Setup", __func__); |
| 15542 | return status; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 15543 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 15544 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15545 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15546 | case NL80211_TDLS_DISCOVERY_REQ: |
| 15547 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15548 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 15549 | "%s: We don't support in-driver setup/teardown/discovery " |
| 15550 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15551 | return -ENOTSUPP; |
| 15552 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15553 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15554 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15555 | return -ENOTSUPP; |
| 15556 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15557 | |
| 15558 | EXIT(); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15559 | return 0; |
| 15560 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15561 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15562 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
| 15563 | u8 *peer, enum nl80211_tdls_operation oper) |
| 15564 | { |
| 15565 | int ret; |
| 15566 | |
| 15567 | vos_ssr_protect(__func__); |
| 15568 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 15569 | vos_ssr_unprotect(__func__); |
| 15570 | |
| 15571 | return ret; |
| 15572 | } |
| 15573 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15574 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 15575 | struct net_device *dev, u8 *peer) |
| 15576 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 15577 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 15578 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 15579 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15580 | |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15581 | #if TDLS_MGMT_VERSION2 |
| 15582 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 15583 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 15584 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15585 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 15586 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15587 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15588 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15589 | #endif |
| 15590 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15591 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 15592 | /* |
| 15593 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 15594 | * Callback rountine called upon receiving response for |
| 15595 | * get offload info |
| 15596 | */ |
| 15597 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 15598 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 15599 | { |
| 15600 | |
| 15601 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15602 | tANI_U8 tempReplayCounter[8]; |
| 15603 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15604 | |
| 15605 | ENTER(); |
| 15606 | |
| 15607 | if (NULL == pAdapter) |
| 15608 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 15609 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15610 | "%s: HDD adapter is Null", __func__); |
| 15611 | return ; |
| 15612 | } |
| 15613 | |
| 15614 | if (NULL == pGtkOffloadGetInfoRsp) |
| 15615 | { |
| 15616 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15617 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 15618 | return ; |
| 15619 | } |
| 15620 | |
| 15621 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 15622 | { |
| 15623 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15624 | "%s: wlan Failed to get replay counter value", |
| 15625 | __func__); |
| 15626 | return ; |
| 15627 | } |
| 15628 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15629 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15630 | /* Update replay counter */ |
| 15631 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 15632 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 15633 | |
| 15634 | { |
| 15635 | /* changing from little to big endian since supplicant |
| 15636 | * works on big endian format |
| 15637 | */ |
| 15638 | int i; |
| 15639 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 15640 | |
| 15641 | for (i = 0; i < 8; i++) |
| 15642 | { |
| 15643 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 15644 | } |
| 15645 | } |
| 15646 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15647 | /* Update replay counter to NL */ |
| 15648 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15649 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15650 | } |
| 15651 | |
| 15652 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15653 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15654 | * This function is used to offload GTK rekeying job to the firmware. |
| 15655 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15656 | 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] | 15657 | struct cfg80211_gtk_rekey_data *data) |
| 15658 | { |
| 15659 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15660 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 15661 | hdd_station_ctx_t *pHddStaCtx; |
| 15662 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15663 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15664 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15665 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 15666 | |
| 15667 | ENTER(); |
| 15668 | |
| 15669 | if (NULL == pAdapter) |
| 15670 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15671 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15672 | "%s: HDD adapter is Null", __func__); |
| 15673 | return -ENODEV; |
| 15674 | } |
| 15675 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15676 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15677 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 15678 | pAdapter->sessionId, pAdapter->device_mode)); |
| 15679 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15680 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15681 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15682 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15683 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15684 | } |
| 15685 | |
| 15686 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15687 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 15688 | if (NULL == hHal) |
| 15689 | { |
| 15690 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15691 | "%s: HAL context is Null!!!", __func__); |
| 15692 | return -EAGAIN; |
| 15693 | } |
| 15694 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15695 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 15696 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 15697 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 15698 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15699 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15700 | { |
| 15701 | /* changing from big to little endian since driver |
| 15702 | * works on little endian format |
| 15703 | */ |
| 15704 | tANI_U8 *p = |
| 15705 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 15706 | int i; |
| 15707 | |
| 15708 | for (i = 0; i < 8; i++) |
| 15709 | { |
| 15710 | p[7-i] = data->replay_ctr[i]; |
| 15711 | } |
| 15712 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15713 | |
| 15714 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 15715 | { |
| 15716 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15717 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 15718 | sizeof (tSirGtkOffloadParams)); |
| 15719 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15720 | pAdapter->sessionId); |
| 15721 | |
| 15722 | if (eHAL_STATUS_SUCCESS != status) |
| 15723 | { |
| 15724 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15725 | "%s: sme_SetGTKOffload failed, returned %d", |
| 15726 | __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 15727 | |
| 15728 | /* Need to clear any trace of key value in the memory. |
| 15729 | * Thus zero out the memory even though it is local |
| 15730 | * variable. |
| 15731 | */ |
| 15732 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 15733 | sizeof(hddGtkOffloadReqParams)); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15734 | return status; |
| 15735 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15736 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15737 | "%s: sme_SetGTKOffload successfull", __func__); |
| 15738 | } |
| 15739 | else |
| 15740 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15741 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15742 | "%s: wlan not suspended GTKOffload request is stored", |
| 15743 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15744 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15745 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 15746 | /* Need to clear any trace of key value in the memory. |
| 15747 | * Thus zero out the memory even though it is local |
| 15748 | * variable. |
| 15749 | */ |
| 15750 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 15751 | sizeof(hddGtkOffloadReqParams)); |
| 15752 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15753 | EXIT(); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15754 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15755 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15756 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15757 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 15758 | struct cfg80211_gtk_rekey_data *data) |
| 15759 | { |
| 15760 | int ret; |
| 15761 | |
| 15762 | vos_ssr_protect(__func__); |
| 15763 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 15764 | vos_ssr_unprotect(__func__); |
| 15765 | |
| 15766 | return ret; |
| 15767 | } |
| 15768 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15769 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15770 | * FUNCTION: __wlan_hdd_cfg80211_set_mac_acl |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15771 | * This function is used to set access control policy |
| 15772 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15773 | static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 15774 | struct net_device *dev, |
| 15775 | const struct cfg80211_acl_data *params) |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15776 | { |
| 15777 | int i; |
| 15778 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15779 | hdd_hostapd_state_t *pHostapdState; |
| 15780 | tsap_Config_t *pConfig; |
| 15781 | v_CONTEXT_t pVosContext = NULL; |
| 15782 | hdd_context_t *pHddCtx; |
| 15783 | int status; |
| 15784 | |
| 15785 | ENTER(); |
| 15786 | |
| 15787 | if (NULL == pAdapter) |
| 15788 | { |
| 15789 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15790 | "%s: HDD adapter is Null", __func__); |
| 15791 | return -ENODEV; |
| 15792 | } |
| 15793 | |
| 15794 | if (NULL == params) |
| 15795 | { |
| 15796 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15797 | "%s: params is Null", __func__); |
| 15798 | return -EINVAL; |
| 15799 | } |
| 15800 | |
| 15801 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15802 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15803 | if (0 != status) |
| 15804 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15805 | return status; |
| 15806 | } |
| 15807 | |
| 15808 | pVosContext = pHddCtx->pvosContext; |
| 15809 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 15810 | |
| 15811 | if (NULL == pHostapdState) |
| 15812 | { |
| 15813 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15814 | "%s: pHostapdState is Null", __func__); |
| 15815 | return -EINVAL; |
| 15816 | } |
| 15817 | |
| 15818 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 15819 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
| 15820 | |
| 15821 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 15822 | { |
| 15823 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 15824 | |
| 15825 | /* default value */ |
| 15826 | pConfig->num_accept_mac = 0; |
| 15827 | pConfig->num_deny_mac = 0; |
| 15828 | |
| 15829 | /** |
| 15830 | * access control policy |
| 15831 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 15832 | * listed in hostapd.deny file. |
| 15833 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 15834 | * listed in hostapd.accept file. |
| 15835 | */ |
| 15836 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 15837 | { |
| 15838 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 15839 | } |
| 15840 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 15841 | { |
| 15842 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 15843 | } |
| 15844 | else |
| 15845 | { |
| 15846 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15847 | "%s:Acl Policy : %d is not supported", |
| 15848 | __func__, params->acl_policy); |
| 15849 | return -ENOTSUPP; |
| 15850 | } |
| 15851 | |
| 15852 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 15853 | { |
| 15854 | pConfig->num_accept_mac = params->n_acl_entries; |
| 15855 | for (i = 0; i < params->n_acl_entries; i++) |
| 15856 | { |
| 15857 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15858 | "** Add ACL MAC entry %i in WhiletList :" |
| 15859 | MAC_ADDRESS_STR, i, |
| 15860 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 15861 | |
| 15862 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 15863 | sizeof(qcmacaddr)); |
| 15864 | } |
| 15865 | } |
| 15866 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 15867 | { |
| 15868 | pConfig->num_deny_mac = params->n_acl_entries; |
| 15869 | for (i = 0; i < params->n_acl_entries; i++) |
| 15870 | { |
| 15871 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15872 | "** Add ACL MAC entry %i in BlackList :" |
| 15873 | MAC_ADDRESS_STR, i, |
| 15874 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 15875 | |
| 15876 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 15877 | sizeof(qcmacaddr)); |
| 15878 | } |
| 15879 | } |
| 15880 | |
| 15881 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 15882 | { |
| 15883 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15884 | "%s: SAP Set Mac Acl fail", __func__); |
| 15885 | return -EINVAL; |
| 15886 | } |
| 15887 | } |
| 15888 | else |
| 15889 | { |
| 15890 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15891 | "%s: Invalid device_mode = %s (%d)", |
| 15892 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 15893 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15894 | return -EINVAL; |
| 15895 | } |
| 15896 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15897 | EXIT(); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15898 | return 0; |
| 15899 | } |
| 15900 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15901 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 15902 | struct net_device *dev, |
| 15903 | const struct cfg80211_acl_data *params) |
| 15904 | { |
| 15905 | int ret; |
| 15906 | vos_ssr_protect(__func__); |
| 15907 | ret = __wlan_hdd_cfg80211_set_mac_acl(wiphy, dev, params); |
| 15908 | vos_ssr_unprotect(__func__); |
| 15909 | |
| 15910 | return ret; |
| 15911 | } |
| 15912 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15913 | #ifdef WLAN_NL80211_TESTMODE |
| 15914 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15915 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15916 | ( |
| 15917 | void *pAdapter, |
| 15918 | void *indCont |
| 15919 | ) |
| 15920 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15921 | tSirLPHBInd *lphbInd; |
| 15922 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15923 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15924 | |
| 15925 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15926 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15927 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15928 | if (pAdapter == NULL) |
| 15929 | { |
| 15930 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15931 | "%s: pAdapter is NULL\n",__func__); |
| 15932 | return; |
| 15933 | } |
| 15934 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15935 | if (NULL == indCont) |
| 15936 | { |
| 15937 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15938 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15939 | return; |
| 15940 | } |
| 15941 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15942 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15943 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15944 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15945 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15946 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15947 | GFP_ATOMIC); |
| 15948 | if (!skb) |
| 15949 | { |
| 15950 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15951 | "LPHB timeout, NL buffer alloc fail"); |
| 15952 | return; |
| 15953 | } |
| 15954 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15955 | 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] | 15956 | { |
| 15957 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15958 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 15959 | goto nla_put_failure; |
| 15960 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15961 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15962 | { |
| 15963 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15964 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 15965 | goto nla_put_failure; |
| 15966 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15967 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15968 | sizeof(tSirLPHBInd), lphbInd)) |
| 15969 | { |
| 15970 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15971 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 15972 | goto nla_put_failure; |
| 15973 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15974 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 15975 | return; |
| 15976 | |
| 15977 | nla_put_failure: |
| 15978 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15979 | "NLA Put fail"); |
| 15980 | kfree_skb(skb); |
| 15981 | |
| 15982 | return; |
| 15983 | } |
| 15984 | #endif /* FEATURE_WLAN_LPHB */ |
| 15985 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15986 | 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] | 15987 | { |
| 15988 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 15989 | int err = 0; |
| 15990 | #ifdef FEATURE_WLAN_LPHB |
| 15991 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15992 | eHalStatus smeStatus; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15993 | |
| 15994 | ENTER(); |
| 15995 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 15996 | err = wlan_hdd_validate_context(pHddCtx); |
| 15997 | if (0 != err) |
| 15998 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 15999 | return err; |
| 16000 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16001 | #endif /* FEATURE_WLAN_LPHB */ |
| 16002 | |
| 16003 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 16004 | if (err) |
| 16005 | { |
| 16006 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16007 | "%s Testmode INV ATTR", __func__); |
| 16008 | return err; |
| 16009 | } |
| 16010 | |
| 16011 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 16012 | { |
| 16013 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16014 | "%s Testmode INV CMD", __func__); |
| 16015 | return -EINVAL; |
| 16016 | } |
| 16017 | |
| 16018 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 16019 | { |
| 16020 | #ifdef FEATURE_WLAN_LPHB |
| 16021 | /* Low Power Heartbeat configuration request */ |
| 16022 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 16023 | { |
| 16024 | int buf_len; |
| 16025 | void *buf; |
| 16026 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 16027 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16028 | |
| 16029 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 16030 | { |
| 16031 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16032 | "%s Testmode INV DATA", __func__); |
| 16033 | return -EINVAL; |
| 16034 | } |
| 16035 | |
| 16036 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 16037 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 16038 | |
| 16039 | hb_params_temp =(tSirLPHBReq *)buf; |
| 16040 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 16041 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 16042 | return -EINVAL; |
| 16043 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16044 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 16045 | if (NULL == hb_params) |
| 16046 | { |
| 16047 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16048 | "%s Request Buffer Alloc Fail", __func__); |
| 16049 | return -EINVAL; |
| 16050 | } |
| 16051 | |
| 16052 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16053 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 16054 | hb_params, |
| 16055 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 16056 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16057 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16058 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16059 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16060 | vos_mem_free(hb_params); |
| 16061 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16062 | return 0; |
| 16063 | } |
| 16064 | #endif /* FEATURE_WLAN_LPHB */ |
| 16065 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 16066 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16067 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16068 | return -EOPNOTSUPP; |
| 16069 | } |
| 16070 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16071 | EXIT(); |
| 16072 | return err; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16073 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16074 | |
| 16075 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) |
| 16076 | { |
| 16077 | int ret; |
| 16078 | |
| 16079 | vos_ssr_protect(__func__); |
| 16080 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 16081 | vos_ssr_unprotect(__func__); |
| 16082 | |
| 16083 | return ret; |
| 16084 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16085 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 16086 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16087 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16088 | struct net_device *dev, |
| 16089 | int idx, struct survey_info *survey) |
| 16090 | { |
| 16091 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16092 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16093 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16094 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16095 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16096 | v_S7_t snr,rssi; |
| 16097 | int status, i, j, filled = 0; |
| 16098 | |
| 16099 | ENTER(); |
| 16100 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16101 | if (NULL == pAdapter) |
| 16102 | { |
| 16103 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 16104 | "%s: HDD adapter is Null", __func__); |
| 16105 | return -ENODEV; |
| 16106 | } |
| 16107 | |
| 16108 | if (NULL == wiphy) |
| 16109 | { |
| 16110 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 16111 | "%s: wiphy is Null", __func__); |
| 16112 | return -ENODEV; |
| 16113 | } |
| 16114 | |
| 16115 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16116 | status = wlan_hdd_validate_context(pHddCtx); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16117 | if (0 != status) |
| 16118 | { |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16119 | return status; |
| 16120 | } |
| 16121 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16122 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 16123 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16124 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16125 | 0 != pAdapter->survey_idx || |
| 16126 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16127 | { |
| 16128 | /* The survey dump ops when implemented completely is expected to |
| 16129 | * return a survey of all channels and the ops is called by the |
| 16130 | * kernel with incremental values of the argument 'idx' till it |
| 16131 | * returns -ENONET. But we can only support the survey for the |
| 16132 | * operating channel for now. survey_idx is used to track |
| 16133 | * that the ops is called only once and then return -ENONET for |
| 16134 | * the next iteration |
| 16135 | */ |
| 16136 | pAdapter->survey_idx = 0; |
| 16137 | return -ENONET; |
| 16138 | } |
| 16139 | |
| 16140 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16141 | |
| 16142 | wlan_hdd_get_snr(pAdapter, &snr); |
| 16143 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 16144 | |
| 16145 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 16146 | hdd_wlan_get_freq(channel, &freq); |
| 16147 | |
| 16148 | |
| 16149 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 16150 | { |
| 16151 | if (NULL == wiphy->bands[i]) |
| 16152 | { |
| 16153 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 16154 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 16155 | continue; |
| 16156 | } |
| 16157 | |
| 16158 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 16159 | { |
| 16160 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 16161 | |
| 16162 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 16163 | { |
| 16164 | survey->channel = &band->channels[j]; |
| 16165 | /* The Rx BDs contain SNR values in dB for the received frames |
| 16166 | * while the supplicant expects noise. So we calculate and |
| 16167 | * return the value of noise (dBm) |
| 16168 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 16169 | */ |
| 16170 | survey->noise = rssi - snr; |
| 16171 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 16172 | filled = 1; |
| 16173 | } |
| 16174 | } |
| 16175 | } |
| 16176 | |
| 16177 | if (filled) |
| 16178 | pAdapter->survey_idx = 1; |
| 16179 | else |
| 16180 | { |
| 16181 | pAdapter->survey_idx = 0; |
| 16182 | return -ENONET; |
| 16183 | } |
| 16184 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16185 | EXIT(); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16186 | return 0; |
| 16187 | } |
| 16188 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16189 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 16190 | struct net_device *dev, |
| 16191 | int idx, struct survey_info *survey) |
| 16192 | { |
| 16193 | int ret; |
| 16194 | |
| 16195 | vos_ssr_protect(__func__); |
| 16196 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 16197 | vos_ssr_unprotect(__func__); |
| 16198 | |
| 16199 | return ret; |
| 16200 | } |
| 16201 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16202 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16203 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16204 | * this is called when cfg80211 driver resume |
| 16205 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 16206 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16207 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16208 | { |
| 16209 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 16210 | hdd_adapter_t *pAdapter; |
| 16211 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 16212 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 16213 | |
| 16214 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16215 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16216 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16217 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16218 | return 0; |
| 16219 | } |
| 16220 | |
| 16221 | spin_lock(&pHddCtx->schedScan_lock); |
| 16222 | pHddCtx->isWiphySuspended = FALSE; |
| 16223 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 16224 | { |
| 16225 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16226 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16227 | "%s: Return resume is not due to PNO indication", __func__); |
| 16228 | return 0; |
| 16229 | } |
| 16230 | // Reset flag to avoid updatating cfg80211 data old results again |
| 16231 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 16232 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16233 | |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16234 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16235 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 16236 | |
| 16237 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 16238 | { |
| 16239 | pAdapter = pAdapterNode->pAdapter; |
| 16240 | if ( (NULL != pAdapter) && |
| 16241 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 16242 | { |
| 16243 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16244 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16245 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 16246 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16247 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16248 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16249 | { |
| 16250 | /* Acquire wakelock to handle the case where APP's tries to |
| 16251 | * suspend immediately after updating the scan results. Whis |
| 16252 | * results in app's is in suspended state and not able to |
| 16253 | * process the connect request to AP |
| 16254 | */ |
| 16255 | hdd_prevent_suspend_timeout(2000); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16256 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16257 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16258 | |
| 16259 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16260 | "%s : cfg80211 scan result database updated", __func__); |
| 16261 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16262 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16263 | return 0; |
| 16264 | |
| 16265 | } |
| 16266 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 16267 | pAdapterNode = pNext; |
| 16268 | } |
| 16269 | |
| 16270 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16271 | "%s: Failed to find Adapter", __func__); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16272 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16273 | return 0; |
| 16274 | } |
| 16275 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16276 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 16277 | { |
| 16278 | int ret; |
| 16279 | |
| 16280 | vos_ssr_protect(__func__); |
| 16281 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 16282 | vos_ssr_unprotect(__func__); |
| 16283 | |
| 16284 | return ret; |
| 16285 | } |
| 16286 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16287 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16288 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16289 | * this is called when cfg80211 driver suspends |
| 16290 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16291 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16292 | struct cfg80211_wowlan *wow) |
| 16293 | { |
| 16294 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16295 | int ret = 0; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16296 | |
| 16297 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16298 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16299 | ret = wlan_hdd_validate_context(pHddCtx); |
| 16300 | if (0 != ret) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16301 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16302 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16303 | } |
| 16304 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16305 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16306 | pHddCtx->isWiphySuspended = TRUE; |
| 16307 | |
| 16308 | EXIT(); |
| 16309 | |
| 16310 | return 0; |
| 16311 | } |
| 16312 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16313 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 16314 | struct cfg80211_wowlan *wow) |
| 16315 | { |
| 16316 | int ret; |
| 16317 | |
| 16318 | vos_ssr_protect(__func__); |
| 16319 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 16320 | vos_ssr_unprotect(__func__); |
| 16321 | |
| 16322 | return ret; |
| 16323 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16324 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16325 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16326 | { |
| 16327 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 16328 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 16329 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 16330 | .change_station = wlan_hdd_change_station, |
| 16331 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 16332 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 16333 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 16334 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16335 | #else |
| 16336 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 16337 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 16338 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16339 | #endif |
| 16340 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 16341 | .add_key = wlan_hdd_cfg80211_add_key, |
| 16342 | .get_key = wlan_hdd_cfg80211_get_key, |
| 16343 | .del_key = wlan_hdd_cfg80211_del_key, |
| 16344 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 16345 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16346 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 16347 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16348 | .scan = wlan_hdd_cfg80211_scan, |
| 16349 | .connect = wlan_hdd_cfg80211_connect, |
| 16350 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 16351 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 16352 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 16353 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 16354 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 16355 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16356 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 16357 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 16358 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16359 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 16360 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 16361 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 16362 | .set_txq_params = wlan_hdd_set_txq_params, |
| 16363 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16364 | .get_station = wlan_hdd_cfg80211_get_station, |
| 16365 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 16366 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16367 | .add_station = wlan_hdd_cfg80211_add_station, |
| 16368 | #ifdef FEATURE_WLAN_LFR |
| 16369 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 16370 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 16371 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 16372 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16373 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 16374 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 16375 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16376 | #ifdef FEATURE_WLAN_TDLS |
| 16377 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 16378 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 16379 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16380 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 16381 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 16382 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16383 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 16384 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 16385 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 16386 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16387 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 16388 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16389 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16390 | #ifdef WLAN_NL80211_TESTMODE |
| 16391 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 16392 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16393 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16394 | }; |
| 16395 | |