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) |
Katya Nigam | e7b69a8 | 2015-04-28 15:24:06 +0530 | [diff] [blame] | 5786 | | BIT(NL80211_IFTYPE_AP) |
| 5787 | | BIT(NL80211_IFTYPE_MONITOR); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5788 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5789 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5790 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5791 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 5792 | if( pCfg->enableMCC ) |
| 5793 | { |
| 5794 | /* Currently, supports up to two channels */ |
| 5795 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5796 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5797 | if( !pCfg->allowMCCGODiffBI ) |
| 5798 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5799 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5800 | } |
| 5801 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 5802 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5803 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5804 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5805 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5806 | /* Before registering we need to update the ht capabilitied based |
| 5807 | * on ini values*/ |
| 5808 | if( !pCfg->ShortGI20MhzEnable ) |
| 5809 | { |
| 5810 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5811 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5812 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5813 | } |
| 5814 | |
| 5815 | if( !pCfg->ShortGI40MhzEnable ) |
| 5816 | { |
| 5817 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 5818 | } |
| 5819 | |
| 5820 | if( !pCfg->nChannelBondingMode5GHz ) |
| 5821 | { |
| 5822 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 5823 | } |
| 5824 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5825 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 5826 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 5827 | { |
| 5828 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 5829 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5830 | |
| 5831 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 5832 | { |
| 5833 | |
| 5834 | if (NULL == wiphy->bands[i]) |
| 5835 | { |
| 5836 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 5837 | __func__, i); |
| 5838 | continue; |
| 5839 | } |
| 5840 | |
| 5841 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 5842 | { |
| 5843 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 5844 | |
| 5845 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 5846 | { |
| 5847 | // Enable social channels for P2P |
| 5848 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 5849 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 5850 | else |
| 5851 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5852 | continue; |
| 5853 | } |
| 5854 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 5855 | { |
| 5856 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5857 | continue; |
| 5858 | } |
| 5859 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5860 | } |
| 5861 | /*Initialise the supported cipher suite details*/ |
| 5862 | wiphy->cipher_suites = hdd_cipher_suites; |
| 5863 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 5864 | |
| 5865 | /*signal strength in mBm (100*dBm) */ |
| 5866 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 5867 | |
| 5868 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 5869 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5870 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5871 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5872 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 5873 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5874 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 5875 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 5876 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5877 | EXIT(); |
| 5878 | return 0; |
| 5879 | } |
| 5880 | |
| 5881 | /* In this function we are registering wiphy. */ |
| 5882 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 5883 | { |
| 5884 | ENTER(); |
| 5885 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5886 | if (0 > wiphy_register(wiphy)) |
| 5887 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5888 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5889 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 5890 | return -EIO; |
| 5891 | } |
| 5892 | |
| 5893 | EXIT(); |
| 5894 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5895 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5896 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5897 | /* In this function we are updating channel list when, |
| 5898 | regulatory domain is FCC and country code is US. |
| 5899 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 5900 | As per FCC smart phone is not a indoor device. |
| 5901 | GO should not opeate on indoor channels */ |
| 5902 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 5903 | { |
| 5904 | int j; |
| 5905 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5906 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 5907 | //Default counrtycode from NV at the time of wiphy initialization. |
| 5908 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 5909 | &defaultCountryCode[0])) |
| 5910 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 5911 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5912 | } |
| 5913 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 5914 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5915 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 5916 | { |
| 5917 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 5918 | return; |
| 5919 | } |
| 5920 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 5921 | { |
| 5922 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 5923 | // Mark UNII -1 band channel as passive |
| 5924 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 5925 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 5926 | } |
| 5927 | } |
| 5928 | } |
| 5929 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 5930 | /* This function registers for all frame which supplicant is interested in */ |
| 5931 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5932 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5933 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5934 | /* Register for all P2P action, public action etc frames */ |
| 5935 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 5936 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5937 | ENTER(); |
| 5938 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5939 | /* Right now we are registering these frame when driver is getting |
| 5940 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 5941 | frame register ops, we will move this code as a part of that */ |
| 5942 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5943 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5944 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 5945 | |
| 5946 | /* GAS Initial Response */ |
| 5947 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5948 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5949 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5950 | /* GAS Comeback Request */ |
| 5951 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5952 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 5953 | |
| 5954 | /* GAS Comeback Response */ |
| 5955 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5956 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 5957 | |
| 5958 | /* P2P Public Action */ |
| 5959 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5960 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5961 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 5962 | |
| 5963 | /* P2P Action */ |
| 5964 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5965 | (v_U8_t*)P2P_ACTION_FRAME, |
| 5966 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5967 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 5968 | /* WNM BSS Transition Request frame */ |
| 5969 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5970 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 5971 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 5972 | |
| 5973 | /* WNM-Notification */ |
| 5974 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5975 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 5976 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5977 | } |
| 5978 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 5979 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5980 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5981 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5982 | /* Register for all P2P action, public action etc frames */ |
| 5983 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 5984 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5985 | ENTER(); |
| 5986 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5987 | /* Right now we are registering these frame when driver is getting |
| 5988 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 5989 | frame register ops, we will move this code as a part of that */ |
| 5990 | /* GAS Initial Request */ |
| 5991 | |
| 5992 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5993 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 5994 | |
| 5995 | /* GAS Initial Response */ |
| 5996 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5997 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5998 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5999 | /* GAS Comeback Request */ |
| 6000 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6001 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 6002 | |
| 6003 | /* GAS Comeback Response */ |
| 6004 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6005 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 6006 | |
| 6007 | /* P2P Public Action */ |
| 6008 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6009 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6010 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 6011 | |
| 6012 | /* P2P Action */ |
| 6013 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6014 | (v_U8_t*)P2P_ACTION_FRAME, |
| 6015 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 6016 | /* WNM-Notification */ |
| 6017 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6018 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 6019 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6020 | } |
| 6021 | |
| 6022 | #ifdef FEATURE_WLAN_WAPI |
| 6023 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
| 6024 | const u8 *mac_addr, u8 *key , int key_Len) |
| 6025 | { |
| 6026 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6027 | tCsrRoamSetKey setKey; |
| 6028 | v_BOOL_t isConnected = TRUE; |
| 6029 | int status = 0; |
| 6030 | v_U32_t roamId= 0xFF; |
| 6031 | tANI_U8 *pKeyPtr = NULL; |
| 6032 | int n = 0; |
| 6033 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6034 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 6035 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6036 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6037 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 6038 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6039 | setKey.keyId = key_index; // Store Key ID |
| 6040 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 6041 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 6042 | setKey.paeRole = 0 ; // the PAE role |
| 6043 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 6044 | { |
| 6045 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 6046 | } |
| 6047 | else |
| 6048 | { |
| 6049 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 6050 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 6051 | } |
| 6052 | setKey.keyLength = key_Len; |
| 6053 | pKeyPtr = setKey.Key; |
| 6054 | memcpy( pKeyPtr, key, key_Len); |
| 6055 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6056 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6057 | __func__, key_Len); |
| 6058 | for (n = 0 ; n < key_Len; n++) |
| 6059 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 6060 | __func__,n,setKey.Key[n]); |
| 6061 | |
| 6062 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 6063 | if ( isConnected ) |
| 6064 | { |
| 6065 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6066 | pAdapter->sessionId, &setKey, &roamId ); |
| 6067 | } |
| 6068 | if ( status != 0 ) |
| 6069 | { |
| 6070 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6071 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 6072 | __LINE__, status ); |
| 6073 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 6074 | } |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 6075 | /* Need to clear any trace of key value in the memory. |
| 6076 | * Thus zero out the memory even though it is local |
| 6077 | * variable. |
| 6078 | */ |
| 6079 | vos_mem_zero(&setKey, sizeof(setKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6080 | } |
| 6081 | #endif /* FEATURE_WLAN_WAPI*/ |
| 6082 | |
| 6083 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6084 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6085 | beacon_data_t **ppBeacon, |
| 6086 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6087 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6088 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6089 | beacon_data_t **ppBeacon, |
| 6090 | struct cfg80211_beacon_data *params, |
| 6091 | int dtim_period) |
| 6092 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6093 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6094 | int size; |
| 6095 | beacon_data_t *beacon = NULL; |
| 6096 | beacon_data_t *old = NULL; |
| 6097 | int head_len,tail_len; |
| 6098 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6099 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6100 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6101 | { |
| 6102 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6103 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6104 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6105 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6106 | |
| 6107 | old = pAdapter->sessionCtx.ap.beacon; |
| 6108 | |
| 6109 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6110 | { |
| 6111 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6112 | FL("session(%d) old and new heads points to NULL"), |
| 6113 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6114 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6115 | } |
| 6116 | |
| 6117 | if (params->tail && !params->tail_len) |
| 6118 | { |
| 6119 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6120 | FL("tail_len is zero but tail is not NULL")); |
| 6121 | return -EINVAL; |
| 6122 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6123 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6124 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 6125 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 6126 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6127 | { |
| 6128 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6129 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6130 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6131 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6132 | #endif |
| 6133 | |
| 6134 | if(params->head) |
| 6135 | head_len = params->head_len; |
| 6136 | else |
| 6137 | head_len = old->head_len; |
| 6138 | |
| 6139 | if(params->tail || !old) |
| 6140 | tail_len = params->tail_len; |
| 6141 | else |
| 6142 | tail_len = old->tail_len; |
| 6143 | |
| 6144 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 6145 | |
| 6146 | beacon = kzalloc(size, GFP_KERNEL); |
| 6147 | |
| 6148 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6149 | { |
| 6150 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6151 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6152 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6153 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6154 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6155 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6156 | if(params->dtim_period || !old ) |
| 6157 | beacon->dtim_period = params->dtim_period; |
| 6158 | else |
| 6159 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6160 | #else |
| 6161 | if(dtim_period || !old ) |
| 6162 | beacon->dtim_period = dtim_period; |
| 6163 | else |
| 6164 | beacon->dtim_period = old->dtim_period; |
| 6165 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6166 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6167 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 6168 | beacon->tail = beacon->head + head_len; |
| 6169 | beacon->head_len = head_len; |
| 6170 | beacon->tail_len = tail_len; |
| 6171 | |
| 6172 | if(params->head) { |
| 6173 | memcpy (beacon->head,params->head,beacon->head_len); |
| 6174 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6175 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6176 | if(old) |
| 6177 | memcpy (beacon->head,old->head,beacon->head_len); |
| 6178 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6179 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6180 | if(params->tail) { |
| 6181 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 6182 | } |
| 6183 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6184 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6185 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 6186 | } |
| 6187 | |
| 6188 | *ppBeacon = beacon; |
| 6189 | |
| 6190 | kfree(old); |
| 6191 | |
| 6192 | return 0; |
| 6193 | |
| 6194 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6195 | |
| 6196 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid) |
| 6197 | { |
| 6198 | int left = length; |
| 6199 | v_U8_t *ptr = pIes; |
| 6200 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6201 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6202 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6203 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6204 | elem_id = ptr[0]; |
| 6205 | elem_len = ptr[1]; |
| 6206 | left -= 2; |
| 6207 | if(elem_len > left) |
| 6208 | { |
| 6209 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 6210 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6211 | eid,elem_len,left); |
| 6212 | return NULL; |
| 6213 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6214 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6215 | { |
| 6216 | return ptr; |
| 6217 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6218 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6219 | left -= elem_len; |
| 6220 | ptr += (elem_len + 2); |
| 6221 | } |
| 6222 | return NULL; |
| 6223 | } |
| 6224 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6225 | /* Check if rate is 11g rate or not */ |
| 6226 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 6227 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 6228 | 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] | 6229 | u8 i; |
| 6230 | for (i = 0; i < 8; i++) |
| 6231 | { |
| 6232 | if(rate == gRateArray[i]) |
| 6233 | return TRUE; |
| 6234 | } |
| 6235 | return FALSE; |
| 6236 | } |
| 6237 | |
| 6238 | /* Check for 11g rate and set proper 11g only mode */ |
| 6239 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 6240 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 6241 | { |
| 6242 | u8 i, num_rates = pIe[0]; |
| 6243 | |
| 6244 | pIe += 1; |
| 6245 | for ( i = 0; i < num_rates; i++) |
| 6246 | { |
| 6247 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 6248 | { |
| 6249 | /* If rate set have 11g rate than change the mode to 11G */ |
| 6250 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 6251 | if (pIe[i] & BASIC_RATE_MASK) |
| 6252 | { |
| 6253 | /* If we have 11g rate as basic rate, it means mode |
| 6254 | is 11g only mode. |
| 6255 | */ |
| 6256 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 6257 | *pCheckRatesfor11g = FALSE; |
| 6258 | } |
| 6259 | } |
| 6260 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 6261 | { |
| 6262 | *require_ht = TRUE; |
| 6263 | } |
| 6264 | } |
| 6265 | return; |
| 6266 | } |
| 6267 | |
| 6268 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 6269 | { |
| 6270 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 6271 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6272 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 6273 | u8 checkRatesfor11g = TRUE; |
| 6274 | u8 require_ht = FALSE; |
| 6275 | u8 *pIe=NULL; |
| 6276 | |
| 6277 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 6278 | |
| 6279 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 6280 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 6281 | if (pIe != NULL) |
| 6282 | { |
| 6283 | pIe += 1; |
| 6284 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 6285 | &pConfig->SapHw_mode); |
| 6286 | } |
| 6287 | |
| 6288 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 6289 | WLAN_EID_EXT_SUPP_RATES); |
| 6290 | if (pIe != NULL) |
| 6291 | { |
| 6292 | |
| 6293 | pIe += 1; |
| 6294 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 6295 | &pConfig->SapHw_mode); |
| 6296 | } |
| 6297 | |
| 6298 | if( pConfig->channel > 14 ) |
| 6299 | { |
| 6300 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 6301 | } |
| 6302 | |
| 6303 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 6304 | WLAN_EID_HT_CAPABILITY); |
| 6305 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6306 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6307 | { |
| 6308 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 6309 | if(require_ht) |
| 6310 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 6311 | } |
| 6312 | } |
| 6313 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6314 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 6315 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 6316 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6317 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6318 | v_U8_t *pIe = NULL; |
| 6319 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6320 | |
| 6321 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 6322 | pBeacon->tail, pBeacon->tail_len); |
| 6323 | |
| 6324 | if (pIe) |
| 6325 | { |
| 6326 | ielen = pIe[1] + 2; |
| 6327 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 6328 | { |
| 6329 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 6330 | } |
| 6331 | else |
| 6332 | { |
| 6333 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 6334 | return -EINVAL; |
| 6335 | } |
| 6336 | *total_ielen += ielen; |
| 6337 | } |
| 6338 | return 0; |
| 6339 | } |
| 6340 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6341 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 6342 | v_U8_t *genie, v_U8_t *total_ielen) |
| 6343 | { |
| 6344 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6345 | int left = pBeacon->tail_len; |
| 6346 | v_U8_t *ptr = pBeacon->tail; |
| 6347 | v_U8_t elem_id, elem_len; |
| 6348 | v_U16_t ielen = 0; |
| 6349 | |
| 6350 | if ( NULL == ptr || 0 == left ) |
| 6351 | return; |
| 6352 | |
| 6353 | while (left >= 2) |
| 6354 | { |
| 6355 | elem_id = ptr[0]; |
| 6356 | elem_len = ptr[1]; |
| 6357 | left -= 2; |
| 6358 | if (elem_len > left) |
| 6359 | { |
| 6360 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 6361 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 6362 | elem_id, elem_len, left); |
| 6363 | return; |
| 6364 | } |
| 6365 | if (IE_EID_VENDOR == elem_id) |
| 6366 | { |
| 6367 | /* skipping the VSIE's which we don't want to include or |
| 6368 | * it will be included by existing code |
| 6369 | */ |
| 6370 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 6371 | #ifdef WLAN_FEATURE_WFD |
| 6372 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 6373 | #endif |
| 6374 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6375 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6376 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 6377 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6378 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 6379 | { |
| 6380 | ielen = ptr[1] + 2; |
| 6381 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 6382 | { |
| 6383 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 6384 | *total_ielen += ielen; |
| 6385 | } |
| 6386 | else |
| 6387 | { |
| 6388 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 6389 | "IE Length is too big " |
| 6390 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 6391 | elem_id, elem_len, *total_ielen); |
| 6392 | } |
| 6393 | } |
| 6394 | } |
| 6395 | |
| 6396 | left -= elem_len; |
| 6397 | ptr += (elem_len + 2); |
| 6398 | } |
| 6399 | return; |
| 6400 | } |
| 6401 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6402 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6403 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 6404 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6405 | #else |
| 6406 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 6407 | struct cfg80211_beacon_data *params) |
| 6408 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6409 | { |
| 6410 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6411 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6412 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6413 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6414 | |
| 6415 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 6416 | |
| 6417 | if(genie == NULL) { |
| 6418 | |
| 6419 | return -ENOMEM; |
| 6420 | } |
| 6421 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6422 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6423 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6424 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6425 | hddLog(LOGE, |
| 6426 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6427 | ret = -EINVAL; |
| 6428 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6429 | } |
| 6430 | |
| 6431 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6432 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6433 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 6434 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6435 | hddLog(LOGE, |
| 6436 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6437 | ret = -EINVAL; |
| 6438 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6439 | } |
| 6440 | #endif |
| 6441 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6442 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6443 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6444 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6445 | hddLog(LOGE, |
| 6446 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6447 | ret = -EINVAL; |
| 6448 | goto done; |
| 6449 | } |
| 6450 | |
| 6451 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 6452 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6453 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6454 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6455 | |
| 6456 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6457 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 6458 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 6459 | { |
| 6460 | hddLog(LOGE, |
| 6461 | "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] | 6462 | ret = -EINVAL; |
| 6463 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6464 | } |
| 6465 | |
| 6466 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6467 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 6468 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6469 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6470 | ==eHAL_STATUS_FAILURE) |
| 6471 | { |
| 6472 | hddLog(LOGE, |
| 6473 | "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] | 6474 | ret = -EINVAL; |
| 6475 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6476 | } |
| 6477 | |
| 6478 | // Added for ProResp IE |
| 6479 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 6480 | { |
| 6481 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 6482 | u8 probe_rsp_ie_len[3] = {0}; |
| 6483 | u8 counter = 0; |
| 6484 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 6485 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 6486 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 6487 | Store More then 255 bytes into One Variable. |
| 6488 | */ |
| 6489 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 6490 | { |
| 6491 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 6492 | { |
| 6493 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 6494 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 6495 | } |
| 6496 | else |
| 6497 | { |
| 6498 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 6499 | rem_probe_resp_ie_len = 0; |
| 6500 | } |
| 6501 | } |
| 6502 | |
| 6503 | rem_probe_resp_ie_len = 0; |
| 6504 | |
| 6505 | if (probe_rsp_ie_len[0] > 0) |
| 6506 | { |
| 6507 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6508 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 6509 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6510 | probe_rsp_ie_len[0], NULL, |
| 6511 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6512 | { |
| 6513 | hddLog(LOGE, |
| 6514 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6515 | ret = -EINVAL; |
| 6516 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6517 | } |
| 6518 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 6519 | } |
| 6520 | |
| 6521 | if (probe_rsp_ie_len[1] > 0) |
| 6522 | { |
| 6523 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6524 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 6525 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6526 | probe_rsp_ie_len[1], NULL, |
| 6527 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6528 | { |
| 6529 | hddLog(LOGE, |
| 6530 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6531 | ret = -EINVAL; |
| 6532 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6533 | } |
| 6534 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 6535 | } |
| 6536 | |
| 6537 | if (probe_rsp_ie_len[2] > 0) |
| 6538 | { |
| 6539 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6540 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 6541 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6542 | probe_rsp_ie_len[2], NULL, |
| 6543 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6544 | { |
| 6545 | hddLog(LOGE, |
| 6546 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6547 | ret = -EINVAL; |
| 6548 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6549 | } |
| 6550 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 6551 | } |
| 6552 | |
| 6553 | if (probe_rsp_ie_len[1] == 0 ) |
| 6554 | { |
| 6555 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6556 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 6557 | eANI_BOOLEAN_FALSE) ) |
| 6558 | { |
| 6559 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6560 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6561 | } |
| 6562 | } |
| 6563 | |
| 6564 | if (probe_rsp_ie_len[2] == 0 ) |
| 6565 | { |
| 6566 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6567 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 6568 | eANI_BOOLEAN_FALSE) ) |
| 6569 | { |
| 6570 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6571 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6572 | } |
| 6573 | } |
| 6574 | |
| 6575 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6576 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 6577 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6578 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6579 | == eHAL_STATUS_FAILURE) |
| 6580 | { |
| 6581 | hddLog(LOGE, |
| 6582 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6583 | ret = -EINVAL; |
| 6584 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6585 | } |
| 6586 | } |
| 6587 | else |
| 6588 | { |
| 6589 | // Reset WNI_CFG_PROBE_RSP Flags |
| 6590 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 6591 | |
| 6592 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6593 | "%s: No Probe Response IE received in set beacon", |
| 6594 | __func__); |
| 6595 | } |
| 6596 | |
| 6597 | // Added for AssocResp IE |
| 6598 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 6599 | { |
| 6600 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6601 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 6602 | params->assocresp_ies_len, NULL, |
| 6603 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6604 | { |
| 6605 | hddLog(LOGE, |
| 6606 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6607 | ret = -EINVAL; |
| 6608 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6609 | } |
| 6610 | |
| 6611 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6612 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 6613 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6614 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6615 | == eHAL_STATUS_FAILURE) |
| 6616 | { |
| 6617 | hddLog(LOGE, |
| 6618 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6619 | ret = -EINVAL; |
| 6620 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6621 | } |
| 6622 | } |
| 6623 | else |
| 6624 | { |
| 6625 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6626 | "%s: No Assoc Response IE received in set beacon", |
| 6627 | __func__); |
| 6628 | |
| 6629 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6630 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 6631 | eANI_BOOLEAN_FALSE) ) |
| 6632 | { |
| 6633 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6634 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6635 | } |
| 6636 | } |
| 6637 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6638 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6639 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6640 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6641 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6642 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6643 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6644 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 6645 | * called by wlan_hdd_cfg80211_start_bss() and |
| 6646 | * wlan_hdd_cfg80211_set_channel() |
| 6647 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6648 | * channel list. |
| 6649 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 6650 | 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] | 6651 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6652 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6653 | v_U32_t num_ch = 0; |
| 6654 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 6655 | u32 indx = 0; |
| 6656 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6657 | v_U8_t fValidChannel = FALSE, count = 0; |
| 6658 | 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] | 6659 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6660 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6661 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6662 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6663 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6664 | /* Validate the channel */ |
| 6665 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6666 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6667 | if ( channel == rfChannels[count].channelNum ) |
| 6668 | { |
| 6669 | fValidChannel = TRUE; |
| 6670 | break; |
| 6671 | } |
| 6672 | } |
| 6673 | if (fValidChannel != TRUE) |
| 6674 | { |
| 6675 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6676 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6677 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6678 | } |
| 6679 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6680 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6681 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6682 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 6683 | valid_ch, &num_ch)) |
| 6684 | { |
| 6685 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6686 | "%s: failed to get valid channel list", __func__); |
| 6687 | return VOS_STATUS_E_FAILURE; |
| 6688 | } |
| 6689 | for (indx = 0; indx < num_ch; indx++) |
| 6690 | { |
| 6691 | if (channel == valid_ch[indx]) |
| 6692 | { |
| 6693 | break; |
| 6694 | } |
| 6695 | } |
| 6696 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6697 | if (indx >= num_ch) |
| 6698 | { |
| 6699 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6700 | { |
| 6701 | eCsrBand band; |
| 6702 | unsigned int freq; |
| 6703 | |
| 6704 | sme_GetFreqBand(hHal, &band); |
| 6705 | |
| 6706 | if (eCSR_BAND_5G == band) |
| 6707 | { |
| 6708 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 6709 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 6710 | { |
| 6711 | freq = ieee80211_channel_to_frequency(channel, |
| 6712 | IEEE80211_BAND_2GHZ); |
| 6713 | } |
| 6714 | else |
| 6715 | { |
| 6716 | freq = ieee80211_channel_to_frequency(channel, |
| 6717 | IEEE80211_BAND_5GHZ); |
| 6718 | } |
| 6719 | #else |
| 6720 | freq = ieee80211_channel_to_frequency(channel); |
| 6721 | #endif |
| 6722 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 6723 | return VOS_STATUS_SUCCESS; |
| 6724 | } |
| 6725 | } |
| 6726 | |
| 6727 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6728 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6729 | return VOS_STATUS_E_FAILURE; |
| 6730 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6731 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6732 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6733 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6734 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6735 | } |
| 6736 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6737 | /** |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6738 | * FUNCTION: __wlan_hdd_cfg80211_set_channel |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6739 | * This function is used to set the channel number |
| 6740 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6741 | 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] | 6742 | struct ieee80211_channel *chan, |
| 6743 | enum nl80211_channel_type channel_type |
| 6744 | ) |
| 6745 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6746 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6747 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6748 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6749 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6750 | hdd_context_t *pHddCtx; |
| 6751 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6752 | |
| 6753 | ENTER(); |
| 6754 | |
| 6755 | if( NULL == dev ) |
| 6756 | { |
| 6757 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6758 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6759 | return -ENODEV; |
| 6760 | } |
| 6761 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6762 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6763 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6764 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 6765 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6766 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6767 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 6768 | hdd_device_modetoString(pAdapter->device_mode), |
| 6769 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6770 | |
| 6771 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6772 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6773 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6774 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6775 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6776 | } |
| 6777 | |
| 6778 | /* |
| 6779 | * Do freq to chan conversion |
| 6780 | * TODO: for 11a |
| 6781 | */ |
| 6782 | |
| 6783 | channel = ieee80211_frequency_to_channel(freq); |
| 6784 | |
| 6785 | /* Check freq range */ |
| 6786 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 6787 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 6788 | { |
| 6789 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6790 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6791 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 6792 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 6793 | return -EINVAL; |
| 6794 | } |
| 6795 | |
| 6796 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6797 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 6798 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 6799 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6800 | { |
| 6801 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6802 | { |
| 6803 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6804 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6805 | return -EINVAL; |
| 6806 | } |
| 6807 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 6808 | "%s: set channel to [%d] for device mode =%d", |
| 6809 | __func__, channel,pAdapter->device_mode); |
| 6810 | } |
| 6811 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6812 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6813 | ) |
| 6814 | { |
| 6815 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6816 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 6817 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6818 | |
| 6819 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 6820 | { |
| 6821 | /* Link is up then return cant set channel*/ |
| 6822 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6823 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6824 | return -EINVAL; |
| 6825 | } |
| 6826 | |
| 6827 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 6828 | pHddStaCtx->conn_info.operationChannel = channel; |
| 6829 | pRoamProfile->ChannelInfo.ChannelList = |
| 6830 | &pHddStaCtx->conn_info.operationChannel; |
| 6831 | } |
| 6832 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6833 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6834 | ) |
| 6835 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6836 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6837 | { |
| 6838 | if(VOS_STATUS_SUCCESS != |
| 6839 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6840 | { |
| 6841 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6842 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6843 | return -EINVAL; |
| 6844 | } |
| 6845 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 6846 | } |
| 6847 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6848 | { |
| 6849 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 6850 | |
| 6851 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 6852 | channel set by supplicant |
| 6853 | */ |
| 6854 | if ( cfg_param->apAutoChannelSelection ) |
| 6855 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6856 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 6857 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6858 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6859 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 6860 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6861 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6862 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6863 | else |
| 6864 | { |
| 6865 | if(VOS_STATUS_SUCCESS != |
| 6866 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6867 | { |
| 6868 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6869 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6870 | return -EINVAL; |
| 6871 | } |
| 6872 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 6873 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6874 | } |
| 6875 | } |
| 6876 | else |
| 6877 | { |
| 6878 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 6879 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 6880 | return -EINVAL; |
| 6881 | } |
| 6882 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6883 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6884 | } |
| 6885 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6886 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, |
| 6887 | struct net_device *dev, |
| 6888 | struct ieee80211_channel *chan, |
| 6889 | enum nl80211_channel_type channel_type |
| 6890 | ) |
| 6891 | { |
| 6892 | int ret; |
| 6893 | |
| 6894 | vos_ssr_protect(__func__); |
| 6895 | ret = __wlan_hdd_cfg80211_set_channel(wiphy, dev, chan, channel_type); |
| 6896 | vos_ssr_unprotect(__func__); |
| 6897 | |
| 6898 | return ret; |
| 6899 | } |
| 6900 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6901 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 6902 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 6903 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6904 | #else |
| 6905 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 6906 | struct cfg80211_beacon_data *params, |
| 6907 | const u8 *ssid, size_t ssid_len, |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 6908 | enum nl80211_hidden_ssid hidden_ssid, |
| 6909 | v_U8_t auth_type) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6910 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6911 | { |
| 6912 | tsap_Config_t *pConfig; |
| 6913 | beacon_data_t *pBeacon = NULL; |
| 6914 | struct ieee80211_mgmt *pMgmt_frame; |
| 6915 | v_U8_t *pIe=NULL; |
| 6916 | v_U16_t capab_info; |
| 6917 | eCsrAuthType RSNAuthType; |
| 6918 | eCsrEncryptionType RSNEncryptType; |
| 6919 | eCsrEncryptionType mcRSNEncryptType; |
| 6920 | int status = VOS_STATUS_SUCCESS; |
| 6921 | tpWLAN_SAPEventCB pSapEventCallback; |
| 6922 | hdd_hostapd_state_t *pHostapdState; |
| 6923 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 6924 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6925 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6926 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6927 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6928 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 6929 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6930 | tSmeConfigParams *psmeConfig; |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 6931 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 6932 | v_BOOL_t MFPRequired = VOS_FALSE; |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 6933 | v_BOOL_t sapEnable11AC = |
| 6934 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapEnable11AC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6935 | ENTER(); |
| 6936 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6937 | iniConfig = pHddCtx->cfg_ini; |
| 6938 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6939 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 6940 | |
| 6941 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 6942 | |
| 6943 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6944 | |
| 6945 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 6946 | |
| 6947 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 6948 | |
| 6949 | //channel is already set in the set_channel Call back |
| 6950 | //pConfig->channel = pCommitConfig->channel; |
| 6951 | |
| 6952 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6953 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6954 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 6955 | |
| 6956 | pConfig->dtim_period = pBeacon->dtim_period; |
| 6957 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6958 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6959 | pConfig->dtim_period); |
| 6960 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 6961 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6962 | { |
| 6963 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6964 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 6965 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 6966 | { |
| 6967 | tANI_BOOLEAN restartNeeded; |
| 6968 | pConfig->ieee80211d = 1; |
| 6969 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 6970 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 6971 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 6972 | } |
| 6973 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6974 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6975 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6976 | pConfig->ieee80211d = 1; |
| 6977 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 6978 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 6979 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6980 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6981 | else |
| 6982 | { |
| 6983 | pConfig->ieee80211d = 0; |
| 6984 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6985 | /* |
| 6986 | * If auto channel is configured i.e. channel is 0, |
| 6987 | * so skip channel validation. |
| 6988 | */ |
| 6989 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 6990 | { |
| 6991 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 6992 | { |
| 6993 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6994 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6995 | return -EINVAL; |
| 6996 | } |
| 6997 | } |
| 6998 | else |
| 6999 | { |
| 7000 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 7001 | { |
| 7002 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 7003 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 7004 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 7005 | } |
| 7006 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 7007 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7008 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7009 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7010 | { |
| 7011 | pConfig->ieee80211d = 0; |
| 7012 | } |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 7013 | |
| 7014 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7015 | if (params->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
| 7016 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 7017 | else if (params->auth_type == NL80211_AUTHTYPE_SHARED_KEY) |
| 7018 | pConfig->authType = eSAP_SHARED_KEY; |
| 7019 | else |
| 7020 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 7021 | #else |
| 7022 | if (auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
| 7023 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 7024 | else if (auth_type == NL80211_AUTHTYPE_SHARED_KEY) |
| 7025 | pConfig->authType = eSAP_SHARED_KEY; |
| 7026 | else |
| 7027 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 7028 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7029 | |
| 7030 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7031 | |
| 7032 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7033 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 7034 | |
| 7035 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 7036 | |
| 7037 | /*Set wps station to configured*/ |
| 7038 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 7039 | |
| 7040 | if(pIe) |
| 7041 | { |
| 7042 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 7043 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7044 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7045 | return -EINVAL; |
| 7046 | } |
| 7047 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 7048 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 7049 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7050 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 7051 | * WPS state |
| 7052 | */ |
| 7053 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 7054 | { |
| 7055 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 7056 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 7057 | { |
| 7058 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 7059 | } |
| 7060 | } |
| 7061 | } |
| 7062 | else |
| 7063 | { |
| 7064 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 7065 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7066 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7067 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 7068 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 7069 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 7070 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 7071 | eCSR_ENCRYPT_TYPE_NONE; |
| 7072 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7073 | pConfig->RSNWPAReqIELength = 0; |
| 7074 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7075 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7076 | WLAN_EID_RSN); |
| 7077 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7078 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7079 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 7080 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 7081 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7082 | /* The actual processing may eventually be more extensive than |
| 7083 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7084 | * by the app. |
| 7085 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7086 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7087 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 7088 | &RSNEncryptType, |
| 7089 | &mcRSNEncryptType, |
| 7090 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7091 | &MFPCapable, |
| 7092 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7093 | pConfig->pRSNWPAReqIE[1]+2, |
| 7094 | pConfig->pRSNWPAReqIE ); |
| 7095 | |
| 7096 | if( VOS_STATUS_SUCCESS == status ) |
| 7097 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7098 | /* Now copy over all the security attributes you have |
| 7099 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7100 | * */ |
| 7101 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 7102 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 7103 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 7104 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 7105 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7106 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7107 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 7108 | } |
| 7109 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7110 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7111 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7112 | pBeacon->tail, pBeacon->tail_len); |
| 7113 | |
| 7114 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 7115 | { |
| 7116 | if (pConfig->pRSNWPAReqIE) |
| 7117 | { |
| 7118 | /*Mixed mode WPA/WPA2*/ |
| 7119 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 7120 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 7121 | } |
| 7122 | else |
| 7123 | { |
| 7124 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 7125 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 7126 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7127 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7128 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 7129 | &RSNEncryptType, |
| 7130 | &mcRSNEncryptType, |
| 7131 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7132 | &MFPCapable, |
| 7133 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7134 | pConfig->pRSNWPAReqIE[1]+2, |
| 7135 | pConfig->pRSNWPAReqIE ); |
| 7136 | |
| 7137 | if( VOS_STATUS_SUCCESS == status ) |
| 7138 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7139 | /* Now copy over all the security attributes you have |
| 7140 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7141 | * */ |
| 7142 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 7143 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 7144 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 7145 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 7146 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7147 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7148 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 7149 | } |
| 7150 | } |
| 7151 | } |
| 7152 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7153 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 7154 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 7155 | return -EINVAL; |
| 7156 | } |
| 7157 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7158 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 7159 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7160 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7161 | if (params->ssid != NULL) |
| 7162 | { |
| 7163 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 7164 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 7165 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 7166 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 7167 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7168 | #else |
| 7169 | if (ssid != NULL) |
| 7170 | { |
| 7171 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 7172 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 7173 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 7174 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 7175 | } |
| 7176 | #endif |
| 7177 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7178 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7179 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7180 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7181 | /* default value */ |
| 7182 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 7183 | pConfig->num_accept_mac = 0; |
| 7184 | pConfig->num_deny_mac = 0; |
| 7185 | |
| 7186 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7187 | pBeacon->tail, pBeacon->tail_len); |
| 7188 | |
| 7189 | /* pIe for black list is following form: |
| 7190 | type : 1 byte |
| 7191 | length : 1 byte |
| 7192 | OUI : 4 bytes |
| 7193 | acl type : 1 byte |
| 7194 | no of mac addr in black list: 1 byte |
| 7195 | 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] | 7196 | */ |
| 7197 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7198 | { |
| 7199 | pConfig->SapMacaddr_acl = pIe[6]; |
| 7200 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7201 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7202 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7203 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 7204 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7205 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 7206 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 7207 | { |
| 7208 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 7209 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7210 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7211 | } |
| 7212 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7213 | pBeacon->tail, pBeacon->tail_len); |
| 7214 | |
| 7215 | /* pIe for white list is following form: |
| 7216 | type : 1 byte |
| 7217 | length : 1 byte |
| 7218 | OUI : 4 bytes |
| 7219 | acl type : 1 byte |
| 7220 | no of mac addr in white list: 1 byte |
| 7221 | 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] | 7222 | */ |
| 7223 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7224 | { |
| 7225 | pConfig->SapMacaddr_acl = pIe[6]; |
| 7226 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7227 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7228 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7229 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 7230 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7231 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 7232 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 7233 | { |
| 7234 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 7235 | acl_entry++; |
| 7236 | } |
| 7237 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7238 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7239 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 7240 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7241 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 7242 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 7243 | * This is valid only if mode is set to 11n in hostapd, sapEnable11AC |
| 7244 | * 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] | 7245 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 7246 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 7247 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 7248 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 7249 | (sapEnable11AC) && (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 7250 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7251 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7252 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7253 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7254 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7255 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 7256 | /* If ACS disable and selected channel <= 14 |
| 7257 | * OR |
| 7258 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 7259 | * AND |
| 7260 | * VHT in 2.4G Disabled |
| 7261 | * THEN |
| 7262 | * Fallback to 11N mode |
| 7263 | */ |
| 7264 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 7265 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 7266 | operatingBand == eSAP_RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 7267 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7268 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7269 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 7270 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7271 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 7272 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7273 | } |
| 7274 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7275 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7276 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 7277 | pConfig->ht_capab = |
| 7278 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 7279 | |
| 7280 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 7281 | { |
| 7282 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 7283 | return -EINVAL; |
| 7284 | } |
| 7285 | |
| 7286 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7287 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7288 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 7289 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7290 | pConfig->obssProtEnabled = |
| 7291 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7292 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7293 | #ifdef WLAN_FEATURE_11W |
| 7294 | pConfig->mfpCapable = MFPCapable; |
| 7295 | pConfig->mfpRequired = MFPRequired; |
| 7296 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 7297 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 7298 | #endif |
| 7299 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7300 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7301 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7302 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 7303 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 7304 | (int)pConfig->channel); |
| 7305 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 7306 | pConfig->SapHw_mode, pConfig->privacy, |
| 7307 | pConfig->authType); |
| 7308 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 7309 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 7310 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 7311 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7312 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7313 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7314 | { |
| 7315 | //Bss already started. just return. |
| 7316 | //TODO Probably it should update some beacon params. |
| 7317 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 7318 | EXIT(); |
| 7319 | return 0; |
| 7320 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7321 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7322 | if (vos_max_concurrent_connections_reached()) { |
| 7323 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7324 | return -EINVAL; |
| 7325 | } |
| 7326 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7327 | pConfig->persona = pHostapdAdapter->device_mode; |
| 7328 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7329 | psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams)); |
| 7330 | if ( NULL != psmeConfig) |
| 7331 | { |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 7332 | vos_mem_zero(psmeConfig, sizeof (tSmeConfigParams)); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7333 | sme_GetConfigParam(hHal, psmeConfig); |
| 7334 | pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference; |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 7335 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 7336 | if (((pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 7337 | || (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 7338 | && pHddCtx->cfg_ini->apHT40_24GEnabled) |
| 7339 | { |
| 7340 | psmeConfig->csrConfig.apHT40_24GEnabled = 1; |
| 7341 | sme_UpdateConfig (hHal, psmeConfig); |
| 7342 | } |
| 7343 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7344 | vos_mem_free(psmeConfig); |
| 7345 | } |
Peng Xu | afc34e3 | 2014-09-25 13:23:55 +0530 | [diff] [blame] | 7346 | pConfig->acsBandSwitchThreshold = iniConfig->acsBandSwitchThreshold; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7347 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7348 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 7349 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 7350 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 7351 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7352 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7353 | return -EINVAL; |
| 7354 | } |
| 7355 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7356 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7357 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 7358 | |
| 7359 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7360 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7361 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7362 | { |
| 7363 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7364 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 7365 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7366 | VOS_ASSERT(0); |
| 7367 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7369 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Kaushik, Sushant | f607080 | 2014-10-15 15:09:23 +0530 | [diff] [blame] | 7370 | /* Initialize WMM configuation */ |
| 7371 | hdd_wmm_init(pHostapdAdapter); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7372 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7373 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7374 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7375 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 7376 | { |
| 7377 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 7378 | { |
| 7379 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 7380 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 7381 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7382 | } |
| 7383 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 7384 | { |
| 7385 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 7386 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 7387 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7388 | } |
| 7389 | } |
| 7390 | #endif |
| 7391 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7392 | pHostapdState->bCommit = TRUE; |
| 7393 | EXIT(); |
| 7394 | |
| 7395 | return 0; |
| 7396 | } |
| 7397 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7398 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7399 | static int __wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7400 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7401 | struct beacon_parameters *params) |
| 7402 | { |
| 7403 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7404 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7405 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7406 | |
| 7407 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7408 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7409 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7410 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 7411 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7412 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 7413 | hdd_device_modetoString(pAdapter->device_mode), |
| 7414 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7415 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7416 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7417 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7418 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7419 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7420 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7421 | } |
| 7422 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7423 | if (vos_max_concurrent_connections_reached()) { |
| 7424 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7425 | return -EINVAL; |
| 7426 | } |
| 7427 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7428 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7429 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7430 | ) |
| 7431 | { |
| 7432 | beacon_data_t *old,*new; |
| 7433 | |
| 7434 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7435 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7436 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7437 | { |
| 7438 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 7439 | FL("already beacon info added to session(%d)"), |
| 7440 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7441 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7442 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7443 | |
| 7444 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 7445 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7446 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7447 | { |
| 7448 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7449 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7450 | return -EINVAL; |
| 7451 | } |
| 7452 | |
| 7453 | pAdapter->sessionCtx.ap.beacon = new; |
| 7454 | |
| 7455 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 7456 | } |
| 7457 | |
| 7458 | EXIT(); |
| 7459 | return status; |
| 7460 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7461 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7462 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 7463 | struct net_device *dev, |
| 7464 | struct beacon_parameters *params) |
| 7465 | { |
| 7466 | int ret; |
| 7467 | |
| 7468 | vos_ssr_protect(__func__); |
| 7469 | ret = __wlan_hdd_cfg80211_add_beacon(wiphy, dev, params); |
| 7470 | vos_ssr_unprotect(__func__); |
| 7471 | |
| 7472 | return ret; |
| 7473 | } |
| 7474 | |
| 7475 | static int __wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7476 | struct net_device *dev, |
| 7477 | struct beacon_parameters *params) |
| 7478 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7479 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7480 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7481 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7482 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7483 | |
| 7484 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 7485 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7486 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7487 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 7488 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 7489 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7490 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7491 | pAdapter->device_mode); |
| 7492 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7493 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7494 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7495 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7496 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7497 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7498 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7499 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7500 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7501 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7502 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7503 | { |
| 7504 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7505 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7506 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7508 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7509 | { |
| 7510 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7511 | FL("session(%d) old and new heads points to NULL"), |
| 7512 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7513 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7514 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7515 | |
| 7516 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 7517 | |
| 7518 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7519 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7520 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7521 | return -EINVAL; |
| 7522 | } |
| 7523 | |
| 7524 | pAdapter->sessionCtx.ap.beacon = new; |
| 7525 | |
| 7526 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 7527 | } |
| 7528 | |
| 7529 | EXIT(); |
| 7530 | return status; |
| 7531 | } |
| 7532 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7533 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
| 7534 | struct net_device *dev, |
| 7535 | struct beacon_parameters *params) |
| 7536 | { |
| 7537 | int ret; |
| 7538 | |
| 7539 | vos_ssr_protect(__func__); |
| 7540 | ret = __wlan_hdd_cfg80211_set_beacon(wiphy, dev, params); |
| 7541 | vos_ssr_unprotect(__func__); |
| 7542 | |
| 7543 | return ret; |
| 7544 | } |
| 7545 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7546 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7547 | |
| 7548 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7549 | static int __wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7550 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7551 | #else |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7552 | static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7553 | struct net_device *dev) |
| 7554 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7555 | { |
| 7556 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7557 | hdd_context_t *pHddCtx = NULL; |
| 7558 | hdd_scaninfo_t *pScanInfo = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7559 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7560 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7561 | |
| 7562 | ENTER(); |
| 7563 | |
| 7564 | if (NULL == pAdapter) |
| 7565 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7566 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7567 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7568 | return -ENODEV; |
| 7569 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7570 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7571 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7572 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 7573 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7574 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7575 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7576 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7577 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7578 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7579 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7580 | |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7581 | pScanInfo = &pHddCtx->scan_info; |
| 7582 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7583 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7584 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7585 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7586 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7587 | ret = wlan_hdd_scan_abort(pAdapter); |
| 7588 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 7589 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7590 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7591 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7592 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7593 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7594 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7595 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7596 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7597 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 7598 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7599 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7600 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7601 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7602 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7603 | } |
| 7604 | |
Rashmi Ramanna | 1f0948d | 2014-08-28 15:33:48 +0530 | [diff] [blame] | 7605 | /* Delete all associated STAs before stopping AP/P2P GO */ |
| 7606 | hdd_del_all_sta(pAdapter); |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 7607 | hdd_hostapd_stop(dev); |
| 7608 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7609 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7610 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7611 | ) |
| 7612 | { |
| 7613 | beacon_data_t *old; |
| 7614 | |
| 7615 | old = pAdapter->sessionCtx.ap.beacon; |
| 7616 | |
| 7617 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7618 | { |
| 7619 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7620 | FL("session(%d) beacon data points to NULL"), |
| 7621 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7622 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7623 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7624 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7625 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7626 | |
| 7627 | mutex_lock(&pHddCtx->sap_lock); |
| 7628 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 7629 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7630 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7631 | { |
| 7632 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 7633 | |
| 7634 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 7635 | |
| 7636 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 7637 | { |
| 7638 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7639 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7640 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7641 | } |
| 7642 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7643 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7644 | /* BSS stopped, clear the active sessions for this device mode */ |
| 7645 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7646 | } |
| 7647 | mutex_unlock(&pHddCtx->sap_lock); |
| 7648 | |
| 7649 | if(status != VOS_STATUS_SUCCESS) |
| 7650 | { |
| 7651 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7652 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7653 | return -EINVAL; |
| 7654 | } |
| 7655 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7656 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7657 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 7658 | ==eHAL_STATUS_FAILURE) |
| 7659 | { |
| 7660 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7661 | "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] | 7662 | } |
| 7663 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7664 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7665 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 7666 | eANI_BOOLEAN_FALSE) ) |
| 7667 | { |
| 7668 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7669 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7670 | } |
| 7671 | |
| 7672 | // Reset WNI_CFG_PROBE_RSP Flags |
| 7673 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 7674 | |
| 7675 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 7676 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7677 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7678 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 7679 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 7680 | { |
| 7681 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 7682 | "GO got removed"); |
| 7683 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 7684 | } |
| 7685 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7686 | } |
| 7687 | EXIT(); |
| 7688 | return status; |
| 7689 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7690 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7691 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7692 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 7693 | struct net_device *dev) |
| 7694 | { |
| 7695 | int ret; |
| 7696 | |
| 7697 | vos_ssr_protect(__func__); |
| 7698 | ret = __wlan_hdd_cfg80211_del_beacon(wiphy, dev); |
| 7699 | vos_ssr_unprotect(__func__); |
| 7700 | |
| 7701 | return ret; |
| 7702 | } |
| 7703 | #else |
| 7704 | static int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, |
| 7705 | struct net_device *dev) |
| 7706 | { |
| 7707 | int ret; |
| 7708 | |
| 7709 | vos_ssr_protect(__func__); |
| 7710 | ret = __wlan_hdd_cfg80211_stop_ap(wiphy, dev); |
| 7711 | vos_ssr_unprotect(__func__); |
| 7712 | |
| 7713 | return ret; |
| 7714 | } |
| 7715 | #endif |
| 7716 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7717 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 7718 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7719 | static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7720 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7721 | struct cfg80211_ap_settings *params) |
| 7722 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7723 | hdd_adapter_t *pAdapter; |
| 7724 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7725 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7726 | |
| 7727 | ENTER(); |
| 7728 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7729 | if (NULL == dev || NULL == params) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7730 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7731 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7732 | "%s: Device or params is Null", __func__); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7733 | return -ENODEV; |
| 7734 | } |
| 7735 | |
| 7736 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7737 | if (NULL == pAdapter) |
| 7738 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7739 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7740 | "%s: HDD adapter is Null", __func__); |
| 7741 | return -ENODEV; |
| 7742 | } |
| 7743 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7744 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7745 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 7746 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7747 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 7748 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7749 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7750 | "%s: HDD adapter magic is invalid", __func__); |
| 7751 | return -ENODEV; |
| 7752 | } |
| 7753 | |
| 7754 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7755 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7756 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7757 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7758 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7759 | } |
| 7760 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7761 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 7762 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7763 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7764 | |
| 7765 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7766 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7767 | ) |
| 7768 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7769 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7770 | |
| 7771 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7772 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7773 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7774 | { |
| 7775 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 7776 | FL("already beacon info added to session(%d)"), |
| 7777 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7778 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7779 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7780 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7781 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7782 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 7783 | &new, |
| 7784 | ¶ms->beacon); |
| 7785 | #else |
| 7786 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 7787 | &new, |
| 7788 | ¶ms->beacon, |
| 7789 | params->dtim_period); |
| 7790 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7791 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7792 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7793 | { |
| 7794 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7795 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7796 | return -EINVAL; |
| 7797 | } |
| 7798 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7799 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 7800 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 7801 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 7802 | params->channel, params->channel_type); |
| 7803 | #else |
| 7804 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 7805 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7806 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7807 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 7808 | params->ssid_len, params->hidden_ssid, |
| 7809 | params->auth_type); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7810 | } |
| 7811 | |
| 7812 | EXIT(); |
| 7813 | return status; |
| 7814 | } |
| 7815 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7816 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 7817 | struct net_device *dev, |
| 7818 | struct cfg80211_ap_settings *params) |
| 7819 | { |
| 7820 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7821 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7822 | vos_ssr_protect(__func__); |
| 7823 | ret = __wlan_hdd_cfg80211_start_ap(wiphy, dev, params); |
| 7824 | vos_ssr_unprotect(__func__); |
| 7825 | |
| 7826 | return ret; |
| 7827 | } |
| 7828 | |
| 7829 | static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7830 | struct net_device *dev, |
| 7831 | struct cfg80211_beacon_data *params) |
| 7832 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7833 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7834 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7835 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7836 | |
| 7837 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7838 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7839 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7840 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 7841 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7842 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7843 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7844 | |
| 7845 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7846 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7847 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7848 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7849 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7850 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7851 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7852 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7853 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7854 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7855 | { |
| 7856 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7857 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7858 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7859 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7860 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7861 | { |
| 7862 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7863 | FL("session(%d) beacon data points to NULL"), |
| 7864 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7865 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7866 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7867 | |
| 7868 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 7869 | |
| 7870 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7871 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7872 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7873 | return -EINVAL; |
| 7874 | } |
| 7875 | |
| 7876 | pAdapter->sessionCtx.ap.beacon = new; |
| 7877 | |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 7878 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0, |
| 7879 | pAdapter->sessionCtx.ap.sapConfig.authType); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7880 | } |
| 7881 | |
| 7882 | EXIT(); |
| 7883 | return status; |
| 7884 | } |
| 7885 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7886 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
| 7887 | struct net_device *dev, |
| 7888 | struct cfg80211_beacon_data *params) |
| 7889 | { |
| 7890 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7891 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7892 | vos_ssr_protect(__func__); |
| 7893 | ret = __wlan_hdd_cfg80211_change_beacon(wiphy, dev, params); |
| 7894 | vos_ssr_unprotect(__func__); |
| 7895 | |
| 7896 | return ret; |
| 7897 | } |
| 7898 | |
| 7899 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7900 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 7901 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7902 | struct net_device *dev, |
| 7903 | struct bss_parameters *params) |
| 7904 | { |
| 7905 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7906 | hdd_context_t *pHddCtx; |
| 7907 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7908 | |
| 7909 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7910 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7911 | if (NULL == pAdapter) |
| 7912 | { |
| 7913 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7914 | "%s: HDD adapter is Null", __func__); |
| 7915 | return -ENODEV; |
| 7916 | } |
| 7917 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7918 | ret = wlan_hdd_validate_context(pHddCtx); |
| 7919 | if (0 != ret) |
| 7920 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7921 | return ret; |
| 7922 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7923 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7924 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 7925 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7926 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7927 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7928 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7929 | |
| 7930 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7931 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7932 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7933 | { |
| 7934 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 7935 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7936 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7937 | { |
| 7938 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7939 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7940 | } |
| 7941 | |
| 7942 | EXIT(); |
| 7943 | return 0; |
| 7944 | } |
| 7945 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 7946 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 7947 | struct net_device *dev, |
| 7948 | struct bss_parameters *params) |
| 7949 | { |
| 7950 | int ret; |
| 7951 | |
| 7952 | vos_ssr_protect(__func__); |
| 7953 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 7954 | vos_ssr_unprotect(__func__); |
| 7955 | |
| 7956 | return ret; |
| 7957 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7958 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 7959 | * to wait for contry code completion |
| 7960 | */ |
| 7961 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 7962 | { |
| 7963 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 7964 | complete(&call_back_pAdapter->change_country_code); |
| 7965 | return NULL; |
| 7966 | } |
| 7967 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7968 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7969 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7970 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 7971 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7972 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7973 | struct net_device *ndev, |
| 7974 | enum nl80211_iftype type, |
| 7975 | u32 *flags, |
| 7976 | struct vif_params *params |
| 7977 | ) |
| 7978 | { |
| 7979 | struct wireless_dev *wdev; |
| 7980 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7981 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7982 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7983 | tCsrRoamProfile *pRoamProfile = NULL; |
| 7984 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7985 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7986 | eMib_dot11DesiredBssType connectedBssType; |
| 7987 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7988 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7989 | |
| 7990 | ENTER(); |
| 7991 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7992 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7993 | { |
| 7994 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7995 | "%s: Adapter context is null", __func__); |
| 7996 | return VOS_STATUS_E_FAILURE; |
| 7997 | } |
| 7998 | |
| 7999 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8000 | if (!pHddCtx) |
| 8001 | { |
| 8002 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8003 | "%s: HDD context is null", __func__); |
| 8004 | return VOS_STATUS_E_FAILURE; |
| 8005 | } |
| 8006 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8007 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8008 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 8009 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8010 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8011 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8012 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8013 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8014 | } |
| 8015 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8016 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8017 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8018 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8019 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 8020 | if (vos_max_concurrent_connections_reached()) { |
| 8021 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 8022 | return -EINVAL; |
| 8023 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8024 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8025 | wdev = ndev->ieee80211_ptr; |
| 8026 | |
| 8027 | #ifdef WLAN_BTAMP_FEATURE |
| 8028 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 8029 | (NL80211_IFTYPE_ADHOC == type)|| |
| 8030 | (NL80211_IFTYPE_AP == type)|| |
| 8031 | (NL80211_IFTYPE_P2P_GO == type)) |
| 8032 | { |
| 8033 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 8034 | // stop AMP traffic |
| 8035 | status = WLANBAP_StopAmp(); |
| 8036 | if(VOS_STATUS_SUCCESS != status ) |
| 8037 | { |
| 8038 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 8039 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 8040 | "%s: Failed to stop AMP", __func__); |
| 8041 | return -EINVAL; |
| 8042 | } |
| 8043 | } |
| 8044 | #endif //WLAN_BTAMP_FEATURE |
| 8045 | /* Reset the current device mode bit mask*/ |
| 8046 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 8047 | |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 8048 | /* Notify Mode change in case of concurrency. |
| 8049 | * Below function invokes TDLS teardown Functionality Since TDLS is |
| 8050 | * not Supported in case of concurrency i.e Once P2P session |
| 8051 | * is detected disable offchannel and teardown TDLS links |
| 8052 | */ |
| 8053 | hdd_tdls_notify_mode_change(pAdapter, pHddCtx); |
| 8054 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8055 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8056 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8057 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8058 | ) |
| 8059 | { |
| 8060 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 8061 | if (!pWextState) |
| 8062 | { |
| 8063 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8064 | "%s: pWextState is null", __func__); |
| 8065 | return VOS_STATUS_E_FAILURE; |
| 8066 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8067 | pRoamProfile = &pWextState->roamProfile; |
| 8068 | LastBSSType = pRoamProfile->BSSType; |
| 8069 | |
| 8070 | switch (type) |
| 8071 | { |
| 8072 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8073 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8074 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8075 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 8076 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8077 | #ifdef WLAN_FEATURE_11AC |
| 8078 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 8079 | { |
| 8080 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 8081 | } |
| 8082 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8083 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8084 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8085 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8086 | //Check for sub-string p2p to confirm its a p2p interface |
| 8087 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8088 | { |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8089 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 8090 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 8091 | } |
| 8092 | else |
| 8093 | { |
| 8094 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8095 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8096 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8097 | break; |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 8098 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8099 | case NL80211_IFTYPE_ADHOC: |
| 8100 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8101 | "%s: setting interface Type to ADHOC", __func__); |
| 8102 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 8103 | pRoamProfile->phyMode = |
| 8104 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 8105 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8106 | wdev->iftype = type; |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 8107 | hdd_set_ibss_ops( pAdapter ); |
| 8108 | hdd_ibss_init_tx_rx( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8109 | break; |
| 8110 | |
| 8111 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8112 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8113 | { |
| 8114 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 8115 | "%s: setting interface Type to %s", __func__, |
| 8116 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 8117 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8118 | //Cancel any remain on channel for GO mode |
| 8119 | if (NL80211_IFTYPE_P2P_GO == type) |
| 8120 | { |
| 8121 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 8122 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8123 | if (NL80211_IFTYPE_AP == type) |
| 8124 | { |
| 8125 | /* As Loading WLAN Driver one interface being created for p2p device |
| 8126 | * address. This will take one HW STA and the max number of clients |
| 8127 | * that can connect to softAP will be reduced by one. so while changing |
| 8128 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 8129 | * interface as it is not required in SoftAP mode. |
| 8130 | */ |
| 8131 | |
| 8132 | // Get P2P Adapter |
| 8133 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 8134 | |
| 8135 | if (pP2pAdapter) |
| 8136 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 8137 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8138 | hdd_deinit_adapter(pHddCtx, pP2pAdapter, TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8139 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 8140 | } |
| 8141 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 8142 | //Disable IMPS & BMPS for SAP/GO |
| 8143 | if(VOS_STATUS_E_FAILURE == |
| 8144 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 8145 | { |
| 8146 | //Fail to Exit BMPS |
| 8147 | VOS_ASSERT(0); |
| 8148 | } |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 8149 | |
| 8150 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
| 8151 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8152 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8153 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8154 | /* A Mutex Lock is introduced while changing the mode to |
| 8155 | * protect the concurrent access for the Adapters by TDLS |
| 8156 | * module. |
| 8157 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8158 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8159 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8160 | //De-init the adapter. |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8161 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8162 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8163 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 8164 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8165 | #ifdef FEATURE_WLAN_TDLS |
| 8166 | mutex_unlock(&pHddCtx->tdls_lock); |
| 8167 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 8168 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 8169 | (pConfig->apRandomBssidEnabled)) |
| 8170 | { |
| 8171 | /* To meet Android requirements create a randomized |
| 8172 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 8173 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 8174 | ndev->dev_addr[0] = 0x02; |
| 8175 | ndev->dev_addr[1] = 0x1A; |
| 8176 | ndev->dev_addr[2] = 0x11; |
| 8177 | ndev->dev_addr[3] |= 0xF0; |
| 8178 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 8179 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 8180 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 8181 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 8182 | } |
| 8183 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8184 | hdd_set_ap_ops( pAdapter->dev ); |
| 8185 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8186 | /* This is for only SAP mode where users can |
| 8187 | * control country through ini. |
| 8188 | * P2P GO follows station country code |
| 8189 | * acquired during the STA scanning. */ |
| 8190 | if((NL80211_IFTYPE_AP == type) && |
| 8191 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 8192 | { |
| 8193 | int status = 0; |
| 8194 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 8195 | "%s: setting country code from INI ", __func__); |
| 8196 | init_completion(&pAdapter->change_country_code); |
| 8197 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 8198 | (void *)(tSmeChangeCountryCallback) |
| 8199 | wlan_hdd_change_country_code_cb, |
| 8200 | pConfig->apCntryCode, pAdapter, |
| 8201 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 8202 | eSIR_FALSE, |
| 8203 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8204 | if (eHAL_STATUS_SUCCESS == status) |
| 8205 | { |
| 8206 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8207 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8208 | &pAdapter->change_country_code, |
| 8209 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8210 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8211 | { |
| 8212 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8213 | FL("SME Timed out while setting country code %ld"), |
| 8214 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 8215 | |
| 8216 | if (pHddCtx->isLogpInProgress) |
| 8217 | { |
| 8218 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8219 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 8220 | return -EAGAIN; |
| 8221 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8222 | } |
| 8223 | } |
| 8224 | else |
| 8225 | { |
| 8226 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8227 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8228 | return -EINVAL; |
| 8229 | } |
| 8230 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8231 | status = hdd_init_ap_mode(pAdapter); |
| 8232 | if(status != VOS_STATUS_SUCCESS) |
| 8233 | { |
| 8234 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 8235 | "%s: Error initializing the ap mode", __func__); |
| 8236 | return -EINVAL; |
| 8237 | } |
| 8238 | hdd_set_conparam(1); |
| 8239 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8240 | /*interface type changed update in wiphy structure*/ |
| 8241 | if(wdev) |
| 8242 | { |
| 8243 | wdev->iftype = type; |
| 8244 | pHddCtx->change_iface = type; |
| 8245 | } |
| 8246 | else |
| 8247 | { |
| 8248 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8249 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 8250 | return -EINVAL; |
| 8251 | } |
| 8252 | goto done; |
| 8253 | } |
| 8254 | |
| 8255 | default: |
| 8256 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 8257 | __func__); |
| 8258 | return -EOPNOTSUPP; |
| 8259 | } |
| 8260 | } |
| 8261 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8262 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8263 | ) |
| 8264 | { |
| 8265 | switch(type) |
| 8266 | { |
| 8267 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8268 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8269 | case NL80211_IFTYPE_ADHOC: |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 8270 | |
| 8271 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8272 | #ifdef FEATURE_WLAN_TDLS |
| 8273 | |
| 8274 | /* A Mutex Lock is introduced while changing the mode to |
| 8275 | * protect the concurrent access for the Adapters by TDLS |
| 8276 | * module. |
| 8277 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8278 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8279 | #endif |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8280 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8281 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8282 | //Check for sub-string p2p to confirm its a p2p interface |
| 8283 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8284 | { |
| 8285 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 8286 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 8287 | } |
| 8288 | else |
| 8289 | { |
| 8290 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8291 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8292 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8293 | hdd_set_conparam(0); |
| 8294 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8295 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 8296 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8297 | #ifdef FEATURE_WLAN_TDLS |
| 8298 | mutex_unlock(&pHddCtx->tdls_lock); |
| 8299 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 8300 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8301 | if( VOS_STATUS_SUCCESS != status ) |
| 8302 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8303 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 8304 | * This is the right place to enable back bmps_imps() |
| 8305 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 8306 | if (pHddCtx->hdd_wlan_suspended) |
| 8307 | { |
| 8308 | hdd_set_pwrparams(pHddCtx); |
| 8309 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8310 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8311 | goto done; |
| 8312 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8313 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8314 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8315 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 8316 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8317 | goto done; |
| 8318 | default: |
| 8319 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 8320 | __func__); |
| 8321 | return -EOPNOTSUPP; |
| 8322 | |
| 8323 | } |
| 8324 | |
| 8325 | } |
| 8326 | else |
| 8327 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8328 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 8329 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8330 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8331 | return -EOPNOTSUPP; |
| 8332 | } |
| 8333 | |
| 8334 | |
| 8335 | if(pRoamProfile) |
| 8336 | { |
| 8337 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 8338 | { |
| 8339 | /*interface type changed update in wiphy structure*/ |
| 8340 | wdev->iftype = type; |
| 8341 | |
| 8342 | /*the BSS mode changed, We need to issue disconnect |
| 8343 | if connected or in IBSS disconnect state*/ |
| 8344 | if ( hdd_connGetConnectedBssType( |
| 8345 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 8346 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 8347 | { |
| 8348 | /*need to issue a disconnect to CSR.*/ |
| 8349 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 8350 | if( eHAL_STATUS_SUCCESS == |
| 8351 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8352 | pAdapter->sessionId, |
| 8353 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 8354 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8355 | ret = wait_for_completion_interruptible_timeout( |
| 8356 | &pAdapter->disconnect_comp_var, |
| 8357 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 8358 | if (ret <= 0) |
| 8359 | { |
| 8360 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8361 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 8362 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8363 | } |
| 8364 | } |
| 8365 | } |
| 8366 | } |
| 8367 | |
| 8368 | done: |
| 8369 | /*set bitmask based on updated value*/ |
| 8370 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 8371 | |
| 8372 | /* Only STA mode support TM now |
| 8373 | * all other mode, TM feature should be disabled */ |
| 8374 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 8375 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 8376 | { |
| 8377 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 8378 | } |
| 8379 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8380 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8381 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 8382 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8383 | { |
| 8384 | //we are ok to do AMP |
| 8385 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 8386 | } |
| 8387 | #endif //WLAN_BTAMP_FEATURE |
| 8388 | EXIT(); |
| 8389 | return 0; |
| 8390 | } |
| 8391 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 8392 | /* |
| 8393 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 8394 | * wrapper function to protect the actual implementation from SSR. |
| 8395 | */ |
| 8396 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 8397 | struct net_device *ndev, |
| 8398 | enum nl80211_iftype type, |
| 8399 | u32 *flags, |
| 8400 | struct vif_params *params |
| 8401 | ) |
| 8402 | { |
| 8403 | int ret; |
| 8404 | |
| 8405 | vos_ssr_protect(__func__); |
| 8406 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 8407 | vos_ssr_unprotect(__func__); |
| 8408 | |
| 8409 | return ret; |
| 8410 | } |
| 8411 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8412 | #ifdef FEATURE_WLAN_TDLS |
| 8413 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
| 8414 | struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams) |
| 8415 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8416 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8417 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8418 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8419 | tANI_U16 numCurrTdlsPeers; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 8420 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8421 | |
| 8422 | ENTER(); |
| 8423 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 8424 | if (!dev) { |
| 8425 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 8426 | return -EINVAL; |
| 8427 | } |
| 8428 | |
| 8429 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8430 | if (!pAdapter) { |
| 8431 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 8432 | return -EINVAL; |
| 8433 | } |
| 8434 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8435 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8436 | { |
| 8437 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8438 | "Invalid arguments"); |
| 8439 | return -EINVAL; |
| 8440 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8441 | |
| 8442 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 8443 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 8444 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8445 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8446 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 8447 | MAC_ADDRESS_STR " Request declined.", |
| 8448 | __func__, MAC_ADDR_ARRAY(mac)); |
| 8449 | return -ENOTSUPP; |
| 8450 | } |
| 8451 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8452 | if (pHddCtx->isLogpInProgress) |
| 8453 | { |
| 8454 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8455 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8456 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8457 | mac, |
| 8458 | eTDLS_LINK_IDLE, |
| 8459 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8460 | return -EBUSY; |
| 8461 | } |
| 8462 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 8463 | mutex_lock(&pHddCtx->tdls_lock); |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 8464 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8465 | |
| 8466 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8467 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8468 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 8469 | __func__, MAC_ADDR_ARRAY(mac), update); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 8470 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8471 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8472 | } |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 8473 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8474 | |
| 8475 | /* in add station, we accept existing valid staId if there is */ |
| 8476 | if ((0 == update) && |
| 8477 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 8478 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8479 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8480 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8481 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8482 | " link_status %d. staId %d. add station ignored.", |
| 8483 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 8484 | return 0; |
| 8485 | } |
| 8486 | /* in change station, we accept only when staId is valid */ |
| 8487 | if ((1 == update) && |
| 8488 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 8489 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 8490 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8491 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8492 | "%s: " MAC_ADDRESS_STR |
| 8493 | " link status %d. staId %d. change station %s.", |
| 8494 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 8495 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 8496 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8497 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8498 | |
| 8499 | /* 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] | 8500 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8501 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8502 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8503 | "%s: " MAC_ADDRESS_STR |
| 8504 | " TDLS setup is ongoing. Request declined.", |
| 8505 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8506 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8507 | } |
| 8508 | |
| 8509 | /* first to check if we reached to maximum supported TDLS peer. |
| 8510 | TODO: for now, return -EPERM looks working fine, |
| 8511 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8512 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 8513 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8514 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8515 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8516 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8517 | " TDLS Max peer already connected. Request declined." |
| 8518 | " Num of peers (%d), Max allowed (%d).", |
| 8519 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 8520 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8521 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8522 | } |
| 8523 | else |
| 8524 | { |
| 8525 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8526 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8527 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8528 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8529 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8530 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 8531 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8532 | return -EPERM; |
| 8533 | } |
| 8534 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8535 | if (0 == update) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8536 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8537 | mac, |
| 8538 | eTDLS_LINK_CONNECTING, |
| 8539 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8540 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 8541 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8542 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8543 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8544 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8545 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8546 | if(StaParams->htcap_present) |
| 8547 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8548 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8549 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8550 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8551 | "ht_capa->extended_capabilities: %0x", |
| 8552 | StaParams->HTCap.extendedHtCapInfo); |
| 8553 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8554 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8555 | "params->capability: %0x",StaParams->capability); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8556 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8557 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8558 | if(StaParams->vhtcap_present) |
| 8559 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8560 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8561 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 8562 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 8563 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 8564 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8565 | { |
| 8566 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8567 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8568 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8569 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8570 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 8571 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 8572 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8573 | else if ((1 == update) && (NULL == StaParams)) |
| 8574 | { |
| 8575 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8576 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 8577 | return -EPERM; |
| 8578 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8579 | |
| 8580 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 8581 | |
| 8582 | if (!update) |
| 8583 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8584 | ret = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8585 | pAdapter->sessionId, mac); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8586 | if (ret != eHAL_STATUS_SUCCESS) { |
| 8587 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to add TDLS peer STA")); |
| 8588 | return -EPERM; |
| 8589 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8590 | } |
| 8591 | else |
| 8592 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8593 | ret = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8594 | pAdapter->sessionId, mac, StaParams); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8595 | if (ret != eHAL_STATUS_SUCCESS) { |
| 8596 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to change TDLS peer STA params")); |
| 8597 | return -EPERM; |
| 8598 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8599 | } |
| 8600 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8601 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8602 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 8603 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8604 | if (ret <= 0) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8605 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8606 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8607 | "%s: timeout waiting for tdls add station indication %ld", |
| 8608 | __func__, ret); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8609 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8610 | } |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8611 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8612 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 8613 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8614 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8615 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8616 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8617 | } |
| 8618 | |
| 8619 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8620 | |
| 8621 | error: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8622 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8623 | mac, |
| 8624 | eTDLS_LINK_IDLE, |
| 8625 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8626 | return -EPERM; |
| 8627 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8628 | } |
| 8629 | #endif |
| 8630 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8631 | static int __wlan_hdd_change_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8632 | struct net_device *dev, |
| 8633 | u8 *mac, |
| 8634 | struct station_parameters *params) |
| 8635 | { |
| 8636 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8637 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8638 | hdd_context_t *pHddCtx; |
| 8639 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8640 | v_MACADDR_t STAMacAddress; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8641 | int ret = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8642 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8643 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8644 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8645 | tANI_U8 isOffChannelSupported = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8646 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8647 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8648 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8649 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8650 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8651 | if ((NULL == pAdapter)) |
| 8652 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8653 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8654 | "invalid adapter "); |
| 8655 | return -EINVAL; |
| 8656 | } |
| 8657 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8658 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8659 | TRACE_CODE_HDD_CHANGE_STATION, |
| 8660 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8661 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8662 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8663 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8664 | if (0 != ret) |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8665 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8666 | return ret; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8667 | } |
| 8668 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8669 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8670 | |
| 8671 | if (NULL == pHddStaCtx) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8672 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8673 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8674 | "invalid HDD station context"); |
| 8675 | return -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8676 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8677 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 8678 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8679 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 8680 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8681 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8682 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8683 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8684 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8685 | WLANTL_STA_AUTHENTICATED); |
| 8686 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8687 | if (status != VOS_STATUS_SUCCESS) |
| 8688 | { |
| 8689 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8690 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 8691 | return -EINVAL; |
| 8692 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8693 | } |
| 8694 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 8695 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 8696 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8697 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8698 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 8699 | StaParams.capability = params->capability; |
| 8700 | StaParams.uapsd_queues = params->uapsd_queues; |
| 8701 | StaParams.max_sp = params->max_sp; |
| 8702 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8703 | /* Convert (first channel , number of channels) tuple to |
| 8704 | * the total list of channels. This goes with the assumption |
| 8705 | * that if the first channel is < 14, then the next channels |
| 8706 | * are an incremental of 1 else an incremental of 4 till the number |
| 8707 | * of channels. |
| 8708 | */ |
| 8709 | if (0 != params->supported_channels_len) { |
| 8710 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 8711 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 8712 | { |
| 8713 | int wifi_chan_index; |
| 8714 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 8715 | wifi_chan_index = |
| 8716 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 8717 | no_of_channels = params->supported_channels[i+1]; |
| 8718 | for(k=1; k <= no_of_channels; k++) |
| 8719 | { |
| 8720 | StaParams.supported_channels[j+1] = |
| 8721 | StaParams.supported_channels[j] + wifi_chan_index; |
| 8722 | j+=1; |
| 8723 | } |
| 8724 | } |
| 8725 | StaParams.supported_channels_len = j; |
| 8726 | } |
| 8727 | vos_mem_copy(StaParams.supported_oper_classes, |
| 8728 | params->supported_oper_classes, |
| 8729 | params->supported_oper_classes_len); |
| 8730 | StaParams.supported_oper_classes_len = |
| 8731 | params->supported_oper_classes_len; |
| 8732 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8733 | if (0 != params->ext_capab_len) |
| 8734 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 8735 | sizeof(StaParams.extn_capability)); |
| 8736 | |
| 8737 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8738 | { |
| 8739 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8740 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8741 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8742 | |
| 8743 | StaParams.supported_rates_len = params->supported_rates_len; |
| 8744 | |
| 8745 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 8746 | * The supported_rates array , for all the structures propogating till Add Sta |
| 8747 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 8748 | * modified to send more rates. |
| 8749 | */ |
| 8750 | |
| 8751 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 8752 | */ |
| 8753 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 8754 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 8755 | |
| 8756 | if (0 != StaParams.supported_rates_len) { |
| 8757 | int i = 0; |
| 8758 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 8759 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8760 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8761 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 8762 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8763 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8764 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 8765 | } |
| 8766 | |
| 8767 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8768 | { |
| 8769 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8770 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8771 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8772 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8773 | if (0 != params->ext_capab_len ) { |
| 8774 | /*Define A Macro : TODO Sunil*/ |
| 8775 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 8776 | isBufSta = 1; |
| 8777 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8778 | /* TDLS Channel Switching Support */ |
| 8779 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 8780 | isOffChannelSupported = 1; |
| 8781 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8782 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8783 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 8784 | &StaParams, isBufSta, |
| 8785 | isOffChannelSupported); |
| 8786 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8787 | if (VOS_STATUS_SUCCESS != status) { |
| 8788 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8789 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 8790 | return -EINVAL; |
| 8791 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8792 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 8793 | |
| 8794 | if (VOS_STATUS_SUCCESS != status) { |
| 8795 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8796 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 8797 | return -EINVAL; |
| 8798 | } |
| 8799 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8800 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 8801 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8802 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8803 | return status; |
| 8804 | } |
| 8805 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8806 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 8807 | struct net_device *dev, |
| 8808 | u8 *mac, |
| 8809 | struct station_parameters *params) |
| 8810 | { |
| 8811 | int ret; |
| 8812 | |
| 8813 | vos_ssr_protect(__func__); |
| 8814 | ret = __wlan_hdd_change_station(wiphy, dev, mac, params); |
| 8815 | vos_ssr_unprotect(__func__); |
| 8816 | |
| 8817 | return ret; |
| 8818 | } |
| 8819 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8820 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8821 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8822 | * This function is used to initialize the key information |
| 8823 | */ |
| 8824 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8825 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8826 | struct net_device *ndev, |
| 8827 | u8 key_index, bool pairwise, |
| 8828 | const u8 *mac_addr, |
| 8829 | struct key_params *params |
| 8830 | ) |
| 8831 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8832 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8833 | struct net_device *ndev, |
| 8834 | u8 key_index, const u8 *mac_addr, |
| 8835 | struct key_params *params |
| 8836 | ) |
| 8837 | #endif |
| 8838 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8839 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8840 | tCsrRoamSetKey setKey; |
| 8841 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8842 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8843 | v_U32_t roamId= 0xFF; |
| 8844 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8845 | hdd_hostapd_state_t *pHostapdState; |
| 8846 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8847 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8848 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8849 | |
| 8850 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8851 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8852 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8853 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 8854 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8855 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8856 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8857 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8858 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8859 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8860 | } |
| 8861 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8862 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8863 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8864 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8865 | |
| 8866 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8867 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8868 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8869 | key_index); |
| 8870 | |
| 8871 | return -EINVAL; |
| 8872 | } |
| 8873 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8874 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 8875 | { |
| 8876 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 8877 | params->key_len); |
| 8878 | |
| 8879 | return -EINVAL; |
| 8880 | } |
| 8881 | |
| 8882 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8883 | "%s: called with key index = %d & key length %d", |
| 8884 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8885 | |
| 8886 | /*extract key idx, key len and key*/ |
| 8887 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8888 | setKey.keyId = key_index; |
| 8889 | setKey.keyLength = params->key_len; |
| 8890 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 8891 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8892 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8893 | { |
| 8894 | case WLAN_CIPHER_SUITE_WEP40: |
| 8895 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 8896 | break; |
| 8897 | |
| 8898 | case WLAN_CIPHER_SUITE_WEP104: |
| 8899 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 8900 | break; |
| 8901 | |
| 8902 | case WLAN_CIPHER_SUITE_TKIP: |
| 8903 | { |
| 8904 | u8 *pKey = &setKey.Key[0]; |
| 8905 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 8906 | |
| 8907 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 8908 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8909 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8910 | |
| 8911 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8912 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8913 | |--------------|----------|----------| |
| 8914 | <---16bytes---><--8bytes--><--8bytes--> |
| 8915 | |
| 8916 | */ |
| 8917 | /*Sme expects the 32 bytes key to be in the below order |
| 8918 | |
| 8919 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8920 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8921 | |--------------|----------|----------| |
| 8922 | <---16bytes---><--8bytes--><--8bytes--> |
| 8923 | */ |
| 8924 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8925 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8926 | |
| 8927 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8928 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8929 | |
| 8930 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8931 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8932 | |
| 8933 | |
| 8934 | break; |
| 8935 | } |
| 8936 | |
| 8937 | case WLAN_CIPHER_SUITE_CCMP: |
| 8938 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 8939 | break; |
| 8940 | |
| 8941 | #ifdef FEATURE_WLAN_WAPI |
| 8942 | case WLAN_CIPHER_SUITE_SMS4: |
| 8943 | { |
| 8944 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8945 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 8946 | params->key, params->key_len); |
| 8947 | return 0; |
| 8948 | } |
| 8949 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8950 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8951 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8952 | case WLAN_CIPHER_SUITE_KRK: |
| 8953 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 8954 | break; |
| 8955 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8956 | |
| 8957 | #ifdef WLAN_FEATURE_11W |
| 8958 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 8959 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 8960 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8961 | #endif |
| 8962 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8963 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8964 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8965 | __func__, params->cipher); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8966 | status = -EOPNOTSUPP; |
| 8967 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8968 | } |
| 8969 | |
| 8970 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 8971 | __func__, setKey.encType); |
| 8972 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8973 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8974 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8975 | (!pairwise) |
| 8976 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8977 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8978 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8979 | ) |
| 8980 | { |
| 8981 | /* set group key*/ |
| 8982 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8983 | "%s- %d: setting Broadcast key", |
| 8984 | __func__, __LINE__); |
| 8985 | setKey.keyDirection = eSIR_RX_ONLY; |
| 8986 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 8987 | } |
| 8988 | else |
| 8989 | { |
| 8990 | /* set pairwise key*/ |
| 8991 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8992 | "%s- %d: setting pairwise key", |
| 8993 | __func__, __LINE__); |
| 8994 | setKey.keyDirection = eSIR_TX_RX; |
| 8995 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 8996 | } |
| 8997 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 8998 | { |
| 8999 | setKey.keyDirection = eSIR_TX_RX; |
| 9000 | /*Set the group key*/ |
| 9001 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9002 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9003 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9004 | if ( 0 != status ) |
| 9005 | { |
| 9006 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9007 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9008 | status = -EINVAL; |
| 9009 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9010 | } |
| 9011 | /*Save the keys here and call sme_RoamSetKey for setting |
| 9012 | the PTK after peer joins the IBSS network*/ |
| 9013 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 9014 | &setKey, sizeof(tCsrRoamSetKey)); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9015 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9016 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9017 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 9018 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 9019 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9020 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9021 | if( pHostapdState->bssState == BSS_START ) |
| 9022 | { |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9023 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9024 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 9025 | |
| 9026 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 9027 | { |
| 9028 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9029 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 9030 | __LINE__, vos_status ); |
| 9031 | |
| 9032 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 9033 | |
| 9034 | status = -EINVAL; |
| 9035 | goto end; |
| 9036 | } |
| 9037 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9038 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 9039 | |
| 9040 | if ( status != eHAL_STATUS_SUCCESS ) |
| 9041 | { |
| 9042 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9043 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 9044 | __LINE__, status ); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9045 | status = -EINVAL; |
| 9046 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9047 | } |
| 9048 | } |
| 9049 | |
| 9050 | /* Saving WEP keys */ |
| 9051 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 9052 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 9053 | { |
| 9054 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 9055 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 9056 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 9057 | } |
| 9058 | else |
| 9059 | { |
| 9060 | //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] | 9061 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9062 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 9063 | } |
| 9064 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9065 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 9066 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9067 | { |
| 9068 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9069 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9070 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9071 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9072 | if (!pairwise) |
| 9073 | #else |
| 9074 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 9075 | #endif |
| 9076 | { |
| 9077 | /* set group key*/ |
| 9078 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 9079 | { |
| 9080 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9081 | "%s- %d: Perform Set key Complete", |
| 9082 | __func__, __LINE__); |
| 9083 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 9084 | } |
| 9085 | } |
| 9086 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9087 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 9088 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 9089 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 9090 | |
| 9091 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9092 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9093 | params->key, params->key_len); |
| 9094 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9095 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9096 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 9097 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9098 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9099 | "%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] | 9100 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9101 | setKey.peerMac[2], setKey.peerMac[3], |
| 9102 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9103 | setKey.keyDirection); |
| 9104 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9105 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 9106 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9107 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 9108 | { |
| 9109 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9110 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 9111 | __LINE__, vos_status ); |
| 9112 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9113 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9114 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9115 | status = -EINVAL; |
| 9116 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9117 | |
| 9118 | } |
| 9119 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9120 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9121 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 9122 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 9123 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9124 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9125 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9126 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9127 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 9128 | "%s: Update PreAuth Key success", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9129 | status = 0; |
| 9130 | goto end; |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9131 | } |
| 9132 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 9133 | { |
| 9134 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9135 | "%s: Update PreAuth Key failed", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9136 | status = -EINVAL; |
| 9137 | goto end; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9138 | } |
| 9139 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9140 | |
| 9141 | /* issue set key request to SME*/ |
| 9142 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9143 | pAdapter->sessionId, &setKey, &roamId ); |
| 9144 | |
| 9145 | if ( 0 != status ) |
| 9146 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9147 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9148 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 9149 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9150 | status = -EINVAL; |
| 9151 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9152 | } |
| 9153 | |
| 9154 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9155 | /* in case of IBSS as there was no information available about WEP keys during |
| 9156 | * 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] | 9157 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9158 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 9159 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 9160 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9161 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 9162 | ) |
| 9163 | && |
| 9164 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 9165 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 9166 | ) |
| 9167 | ) |
| 9168 | { |
| 9169 | setKey.keyDirection = eSIR_RX_ONLY; |
| 9170 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 9171 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9172 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9173 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9174 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9175 | setKey.peerMac[2], setKey.peerMac[3], |
| 9176 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9177 | setKey.keyDirection); |
| 9178 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9179 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9180 | pAdapter->sessionId, &setKey, &roamId ); |
| 9181 | |
| 9182 | if ( 0 != status ) |
| 9183 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9184 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9185 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9186 | __func__, status); |
| 9187 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9188 | status = -EINVAL; |
| 9189 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9190 | } |
| 9191 | } |
| 9192 | } |
| 9193 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9194 | end: |
| 9195 | /* Need to clear any trace of key value in the memory. |
| 9196 | * Thus zero out the memory even though it is local |
| 9197 | * variable. |
| 9198 | */ |
| 9199 | vos_mem_zero(&setKey, sizeof(setKey)); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9200 | EXIT(); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9201 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9202 | } |
| 9203 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9204 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9205 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 9206 | struct net_device *ndev, |
| 9207 | u8 key_index, bool pairwise, |
| 9208 | const u8 *mac_addr, |
| 9209 | struct key_params *params |
| 9210 | ) |
| 9211 | #else |
| 9212 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 9213 | struct net_device *ndev, |
| 9214 | u8 key_index, const u8 *mac_addr, |
| 9215 | struct key_params *params |
| 9216 | ) |
| 9217 | #endif |
| 9218 | { |
| 9219 | int ret; |
| 9220 | vos_ssr_protect(__func__); |
| 9221 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9222 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 9223 | mac_addr, params); |
| 9224 | #else |
| 9225 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 9226 | params); |
| 9227 | #endif |
| 9228 | vos_ssr_unprotect(__func__); |
| 9229 | |
| 9230 | return ret; |
| 9231 | } |
| 9232 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9233 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9234 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9235 | * This function is used to get the key information |
| 9236 | */ |
| 9237 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9238 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9239 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9240 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9241 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9242 | const u8 *mac_addr, void *cookie, |
| 9243 | void (*callback)(void *cookie, struct key_params*) |
| 9244 | ) |
| 9245 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9246 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9247 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9248 | struct net_device *ndev, |
| 9249 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 9250 | void (*callback)(void *cookie, struct key_params*) |
| 9251 | ) |
| 9252 | #endif |
| 9253 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9254 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9255 | hdd_wext_state_t *pWextState = NULL; |
| 9256 | tCsrRoamProfile *pRoamProfile = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9257 | struct key_params params; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9258 | hdd_context_t *pHddCtx; |
| 9259 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9260 | |
| 9261 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9262 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9263 | if (NULL == pAdapter) |
| 9264 | { |
| 9265 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9266 | "%s: HDD adapter is Null", __func__); |
| 9267 | return -ENODEV; |
| 9268 | } |
| 9269 | |
| 9270 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9271 | ret = wlan_hdd_validate_context(pHddCtx); |
| 9272 | if (0 != ret) |
| 9273 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9274 | return ret; |
| 9275 | } |
| 9276 | |
| 9277 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9278 | pRoamProfile = &(pWextState->roamProfile); |
| 9279 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9280 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 9281 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9282 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9283 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9284 | memset(¶ms, 0, sizeof(params)); |
| 9285 | |
| 9286 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9287 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9288 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9289 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9290 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9291 | |
| 9292 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 9293 | { |
| 9294 | case eCSR_ENCRYPT_TYPE_NONE: |
| 9295 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 9296 | break; |
| 9297 | |
| 9298 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 9299 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 9300 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 9301 | break; |
| 9302 | |
| 9303 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 9304 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 9305 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 9306 | break; |
| 9307 | |
| 9308 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 9309 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 9310 | break; |
| 9311 | |
| 9312 | case eCSR_ENCRYPT_TYPE_AES: |
| 9313 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 9314 | break; |
| 9315 | |
| 9316 | default: |
| 9317 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 9318 | break; |
| 9319 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9320 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 9321 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9322 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 9323 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9324 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9325 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 9326 | params.seq_len = 0; |
| 9327 | params.seq = NULL; |
| 9328 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 9329 | callback(cookie, ¶ms); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9330 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9331 | return 0; |
| 9332 | } |
| 9333 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9334 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9335 | static int wlan_hdd_cfg80211_get_key( |
| 9336 | struct wiphy *wiphy, |
| 9337 | struct net_device *ndev, |
| 9338 | u8 key_index, bool pairwise, |
| 9339 | const u8 *mac_addr, void *cookie, |
| 9340 | void (*callback)(void *cookie, struct key_params*) |
| 9341 | ) |
| 9342 | #else |
| 9343 | static int wlan_hdd_cfg80211_get_key( |
| 9344 | struct wiphy *wiphy, |
| 9345 | struct net_device *ndev, |
| 9346 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 9347 | void (*callback)(void *cookie, struct key_params*) |
| 9348 | ) |
| 9349 | #endif |
| 9350 | { |
| 9351 | int ret; |
| 9352 | |
| 9353 | vos_ssr_protect(__func__); |
| 9354 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9355 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 9356 | mac_addr, cookie, callback); |
| 9357 | #else |
| 9358 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 9359 | callback); |
| 9360 | #endif |
| 9361 | vos_ssr_unprotect(__func__); |
| 9362 | |
| 9363 | return ret; |
| 9364 | } |
| 9365 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9366 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9367 | * FUNCTION: __wlan_hdd_cfg80211_del_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9368 | * This function is used to delete the key information |
| 9369 | */ |
| 9370 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9371 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9372 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9373 | u8 key_index, |
| 9374 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9375 | const u8 *mac_addr |
| 9376 | ) |
| 9377 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9378 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9379 | struct net_device *ndev, |
| 9380 | u8 key_index, |
| 9381 | const u8 *mac_addr |
| 9382 | ) |
| 9383 | #endif |
| 9384 | { |
| 9385 | int status = 0; |
| 9386 | |
| 9387 | //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] | 9388 | //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] | 9389 | //it is observed that this is invalidating peer |
| 9390 | //key index whenever re-key is done. This is affecting data link. |
| 9391 | //It should be ok to ignore del_key. |
| 9392 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9393 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 9394 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9395 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 9396 | tCsrRoamSetKey setKey; |
| 9397 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9398 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9399 | ENTER(); |
| 9400 | |
| 9401 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 9402 | __func__,pAdapter->device_mode); |
| 9403 | |
| 9404 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9405 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9406 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9407 | key_index); |
| 9408 | |
| 9409 | return -EINVAL; |
| 9410 | } |
| 9411 | |
| 9412 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9413 | setKey.keyId = key_index; |
| 9414 | |
| 9415 | if (mac_addr) |
| 9416 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 9417 | else |
| 9418 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 9419 | |
| 9420 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 9421 | |
| 9422 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9423 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9424 | ) |
| 9425 | { |
| 9426 | |
| 9427 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9428 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 9429 | if( pHostapdState->bssState == BSS_START) |
| 9430 | { |
| 9431 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9432 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9433 | if ( status != eHAL_STATUS_SUCCESS ) |
| 9434 | { |
| 9435 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9436 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 9437 | __LINE__, status ); |
| 9438 | } |
| 9439 | } |
| 9440 | } |
| 9441 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9442 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9443 | ) |
| 9444 | { |
| 9445 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9446 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9447 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 9448 | |
| 9449 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9450 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9451 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9452 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9453 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9454 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 9455 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9456 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9457 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9458 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9459 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9460 | if ( 0 != status ) |
| 9461 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9462 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9463 | "%s: sme_RoamSetKey failure, returned %d", |
| 9464 | __func__, status); |
| 9465 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 9466 | return -EINVAL; |
| 9467 | } |
| 9468 | } |
| 9469 | } |
| 9470 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9471 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9472 | return status; |
| 9473 | } |
| 9474 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9475 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9476 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 9477 | struct net_device *ndev, |
| 9478 | u8 key_index, |
| 9479 | bool pairwise, |
| 9480 | const u8 *mac_addr |
| 9481 | ) |
| 9482 | #else |
| 9483 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 9484 | struct net_device *ndev, |
| 9485 | u8 key_index, |
| 9486 | const u8 *mac_addr |
| 9487 | ) |
| 9488 | #endif |
| 9489 | { |
| 9490 | int ret; |
| 9491 | |
| 9492 | vos_ssr_protect(__func__); |
| 9493 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9494 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, pairwise, |
| 9495 | mac_addr); |
| 9496 | #else |
| 9497 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, mac_addr); |
| 9498 | #endif |
| 9499 | vos_ssr_unprotect(__func__); |
| 9500 | |
| 9501 | return ret; |
| 9502 | } |
| 9503 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9504 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9505 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9506 | * This function is used to set the default tx key index |
| 9507 | */ |
| 9508 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9509 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9510 | struct net_device *ndev, |
| 9511 | u8 key_index, |
| 9512 | bool unicast, bool multicast) |
| 9513 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9514 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9515 | struct net_device *ndev, |
| 9516 | u8 key_index) |
| 9517 | #endif |
| 9518 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9519 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9520 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9521 | hdd_wext_state_t *pWextState; |
| 9522 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9523 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9524 | |
| 9525 | ENTER(); |
| 9526 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9527 | if ((NULL == pAdapter)) |
| 9528 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9529 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9530 | "invalid adapter"); |
| 9531 | return -EINVAL; |
| 9532 | } |
| 9533 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9534 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9535 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 9536 | pAdapter->sessionId, key_index)); |
| 9537 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9538 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9539 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9540 | |
| 9541 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 9542 | { |
| 9543 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9544 | "invalid Wext state or HDD context"); |
| 9545 | return -EINVAL; |
| 9546 | } |
| 9547 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9548 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9549 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9550 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9551 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9552 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9553 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9554 | key_index); |
| 9555 | |
| 9556 | return -EINVAL; |
| 9557 | } |
| 9558 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9559 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9560 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9561 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9562 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9563 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9564 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9565 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9566 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9567 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9568 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9569 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9570 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 9571 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9572 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 9573 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9574 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9575 | { |
| 9576 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9577 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9578 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9579 | tCsrRoamSetKey setKey; |
| 9580 | v_U32_t roamId= 0xFF; |
| 9581 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9582 | |
| 9583 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9584 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9585 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9586 | Keys->defaultIndex = (u8)key_index; |
| 9587 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9588 | setKey.keyId = key_index; |
| 9589 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9590 | |
| 9591 | vos_mem_copy(&setKey.Key[0], |
| 9592 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9593 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9594 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9595 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9596 | |
| 9597 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9598 | &pHddStaCtx->conn_info.bssId[0], |
| 9599 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9600 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9601 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 9602 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 9603 | eCSR_ENCRYPT_TYPE_WEP104) |
| 9604 | { |
| 9605 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 9606 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 9607 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 9608 | type(104) and switching encryption type to 40*/ |
| 9609 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 9610 | eCSR_ENCRYPT_TYPE_WEP40; |
| 9611 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 9612 | eCSR_ENCRYPT_TYPE_WEP40; |
| 9613 | } |
| 9614 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9615 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9616 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9617 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9618 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9619 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9620 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9621 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9622 | if ( 0 != status ) |
| 9623 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9624 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9625 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9626 | status); |
| 9627 | return -EINVAL; |
| 9628 | } |
| 9629 | } |
| 9630 | } |
| 9631 | |
| 9632 | /* In SoftAp mode setting key direction for default mode */ |
| 9633 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 9634 | { |
| 9635 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 9636 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 9637 | (eCSR_ENCRYPT_TYPE_AES != |
| 9638 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 9639 | ) |
| 9640 | { |
| 9641 | /* Saving key direction for default key index to TX default */ |
| 9642 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 9643 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 9644 | } |
| 9645 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9646 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9647 | return status; |
| 9648 | } |
| 9649 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9650 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9651 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 9652 | struct net_device *ndev, |
| 9653 | u8 key_index, |
| 9654 | bool unicast, bool multicast) |
| 9655 | #else |
| 9656 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 9657 | struct net_device *ndev, |
| 9658 | u8 key_index) |
| 9659 | #endif |
| 9660 | { |
| 9661 | int ret; |
| 9662 | vos_ssr_protect(__func__); |
| 9663 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9664 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 9665 | multicast); |
| 9666 | #else |
| 9667 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 9668 | #endif |
| 9669 | vos_ssr_unprotect(__func__); |
| 9670 | |
| 9671 | return ret; |
| 9672 | } |
| 9673 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9674 | /* |
| 9675 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 9676 | * This function is used to inform the BSS details to nl80211 interface. |
| 9677 | */ |
| 9678 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 9679 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 9680 | { |
| 9681 | struct net_device *dev = pAdapter->dev; |
| 9682 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 9683 | struct wiphy *wiphy = wdev->wiphy; |
| 9684 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 9685 | int chan_no; |
| 9686 | int ie_length; |
| 9687 | const char *ie; |
| 9688 | unsigned int freq; |
| 9689 | struct ieee80211_channel *chan; |
| 9690 | int rssi = 0; |
| 9691 | struct cfg80211_bss *bss = NULL; |
| 9692 | |
| 9693 | ENTER(); |
| 9694 | |
| 9695 | if( NULL == pBssDesc ) |
| 9696 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9697 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9698 | return bss; |
| 9699 | } |
| 9700 | |
| 9701 | chan_no = pBssDesc->channelId; |
| 9702 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 9703 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 9704 | |
| 9705 | if( NULL == ie ) |
| 9706 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9707 | 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] | 9708 | return bss; |
| 9709 | } |
| 9710 | |
| 9711 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 9712 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 9713 | { |
| 9714 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9715 | } |
| 9716 | else |
| 9717 | { |
| 9718 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9719 | } |
| 9720 | #else |
| 9721 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9722 | #endif |
| 9723 | |
| 9724 | chan = __ieee80211_get_channel(wiphy, freq); |
| 9725 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 9726 | if (!chan) { |
| 9727 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 9728 | return NULL; |
| 9729 | } |
| 9730 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9731 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9732 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9733 | return cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9734 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9735 | pBssDesc->capabilityInfo, |
| 9736 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9737 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9738 | } |
| 9739 | |
| 9740 | |
| 9741 | |
| 9742 | /* |
| 9743 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 9744 | * This function is used to inform the BSS details to nl80211 interface. |
| 9745 | */ |
| 9746 | struct cfg80211_bss* |
| 9747 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 9748 | tSirBssDescription *bss_desc |
| 9749 | ) |
| 9750 | { |
| 9751 | /* |
| 9752 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 9753 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 9754 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 9755 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 9756 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 9757 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 9758 | cfg80211_inform_bss_frame. |
| 9759 | */ |
| 9760 | struct net_device *dev = pAdapter->dev; |
| 9761 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 9762 | struct wiphy *wiphy = wdev->wiphy; |
| 9763 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 9764 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 9765 | qcom_ie_age *qie_age = NULL; |
| 9766 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 9767 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9768 | 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] | 9769 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9770 | const char *ie = |
| 9771 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 9772 | unsigned int freq; |
| 9773 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 9774 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9775 | struct cfg80211_bss *bss_status = NULL; |
| 9776 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 9777 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9778 | hdd_context_t *pHddCtx; |
| 9779 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9780 | #ifdef WLAN_OPEN_SOURCE |
| 9781 | struct timespec ts; |
| 9782 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9783 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9784 | ENTER(); |
| 9785 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9786 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9787 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9788 | if (0 != status) |
| 9789 | { |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 9790 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9791 | } |
| 9792 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 9793 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9794 | if (!mgmt) |
| 9795 | { |
| 9796 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9797 | "%s: memory allocation failed ", __func__); |
| 9798 | return NULL; |
| 9799 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 9800 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9801 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9802 | |
| 9803 | #ifdef WLAN_OPEN_SOURCE |
| 9804 | /* Android does not want the timestamp from the frame. |
| 9805 | Instead it wants a monotonic increasing value */ |
| 9806 | get_monotonic_boottime(&ts); |
| 9807 | mgmt->u.probe_resp.timestamp = |
| 9808 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 9809 | #else |
| 9810 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9811 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 9812 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9813 | |
| 9814 | #endif |
| 9815 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9816 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 9817 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 9818 | |
| 9819 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 9820 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 9821 | /* Assuming this is the last IE, copy at the end */ |
| 9822 | ie_length -=sizeof(qcom_ie_age); |
| 9823 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 9824 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 9825 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 9826 | qie_age->oui_1 = QCOM_OUI1; |
| 9827 | qie_age->oui_2 = QCOM_OUI2; |
| 9828 | qie_age->oui_3 = QCOM_OUI3; |
| 9829 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 9830 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 9831 | #endif |
| 9832 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9833 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 9834 | if (bss_desc->fProbeRsp) |
| 9835 | { |
| 9836 | mgmt->frame_control |= |
| 9837 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 9838 | } |
| 9839 | else |
| 9840 | { |
| 9841 | mgmt->frame_control |= |
| 9842 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 9843 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9844 | |
| 9845 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9846 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9847 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 9848 | { |
| 9849 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9850 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9851 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9852 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 9853 | |
| 9854 | { |
| 9855 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9856 | } |
| 9857 | else |
| 9858 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9859 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 9860 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9861 | kfree(mgmt); |
| 9862 | return NULL; |
| 9863 | } |
| 9864 | #else |
| 9865 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9866 | #endif |
| 9867 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 9868 | /*when the band is changed on the fly using the GUI, three things are done |
| 9869 | * 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) |
| 9870 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 9871 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 9872 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 9873 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 9874 | * 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 |
| 9875 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 9876 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 9877 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 9878 | * So drop the bss and continue to next bss. |
| 9879 | */ |
| 9880 | if(chan == NULL) |
| 9881 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9882 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 9883 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 9884 | return NULL; |
| 9885 | } |
Sachin Ahuja | 40530ed | 2015-04-20 00:20:58 +0530 | [diff] [blame] | 9886 | /* Supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 9887 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0)) * 100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9888 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9889 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
| 9890 | "RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 9891 | chan->center_freq, (int)(rssi/100)); |
| 9892 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9893 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 9894 | frame_len, rssi, GFP_KERNEL); |
| 9895 | kfree(mgmt); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9896 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9897 | return bss_status; |
| 9898 | } |
| 9899 | |
| 9900 | /* |
| 9901 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 9902 | * This function is used to update the BSS data base of CFG8011 |
| 9903 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9904 | 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] | 9905 | tCsrRoamInfo *pRoamInfo |
| 9906 | ) |
| 9907 | { |
| 9908 | tCsrRoamConnectedProfile roamProfile; |
| 9909 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9910 | struct cfg80211_bss *bss = NULL; |
| 9911 | |
| 9912 | ENTER(); |
| 9913 | |
| 9914 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 9915 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 9916 | |
| 9917 | if (NULL != roamProfile.pBssDesc) |
| 9918 | { |
Girish Gowli | f4b6802 | 2014-08-28 23:18:57 +0530 | [diff] [blame] | 9919 | bss = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 9920 | roamProfile.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9921 | |
| 9922 | if (NULL == bss) |
| 9923 | { |
| 9924 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 9925 | __func__); |
| 9926 | } |
| 9927 | |
| 9928 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 9929 | } |
| 9930 | else |
| 9931 | { |
| 9932 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 9933 | __func__); |
| 9934 | } |
| 9935 | return bss; |
| 9936 | } |
| 9937 | |
| 9938 | /* |
| 9939 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 9940 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9941 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 9942 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9943 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9944 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9945 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9946 | tCsrScanResultInfo *pScanResult; |
| 9947 | eHalStatus status = 0; |
| 9948 | tScanResultHandle pResult; |
| 9949 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9950 | hdd_context_t *pHddCtx; |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 9951 | bool is_p2p_scan = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9952 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9953 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9954 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9955 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 9956 | NO_SESSION, pAdapter->sessionId)); |
| 9957 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9958 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9959 | |
| 9960 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9961 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9962 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9963 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 9964 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9965 | } |
| 9966 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9967 | |
| 9968 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 9969 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9970 | { |
| 9971 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9972 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 9973 | return VOS_STATUS_E_PERM; |
| 9974 | } |
| 9975 | |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 9976 | if (pAdapter->request != NULL) |
| 9977 | { |
| 9978 | if ((pAdapter->request->n_ssids == 1) |
| 9979 | && (pAdapter->request->ssids != NULL) |
| 9980 | && vos_mem_compare(&pAdapter->request->ssids[0], "DIRECT-", 7)) |
| 9981 | is_p2p_scan = true; |
| 9982 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9983 | /* |
| 9984 | * start getting scan results and populate cgf80211 BSS database |
| 9985 | */ |
| 9986 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 9987 | |
| 9988 | /* no scan results */ |
| 9989 | if (NULL == pResult) |
| 9990 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9991 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 9992 | __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9993 | return status; |
| 9994 | } |
| 9995 | |
| 9996 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 9997 | |
| 9998 | while (pScanResult) |
| 9999 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10000 | /* |
| 10001 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 10002 | * entry already exists in bss data base of cfg80211 for that |
| 10003 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 10004 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 10005 | * mgmt packet as input. As of now there is no possibility to get |
| 10006 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10007 | * ieee80211_mgmt(probe response) and passing to c |
| 10008 | * fg80211_inform_bss_frame. |
| 10009 | * */ |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 10010 | if(is_p2p_scan && (pScanResult->ssId.ssId != NULL) && |
| 10011 | !vos_mem_compare( pScanResult->ssId.ssId, "DIRECT-", 7) ) |
| 10012 | { |
| 10013 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Non P2P BSS skipped: =%s:"), |
| 10014 | pScanResult->ssId.ssId); |
| 10015 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 10016 | continue; //Skip the non p2p bss entries |
| 10017 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10018 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 10019 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10020 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10021 | |
| 10022 | if (NULL == bss_status) |
| 10023 | { |
| 10024 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10025 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10026 | } |
| 10027 | else |
| 10028 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 10029 | cfg80211_put_bss( |
| 10030 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 10031 | wiphy, |
| 10032 | #endif |
| 10033 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10034 | } |
| 10035 | |
| 10036 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 10037 | } |
| 10038 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10039 | sme_ScanResultPurge(hHal, pResult); |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 10040 | is_p2p_scan = false; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10041 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10042 | } |
| 10043 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10044 | void |
| 10045 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 10046 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10047 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 10048 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10049 | } /****** end hddPrintMacAddr() ******/ |
| 10050 | |
| 10051 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 10052 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10053 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10054 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10055 | "%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] | 10056 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 10057 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 10058 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10059 | } /****** end hddPrintPmkId() ******/ |
| 10060 | |
| 10061 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 10062 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 10063 | |
| 10064 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 10065 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 10066 | |
| 10067 | #define dump_bssid(bssid) \ |
| 10068 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10069 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 10070 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10071 | } |
| 10072 | |
| 10073 | #define dump_pmkid(pMac, pmkid) \ |
| 10074 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10075 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 10076 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10077 | } |
| 10078 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 10079 | #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] | 10080 | /* |
| 10081 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 10082 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 10083 | */ |
| 10084 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10085 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10086 | int index, bool preauth ) |
| 10087 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10088 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10089 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10090 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10091 | |
| 10092 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10093 | 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] | 10094 | |
| 10095 | if( NULL == pRoamInfo ) |
| 10096 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10097 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10098 | return -EINVAL; |
| 10099 | } |
| 10100 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10101 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 10102 | { |
| 10103 | dump_bssid(pRoamInfo->bssid); |
| 10104 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10105 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10106 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10107 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10108 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10109 | } |
| 10110 | #endif //FEATURE_WLAN_LFR |
| 10111 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 10112 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 10113 | /* |
| 10114 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 10115 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 10116 | * |
| 10117 | */ |
| 10118 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 10119 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 10120 | tCsrRoamInfo *pRoamInfo) |
| 10121 | { |
| 10122 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10123 | union iwreq_data wrqu; |
| 10124 | |
| 10125 | ENTER(); |
| 10126 | |
| 10127 | if (NULL == pAdapter) |
| 10128 | { |
| 10129 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10130 | return VOS_STATUS_E_FAILURE; |
| 10131 | } |
| 10132 | |
| 10133 | /* create the event */ |
| 10134 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10135 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10136 | |
| 10137 | wrqu.data.pointer = metrics_notification; |
| 10138 | wrqu.data.length = scnprintf(metrics_notification, |
| 10139 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 10140 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10141 | |
| 10142 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10143 | |
| 10144 | EXIT(); |
| 10145 | |
| 10146 | return VOS_STATUS_SUCCESS; |
| 10147 | } |
| 10148 | |
| 10149 | /* |
| 10150 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 10151 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 10152 | * or failure |
| 10153 | */ |
| 10154 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 10155 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 10156 | { |
| 10157 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10158 | union iwreq_data wrqu; |
| 10159 | |
| 10160 | ENTER(); |
| 10161 | |
| 10162 | if (NULL == pAdapter) |
| 10163 | { |
| 10164 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10165 | return VOS_STATUS_E_FAILURE; |
| 10166 | } |
| 10167 | |
| 10168 | /* create the event */ |
| 10169 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10170 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10171 | |
| 10172 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 10173 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 10174 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10175 | |
| 10176 | if (1 == preauth_status) |
| 10177 | strncat(metrics_notification, " TRUE", 5); |
| 10178 | else |
| 10179 | strncat(metrics_notification, " FALSE", 6); |
| 10180 | |
| 10181 | wrqu.data.pointer = metrics_notification; |
| 10182 | wrqu.data.length = strlen(metrics_notification); |
| 10183 | |
| 10184 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10185 | |
| 10186 | EXIT(); |
| 10187 | |
| 10188 | return VOS_STATUS_SUCCESS; |
| 10189 | } |
| 10190 | |
| 10191 | /* |
| 10192 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 10193 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 10194 | * |
| 10195 | */ |
| 10196 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 10197 | tCsrRoamInfo *pRoamInfo) |
| 10198 | { |
| 10199 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10200 | union iwreq_data wrqu; |
| 10201 | |
| 10202 | ENTER(); |
| 10203 | |
| 10204 | if (NULL == pAdapter) |
| 10205 | { |
| 10206 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10207 | return VOS_STATUS_E_FAILURE; |
| 10208 | } |
| 10209 | |
| 10210 | /* create the event */ |
| 10211 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10212 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10213 | |
| 10214 | wrqu.data.pointer = metrics_notification; |
| 10215 | wrqu.data.length = scnprintf(metrics_notification, |
| 10216 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 10217 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10218 | |
| 10219 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10220 | |
| 10221 | EXIT(); |
| 10222 | |
| 10223 | return VOS_STATUS_SUCCESS; |
| 10224 | } |
| 10225 | #endif |
| 10226 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10227 | /* |
| 10228 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 10229 | * scanning callback function, called after finishing scan |
| 10230 | * |
| 10231 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10232 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10233 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 10234 | { |
| 10235 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10236 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10237 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10238 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10239 | struct cfg80211_scan_request *req = NULL; |
| 10240 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10241 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10242 | long waitRet = 0; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10243 | tANI_U8 i; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10244 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10245 | |
| 10246 | ENTER(); |
| 10247 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10248 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Siddharth Bhal | 5c2e02d | 2015-05-05 17:35:29 +0530 | [diff] [blame] | 10249 | if (NULL == pHddCtx) { |
| 10250 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is Null")); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10251 | goto allow_suspend; |
| 10252 | } |
| 10253 | |
| 10254 | pScanInfo = &pHddCtx->scan_info; |
| 10255 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10256 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10257 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10258 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10259 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 10260 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10261 | pScanInfo->mScanPendingCounter = 0; |
| 10262 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10263 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10264 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10265 | &pScanInfo->scan_req_completion_event, |
| 10266 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10267 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10268 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10269 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10270 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10271 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10272 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10273 | } |
| 10274 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 10275 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10276 | { |
| 10277 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10278 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10279 | } |
| 10280 | |
| 10281 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10282 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10283 | { |
| 10284 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10285 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10286 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10287 | (int) scanId); |
| 10288 | } |
| 10289 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10290 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10291 | pAdapter); |
| 10292 | |
| 10293 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10294 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10295 | |
| 10296 | |
| 10297 | /* If any client wait scan result through WEXT |
| 10298 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10299 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10300 | { |
| 10301 | /* The other scan request waiting for current scan finish |
| 10302 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10303 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10304 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10305 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10306 | } |
| 10307 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10308 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10309 | { |
| 10310 | struct net_device *dev = pAdapter->dev; |
| 10311 | union iwreq_data wrqu; |
| 10312 | int we_event; |
| 10313 | char *msg; |
| 10314 | |
| 10315 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 10316 | we_event = SIOCGIWSCAN; |
| 10317 | msg = NULL; |
| 10318 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 10319 | } |
| 10320 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10321 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10322 | |
| 10323 | /* Get the Scan Req */ |
| 10324 | req = pAdapter->request; |
| 10325 | |
| 10326 | if (!req) |
| 10327 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10328 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10329 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10330 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10331 | } |
| 10332 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10333 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10334 | /* Scan is no longer pending */ |
| 10335 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10336 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10337 | /* last_scan_timestamp is used to decide if new scan |
| 10338 | * is needed or not on station interface. If last station |
| 10339 | * scan time and new station scan time is less then |
| 10340 | * last_scan_timestamp ; driver will return cached scan. |
| 10341 | */ |
| 10342 | if (req->no_cck == FALSE && status == eCSR_SCAN_SUCCESS) // no_cck will be set during p2p find |
| 10343 | { |
| 10344 | pScanInfo->last_scan_timestamp = vos_timer_get_system_time(); |
| 10345 | |
| 10346 | if ( req->n_channels ) |
| 10347 | { |
| 10348 | for (i = 0; i < req->n_channels ; i++ ) |
| 10349 | { |
| 10350 | pHddCtx->scan_info.last_scan_channelList[i] = req->channels[i]->hw_value; |
| 10351 | } |
| 10352 | /* store no of channel scanned */ |
| 10353 | pHddCtx->scan_info.last_scan_numChannels= req->n_channels; |
| 10354 | } |
| 10355 | |
| 10356 | } |
| 10357 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 10358 | /* |
| 10359 | * cfg80211_scan_done informing NL80211 about completion |
| 10360 | * of scanning |
| 10361 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10362 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 10363 | { |
| 10364 | aborted = true; |
| 10365 | } |
| 10366 | cfg80211_scan_done(req, aborted); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 10367 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10368 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10369 | if (pHddCtx->spoofMacAddr.isEnabled || pHddCtx->spoofMacAddr.isReqDeferred) { |
| 10370 | /* Generate new random mac addr for next scan */ |
| 10371 | hddLog(VOS_TRACE_LEVEL_INFO, "scan completed - generate new spoof mac addr"); |
| 10372 | hdd_processSpoofMacAddrRequest(pHddCtx); |
| 10373 | } |
| 10374 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10375 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10376 | /* release the wake lock at the end of the scan*/ |
| 10377 | hdd_allow_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10378 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 10379 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 10380 | * immediatly after the driver gets connect request(i.e after scan) |
| 10381 | * from supplicant, this result in app's is suspending and not able |
| 10382 | * to process the connect request to AP */ |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 10383 | hdd_prevent_suspend_timeout(1000); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 10384 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 10385 | #ifdef FEATURE_WLAN_TDLS |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10386 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 10387 | #endif |
| 10388 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10389 | EXIT(); |
| 10390 | return 0; |
| 10391 | } |
| 10392 | |
| 10393 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10394 | * FUNCTION: hdd_isConnectionInProgress |
| 10395 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10396 | * |
| 10397 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10398 | v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10399 | { |
| 10400 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 10401 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 10402 | hdd_adapter_t *pAdapter = NULL; |
| 10403 | VOS_STATUS status = 0; |
| 10404 | v_U8_t staId = 0; |
| 10405 | v_U8_t *staMac = NULL; |
| 10406 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 10407 | if (TRUE == pHddCtx->btCoexModeSet) |
| 10408 | { |
| 10409 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10410 | FL("BTCoex Mode operation in progress")); |
| 10411 | return VOS_TRUE; |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 10412 | } |
| 10413 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10414 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 10415 | |
| 10416 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 10417 | { |
| 10418 | pAdapter = pAdapterNode->pAdapter; |
| 10419 | |
| 10420 | if( pAdapter ) |
| 10421 | { |
| 10422 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10423 | "%s: Adapter with device mode %s (%d) exists", |
| 10424 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10425 | pAdapter->device_mode); |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10426 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10427 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10428 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 10429 | (eConnectionState_Connecting == |
| 10430 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 10431 | { |
| 10432 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10433 | "%s: %p(%d) Connection is in progress", __func__, |
| 10434 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 10435 | return VOS_TRUE; |
| 10436 | } |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10437 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Padma, Santhosh Kumar | 3b9657d | 2015-02-04 19:37:32 +0530 | [diff] [blame] | 10438 | smeNeighborMiddleOfRoaming(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10439 | { |
| 10440 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10441 | "%s: %p(%d) Reassociation is in progress", __func__, |
| 10442 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 10443 | return VOS_TRUE; |
| 10444 | } |
| 10445 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10446 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10447 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10448 | { |
| 10449 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10450 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10451 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10452 | { |
| 10453 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 10454 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10455 | "%s: client " MAC_ADDRESS_STR |
| 10456 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 10457 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10458 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10459 | } |
| 10460 | } |
| 10461 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 10462 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 10463 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10464 | v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 10465 | ptSapContext pSapCtx = NULL; |
| 10466 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 10467 | if(pSapCtx == NULL){ |
| 10468 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10469 | FL("psapCtx is NULL")); |
| 10470 | return VOS_FALSE; |
| 10471 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10472 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 10473 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10474 | if ((pSapCtx->aStaInfo[staId].isUsed) && |
| 10475 | (WLANTL_STA_CONNECTED == pSapCtx->aStaInfo[staId].tlSTAState)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10476 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10477 | staMac = (v_U8_t *) &(pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10478 | |
| 10479 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10480 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 10481 | "middle of WPS/EAPOL exchange.", __func__, |
| 10482 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10483 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10484 | } |
| 10485 | } |
| 10486 | } |
| 10487 | } |
| 10488 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 10489 | pAdapterNode = pNext; |
| 10490 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10491 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10492 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10493 | |
| 10494 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10495 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10496 | * this scan respond to scan trigger and update cfg80211 scan database |
| 10497 | * later, scan dump command can be used to recieve scan results |
| 10498 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10499 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 10500 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10501 | struct net_device *dev, |
| 10502 | #endif |
| 10503 | struct cfg80211_scan_request *request) |
| 10504 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10505 | hdd_adapter_t *pAdapter = NULL; |
| 10506 | hdd_context_t *pHddCtx = NULL; |
| 10507 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10508 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10509 | tCsrScanRequest scanRequest; |
| 10510 | tANI_U8 *channelList = NULL, i; |
| 10511 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10512 | int status; |
| 10513 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10514 | v_U8_t* pP2pIe = NULL; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10515 | int ret = 0; |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 10516 | v_U8_t *pWpsIe=NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10517 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10518 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 10519 | struct net_device *dev = NULL; |
| 10520 | if (NULL == request) |
| 10521 | { |
| 10522 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10523 | "%s: scan req param null", __func__); |
| 10524 | return -EINVAL; |
| 10525 | } |
| 10526 | dev = request->wdev->netdev; |
| 10527 | #endif |
| 10528 | |
| 10529 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 10530 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 10531 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10532 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10533 | ENTER(); |
| 10534 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10535 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 10536 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10537 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10538 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10539 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10540 | if (0 != status) |
| 10541 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10542 | return status; |
| 10543 | } |
| 10544 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10545 | if (NULL == pwextBuf) |
| 10546 | { |
| 10547 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 10548 | __func__); |
| 10549 | return -EIO; |
| 10550 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10551 | cfg_param = pHddCtx->cfg_ini; |
| 10552 | pScanInfo = &pHddCtx->scan_info; |
| 10553 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10554 | #ifdef WLAN_BTAMP_FEATURE |
| 10555 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10556 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10557 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 10558 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10559 | "%s: No scanning when AMP is on", __func__); |
| 10560 | return -EOPNOTSUPP; |
| 10561 | } |
| 10562 | #endif |
| 10563 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10564 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10565 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10566 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10567 | "%s: Not scanning on device_mode = %s (%d)", |
| 10568 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10569 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10570 | return -EOPNOTSUPP; |
| 10571 | } |
| 10572 | |
| 10573 | if (TRUE == pScanInfo->mScanPending) |
| 10574 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10575 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 10576 | { |
| 10577 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 10578 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10579 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10580 | } |
| 10581 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10582 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10583 | //Channel and action frame is pending |
| 10584 | //Otherwise Cancel Remain On Channel and allow Scan |
| 10585 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10586 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10587 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10588 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10589 | return -EBUSY; |
| 10590 | } |
| 10591 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10592 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 10593 | { |
| 10594 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 10595 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10596 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10597 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10598 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 10599 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10600 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10601 | "%s: MAX TM Level Scan not allowed", __func__); |
| 10602 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10603 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10604 | } |
| 10605 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 10606 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10607 | /* Check if scan is allowed at this point of time. |
| 10608 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10609 | if (hdd_isConnectionInProgress(pHddCtx)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10610 | { |
| 10611 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 10612 | return -EBUSY; |
| 10613 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10614 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10615 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 10616 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10617 | hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d", |
| 10618 | (int)request->n_ssids); |
| 10619 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10620 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10621 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 10622 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 10623 | * is not aging out the scan results. |
| 10624 | */ |
| 10625 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10626 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10627 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10628 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10629 | |
| 10630 | if ((request->ssids) && (0 < request->n_ssids)) |
| 10631 | { |
| 10632 | tCsrSSIDInfo *SsidInfo; |
| 10633 | int j; |
| 10634 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 10635 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 10636 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 10637 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 10638 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 10639 | |
| 10640 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 10641 | { |
| 10642 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10643 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 10644 | return -ENOMEM; |
| 10645 | } |
| 10646 | |
| 10647 | /* copy all the ssid's and their length */ |
| 10648 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 10649 | { |
| 10650 | /* get the ssid length */ |
| 10651 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 10652 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 10653 | SsidInfo->SSID.length); |
| 10654 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 10655 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 10656 | j, SsidInfo->SSID.ssId); |
| 10657 | } |
| 10658 | /* set the scan type to active */ |
| 10659 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 10660 | } |
| 10661 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10662 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10663 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10664 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 10665 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10666 | /* set the scan type to active */ |
| 10667 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10668 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10669 | else |
| 10670 | { |
| 10671 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 10672 | scanRequest.scanType = pScanInfo->scan_mode; |
| 10673 | } |
| 10674 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 10675 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10676 | |
| 10677 | /* set BSSType to default type */ |
| 10678 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 10679 | |
| 10680 | /*TODO: scan the requested channels only*/ |
| 10681 | |
| 10682 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10683 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10684 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10685 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10686 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 10687 | request->n_channels = MAX_CHANNEL; |
| 10688 | } |
| 10689 | |
| 10690 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10691 | "No of Scan Channels: %d", request->n_channels); |
| 10692 | |
| 10693 | |
| 10694 | if( request->n_channels ) |
| 10695 | { |
| 10696 | char chList [(request->n_channels*5)+1]; |
| 10697 | int len; |
| 10698 | channelList = vos_mem_malloc( request->n_channels ); |
| 10699 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10700 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10701 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10702 | "%s: memory alloc failed channelList", __func__); |
| 10703 | status = -ENOMEM; |
| 10704 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10705 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10706 | |
| 10707 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 10708 | { |
| 10709 | channelList[i] = request->channels[i]->hw_value; |
| 10710 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 10711 | } |
| 10712 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10713 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10714 | "Channel-List: %s ", chList); |
| 10715 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10716 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10717 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 10718 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 10719 | |
| 10720 | /* set requestType to full scan */ |
| 10721 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 10722 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10723 | /* if there is back to back scan happening in driver with in |
| 10724 | * nDeferScanTimeInterval interval driver should defer new scan request |
| 10725 | * and should provide last cached scan results instead of new channel list. |
| 10726 | * This rule is not applicable if scan is p2p scan. |
| 10727 | * This condition will work only in case when last request no of channels |
| 10728 | * and channels are exactly same as new request. |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10729 | * This should be done only in connected state |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 10730 | * Scan shouldn't be defered for WPS scan case. |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10731 | */ |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10732 | |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 10733 | pWpsIe = wlan_hdd_get_wps_ie_ptr((v_U8_t*)request->ie,request->ie_len); |
| 10734 | /* if wps ie is NULL , then only defer scan */ |
| 10735 | if ( pWpsIe == NULL && |
| 10736 | (VOS_STATUS_SUCCESS == hdd_is_any_session_connected(pHddCtx))) |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10737 | { |
| 10738 | if ( pScanInfo->last_scan_timestamp !=0 && |
| 10739 | ((vos_timer_get_system_time() - pScanInfo->last_scan_timestamp ) < pHddCtx->cfg_ini->nDeferScanTimeInterval)) |
| 10740 | { |
| 10741 | if ( request->no_cck == FALSE && scanRequest.ChannelInfo.numOfChannels != 1 && |
| 10742 | (pScanInfo->last_scan_numChannels == scanRequest.ChannelInfo.numOfChannels) && |
| 10743 | vos_mem_compare(pScanInfo->last_scan_channelList, |
| 10744 | channelList, pScanInfo->last_scan_numChannels)) |
| 10745 | { |
| 10746 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10747 | " New and old station scan time differ is less then %u", |
| 10748 | pHddCtx->cfg_ini->nDeferScanTimeInterval); |
| 10749 | |
| 10750 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10751 | pAdapter); |
| 10752 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10753 | hddLog(VOS_TRACE_LEVEL_WARN, |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 10754 | "Return old cached scan as all channels and no of channels are same"); |
| 10755 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10756 | if (0 > ret) |
| 10757 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10758 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10759 | cfg80211_scan_done(request, eCSR_SCAN_SUCCESS); |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 10760 | |
| 10761 | status = eHAL_STATUS_SUCCESS; |
| 10762 | goto free_mem; |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10763 | } |
| 10764 | } |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10765 | } |
| 10766 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10767 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 10768 | * search (Flush on both full scan and social scan but not on single |
| 10769 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 10770 | */ |
| 10771 | |
| 10772 | /* Supplicant does single channel scan after 8-way handshake |
| 10773 | * and in that case driver shoudnt flush scan results. If |
| 10774 | * driver flushes the scan results here and unfortunately if |
| 10775 | * the AP doesnt respond to our probe req then association |
| 10776 | * fails which is not desired |
| 10777 | */ |
| 10778 | |
| 10779 | if( request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN ) |
| 10780 | { |
| 10781 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 10782 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10783 | pAdapter->sessionId ); |
| 10784 | } |
| 10785 | |
| 10786 | if( request->ie_len ) |
| 10787 | { |
| 10788 | /* save this for future association (join requires this) */ |
| 10789 | /*TODO: Array needs to be converted to dynamic allocation, |
| 10790 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 10791 | * CR 597966 |
| 10792 | */ |
| 10793 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 10794 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 10795 | pScanInfo->scanAddIE.length = request->ie_len; |
| 10796 | |
| 10797 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 10798 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10799 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10800 | { |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 10801 | if (request->ie_len <= SIR_MAC_MAX_ADD_IE_LENGTH) |
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 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 10804 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 10805 | request->ie, request->ie_len); |
| 10806 | } |
| 10807 | else |
| 10808 | { |
| 10809 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 10810 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10811 | } |
| 10812 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10813 | } |
| 10814 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 10815 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 10816 | |
| 10817 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 10818 | request->ie_len); |
| 10819 | if (pP2pIe != NULL) |
| 10820 | { |
| 10821 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 10822 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 10823 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 10824 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10825 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10826 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 10827 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 10828 | "Go nego completed to Connection is started"); |
| 10829 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 10830 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10831 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10832 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 10833 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10834 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10835 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 10836 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 10837 | "Disconnected state to Connection is started"); |
| 10838 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 10839 | "for 4way Handshake"); |
| 10840 | } |
| 10841 | #endif |
| 10842 | |
| 10843 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 10844 | if(TRUE == request->no_cck) |
| 10845 | { |
| 10846 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10847 | "%s: This is a P2P Search", __func__); |
| 10848 | scanRequest.p2pSearch = 1; |
| 10849 | |
| 10850 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10851 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10852 | /* set requestType to P2P Discovery */ |
| 10853 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 10854 | } |
| 10855 | |
| 10856 | /* |
| 10857 | Skip Dfs Channel in case of P2P Search |
| 10858 | if it is set in ini file |
| 10859 | */ |
| 10860 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 10861 | { |
| 10862 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10863 | } |
| 10864 | else |
| 10865 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10866 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10867 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10868 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10869 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10870 | } |
| 10871 | } |
| 10872 | |
| 10873 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 10874 | |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10875 | #ifdef FEATURE_WLAN_TDLS |
| 10876 | /* if tdls disagree scan right now, return immediately. |
| 10877 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 10878 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 10879 | */ |
| 10880 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 10881 | wiphy, |
| 10882 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10883 | dev, |
| 10884 | #endif |
| 10885 | request); |
| 10886 | if(status <= 0) |
| 10887 | { |
| 10888 | if(!status) |
| 10889 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 10890 | "scan rejected %d", __func__, status); |
| 10891 | else |
| 10892 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 10893 | __func__, status); |
| 10894 | |
| 10895 | return status; |
| 10896 | } |
| 10897 | #endif |
| 10898 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10899 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 10900 | * address the following issues. |
| 10901 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 10902 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 10903 | * for long time, this result in apps running at full power for long time. |
| 10904 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 10905 | * be stuck in full power because of resume BMPS |
| 10906 | */ |
| 10907 | hdd_prevent_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10908 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10909 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 10910 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10911 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 10912 | scanRequest.requestType, scanRequest.scanType, |
| 10913 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10914 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 10915 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10916 | if (pHddCtx->spoofMacAddr.isEnabled) |
| 10917 | { |
| 10918 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10919 | "%s: MAC Spoofing enabled for current scan", __func__); |
| 10920 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 10921 | * to fill TxBds for probe request during current scan |
| 10922 | */ |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 10923 | status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10924 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 10925 | |
| 10926 | if(status != VOS_STATUS_SUCCESS) |
| 10927 | { |
| 10928 | hdd_allow_suspend(); |
| 10929 | status = -EFAULT; |
Ganesh Kondabattini | 6d3b490 | 2015-05-12 23:19:22 +0530 | [diff] [blame] | 10930 | #ifdef FEATURE_WLAN_TDLS |
| 10931 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 10932 | #endif |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 10933 | goto free_mem; |
| 10934 | } |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10935 | } |
| 10936 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10937 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10938 | pAdapter->sessionId, &scanRequest, &scanId, |
| 10939 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10940 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10941 | if (eHAL_STATUS_SUCCESS != status) |
| 10942 | { |
| 10943 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10944 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 10945 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 10946 | if(eHAL_STATUS_RESOURCES == status) |
| 10947 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10948 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 10949 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 10950 | status = -EBUSY; |
| 10951 | } else { |
| 10952 | status = -EIO; |
| 10953 | } |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10954 | hdd_allow_suspend(); |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10955 | |
| 10956 | #ifdef FEATURE_WLAN_TDLS |
| 10957 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 10958 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10959 | goto free_mem; |
| 10960 | } |
| 10961 | |
| 10962 | pScanInfo->mScanPending = TRUE; |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 10963 | pScanInfo->sessionId = pAdapter->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10964 | pAdapter->request = request; |
| 10965 | pScanInfo->scanId = scanId; |
| 10966 | |
| 10967 | complete(&pScanInfo->scan_req_completion_event); |
| 10968 | |
| 10969 | free_mem: |
| 10970 | if( scanRequest.SSIDs.SSIDList ) |
| 10971 | { |
| 10972 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 10973 | } |
| 10974 | |
| 10975 | if( channelList ) |
| 10976 | vos_mem_free( channelList ); |
| 10977 | |
| 10978 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10979 | return status; |
| 10980 | } |
| 10981 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10982 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 10983 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10984 | struct net_device *dev, |
| 10985 | #endif |
| 10986 | struct cfg80211_scan_request *request) |
| 10987 | { |
| 10988 | int ret; |
| 10989 | |
| 10990 | vos_ssr_protect(__func__); |
| 10991 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 10992 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10993 | dev, |
| 10994 | #endif |
| 10995 | request); |
| 10996 | vos_ssr_unprotect(__func__); |
| 10997 | |
| 10998 | return ret; |
| 10999 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11000 | |
| 11001 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 11002 | { |
| 11003 | v_U8_t iniDot11Mode = |
| 11004 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 11005 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 11006 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11007 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 11008 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11009 | switch ( iniDot11Mode ) |
| 11010 | { |
| 11011 | case eHDD_DOT11_MODE_AUTO: |
| 11012 | case eHDD_DOT11_MODE_11ac: |
| 11013 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 11014 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 4b1d235 | 2014-08-01 21:59:28 +0530 | [diff] [blame] | 11015 | if ( sme_IsFeatureSupportedByDriver(DOT11AC) && |
| 11016 | sme_IsFeatureSupportedByFW(DOT11AC) ) |
| 11017 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 11018 | else |
| 11019 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11020 | #else |
| 11021 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 11022 | #endif |
| 11023 | break; |
| 11024 | case eHDD_DOT11_MODE_11n: |
| 11025 | case eHDD_DOT11_MODE_11n_ONLY: |
| 11026 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 11027 | break; |
| 11028 | default: |
| 11029 | hddDot11Mode = iniDot11Mode; |
| 11030 | break; |
| 11031 | } |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 11032 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 11033 | if (operationChannel > SIR_11B_CHANNEL_END) |
| 11034 | #endif |
| 11035 | { |
| 11036 | /* This call decides required channel bonding mode */ |
| 11037 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11038 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 11039 | operationChannel); |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 11040 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11041 | } |
| 11042 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11043 | /* |
| 11044 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11045 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11046 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11047 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11048 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11049 | { |
| 11050 | int status = 0; |
| 11051 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11052 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11053 | v_U32_t roamId; |
| 11054 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11055 | eCsrAuthType RSNAuthType; |
| 11056 | |
| 11057 | ENTER(); |
| 11058 | |
| 11059 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11060 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11061 | |
| 11062 | status = wlan_hdd_validate_context(pHddCtx); |
| 11063 | if (status) |
| 11064 | { |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11065 | return status; |
| 11066 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11067 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11068 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 11069 | { |
| 11070 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 11071 | return -EINVAL; |
| 11072 | } |
| 11073 | |
| 11074 | pRoamProfile = &pWextState->roamProfile; |
| 11075 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11076 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11077 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11078 | hdd_station_ctx_t *pHddStaCtx; |
| 11079 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11080 | |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 11081 | wlan_hdd_get_frame_logs(pAdapter, WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR); |
| 11082 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11083 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11084 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 11085 | { |
| 11086 | /*QoS not enabled in cfg file*/ |
| 11087 | pRoamProfile->uapsd_mask = 0; |
| 11088 | } |
| 11089 | else |
| 11090 | { |
| 11091 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11092 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11093 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 11094 | } |
| 11095 | |
| 11096 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 11097 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 11098 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11099 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11100 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 11101 | ssid, ssid_len); |
| 11102 | |
| 11103 | if (bssid) |
| 11104 | { |
| 11105 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 11106 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 11107 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11108 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 11109 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11110 | case of join failure we should send valid BSSID to supplicant |
| 11111 | */ |
| 11112 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 11113 | WNI_CFG_BSSID_LEN); |
| 11114 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 11115 | else |
| 11116 | { |
| 11117 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 11118 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11119 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11120 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 11121 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11122 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 11123 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11124 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11125 | /*set gen ie*/ |
| 11126 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 11127 | /*set auth*/ |
| 11128 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 11129 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11130 | #ifdef FEATURE_WLAN_WAPI |
| 11131 | if (pAdapter->wapi_info.nWapiMode) |
| 11132 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11133 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11134 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 11135 | { |
| 11136 | case WAPI_AUTH_MODE_PSK: |
| 11137 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11138 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11139 | pAdapter->wapi_info.wapiAuthMode); |
| 11140 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 11141 | break; |
| 11142 | } |
| 11143 | case WAPI_AUTH_MODE_CERT: |
| 11144 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11145 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11146 | pAdapter->wapi_info.wapiAuthMode); |
| 11147 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 11148 | break; |
| 11149 | } |
| 11150 | } // End of switch |
| 11151 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 11152 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 11153 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11154 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11155 | pRoamProfile->AuthType.numEntries = 1; |
| 11156 | pRoamProfile->EncryptionType.numEntries = 1; |
| 11157 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 11158 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 11159 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 11160 | } |
| 11161 | } |
| 11162 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11163 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11164 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11165 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 11166 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 11167 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11168 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 11169 | sizeof (tSirGtkOffloadParams)); |
| 11170 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11171 | } |
| 11172 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11173 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 11174 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11175 | if( operatingChannel ) |
| 11176 | { |
| 11177 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 11178 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 11179 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11180 | else |
| 11181 | { |
| 11182 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 11183 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 11184 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11185 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 11186 | { |
| 11187 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 11188 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11189 | |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11190 | /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect() |
| 11191 | * 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] | 11192 | * 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] | 11193 | * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback() |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11194 | * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. |
| 11195 | */ |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 11196 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 11197 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 11198 | { |
| 11199 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11200 | "%s: Set HDD connState to eConnectionState_Connecting", |
| 11201 | __func__); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11202 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 11203 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 11204 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11205 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11206 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 11207 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 11208 | if ((eHAL_STATUS_SUCCESS != status) && |
| 11209 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 11210 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11211 | |
| 11212 | { |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11213 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with " |
| 11214 | "status %d. -> NotConnected", __func__, pAdapter->sessionId, status); |
| 11215 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11216 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11217 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11218 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11219 | |
| 11220 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 11221 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 11222 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11223 | } |
| 11224 | else |
| 11225 | { |
| 11226 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 11227 | return -EINVAL; |
| 11228 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 11229 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11230 | return status; |
| 11231 | } |
| 11232 | |
| 11233 | /* |
| 11234 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 11235 | * This function is used to set the authentication type (OPEN/SHARED). |
| 11236 | * |
| 11237 | */ |
| 11238 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 11239 | enum nl80211_auth_type auth_type) |
| 11240 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11241 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11242 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11243 | |
| 11244 | ENTER(); |
| 11245 | |
| 11246 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11247 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11248 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11249 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11250 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11251 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 11252 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 11253 | break; |
| 11254 | |
| 11255 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11256 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11257 | case NL80211_AUTHTYPE_FT: |
| 11258 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11259 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11260 | "%s: set authentication type to OPEN", __func__); |
| 11261 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 11262 | break; |
| 11263 | |
| 11264 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11265 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11266 | "%s: set authentication type to SHARED", __func__); |
| 11267 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 11268 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11269 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11270 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11271 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11272 | "%s: set authentication type to CCKM WPA", __func__); |
| 11273 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 11274 | break; |
| 11275 | #endif |
| 11276 | |
| 11277 | |
| 11278 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11279 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11280 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11281 | auth_type); |
| 11282 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 11283 | return -EINVAL; |
| 11284 | } |
| 11285 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11286 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11287 | pHddStaCtx->conn_info.authType; |
| 11288 | return 0; |
| 11289 | } |
| 11290 | |
| 11291 | /* |
| 11292 | * FUNCTION: wlan_hdd_set_akm_suite |
| 11293 | * This function is used to set the key mgmt type(PSK/8021x). |
| 11294 | * |
| 11295 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11296 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11297 | u32 key_mgmt |
| 11298 | ) |
| 11299 | { |
| 11300 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11301 | ENTER(); |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11302 | /* Should be in ieee802_11_defs.h */ |
| 11303 | #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05 |
| 11304 | #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11305 | /*set key mgmt type*/ |
| 11306 | switch(key_mgmt) |
| 11307 | { |
| 11308 | case WLAN_AKM_SUITE_PSK: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11309 | case WLAN_AKM_SUITE_PSK_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 11310 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11311 | case WLAN_AKM_SUITE_FT_PSK: |
| 11312 | #endif |
| 11313 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11314 | __func__); |
| 11315 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 11316 | break; |
| 11317 | |
| 11318 | case WLAN_AKM_SUITE_8021X: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11319 | case WLAN_AKM_SUITE_8021X_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 11320 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11321 | case WLAN_AKM_SUITE_FT_8021X: |
| 11322 | #endif |
| 11323 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11324 | __func__); |
| 11325 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 11326 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11327 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11328 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 11329 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 11330 | case WLAN_AKM_SUITE_CCKM: |
| 11331 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 11332 | __func__); |
| 11333 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 11334 | break; |
| 11335 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 11336 | #ifndef WLAN_AKM_SUITE_OSEN |
| 11337 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 11338 | case WLAN_AKM_SUITE_OSEN: |
| 11339 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 11340 | __func__); |
| 11341 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 11342 | break; |
| 11343 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11344 | |
| 11345 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11346 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11347 | __func__, key_mgmt); |
| 11348 | return -EINVAL; |
| 11349 | |
| 11350 | } |
| 11351 | return 0; |
| 11352 | } |
| 11353 | |
| 11354 | /* |
| 11355 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11356 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11357 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 11358 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11359 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 11360 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11361 | bool ucast |
| 11362 | ) |
| 11363 | { |
| 11364 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11365 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11366 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11367 | |
| 11368 | ENTER(); |
| 11369 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11370 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11371 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11372 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11373 | __func__, cipher); |
| 11374 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11375 | } |
| 11376 | else |
| 11377 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11378 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11379 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11380 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11381 | { |
| 11382 | case IW_AUTH_CIPHER_NONE: |
| 11383 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11384 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11385 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11386 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11387 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11388 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11389 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11390 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11391 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11392 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11393 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11394 | case WLAN_CIPHER_SUITE_TKIP: |
| 11395 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 11396 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11397 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11398 | case WLAN_CIPHER_SUITE_CCMP: |
| 11399 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 11400 | break; |
| 11401 | #ifdef FEATURE_WLAN_WAPI |
| 11402 | case WLAN_CIPHER_SUITE_SMS4: |
| 11403 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 11404 | break; |
| 11405 | #endif |
| 11406 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11407 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11408 | case WLAN_CIPHER_SUITE_KRK: |
| 11409 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 11410 | break; |
| 11411 | #endif |
| 11412 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11413 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11414 | __func__, cipher); |
| 11415 | return -EOPNOTSUPP; |
| 11416 | } |
| 11417 | } |
| 11418 | |
| 11419 | if (ucast) |
| 11420 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11421 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11422 | __func__, encryptionType); |
| 11423 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 11424 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11425 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11426 | encryptionType; |
| 11427 | } |
| 11428 | else |
| 11429 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11430 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11431 | __func__, encryptionType); |
| 11432 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 11433 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 11434 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 11435 | } |
| 11436 | |
| 11437 | return 0; |
| 11438 | } |
| 11439 | |
| 11440 | |
| 11441 | /* |
| 11442 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 11443 | * This function is used to parse WPA/RSN IE's. |
| 11444 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11445 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
| 11446 | u8 *ie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11447 | size_t ie_len |
| 11448 | ) |
| 11449 | { |
| 11450 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11451 | u8 *genie = ie; |
| 11452 | v_U16_t remLen = ie_len; |
| 11453 | #ifdef FEATURE_WLAN_WAPI |
| 11454 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 11455 | u16 *tmp; |
| 11456 | v_U16_t akmsuiteCount; |
| 11457 | int *akmlist; |
| 11458 | #endif |
| 11459 | ENTER(); |
| 11460 | |
| 11461 | /* clear previous assocAddIE */ |
| 11462 | pWextState->assocAddIE.length = 0; |
| 11463 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11464 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11465 | |
| 11466 | while (remLen >= 2) |
| 11467 | { |
| 11468 | v_U16_t eLen = 0; |
| 11469 | v_U8_t elementId; |
| 11470 | elementId = *genie++; |
| 11471 | eLen = *genie++; |
| 11472 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11473 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11474 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11475 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11476 | |
| 11477 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11478 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11479 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11480 | 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] | 11481 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11482 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11483 | "%s: Invalid WPA IE", __func__); |
| 11484 | return -EINVAL; |
| 11485 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11486 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11487 | { |
| 11488 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11489 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11490 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11491 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11492 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11493 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11494 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 11495 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11496 | VOS_ASSERT(0); |
| 11497 | return -ENOMEM; |
| 11498 | } |
| 11499 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 11500 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11501 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11502 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11503 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 11504 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11505 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11506 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11507 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 11508 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11509 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 11510 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 11511 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 11512 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 11513 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 11514 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11515 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 11516 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11517 | { |
| 11518 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11519 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11520 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11521 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11522 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11523 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11524 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11525 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11526 | VOS_ASSERT(0); |
| 11527 | return -ENOMEM; |
| 11528 | } |
| 11529 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 11530 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11531 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11532 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11533 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11534 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11535 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11536 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11537 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 11538 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11539 | /*Consider WFD IE, only for P2P Client */ |
| 11540 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 11541 | { |
| 11542 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11543 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11544 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11545 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11546 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11547 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11548 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11549 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11550 | VOS_ASSERT(0); |
| 11551 | return -ENOMEM; |
| 11552 | } |
| 11553 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 11554 | // WPS IE + P2P IE + WFD IE |
| 11555 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11556 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11557 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11558 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11559 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11560 | } |
| 11561 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11562 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11563 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11564 | HS20_OUI_TYPE_SIZE)) ) |
| 11565 | { |
| 11566 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11567 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11568 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11569 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11570 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11571 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11572 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11573 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11574 | VOS_ASSERT(0); |
| 11575 | return -ENOMEM; |
| 11576 | } |
| 11577 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11578 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11579 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11580 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11581 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11582 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11583 | /* Appending OSEN Information Element in Assiciation Request */ |
| 11584 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 11585 | OSEN_OUI_TYPE_SIZE)) ) |
| 11586 | { |
| 11587 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 11588 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 11589 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11590 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11591 | 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] | 11592 | { |
| 11593 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11594 | "Need bigger buffer space"); |
| 11595 | VOS_ASSERT(0); |
| 11596 | return -ENOMEM; |
| 11597 | } |
| 11598 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11599 | pWextState->assocAddIE.length += eLen + 2; |
| 11600 | |
| 11601 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 11602 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11603 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11604 | } |
| 11605 | |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 11606 | if (WLAN_HDD_IBSS == pAdapter->device_mode) { |
| 11607 | |
| 11608 | /* populating as ADDIE in beacon frames */ |
| 11609 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11610 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie - 2, eLen + 2, |
| 11611 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 11612 | { |
| 11613 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11614 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 11615 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 11616 | { |
| 11617 | hddLog(LOGE, |
| 11618 | "Coldn't pass " |
| 11619 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 11620 | } |
| 11621 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 11622 | else |
| 11623 | hddLog(LOGE, |
| 11624 | "Could not pass on " |
| 11625 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 11626 | |
| 11627 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 11628 | beaconIE's need to be populated in probe response frames */ |
| 11629 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 11630 | { |
| 11631 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 11632 | u8 probe_rsp_ie_len[3] = {0}; |
| 11633 | u8 counter = 0; |
| 11634 | |
| 11635 | /* Check Probe Resp Length if it is greater then 255 then |
| 11636 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 11637 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 11638 | not able Store More then 255 bytes into One Variable */ |
| 11639 | |
| 11640 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 11641 | { |
| 11642 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 11643 | { |
| 11644 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 11645 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 11646 | } |
| 11647 | else |
| 11648 | { |
| 11649 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 11650 | rem_probe_resp_ie_len = 0; |
| 11651 | } |
| 11652 | } |
| 11653 | |
| 11654 | rem_probe_resp_ie_len = 0; |
| 11655 | |
| 11656 | if (probe_rsp_ie_len[0] > 0) |
| 11657 | { |
| 11658 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11659 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 11660 | (tANI_U8*)(genie - 2), |
| 11661 | probe_rsp_ie_len[0], NULL, |
| 11662 | eANI_BOOLEAN_FALSE) |
| 11663 | == eHAL_STATUS_FAILURE) |
| 11664 | { |
| 11665 | hddLog(LOGE, |
| 11666 | "Could not pass" |
| 11667 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 11668 | } |
| 11669 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 11670 | } |
| 11671 | |
| 11672 | if (probe_rsp_ie_len[1] > 0) |
| 11673 | { |
| 11674 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11675 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 11676 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 11677 | probe_rsp_ie_len[1], NULL, |
| 11678 | eANI_BOOLEAN_FALSE) |
| 11679 | == eHAL_STATUS_FAILURE) |
| 11680 | { |
| 11681 | hddLog(LOGE, |
| 11682 | "Could not pass" |
| 11683 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 11684 | } |
| 11685 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 11686 | } |
| 11687 | |
| 11688 | if (probe_rsp_ie_len[2] > 0) |
| 11689 | { |
| 11690 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11691 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 11692 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 11693 | probe_rsp_ie_len[2], NULL, |
| 11694 | eANI_BOOLEAN_FALSE) |
| 11695 | == eHAL_STATUS_FAILURE) |
| 11696 | { |
| 11697 | hddLog(LOGE, |
| 11698 | "Could not pass" |
| 11699 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 11700 | } |
| 11701 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 11702 | } |
| 11703 | |
| 11704 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11705 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 11706 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 11707 | { |
| 11708 | hddLog(LOGE, |
| 11709 | "Could not pass" |
| 11710 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 11711 | } |
| 11712 | } |
| 11713 | else |
| 11714 | { |
| 11715 | // Reset WNI_CFG_PROBE_RSP Flags |
| 11716 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 11717 | |
| 11718 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11719 | "%s: No Probe Response IE received in set beacon", |
| 11720 | __func__); |
| 11721 | } |
| 11722 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11723 | break; |
| 11724 | case DOT11F_EID_RSN: |
| 11725 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 11726 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 11727 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 11728 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 11729 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 11730 | break; |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 11731 | |
| 11732 | /* Appending Extended Capabilities with Interworking bit set |
| 11733 | * in Assoc Req. |
| 11734 | * |
| 11735 | * In assoc req this EXT Cap will only be taken into account if |
| 11736 | * interworkingService bit is set to 1. Currently |
| 11737 | * driver is only interested in interworkingService capability |
| 11738 | * from supplicant. If in future any other EXT Cap info is |
| 11739 | * required from supplicat, it needs to be handled while |
| 11740 | * sending Assoc Req in LIM. |
| 11741 | */ |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11742 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11743 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11744 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11745 | 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] | 11746 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11747 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11748 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11749 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11750 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11751 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11752 | VOS_ASSERT(0); |
| 11753 | return -ENOMEM; |
| 11754 | } |
| 11755 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11756 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11757 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11758 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11759 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11760 | break; |
| 11761 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11762 | #ifdef FEATURE_WLAN_WAPI |
| 11763 | case WLAN_EID_WAPI: |
| 11764 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 11765 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11766 | pAdapter->wapi_info.nWapiMode); |
| 11767 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11768 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11769 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 11770 | tmp = tmp + 1; |
| 11771 | akmlist = (int *)(tmp); |
| 11772 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 11773 | { |
| 11774 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 11775 | } |
| 11776 | else |
| 11777 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11778 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11779 | VOS_ASSERT(0); |
| 11780 | return -EINVAL; |
| 11781 | } |
| 11782 | |
| 11783 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 11784 | { |
| 11785 | 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] | 11786 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11787 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11788 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11789 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11790 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11791 | 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] | 11792 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11793 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 11794 | } |
| 11795 | break; |
| 11796 | #endif |
| 11797 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11798 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11799 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11800 | /* when Unknown IE is received we should break and continue |
| 11801 | * to the next IE in the buffer instead we were returning |
| 11802 | * so changing this to break */ |
| 11803 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11804 | } |
| 11805 | genie += eLen; |
| 11806 | remLen -= eLen; |
| 11807 | } |
| 11808 | EXIT(); |
| 11809 | return 0; |
| 11810 | } |
| 11811 | |
| 11812 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 11813 | * FUNCTION: hdd_isWPAIEPresent |
| 11814 | * Parse the received IE to find the WPA IE |
| 11815 | * |
| 11816 | */ |
| 11817 | static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len) |
| 11818 | { |
| 11819 | v_U8_t eLen = 0; |
| 11820 | v_U16_t remLen = ie_len; |
| 11821 | v_U8_t elementId = 0; |
| 11822 | |
| 11823 | while (remLen >= 2) |
| 11824 | { |
| 11825 | elementId = *ie++; |
| 11826 | eLen = *ie++; |
| 11827 | remLen -= 2; |
| 11828 | if (eLen > remLen) |
| 11829 | { |
| 11830 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11831 | "%s: IE length is wrong %d", __func__, eLen); |
| 11832 | return FALSE; |
| 11833 | } |
| 11834 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 11835 | { |
| 11836 | /* OUI - 0x00 0X50 0XF2 |
| 11837 | WPA Information Element - 0x01 |
| 11838 | WPA version - 0x01*/ |
| 11839 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 11840 | return TRUE; |
| 11841 | } |
| 11842 | ie += eLen; |
| 11843 | remLen -= eLen; |
| 11844 | } |
| 11845 | return FALSE; |
| 11846 | } |
| 11847 | |
| 11848 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11849 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11850 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11851 | * parameters during connect operation. |
| 11852 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11853 | int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11854 | struct cfg80211_connect_params *req |
| 11855 | ) |
| 11856 | { |
| 11857 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11858 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11859 | ENTER(); |
| 11860 | |
| 11861 | /*set wpa version*/ |
| 11862 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 11863 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11864 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11865 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 11866 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11867 | { |
| 11868 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 11869 | } |
| 11870 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 11871 | { |
| 11872 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 11873 | } |
| 11874 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11875 | |
| 11876 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11877 | pWextState->wpaVersion); |
| 11878 | |
| 11879 | /*set authentication type*/ |
| 11880 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 11881 | |
| 11882 | if (0 > status) |
| 11883 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11884 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11885 | "%s: failed to set authentication type ", __func__); |
| 11886 | return status; |
| 11887 | } |
| 11888 | |
| 11889 | /*set key mgmt type*/ |
| 11890 | if (req->crypto.n_akm_suites) |
| 11891 | { |
| 11892 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 11893 | if (0 > status) |
| 11894 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11895 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11896 | __func__); |
| 11897 | return status; |
| 11898 | } |
| 11899 | } |
| 11900 | |
| 11901 | /*set pairwise cipher type*/ |
| 11902 | if (req->crypto.n_ciphers_pairwise) |
| 11903 | { |
| 11904 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 11905 | req->crypto.ciphers_pairwise[0], true); |
| 11906 | if (0 > status) |
| 11907 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11908 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11909 | "%s: failed to set unicast cipher type", __func__); |
| 11910 | return status; |
| 11911 | } |
| 11912 | } |
| 11913 | else |
| 11914 | { |
| 11915 | /*Reset previous cipher suite to none*/ |
| 11916 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 11917 | if (0 > status) |
| 11918 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11919 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11920 | "%s: failed to set unicast cipher type", __func__); |
| 11921 | return status; |
| 11922 | } |
| 11923 | } |
| 11924 | |
| 11925 | /*set group cipher type*/ |
| 11926 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 11927 | false); |
| 11928 | |
| 11929 | if (0 > status) |
| 11930 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11931 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11932 | __func__); |
| 11933 | return status; |
| 11934 | } |
| 11935 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11936 | #ifdef WLAN_FEATURE_11W |
| 11937 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 11938 | #endif |
| 11939 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11940 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 11941 | if (req->ie_len) |
| 11942 | { |
| 11943 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 11944 | if ( 0 > status) |
| 11945 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11946 | 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] | 11947 | __func__); |
| 11948 | return status; |
| 11949 | } |
| 11950 | } |
| 11951 | |
| 11952 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11953 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11954 | { |
| 11955 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 11956 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 11957 | ) |
| 11958 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11959 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11960 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 11961 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11962 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11963 | __func__); |
| 11964 | return -EOPNOTSUPP; |
| 11965 | } |
| 11966 | else |
| 11967 | { |
| 11968 | u8 key_len = req->key_len; |
| 11969 | u8 key_idx = req->key_idx; |
| 11970 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11971 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11972 | && (CSR_MAX_NUM_KEY > key_idx) |
| 11973 | ) |
| 11974 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11975 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11976 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11977 | __func__, key_idx, key_len); |
| 11978 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11979 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11980 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11981 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11982 | (u8)key_len; |
| 11983 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 11984 | } |
| 11985 | } |
| 11986 | } |
| 11987 | } |
| 11988 | |
| 11989 | return status; |
| 11990 | } |
| 11991 | |
| 11992 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 11993 | * FUNCTION: wlan_hdd_try_disconnect |
| 11994 | * This function is used to disconnect from previous |
| 11995 | * connection |
| 11996 | */ |
| 11997 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 11998 | { |
| 11999 | long ret = 0; |
| 12000 | hdd_station_ctx_t *pHddStaCtx; |
| 12001 | eMib_dot11DesiredBssType connectedBssType; |
| 12002 | |
| 12003 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12004 | |
| 12005 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 12006 | |
| 12007 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 12008 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 12009 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 12010 | { |
| 12011 | /* Issue disconnect to CSR */ |
| 12012 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 12013 | if( eHAL_STATUS_SUCCESS == |
| 12014 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12015 | pAdapter->sessionId, |
| 12016 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 12017 | { |
| 12018 | ret = wait_for_completion_interruptible_timeout( |
| 12019 | &pAdapter->disconnect_comp_var, |
| 12020 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 12021 | if (0 >= ret) |
| 12022 | { |
| 12023 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 12024 | return -EALREADY; |
| 12025 | } |
| 12026 | } |
| 12027 | } |
| 12028 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 12029 | { |
| 12030 | ret = wait_for_completion_interruptible_timeout( |
| 12031 | &pAdapter->disconnect_comp_var, |
| 12032 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 12033 | if (0 >= ret) |
| 12034 | { |
| 12035 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 12036 | return -EALREADY; |
| 12037 | } |
| 12038 | } |
| 12039 | |
| 12040 | return 0; |
| 12041 | } |
| 12042 | |
| 12043 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12044 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 12045 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12046 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12047 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12048 | struct net_device *ndev, |
| 12049 | struct cfg80211_connect_params *req |
| 12050 | ) |
| 12051 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12052 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12053 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12054 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 12055 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12056 | |
| 12057 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12058 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12059 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12060 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 12061 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12062 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12063 | "%s: device_mode = %s (%d)", __func__, |
| 12064 | hdd_device_modetoString(pAdapter->device_mode), |
| 12065 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12066 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12067 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 12068 | if (!pHddCtx) |
| 12069 | { |
| 12070 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12071 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12072 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 12073 | } |
| 12074 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12075 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12076 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12077 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12078 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12079 | } |
| 12080 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12081 | if (vos_max_concurrent_connections_reached()) { |
| 12082 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 12083 | return -ECONNREFUSED; |
| 12084 | } |
| 12085 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12086 | #ifdef WLAN_BTAMP_FEATURE |
| 12087 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12088 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12089 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12090 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12091 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 12092 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12093 | } |
| 12094 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12095 | |
| 12096 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 12097 | //P2P Mode will be taken care in Open/close adapter |
| 12098 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12099 | (vos_concurrent_open_sessions_running())) { |
| 12100 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 12101 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12102 | } |
| 12103 | |
| 12104 | /*Try disconnecting if already in connected state*/ |
| 12105 | status = wlan_hdd_try_disconnect(pAdapter); |
| 12106 | if ( 0 > status) |
| 12107 | { |
| 12108 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 12109 | " connection")); |
| 12110 | return -EALREADY; |
| 12111 | } |
| 12112 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12113 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12114 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12115 | |
| 12116 | if ( 0 > status) |
| 12117 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12118 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12119 | __func__); |
| 12120 | return status; |
| 12121 | } |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 12122 | if ( req->channel ) |
| 12123 | { |
| 12124 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 12125 | req->ssid_len, req->bssid, |
| 12126 | req->channel->hw_value); |
| 12127 | } |
| 12128 | else |
| 12129 | { |
| 12130 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12131 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 12132 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12133 | |
Sushant Kaushik | d708398 | 2015-03-18 14:33:24 +0530 | [diff] [blame] | 12134 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12135 | { |
| 12136 | //ReEnable BMPS if disabled |
| 12137 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 12138 | (NULL != pHddCtx)) |
| 12139 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 12140 | if (pHddCtx->hdd_wlan_suspended) |
| 12141 | { |
| 12142 | hdd_set_pwrparams(pHddCtx); |
| 12143 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12144 | //ReEnable Bmps and Imps back |
| 12145 | hdd_enable_bmps_imps(pHddCtx); |
| 12146 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12147 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12148 | return status; |
| 12149 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12150 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12151 | EXIT(); |
| 12152 | return status; |
| 12153 | } |
| 12154 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12155 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 12156 | struct net_device *ndev, |
| 12157 | struct cfg80211_connect_params *req) |
| 12158 | { |
| 12159 | int ret; |
| 12160 | vos_ssr_protect(__func__); |
| 12161 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 12162 | vos_ssr_unprotect(__func__); |
| 12163 | |
| 12164 | return ret; |
| 12165 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12166 | |
| 12167 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12168 | * FUNCTION: wlan_hdd_disconnect |
| 12169 | * This function is used to issue a disconnect request to SME |
| 12170 | */ |
| 12171 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 12172 | { |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12173 | int status, result = 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12174 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12175 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12176 | long ret; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12177 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12178 | ENTER(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12179 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12180 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12181 | if (0 != status) |
| 12182 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12183 | return status; |
| 12184 | } |
| 12185 | |
| 12186 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12187 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12188 | /* Need to apply spin lock before decreasing active sessions |
| 12189 | * as there can be chance for double decrement if context switch |
| 12190 | * Calls hdd_DisConnectHandler. |
| 12191 | */ |
| 12192 | |
| 12193 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12194 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 12195 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12196 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 12197 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12198 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 12199 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12200 | |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 12201 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12202 | FL( "Set HDD connState to eConnectionState_Disconnecting" )); |
| 12203 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12204 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12205 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12206 | /* |
| 12207 | * stop tx queues before deleting STA/BSS context from the firmware. |
| 12208 | * tx has to be disabled because the firmware can get busy dropping |
| 12209 | * the tx frames after BSS/STA has been deleted and will not send |
| 12210 | * back a response resulting in WDI timeout |
| 12211 | */ |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 12212 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12213 | netif_tx_disable(pAdapter->dev); |
| 12214 | netif_carrier_off(pAdapter->dev); |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 12215 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12216 | /*issue disconnect*/ |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12217 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12218 | pAdapter->sessionId, reason); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12219 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
| 12220 | { |
| 12221 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12222 | FL("status = %d, already disconnected"), |
| 12223 | (int)status ); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12224 | |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12225 | } |
| 12226 | else if ( 0 != status ) |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12227 | { |
| 12228 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12229 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12230 | __func__, (int)status ); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12231 | result = -EINVAL; |
| 12232 | goto disconnected; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12233 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12234 | ret = wait_for_completion_interruptible_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12235 | &pAdapter->disconnect_comp_var, |
| 12236 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12237 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status )) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12238 | { |
| 12239 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12240 | "%s: Failed to disconnect, timed out", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12241 | result = -ETIMEDOUT; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12242 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12243 | else if (ret == -ERESTARTSYS) |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12244 | { |
| 12245 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12246 | "%s: Failed to disconnect, wait interrupted", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12247 | result = -ERESTARTSYS; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12248 | } |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12249 | disconnected: |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12250 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12251 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 12252 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 12253 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12254 | EXIT(); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12255 | return result; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12256 | } |
| 12257 | |
| 12258 | |
| 12259 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12260 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12261 | * This function is used to issue a disconnect request to SME |
| 12262 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12263 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12264 | struct net_device *dev, |
| 12265 | u16 reason |
| 12266 | ) |
| 12267 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12268 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12269 | int status; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12270 | tCsrRoamProfile *pRoamProfile; |
| 12271 | hdd_station_ctx_t *pHddStaCtx; |
| 12272 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12273 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12274 | tANI_U8 staIdx; |
| 12275 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12276 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12277 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12278 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12279 | if (!pAdapter) { |
| 12280 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 12281 | return -EINVAL; |
| 12282 | } |
| 12283 | |
| 12284 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12285 | if (!pHddStaCtx) { |
| 12286 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD STA context is NULL")); |
| 12287 | return -EINVAL; |
| 12288 | } |
| 12289 | |
| 12290 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12291 | status = wlan_hdd_validate_context(pHddCtx); |
| 12292 | if (0 != status) |
| 12293 | { |
| 12294 | return status; |
| 12295 | } |
| 12296 | |
| 12297 | pRoamProfile = &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
| 12298 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12299 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12300 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 12301 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12302 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 12303 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12304 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12305 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12306 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 12307 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12308 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12309 | if (NULL != pRoamProfile) |
| 12310 | { |
| 12311 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 12312 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 12313 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12314 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12315 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12316 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12317 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12318 | switch(reason) |
| 12319 | { |
| 12320 | case WLAN_REASON_MIC_FAILURE: |
| 12321 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 12322 | break; |
| 12323 | |
| 12324 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 12325 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 12326 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 12327 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 12328 | break; |
| 12329 | |
| 12330 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 12331 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 12332 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12333 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 12334 | break; |
| 12335 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12336 | default: |
| 12337 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 12338 | break; |
| 12339 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12340 | pScanInfo = &pHddCtx->scan_info; |
| 12341 | if (pScanInfo->mScanPending) |
| 12342 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 12343 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12344 | "Aborting Scan"); |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 12345 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 12346 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12347 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12348 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12349 | #ifdef FEATURE_WLAN_TDLS |
| 12350 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12351 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12352 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12353 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 12354 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12355 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12356 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12357 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12358 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12359 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12360 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12361 | MAC_ADDR_ARRAY(mac)); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 12362 | status = sme_DeleteTdlsPeerSta( |
| 12363 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12364 | pAdapter->sessionId, |
| 12365 | mac); |
| 12366 | if (status != eHAL_STATUS_SUCCESS) { |
| 12367 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 12368 | return -EPERM; |
| 12369 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12370 | } |
| 12371 | } |
| 12372 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 12373 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12374 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 12375 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12376 | { |
| 12377 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12378 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12379 | __func__, (int)status ); |
| 12380 | return -EINVAL; |
| 12381 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12382 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 12383 | else |
| 12384 | { |
| 12385 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 12386 | "called while in %d state", __func__, |
| 12387 | pHddStaCtx->conn_info.connState); |
| 12388 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12389 | } |
| 12390 | else |
| 12391 | { |
| 12392 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 12393 | } |
| 12394 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12395 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12396 | return status; |
| 12397 | } |
| 12398 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12399 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 12400 | struct net_device *dev, |
| 12401 | u16 reason |
| 12402 | ) |
| 12403 | { |
| 12404 | int ret; |
| 12405 | vos_ssr_protect(__func__); |
| 12406 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 12407 | vos_ssr_unprotect(__func__); |
| 12408 | |
| 12409 | return ret; |
| 12410 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12411 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12412 | /* |
| 12413 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12414 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12415 | * settings in IBSS mode. |
| 12416 | */ |
| 12417 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12418 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12419 | struct cfg80211_ibss_params *params |
| 12420 | ) |
| 12421 | { |
| 12422 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12423 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12424 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 12425 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12426 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12427 | ENTER(); |
| 12428 | |
| 12429 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 12430 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12431 | |
| 12432 | if (params->ie_len && ( NULL != params->ie) ) |
| 12433 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12434 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 12435 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12436 | { |
| 12437 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 12438 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 12439 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12440 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12441 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12442 | tDot11fIEWPA dot11WPAIE; |
| 12443 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12444 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12445 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 12446 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12447 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 12448 | params->ie_len, DOT11F_EID_WPA); |
| 12449 | if ( NULL != ie ) |
| 12450 | { |
| 12451 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 12452 | // Unpack the WPA IE |
| 12453 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 12454 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 12455 | &ie[2+4], |
| 12456 | ie[1] - 4, |
| 12457 | &dot11WPAIE); |
| 12458 | /*Extract the multicast cipher, the encType for unicast |
| 12459 | cipher for wpa-none is none*/ |
| 12460 | encryptionType = |
| 12461 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 12462 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12463 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12464 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12465 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 12466 | |
| 12467 | if (0 > status) |
| 12468 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12469 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12470 | __func__); |
| 12471 | return status; |
| 12472 | } |
| 12473 | } |
| 12474 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12475 | pWextState->roamProfile.AuthType.authType[0] = |
| 12476 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12477 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 12478 | |
| 12479 | if (params->privacy) |
| 12480 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12481 | /* Security enabled IBSS, At this time there is no information available |
| 12482 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12483 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12484 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12485 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12486 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12487 | *enable privacy bit in beacons */ |
| 12488 | |
| 12489 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 12490 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12491 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 12492 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12493 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 12494 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 12495 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12496 | return status; |
| 12497 | } |
| 12498 | |
| 12499 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12500 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12501 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12502 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12503 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12504 | struct net_device *dev, |
| 12505 | struct cfg80211_ibss_params *params |
| 12506 | ) |
| 12507 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12508 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12509 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12510 | tCsrRoamProfile *pRoamProfile; |
| 12511 | int status; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12512 | bool alloc_bssid = VOS_FALSE; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12513 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12514 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12515 | |
| 12516 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12517 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12518 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12519 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 12520 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12521 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12522 | "%s: device_mode = %s (%d)", __func__, |
| 12523 | hdd_device_modetoString(pAdapter->device_mode), |
| 12524 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12525 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12526 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12527 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12528 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12529 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12530 | } |
| 12531 | |
| 12532 | if (NULL == pWextState) |
| 12533 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12534 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12535 | __func__); |
| 12536 | return -EIO; |
| 12537 | } |
| 12538 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12539 | if (vos_max_concurrent_connections_reached()) { |
| 12540 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 12541 | return -ECONNREFUSED; |
| 12542 | } |
| 12543 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12544 | /*Try disconnecting if already in connected state*/ |
| 12545 | status = wlan_hdd_try_disconnect(pAdapter); |
| 12546 | if ( 0 > status) |
| 12547 | { |
| 12548 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 12549 | " IBSS connection")); |
| 12550 | return -EALREADY; |
| 12551 | } |
| 12552 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12553 | pRoamProfile = &pWextState->roamProfile; |
| 12554 | |
| 12555 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 12556 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12557 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12558 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12559 | return -EINVAL; |
| 12560 | } |
| 12561 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12562 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 12563 | if (NULL != params->bssid) { |
| 12564 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 12565 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 12566 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12567 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 12568 | return -EIO; |
| 12569 | } |
| 12570 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12571 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 12572 | { |
| 12573 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 12574 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 12575 | { |
| 12576 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12577 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 12578 | return -EIO; |
| 12579 | } |
Sachin Ahuja | 46ff491 | 2015-03-23 22:48:43 +0530 | [diff] [blame] | 12580 | params->bssid = vos_mem_malloc(VOS_MAC_ADDR_SIZE); |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12581 | if (!params->bssid) |
| 12582 | { |
| 12583 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12584 | "%s:Failed memory allocation", __func__); |
| 12585 | return -EIO; |
| 12586 | } |
| 12587 | vos_mem_copy((v_U8_t *)params->bssid, |
| 12588 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
| 12589 | VOS_MAC_ADDR_SIZE); |
| 12590 | alloc_bssid = VOS_TRUE; |
| 12591 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12592 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12593 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12594 | if (NULL != |
| 12595 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 12596 | params->chandef.chan) |
| 12597 | #else |
| 12598 | params->channel) |
| 12599 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12600 | { |
| 12601 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12602 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 12603 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 12604 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12605 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12606 | |
| 12607 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12608 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12609 | ieee80211_frequency_to_channel( |
| 12610 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 12611 | params->chandef.chan->center_freq); |
| 12612 | #else |
| 12613 | params->channel->center_freq); |
| 12614 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12615 | |
| 12616 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 12617 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12618 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12619 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 12620 | __func__); |
| 12621 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12622 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12623 | |
| 12624 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12625 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12626 | if (channelNum == validChan[indx]) |
| 12627 | { |
| 12628 | break; |
| 12629 | } |
| 12630 | } |
| 12631 | if (indx >= numChans) |
| 12632 | { |
| 12633 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12634 | __func__, channelNum); |
| 12635 | return -EINVAL; |
| 12636 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12637 | /* Set the Operational Channel */ |
| 12638 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 12639 | channelNum); |
| 12640 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 12641 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 12642 | pRoamProfile->ChannelInfo.ChannelList = |
| 12643 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12644 | } |
| 12645 | |
| 12646 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12647 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12648 | if (status < 0) |
| 12649 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12650 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12651 | __func__); |
| 12652 | return status; |
| 12653 | } |
| 12654 | |
| 12655 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12656 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12657 | params->ssid_len, params->bssid, |
| 12658 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12659 | |
| 12660 | if (0 > status) |
| 12661 | { |
| 12662 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 12663 | return status; |
| 12664 | } |
| 12665 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12666 | if (NULL != params->bssid && |
| 12667 | pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0 && |
| 12668 | alloc_bssid == VOS_TRUE) |
| 12669 | { |
| 12670 | vos_mem_free(params->bssid); |
| 12671 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12672 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12673 | return 0; |
| 12674 | } |
| 12675 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12676 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 12677 | struct net_device *dev, |
| 12678 | struct cfg80211_ibss_params *params |
| 12679 | ) |
| 12680 | { |
| 12681 | int ret = 0; |
| 12682 | |
| 12683 | vos_ssr_protect(__func__); |
| 12684 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 12685 | vos_ssr_unprotect(__func__); |
| 12686 | |
| 12687 | return ret; |
| 12688 | } |
| 12689 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12690 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12691 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12692 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12693 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12694 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12695 | struct net_device *dev |
| 12696 | ) |
| 12697 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12698 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12699 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12700 | tCsrRoamProfile *pRoamProfile; |
| 12701 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12702 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12703 | |
| 12704 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12705 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12706 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12707 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 12708 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12709 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12710 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12711 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12712 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12713 | } |
| 12714 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12715 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 12716 | hdd_device_modetoString(pAdapter->device_mode), |
| 12717 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12718 | if (NULL == pWextState) |
| 12719 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12720 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12721 | __func__); |
| 12722 | return -EIO; |
| 12723 | } |
| 12724 | |
| 12725 | pRoamProfile = &pWextState->roamProfile; |
| 12726 | |
| 12727 | /* Issue disconnect only if interface type is set to IBSS */ |
| 12728 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 12729 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12730 | 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] | 12731 | __func__); |
| 12732 | return -EINVAL; |
| 12733 | } |
| 12734 | |
| 12735 | /* Issue Disconnect request */ |
| 12736 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 12737 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 12738 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 12739 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12740 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12741 | return 0; |
| 12742 | } |
| 12743 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12744 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 12745 | struct net_device *dev |
| 12746 | ) |
| 12747 | { |
| 12748 | int ret = 0; |
| 12749 | |
| 12750 | vos_ssr_protect(__func__); |
| 12751 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 12752 | vos_ssr_unprotect(__func__); |
| 12753 | |
| 12754 | return ret; |
| 12755 | } |
| 12756 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12757 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12758 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12759 | * This function is used to set the phy parameters |
| 12760 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 12761 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12762 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12763 | u32 changed) |
| 12764 | { |
| 12765 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 12766 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12767 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12768 | |
| 12769 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12770 | |
| 12771 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12772 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 12773 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12774 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12775 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12776 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12777 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12778 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12779 | } |
| 12780 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12781 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 12782 | { |
| 12783 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 12784 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 12785 | wiphy->rts_threshold; |
| 12786 | |
| 12787 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12788 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12789 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12790 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12791 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12792 | __func__, rts_threshold); |
| 12793 | return -EINVAL; |
| 12794 | } |
| 12795 | |
| 12796 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 12797 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12798 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12799 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12800 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12801 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12802 | __func__, rts_threshold); |
| 12803 | return -EIO; |
| 12804 | } |
| 12805 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12806 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12807 | rts_threshold); |
| 12808 | } |
| 12809 | |
| 12810 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 12811 | { |
| 12812 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 12813 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 12814 | wiphy->frag_threshold; |
| 12815 | |
| 12816 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12817 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12818 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12819 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12820 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12821 | frag_threshold); |
| 12822 | return -EINVAL; |
| 12823 | } |
| 12824 | |
| 12825 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 12826 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12827 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12828 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12829 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12830 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12831 | __func__, frag_threshold); |
| 12832 | return -EIO; |
| 12833 | } |
| 12834 | |
| 12835 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 12836 | frag_threshold); |
| 12837 | } |
| 12838 | |
| 12839 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 12840 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 12841 | { |
| 12842 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 12843 | wiphy->retry_short : |
| 12844 | wiphy->retry_long; |
| 12845 | |
| 12846 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 12847 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 12848 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12849 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12850 | __func__, retry_value); |
| 12851 | return -EINVAL; |
| 12852 | } |
| 12853 | |
| 12854 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 12855 | { |
| 12856 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 12857 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12858 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12859 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12860 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12861 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12862 | __func__, retry_value); |
| 12863 | return -EIO; |
| 12864 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12865 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12866 | __func__, retry_value); |
| 12867 | } |
| 12868 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 12869 | { |
| 12870 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 12871 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12872 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12873 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12874 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12875 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12876 | __func__, retry_value); |
| 12877 | return -EIO; |
| 12878 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12879 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12880 | __func__, retry_value); |
| 12881 | } |
| 12882 | } |
| 12883 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12884 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12885 | return 0; |
| 12886 | } |
| 12887 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12888 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 12889 | u32 changed) |
| 12890 | { |
| 12891 | int ret; |
| 12892 | |
| 12893 | vos_ssr_protect(__func__); |
| 12894 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 12895 | vos_ssr_unprotect(__func__); |
| 12896 | |
| 12897 | return ret; |
| 12898 | } |
| 12899 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12900 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12901 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12902 | * This function is used to set the txpower |
| 12903 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12904 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12905 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12906 | struct wireless_dev *wdev, |
| 12907 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12908 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12909 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12910 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12911 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12912 | #endif |
| 12913 | int dbm) |
| 12914 | { |
| 12915 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12916 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12917 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 12918 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12919 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12920 | |
| 12921 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12922 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12923 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12924 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 12925 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12926 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12927 | if (0 != status) |
| 12928 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12929 | return status; |
| 12930 | } |
| 12931 | |
| 12932 | hHal = pHddCtx->hHal; |
| 12933 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12934 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 12935 | dbm, ccmCfgSetCallback, |
| 12936 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12937 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12938 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12939 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 12940 | return -EIO; |
| 12941 | } |
| 12942 | |
| 12943 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 12944 | dbm); |
| 12945 | |
| 12946 | switch(type) |
| 12947 | { |
| 12948 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 12949 | /* Fall through */ |
| 12950 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 12951 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 12952 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12953 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 12954 | __func__); |
| 12955 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12956 | } |
| 12957 | break; |
| 12958 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12959 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12960 | __func__); |
| 12961 | return -EOPNOTSUPP; |
| 12962 | break; |
| 12963 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12964 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 12965 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12966 | return -EIO; |
| 12967 | } |
| 12968 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12969 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12970 | return 0; |
| 12971 | } |
| 12972 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12973 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 12974 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12975 | struct wireless_dev *wdev, |
| 12976 | #endif |
| 12977 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 12978 | enum tx_power_setting type, |
| 12979 | #else |
| 12980 | enum nl80211_tx_power_setting type, |
| 12981 | #endif |
| 12982 | int dbm) |
| 12983 | { |
| 12984 | int ret; |
| 12985 | vos_ssr_protect(__func__); |
| 12986 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 12987 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12988 | wdev, |
| 12989 | #endif |
| 12990 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 12991 | type, |
| 12992 | #else |
| 12993 | type, |
| 12994 | #endif |
| 12995 | dbm); |
| 12996 | vos_ssr_unprotect(__func__); |
| 12997 | |
| 12998 | return ret; |
| 12999 | } |
| 13000 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13001 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13002 | * FUNCTION: __wlan_hdd_cfg80211_get_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13003 | * This function is used to read the txpower |
| 13004 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13005 | static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 13006 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13007 | struct wireless_dev *wdev, |
| 13008 | #endif |
| 13009 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13010 | { |
| 13011 | |
| 13012 | hdd_adapter_t *pAdapter; |
| 13013 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13014 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13015 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13016 | ENTER(); |
| 13017 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13018 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13019 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13020 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13021 | *dbm = 0; |
| 13022 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13023 | } |
| 13024 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13025 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 13026 | if (NULL == pAdapter) |
| 13027 | { |
| 13028 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 13029 | return -ENOENT; |
| 13030 | } |
| 13031 | |
| 13032 | wlan_hdd_get_classAstats(pAdapter); |
| 13033 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 13034 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13035 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13036 | return 0; |
| 13037 | } |
| 13038 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13039 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 13040 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13041 | struct wireless_dev *wdev, |
| 13042 | #endif |
| 13043 | int *dbm) |
| 13044 | { |
| 13045 | int ret; |
| 13046 | |
| 13047 | vos_ssr_protect(__func__); |
| 13048 | ret = __wlan_hdd_cfg80211_get_txpower(wiphy, |
| 13049 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13050 | wdev, |
| 13051 | #endif |
| 13052 | dbm); |
| 13053 | vos_ssr_unprotect(__func__); |
| 13054 | |
| 13055 | return ret; |
| 13056 | } |
| 13057 | |
| 13058 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13059 | 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] | 13060 | u8* mac, struct station_info *sinfo) |
| 13061 | { |
| 13062 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 13063 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13064 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13065 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13066 | |
| 13067 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 13068 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13069 | |
| 13070 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 13071 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 13072 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 13073 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 13074 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 13075 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 13076 | tANI_U16 maxRate = 0; |
| 13077 | tANI_U16 myRate; |
| 13078 | tANI_U16 currentRate = 0; |
| 13079 | tANI_U8 maxSpeedMCS = 0; |
| 13080 | tANI_U8 maxMCSIdx = 0; |
| 13081 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13082 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 13083 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13084 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13085 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13086 | #ifdef WLAN_FEATURE_11AC |
| 13087 | tANI_U32 vht_mcs_map; |
| 13088 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 13089 | #endif /* WLAN_FEATURE_11AC */ |
| 13090 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13091 | ENTER(); |
| 13092 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13093 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 13094 | (0 == ssidlen)) |
| 13095 | { |
| 13096 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 13097 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 13098 | /*To keep GUI happy*/ |
| 13099 | return 0; |
| 13100 | } |
| 13101 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 13102 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 13103 | { |
| 13104 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13105 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 13106 | return 0; |
| 13107 | } |
| 13108 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13109 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13110 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13111 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13112 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13113 | } |
| 13114 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13115 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 13116 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 13117 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 13118 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 13119 | wlan_hdd_get_station_stats(pAdapter); |
| 13120 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
| 13121 | |
| 13122 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13123 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 13124 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13125 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13126 | { |
| 13127 | rate_flags = pAdapter->maxRateFlags; |
| 13128 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13129 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13130 | //convert to the UI units of 100kbps |
| 13131 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 13132 | |
| 13133 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13134 | 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] | 13135 | sinfo->signal, |
| 13136 | pCfg->reportMaxLinkSpeed, |
| 13137 | myRate, |
| 13138 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13139 | (int) pCfg->linkSpeedRssiMid, |
| 13140 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13141 | (int) rate_flags, |
| 13142 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13143 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13144 | |
| 13145 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 13146 | { |
| 13147 | // we do not want to necessarily report the current speed |
| 13148 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 13149 | { |
| 13150 | // report the max possible speed |
| 13151 | rssidx = 0; |
| 13152 | } |
| 13153 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 13154 | { |
| 13155 | // report the max possible speed with RSSI scaling |
| 13156 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 13157 | { |
| 13158 | // report the max possible speed |
| 13159 | rssidx = 0; |
| 13160 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13161 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13162 | { |
| 13163 | // report middle speed |
| 13164 | rssidx = 1; |
| 13165 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13166 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 13167 | { |
| 13168 | // report middle speed |
| 13169 | rssidx = 2; |
| 13170 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13171 | else |
| 13172 | { |
| 13173 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13174 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13175 | } |
| 13176 | } |
| 13177 | else |
| 13178 | { |
| 13179 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 13180 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13181 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 13182 | __func__, pCfg->reportMaxLinkSpeed); |
| 13183 | rssidx = 0; |
| 13184 | } |
| 13185 | |
| 13186 | maxRate = 0; |
| 13187 | |
| 13188 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13189 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 13190 | OperationalRates, &ORLeng)) |
| 13191 | { |
| 13192 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13193 | /*To keep GUI happy*/ |
| 13194 | return 0; |
| 13195 | } |
| 13196 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13197 | for (i = 0; i < ORLeng; i++) |
| 13198 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13199 | 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] | 13200 | { |
| 13201 | /* Validate Rate Set */ |
| 13202 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 13203 | { |
| 13204 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 13205 | break; |
| 13206 | } |
| 13207 | } |
| 13208 | /* Update MAX rate */ |
| 13209 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 13210 | } |
| 13211 | |
| 13212 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13213 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 13214 | ExtendedRates, &ERLeng)) |
| 13215 | { |
| 13216 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13217 | /*To keep GUI happy*/ |
| 13218 | return 0; |
| 13219 | } |
| 13220 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13221 | for (i = 0; i < ERLeng; i++) |
| 13222 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13223 | 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] | 13224 | { |
| 13225 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 13226 | { |
| 13227 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 13228 | break; |
| 13229 | } |
| 13230 | } |
| 13231 | /* Update MAX rate */ |
| 13232 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 13233 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13234 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 13235 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 13236 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 13237 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13238 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13239 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13240 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13241 | mode = 2; |
| 13242 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 13243 | mode = 1; |
| 13244 | else |
| 13245 | mode = 0; |
| 13246 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13247 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 13248 | MCSRates, &MCSLeng)) |
| 13249 | { |
| 13250 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13251 | /*To keep GUI happy*/ |
| 13252 | return 0; |
| 13253 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13254 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13255 | #ifdef WLAN_FEATURE_11AC |
| 13256 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13257 | 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] | 13258 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13259 | 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] | 13260 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13261 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13262 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13263 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13264 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13265 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13266 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13267 | maxMCSIdx = 7; |
| 13268 | } |
| 13269 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 13270 | { |
| 13271 | maxMCSIdx = 8; |
| 13272 | } |
| 13273 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 13274 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13275 | //VHT20 is supporting 0~8 |
| 13276 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13277 | maxMCSIdx = 8; |
| 13278 | else |
| 13279 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13280 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13281 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13282 | if (0 != rssidx)/*check for scaled */ |
| 13283 | { |
| 13284 | //get middle rate MCS index if rssi=1/2 |
| 13285 | for (i=0; i <= maxMCSIdx; i++) |
| 13286 | { |
| 13287 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 13288 | { |
| 13289 | maxMCSIdx = i; |
| 13290 | break; |
| 13291 | } |
| 13292 | } |
| 13293 | } |
| 13294 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13295 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13296 | { |
| 13297 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 13298 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 13299 | } |
| 13300 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 13301 | { |
| 13302 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 13303 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 13304 | } |
| 13305 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13306 | { |
| 13307 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 13308 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 13309 | } |
| 13310 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13311 | maxSpeedMCS = 1; |
| 13312 | if (currentRate > maxRate) |
| 13313 | { |
| 13314 | maxRate = currentRate; |
| 13315 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13316 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13317 | } |
| 13318 | else |
| 13319 | #endif /* WLAN_FEATURE_11AC */ |
| 13320 | { |
| 13321 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13322 | { |
| 13323 | rateFlag |= 1; |
| 13324 | } |
| 13325 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13326 | { |
| 13327 | rateFlag |= 2; |
| 13328 | } |
| 13329 | |
Girish Gowli | 01abcee | 2014-07-31 20:18:55 +0530 | [diff] [blame] | 13330 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13331 | if (rssidx == 1 || rssidx == 2) |
| 13332 | { |
| 13333 | //get middle rate MCS index if rssi=1/2 |
| 13334 | for (i=0; i <= 7; i++) |
| 13335 | { |
| 13336 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 13337 | { |
| 13338 | temp = i+1; |
| 13339 | break; |
| 13340 | } |
| 13341 | } |
| 13342 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13343 | |
| 13344 | for (i = 0; i < MCSLeng; i++) |
| 13345 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13346 | for (j = 0; j < temp; j++) |
| 13347 | { |
| 13348 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 13349 | { |
| 13350 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
| 13351 | break; |
| 13352 | } |
| 13353 | } |
| 13354 | if ((j < temp) && (currentRate > maxRate)) |
| 13355 | { |
| 13356 | maxRate = currentRate; |
| 13357 | maxSpeedMCS = 1; |
| 13358 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
| 13359 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13360 | } |
| 13361 | } |
| 13362 | } |
| 13363 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13364 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 13365 | { |
| 13366 | maxRate = myRate; |
| 13367 | maxSpeedMCS = 1; |
| 13368 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 13369 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13370 | // 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] | 13371 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13372 | { |
| 13373 | maxRate = myRate; |
| 13374 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 13375 | { |
| 13376 | maxSpeedMCS = 0; |
| 13377 | } |
| 13378 | else |
| 13379 | { |
| 13380 | maxSpeedMCS = 1; |
| 13381 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 13382 | } |
| 13383 | } |
| 13384 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13385 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13386 | { |
| 13387 | sinfo->txrate.legacy = maxRate; |
| 13388 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13389 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 13390 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13391 | } |
| 13392 | else |
| 13393 | { |
| 13394 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13395 | #ifdef WLAN_FEATURE_11AC |
| 13396 | sinfo->txrate.nss = 1; |
| 13397 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13398 | { |
| 13399 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13400 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13401 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13402 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13403 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13404 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13405 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13406 | } |
| 13407 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13408 | { |
| 13409 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13410 | } |
| 13411 | #endif /* WLAN_FEATURE_11AC */ |
| 13412 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 13413 | { |
| 13414 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 13415 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13416 | { |
| 13417 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13418 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13419 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13420 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13421 | { |
| 13422 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 13423 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13424 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13425 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13426 | pr_info("Reporting MCS rate %d flags %x\n", |
| 13427 | sinfo->txrate.mcs, |
| 13428 | sinfo->txrate.flags ); |
| 13429 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13430 | } |
| 13431 | } |
| 13432 | else |
| 13433 | { |
| 13434 | // report current rate instead of max rate |
| 13435 | |
| 13436 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 13437 | { |
| 13438 | //provide to the UI in units of 100kbps |
| 13439 | sinfo->txrate.legacy = myRate; |
| 13440 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13441 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 13442 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13443 | } |
| 13444 | else |
| 13445 | { |
| 13446 | //must be MCS |
| 13447 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13448 | #ifdef WLAN_FEATURE_11AC |
| 13449 | sinfo->txrate.nss = 1; |
| 13450 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13451 | { |
| 13452 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13453 | } |
| 13454 | else |
| 13455 | #endif /* WLAN_FEATURE_11AC */ |
| 13456 | { |
| 13457 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 13458 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13459 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13460 | { |
| 13461 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 13462 | } |
| 13463 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13464 | { |
| 13465 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13466 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13467 | #ifdef WLAN_FEATURE_11AC |
| 13468 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13469 | { |
| 13470 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 13471 | } |
| 13472 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13473 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13474 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 13475 | sinfo->txrate.mcs, |
| 13476 | sinfo->txrate.flags ); |
| 13477 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13478 | } |
| 13479 | } |
| 13480 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 13481 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 13482 | sinfo->tx_packets = |
| 13483 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 13484 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 13485 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 13486 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 13487 | |
| 13488 | sinfo->tx_retries = |
| 13489 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 13490 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 13491 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 13492 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 13493 | |
| 13494 | sinfo->tx_failed = |
| 13495 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 13496 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 13497 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 13498 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 13499 | |
| 13500 | sinfo->filled |= |
| 13501 | STATION_INFO_TX_PACKETS | |
| 13502 | STATION_INFO_TX_RETRIES | |
| 13503 | STATION_INFO_TX_FAILED; |
| 13504 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13505 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13506 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 13507 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 13508 | EXIT(); |
| 13509 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13510 | } |
| 13511 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13512 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 13513 | u8* mac, struct station_info *sinfo) |
| 13514 | { |
| 13515 | int ret; |
| 13516 | |
| 13517 | vos_ssr_protect(__func__); |
| 13518 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 13519 | vos_ssr_unprotect(__func__); |
| 13520 | |
| 13521 | return ret; |
| 13522 | } |
| 13523 | |
| 13524 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 13525 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13526 | { |
| 13527 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13528 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13529 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13530 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13531 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13532 | ENTER(); |
| 13533 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13534 | if (NULL == pAdapter) |
| 13535 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13536 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13537 | return -ENODEV; |
| 13538 | } |
| 13539 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13540 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13541 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 13542 | pAdapter->sessionId, timeout)); |
| 13543 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13544 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13545 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13546 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13547 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13548 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13549 | } |
| 13550 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13551 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 13552 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 13553 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 13554 | (eConnectionState_Associated == |
| 13555 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 13556 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 13557 | |
| 13558 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13559 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 13560 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13561 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13562 | { |
| 13563 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13564 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13565 | __func__, vos_status); |
| 13566 | } |
| 13567 | } |
| 13568 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13569 | /**The get power cmd from the supplicant gets updated by the nl only |
| 13570 | *on successful execution of the function call |
| 13571 | *we are oppositely mapped w.r.t mode in the driver |
| 13572 | **/ |
| 13573 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 13574 | |
| 13575 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 13576 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13577 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13578 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13579 | return -EINVAL; |
| 13580 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13581 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13582 | return 0; |
| 13583 | } |
| 13584 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13585 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 13586 | struct net_device *dev, bool mode, int timeout) |
| 13587 | { |
| 13588 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13589 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13590 | vos_ssr_protect(__func__); |
| 13591 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 13592 | vos_ssr_unprotect(__func__); |
| 13593 | |
| 13594 | return ret; |
| 13595 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13596 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13597 | static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 13598 | struct net_device *netdev, |
| 13599 | u8 key_index) |
| 13600 | { |
| 13601 | ENTER(); |
| 13602 | return 0; |
| 13603 | } |
| 13604 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13605 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13606 | struct net_device *netdev, |
| 13607 | u8 key_index) |
| 13608 | { |
| 13609 | int ret; |
| 13610 | vos_ssr_protect(__func__); |
| 13611 | ret = __wlan_hdd_set_default_mgmt_key(wiphy, netdev, key_index); |
| 13612 | vos_ssr_unprotect(__func__); |
| 13613 | return ret; |
| 13614 | } |
| 13615 | #endif //LINUX_VERSION_CODE |
| 13616 | |
| 13617 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 13618 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13619 | struct net_device *dev, |
| 13620 | struct ieee80211_txq_params *params) |
| 13621 | { |
| 13622 | ENTER(); |
| 13623 | return 0; |
| 13624 | } |
| 13625 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13626 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13627 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13628 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13629 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13630 | return 0; |
| 13631 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13632 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13633 | |
| 13634 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 13635 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13636 | struct net_device *dev, |
| 13637 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13638 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13639 | int ret; |
| 13640 | |
| 13641 | vos_ssr_protect(__func__); |
| 13642 | ret = __wlan_hdd_set_txq_params(wiphy, dev, params); |
| 13643 | vos_ssr_unprotect(__func__); |
| 13644 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13645 | } |
| 13646 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13647 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13648 | struct ieee80211_txq_params *params) |
| 13649 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13650 | int ret; |
| 13651 | |
| 13652 | vos_ssr_protect(__func__); |
| 13653 | ret = __wlan_hdd_set_txq_params(wiphy, params); |
| 13654 | vos_ssr_unprotect(__func__); |
| 13655 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13656 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13657 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13658 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13659 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13660 | struct net_device *dev, |
| 13661 | struct tagCsrDelStaParams *pDelStaParams) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13662 | { |
| 13663 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13664 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13665 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13666 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13667 | v_U8_t staId; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13668 | v_CONTEXT_t pVosContext = NULL; |
| 13669 | ptSapContext pSapCtx = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13670 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13671 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13672 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13673 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13674 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13675 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13676 | return -EINVAL; |
| 13677 | } |
| 13678 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13679 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13680 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 13681 | pAdapter->sessionId, pAdapter->device_mode)); |
| 13682 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13683 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13684 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13685 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13686 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13687 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13688 | } |
| 13689 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13690 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13691 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13692 | ) |
| 13693 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13694 | pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 13695 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 13696 | if(pSapCtx == NULL){ |
| 13697 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13698 | FL("psapCtx is NULL")); |
| 13699 | return -ENOENT; |
| 13700 | } |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13701 | if (vos_is_macaddr_broadcast((v_MACADDR_t *)pDelStaParams->peerMacAddr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13702 | { |
| 13703 | v_U16_t i; |
| 13704 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 13705 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13706 | if ((pSapCtx->aStaInfo[i].isUsed) && |
| 13707 | (!pSapCtx->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13708 | { |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13709 | vos_mem_copy(pDelStaParams->peerMacAddr, |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13710 | pSapCtx->aStaInfo[i].macAddrSTA.bytes, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13711 | ETHER_ADDR_LEN); |
| 13712 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13713 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13714 | "%s: Delete STA with MAC::" |
| 13715 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13716 | __func__, |
| 13717 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
| 13718 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 13719 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13720 | pSapCtx->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13721 | } |
| 13722 | } |
| 13723 | } |
| 13724 | else |
| 13725 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13726 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13727 | vos_status = hdd_softap_GetStaId(pAdapter, |
| 13728 | (v_MACADDR_t *)pDelStaParams->peerMacAddr, &staId); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13729 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13730 | { |
| 13731 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13732 | "%s: Skip this DEL STA as this is not used::" |
| 13733 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13734 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13735 | return -ENOENT; |
| 13736 | } |
| 13737 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13738 | if( pSapCtx->aStaInfo[staId].isDeauthInProgress == TRUE) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13739 | { |
| 13740 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13741 | "%s: Skip this DEL STA as deauth is in progress::" |
| 13742 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13743 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13744 | return -ENOENT; |
| 13745 | } |
| 13746 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13747 | pSapCtx->aStaInfo[staId].isDeauthInProgress = TRUE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13748 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13749 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13750 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13751 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13752 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13753 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13754 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13755 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13756 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13757 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13758 | pSapCtx->aStaInfo[staId].isDeauthInProgress = FALSE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13759 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13760 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13761 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13762 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13763 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13764 | return -ENOENT; |
| 13765 | } |
| 13766 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13767 | } |
| 13768 | } |
| 13769 | |
| 13770 | EXIT(); |
| 13771 | |
| 13772 | return 0; |
| 13773 | } |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13774 | |
| 13775 | #ifdef CFG80211_DEL_STA_V2 |
| 13776 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 13777 | struct net_device *dev, |
| 13778 | struct station_del_parameters *param) |
| 13779 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13780 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 13781 | struct net_device *dev, u8 *mac) |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13782 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13783 | { |
| 13784 | int ret; |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13785 | struct tagCsrDelStaParams delStaParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13786 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13787 | vos_ssr_protect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13788 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13789 | #ifdef CFG80211_DEL_STA_V2 |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13790 | if (NULL == param) { |
| 13791 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid argumet passed", __func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13792 | vos_ssr_unprotect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13793 | return -EINVAL; |
| 13794 | } |
| 13795 | |
| 13796 | WLANSAP_PopulateDelStaParams(param->mac, param->reason_code, |
| 13797 | param->subtype, &delStaParams); |
| 13798 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13799 | #else |
Sushant Kaushik | 4cd28f6 | 2014-12-26 14:23:50 +0530 | [diff] [blame] | 13800 | WLANSAP_PopulateDelStaParams(mac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13801 | (SIR_MAC_MGMT_DEAUTH >> 4), &delStaParams); |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13802 | #endif |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13803 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, &delStaParams); |
| 13804 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13805 | vos_ssr_unprotect(__func__); |
| 13806 | |
| 13807 | return ret; |
| 13808 | } |
| 13809 | |
| 13810 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13811 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 13812 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13813 | hdd_adapter_t *pAdapter; |
| 13814 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13815 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13816 | #ifdef FEATURE_WLAN_TDLS |
| 13817 | u32 mask, set; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13818 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13819 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13820 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13821 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13822 | if (NULL == pAdapter) |
| 13823 | { |
| 13824 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13825 | "%s: Adapter is NULL",__func__); |
| 13826 | return -EINVAL; |
| 13827 | } |
| 13828 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13829 | status = wlan_hdd_validate_context(pHddCtx); |
| 13830 | if (0 != status) |
| 13831 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13832 | return status; |
| 13833 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13834 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13835 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13836 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 13837 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13838 | mask = params->sta_flags_mask; |
| 13839 | |
| 13840 | set = params->sta_flags_set; |
| 13841 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 13842 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13843 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 13844 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13845 | |
| 13846 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 13847 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13848 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13849 | } |
| 13850 | } |
| 13851 | #endif |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13852 | EXIT(); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13853 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13854 | } |
| 13855 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13856 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 13857 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 13858 | { |
| 13859 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13860 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13861 | vos_ssr_protect(__func__); |
| 13862 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 13863 | vos_ssr_unprotect(__func__); |
| 13864 | |
| 13865 | return ret; |
| 13866 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13867 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13868 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13869 | 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] | 13870 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13871 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13872 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13873 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13874 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13875 | int status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13876 | hdd_context_t *pHddCtx; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13877 | tPmkidCacheInfo pmk_id; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13878 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13879 | ENTER(); |
| 13880 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13881 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13882 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13883 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13884 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13885 | return -EINVAL; |
| 13886 | } |
| 13887 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13888 | if (!pmksa) { |
| 13889 | hddLog(LOGE, FL("pmksa is NULL")); |
| 13890 | return -EINVAL; |
| 13891 | } |
| 13892 | |
| 13893 | if (!pmksa->bssid || !pmksa->pmkid) { |
| 13894 | hddLog(LOGE, FL("pmksa->bssid(%p) or pmksa->pmkid(%p) is NULL"), |
| 13895 | pmksa->bssid, pmksa->pmkid); |
| 13896 | return -EINVAL; |
| 13897 | } |
| 13898 | |
| 13899 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 13900 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13901 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13902 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13903 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13904 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13905 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13906 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13907 | } |
| 13908 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13909 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13910 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13911 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13912 | vos_mem_copy(pmk_id.BSSID, pmksa->bssid, ETHER_ADDR_LEN); |
| 13913 | vos_mem_copy(pmk_id.PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13914 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13915 | /* Add to the PMKSA ID Cache in CSR */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13916 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13917 | &pmk_id, 1, FALSE); |
| 13918 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13919 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13920 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 13921 | pAdapter->sessionId, result)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13922 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13923 | EXIT(); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13924 | return HAL_STATUS_SUCCESS(result) ? 0 : -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13925 | } |
| 13926 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13927 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 13928 | struct cfg80211_pmksa *pmksa) |
| 13929 | { |
| 13930 | int ret; |
| 13931 | |
| 13932 | vos_ssr_protect(__func__); |
| 13933 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 13934 | vos_ssr_unprotect(__func__); |
| 13935 | |
| 13936 | return ret; |
| 13937 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13938 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13939 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13940 | 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] | 13941 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13942 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13943 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13944 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13945 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13946 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13947 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13948 | ENTER(); |
| 13949 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13950 | /* Validate pAdapter */ |
| 13951 | if (NULL == pAdapter) |
| 13952 | { |
| 13953 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 13954 | return -EINVAL; |
| 13955 | } |
| 13956 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13957 | if (!pmksa) { |
| 13958 | hddLog(LOGE, FL("pmksa is NULL")); |
| 13959 | return -EINVAL; |
| 13960 | } |
| 13961 | |
| 13962 | if (!pmksa->bssid) { |
| 13963 | hddLog(LOGE, FL("pmksa->bssid is NULL")); |
| 13964 | return -EINVAL; |
| 13965 | } |
| 13966 | |
Kiet Lam | 98c46a1 | 2014-10-31 15:34:57 -0700 | [diff] [blame] | 13967 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 13968 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13969 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13970 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13971 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13972 | if (0 != status) |
| 13973 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13974 | return status; |
| 13975 | } |
| 13976 | |
| 13977 | /*Retrieve halHandle*/ |
| 13978 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13979 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13980 | /* Delete the PMKID CSR cache */ |
| 13981 | if (eHAL_STATUS_SUCCESS != |
| 13982 | sme_RoamDelPMKIDfromCache(halHandle, |
| 13983 | pAdapter->sessionId, pmksa->bssid, FALSE)) { |
| 13984 | hddLog(LOGE, FL("Failed to delete PMKSA for "MAC_ADDRESS_STR), |
| 13985 | MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13986 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13987 | } |
| 13988 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13989 | EXIT(); |
| 13990 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13991 | } |
| 13992 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13993 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13994 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 13995 | struct cfg80211_pmksa *pmksa) |
| 13996 | { |
| 13997 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13998 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13999 | vos_ssr_protect(__func__); |
| 14000 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 14001 | vos_ssr_unprotect(__func__); |
| 14002 | |
| 14003 | return ret; |
| 14004 | |
| 14005 | } |
| 14006 | |
| 14007 | 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] | 14008 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14009 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14010 | tHalHandle halHandle; |
| 14011 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 14012 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14013 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14014 | ENTER(); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14015 | |
| 14016 | /* Validate pAdapter */ |
| 14017 | if (NULL == pAdapter) |
| 14018 | { |
| 14019 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 14020 | "%s: Invalid Adapter" ,__func__); |
| 14021 | return -EINVAL; |
| 14022 | } |
| 14023 | |
| 14024 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14025 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14026 | if (0 != status) |
| 14027 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14028 | return status; |
| 14029 | } |
| 14030 | |
| 14031 | /*Retrieve halHandle*/ |
| 14032 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14033 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14034 | /* Flush the PMKID cache in CSR */ |
| 14035 | if (eHAL_STATUS_SUCCESS != |
| 14036 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, NULL, TRUE)) { |
| 14037 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Cannot flush PMKIDCache")); |
| 14038 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14039 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14040 | EXIT(); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 14041 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14042 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 14043 | |
| 14044 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 14045 | { |
| 14046 | int ret; |
| 14047 | |
| 14048 | vos_ssr_protect(__func__); |
| 14049 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 14050 | vos_ssr_unprotect(__func__); |
| 14051 | |
| 14052 | return ret; |
| 14053 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14054 | #endif |
| 14055 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14056 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14057 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 14058 | struct net_device *dev, |
| 14059 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14060 | { |
| 14061 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14062 | hdd_station_ctx_t *pHddStaCtx; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14063 | hdd_context_t *pHddCtx; |
| 14064 | int ret = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14065 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14066 | ENTER(); |
| 14067 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14068 | if (NULL == pAdapter) |
| 14069 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14070 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14071 | return -ENODEV; |
| 14072 | } |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14073 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14074 | ret = wlan_hdd_validate_context(pHddCtx); |
| 14075 | if (0 != ret) |
| 14076 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14077 | return ret; |
| 14078 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14079 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14080 | if (NULL == pHddStaCtx) |
| 14081 | { |
| 14082 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: STA Context is NULL", __func__); |
| 14083 | return -EINVAL; |
| 14084 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14085 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14086 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14087 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 14088 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14089 | // Added for debug on reception of Re-assoc Req. |
| 14090 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 14091 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14092 | 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] | 14093 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14094 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14095 | } |
| 14096 | |
| 14097 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14098 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14099 | ftie->ie_len); |
| 14100 | #endif |
| 14101 | |
| 14102 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 14103 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 14104 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14105 | ftie->ie_len); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14106 | |
| 14107 | EXIT(); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14108 | return 0; |
| 14109 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14110 | |
| 14111 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 14112 | struct net_device *dev, |
| 14113 | struct cfg80211_update_ft_ies_params *ftie) |
| 14114 | { |
| 14115 | int ret; |
| 14116 | |
| 14117 | vos_ssr_protect(__func__); |
| 14118 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 14119 | vos_ssr_unprotect(__func__); |
| 14120 | |
| 14121 | return ret; |
| 14122 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14123 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14124 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14125 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 14126 | |
| 14127 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 14128 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 14129 | { |
| 14130 | int ret; |
| 14131 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 14132 | hdd_context_t *pHddCtx; |
| 14133 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14134 | ENTER(); |
| 14135 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14136 | if (NULL == pAdapter) |
| 14137 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 14138 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14139 | "%s: HDD adapter is Null", __func__); |
| 14140 | return ; |
| 14141 | } |
| 14142 | |
| 14143 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14144 | if (NULL == pHddCtx) |
| 14145 | { |
| 14146 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14147 | "%s: HDD context is Null!!!", __func__); |
| 14148 | return ; |
| 14149 | } |
| 14150 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14151 | spin_lock(&pHddCtx->schedScan_lock); |
| 14152 | if (TRUE == pHddCtx->isWiphySuspended) |
| 14153 | { |
| 14154 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 14155 | spin_unlock(&pHddCtx->schedScan_lock); |
| 14156 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14157 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 14158 | return ; |
| 14159 | } |
| 14160 | spin_unlock(&pHddCtx->schedScan_lock); |
| 14161 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14162 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 14163 | |
| 14164 | if (0 > ret) |
| 14165 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 14166 | |
| 14167 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14168 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14169 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14170 | } |
| 14171 | |
| 14172 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14173 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14174 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14175 | */ |
| 14176 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 14177 | { |
| 14178 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 14179 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14180 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14181 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14182 | int status = 0; |
| 14183 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 14184 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14185 | /* The current firmware design does not allow PNO during any |
| 14186 | * active sessions. Hence, determine the active sessions |
| 14187 | * and return a failure. |
| 14188 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14189 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 14190 | { |
| 14191 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14192 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14193 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14194 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 14195 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 14196 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 14197 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 14198 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
Siddharth Bhal | 63a19a7 | 2014-11-07 14:31:56 +0530 | [diff] [blame] | 14199 | || (WLAN_HDD_TM_LEVEL_4 == pHddCtx->tmInfo.currentTmLevel) |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14200 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14201 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14202 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14203 | } |
| 14204 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 14205 | pAdapterNode = pNext; |
| 14206 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14207 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14208 | } |
| 14209 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14210 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 14211 | { |
| 14212 | hdd_adapter_t *pAdapter = callbackContext; |
| 14213 | hdd_context_t *pHddCtx; |
| 14214 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14215 | ENTER(); |
| 14216 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14217 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 14218 | { |
| 14219 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14220 | FL("Invalid adapter or adapter has invalid magic")); |
| 14221 | return; |
| 14222 | } |
| 14223 | |
| 14224 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14225 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 14226 | { |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14227 | return; |
| 14228 | } |
| 14229 | |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 14230 | if (VOS_STATUS_SUCCESS != status) |
| 14231 | { |
| 14232 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14233 | FL("PNO enable response status = %d"), status); |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 14234 | pHddCtx->isPnoEnable = FALSE; |
| 14235 | } |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14236 | |
| 14237 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 14238 | complete(&pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14239 | EXIT(); |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14240 | } |
| 14241 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14242 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14243 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 14244 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14245 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14246 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14247 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 14248 | { |
| 14249 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14250 | tSirPNOScanReq pnoRequest = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14251 | hdd_context_t *pHddCtx; |
| 14252 | tHalHandle hHal; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14253 | v_U32_t i, indx, num_ch, tempInterval, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 14254 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 14255 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14256 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 14257 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14258 | int ret = 0; |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14259 | hdd_config_t *pConfig = NULL; |
| 14260 | v_U32_t num_ignore_dfs_ch = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14261 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14262 | ENTER(); |
| 14263 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14264 | if (NULL == pAdapter) |
| 14265 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14266 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14267 | "%s: HDD adapter is Null", __func__); |
| 14268 | return -ENODEV; |
| 14269 | } |
| 14270 | |
| 14271 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14272 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14273 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14274 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14275 | { |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14276 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14277 | } |
| 14278 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14279 | pConfig = pHddCtx->cfg_ini; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14280 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14281 | if (NULL == hHal) |
| 14282 | { |
| 14283 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14284 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14285 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14286 | } |
Sushant Kaushik | 2fe8993 | 2014-09-03 10:58:09 +0530 | [diff] [blame] | 14287 | sme_ScanFlushResult(hHal, pAdapter->sessionId); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 14288 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 14289 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 14290 | { |
| 14291 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14292 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 14293 | return -EBUSY; |
| 14294 | } |
| 14295 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14296 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14297 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14298 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14299 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14300 | return -EBUSY; |
| 14301 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14302 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14303 | if (TRUE == pHddCtx->isPnoEnable) |
| 14304 | { |
| 14305 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 14306 | FL("already PNO is enabled")); |
| 14307 | return -EBUSY; |
| 14308 | } |
c_hpothu | 225aa7c | 2014-10-22 17:45:13 +0530 | [diff] [blame] | 14309 | |
| 14310 | if (VOS_STATUS_SUCCESS != wlan_hdd_cancel_remain_on_channel(pHddCtx)) |
| 14311 | { |
| 14312 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14313 | "%s: abort ROC failed ", __func__); |
| 14314 | return -EBUSY; |
| 14315 | } |
| 14316 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14317 | pHddCtx->isPnoEnable = TRUE; |
| 14318 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14319 | pnoRequest.enable = 1; /*Enable PNO */ |
| 14320 | pnoRequest.ucNetworksCount = request->n_match_sets; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14321 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14322 | if (( !pnoRequest.ucNetworksCount ) || |
| 14323 | ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14324 | { |
| 14325 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14326 | "%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] | 14327 | __func__, pnoRequest.ucNetworksCount, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14328 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14329 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14330 | goto error; |
| 14331 | } |
| 14332 | |
| 14333 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 14334 | { |
| 14335 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14336 | "%s: Incorrect number of channels %d", |
| 14337 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14338 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14339 | goto error; |
| 14340 | } |
| 14341 | |
| 14342 | /* Framework provides one set of channels(all) |
| 14343 | * common for all saved profile */ |
| 14344 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 14345 | channels_allowed, &num_channels_allowed)) |
| 14346 | { |
| 14347 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14348 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14349 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14350 | goto error; |
| 14351 | } |
| 14352 | /* Checking each channel against allowed channel list */ |
| 14353 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14354 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14355 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14356 | char chList [(request->n_channels*5)+1]; |
| 14357 | int len; |
| 14358 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14359 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14360 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14361 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14362 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 14363 | { |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14364 | if ((!pConfig->enableDFSPnoChnlScan) && |
| 14365 | (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channels_allowed[indx]))) |
| 14366 | { |
| 14367 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14368 | "%s : Dropping DFS channel : %d", |
| 14369 | __func__,channels_allowed[indx]); |
| 14370 | num_ignore_dfs_ch++; |
| 14371 | break; |
| 14372 | } |
| 14373 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14374 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 14375 | len += snprintf(chList+len, 5, "%d ", |
| 14376 | request->channels[i]->hw_value); |
| 14377 | break ; |
| 14378 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14379 | } |
| 14380 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14381 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14382 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14383 | /*If all channels are DFS and dropped, then ignore the PNO request*/ |
| 14384 | if (num_ignore_dfs_ch == request->n_channels) |
| 14385 | { |
| 14386 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14387 | "%s : All requested channels are DFS channels", __func__); |
| 14388 | ret = -EINVAL; |
| 14389 | goto error; |
| 14390 | } |
| 14391 | } |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14392 | |
| 14393 | pnoRequest.aNetworks = |
| 14394 | vos_mem_malloc(sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14395 | if (pnoRequest.aNetworks == NULL) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14396 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14397 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14398 | FL("failed to allocate memory aNetworks %u"), |
| 14399 | (uint32)sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14400 | goto error; |
| 14401 | } |
| 14402 | vos_mem_zero(pnoRequest.aNetworks, |
| 14403 | sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14404 | |
| 14405 | /* Filling per profile params */ |
| 14406 | for (i = 0; i < pnoRequest.ucNetworksCount; i++) |
| 14407 | { |
| 14408 | pnoRequest.aNetworks[i].ssId.length = |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14409 | request->match_sets[i].ssid.ssid_len; |
| 14410 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14411 | if (( 0 == pnoRequest.aNetworks[i].ssId.length ) || |
| 14412 | ( pnoRequest.aNetworks[i].ssId.length > 32 ) ) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14413 | { |
| 14414 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14415 | "%s: SSID Len %d is not correct for network %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14416 | __func__, pnoRequest.aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14417 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14418 | goto error; |
| 14419 | } |
| 14420 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14421 | memcpy(pnoRequest.aNetworks[i].ssId.ssId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14422 | request->match_sets[i].ssid.ssid, |
| 14423 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14424 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14425 | "%s: SSID of network %d is %s ", __func__, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14426 | i, pnoRequest.aNetworks[i].ssId.ssId); |
| 14427 | pnoRequest.aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 14428 | pnoRequest.aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 14429 | pnoRequest.aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14430 | |
| 14431 | /*Copying list of valid channel into request */ |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14432 | memcpy(pnoRequest.aNetworks[i].aChannels, valid_ch, num_ch); |
| 14433 | pnoRequest.aNetworks[i].ucChannelCount = num_ch; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14434 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14435 | pnoRequest.aNetworks[i].rssiThreshold = 0; //Default value |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14436 | } |
| 14437 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14438 | for (i = 0; i < request->n_ssids; i++) |
| 14439 | { |
| 14440 | j = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14441 | while (j < pnoRequest.ucNetworksCount) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14442 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14443 | if ((pnoRequest.aNetworks[j].ssId.length == |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14444 | request->ssids[i].ssid_len) && |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14445 | (0 == memcmp(pnoRequest.aNetworks[j].ssId.ssId, |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14446 | request->ssids[i].ssid, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14447 | pnoRequest.aNetworks[j].ssId.length))) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14448 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14449 | pnoRequest.aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14450 | break; |
| 14451 | } |
| 14452 | j++; |
| 14453 | } |
| 14454 | } |
| 14455 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14456 | "Number of hidden networks being Configured = %d", |
| 14457 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14458 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 14459 | "request->ie_len = %zu", request->ie_len); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14460 | |
| 14461 | pnoRequest.p24GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 14462 | if (pnoRequest.p24GProbeTemplate == NULL) |
| 14463 | { |
| 14464 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14465 | FL("failed to allocate memory p24GProbeTemplate %u"), |
| 14466 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 14467 | goto error; |
| 14468 | } |
| 14469 | |
| 14470 | pnoRequest.p5GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 14471 | if (pnoRequest.p5GProbeTemplate == NULL) |
| 14472 | { |
| 14473 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14474 | FL("failed to allocate memory p5GProbeTemplate %u"), |
| 14475 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 14476 | goto error; |
| 14477 | } |
| 14478 | |
| 14479 | vos_mem_zero(pnoRequest.p24GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 14480 | vos_mem_zero(pnoRequest.p5GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 14481 | |
Hanumantha Reddy Pothula | 06e87b2 | 2015-03-02 18:02:23 +0530 | [diff] [blame] | 14482 | if ((0 < request->ie_len) && (request->ie_len <= SIR_PNO_MAX_PB_REQ_SIZE) && |
| 14483 | (NULL != request->ie)) |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14484 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14485 | pnoRequest.us24GProbeTemplateLen = request->ie_len; |
| 14486 | memcpy(pnoRequest.p24GProbeTemplate, request->ie, |
| 14487 | pnoRequest.us24GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14488 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14489 | pnoRequest.us5GProbeTemplateLen = request->ie_len; |
| 14490 | memcpy(pnoRequest.p5GProbeTemplate, request->ie, |
| 14491 | pnoRequest.us5GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14492 | } |
| 14493 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14494 | /* Driver gets only one time interval which is hardcoded in |
| 14495 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 14496 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 14497 | * 80,160,320 secs. And number of scan cycle for each timer |
| 14498 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 14499 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 14500 | * will be repeated after each interval specified by supplicant |
| 14501 | * till PNO is disabled. |
| 14502 | */ |
| 14503 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14504 | pnoRequest.scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14505 | else |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14506 | pnoRequest.scanTimers.ucScanTimersCount = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14507 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 14508 | |
| 14509 | tempInterval = (request->interval)/1000; |
| 14510 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14511 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 14512 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14513 | for ( i = 0; i < pnoRequest.scanTimers.ucScanTimersCount; i++) |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14514 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14515 | pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14516 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14517 | pnoRequest.scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14518 | tempInterval *= 2; |
| 14519 | } |
| 14520 | //Repeat last timer until pno disabled. |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14521 | pnoRequest.scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14522 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14523 | pnoRequest.modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14524 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14525 | INIT_COMPLETION(pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14526 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 14527 | pnoRequest.callbackContext = pAdapter; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14528 | pAdapter->pno_req_status = 0; |
| 14529 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14530 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14531 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14532 | pAdapter->sessionId, pnoRequest.enable, pnoRequest.modePNO, |
| 14533 | pnoRequest.scanTimers.ucScanTimersCount); |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14534 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14535 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14536 | &pnoRequest, pAdapter->sessionId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14537 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 14538 | if (eHAL_STATUS_SUCCESS != status) |
| 14539 | { |
| 14540 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14541 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14542 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14543 | goto error; |
| 14544 | } |
| 14545 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14546 | ret = wait_for_completion_timeout( |
| 14547 | &pAdapter->pno_comp_var, |
| 14548 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 14549 | if (0 >= ret) |
| 14550 | { |
| 14551 | // Did not receive the response for PNO enable in time. |
| 14552 | // Assuming the PNO enable was success. |
| 14553 | // Returning error from here, because we timeout, results |
| 14554 | // in side effect of Wifi (Wifi Setting) not to work. |
| 14555 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14556 | FL("Timed out waiting for PNO to be Enabled")); |
| 14557 | ret = 0; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14558 | } |
| 14559 | |
| 14560 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14561 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14562 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14563 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14564 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14565 | FL("PNO scanRequest offloaded ret = %d"), ret); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14566 | pHddCtx->isPnoEnable = FALSE; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14567 | if (pnoRequest.aNetworks) |
| 14568 | vos_mem_free(pnoRequest.aNetworks); |
| 14569 | if (pnoRequest.p24GProbeTemplate) |
| 14570 | vos_mem_free(pnoRequest.p24GProbeTemplate); |
| 14571 | if (pnoRequest.p5GProbeTemplate) |
| 14572 | vos_mem_free(pnoRequest.p5GProbeTemplate); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14573 | |
| 14574 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14575 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14576 | } |
| 14577 | |
| 14578 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14579 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 14580 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14581 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14582 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 14583 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 14584 | { |
| 14585 | int ret; |
| 14586 | |
| 14587 | vos_ssr_protect(__func__); |
| 14588 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 14589 | vos_ssr_unprotect(__func__); |
| 14590 | |
| 14591 | return ret; |
| 14592 | } |
| 14593 | |
| 14594 | /* |
| 14595 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 14596 | * Function to disable PNO |
| 14597 | */ |
| 14598 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14599 | struct net_device *dev) |
| 14600 | { |
| 14601 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14602 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14603 | hdd_context_t *pHddCtx; |
| 14604 | tHalHandle hHal; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14605 | tSirPNOScanReq pnoRequest = {0}; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14606 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14607 | |
| 14608 | ENTER(); |
| 14609 | |
| 14610 | if (NULL == pAdapter) |
| 14611 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14612 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14613 | "%s: HDD adapter is Null", __func__); |
| 14614 | return -ENODEV; |
| 14615 | } |
| 14616 | |
| 14617 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14618 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14619 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14620 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14621 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14622 | "%s: HDD context is Null", __func__); |
| 14623 | return -ENODEV; |
| 14624 | } |
| 14625 | |
| 14626 | /* The return 0 is intentional when isLogpInProgress and |
| 14627 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 14628 | * failure in sched_scan_stop , especially for a case where the unload |
| 14629 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 14630 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 14631 | * success. If it returns a failure , then its next invocation due to the |
| 14632 | * clean up of the second interface will have the dev pointer corresponding |
| 14633 | * to the first one leading to a crash. |
| 14634 | */ |
| 14635 | if (pHddCtx->isLogpInProgress) |
| 14636 | { |
| 14637 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14638 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14639 | return ret; |
| 14640 | } |
| 14641 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 14642 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14643 | { |
| 14644 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14645 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14646 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14647 | } |
| 14648 | |
| 14649 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14650 | if (NULL == hHal) |
| 14651 | { |
| 14652 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14653 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14654 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14655 | } |
| 14656 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14657 | pnoRequest.enable = 0; /* Disable PNO */ |
| 14658 | pnoRequest.ucNetworksCount = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14659 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14660 | status = sme_SetPreferredNetworkList(hHal, &pnoRequest, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14661 | pAdapter->sessionId, |
| 14662 | NULL, pAdapter); |
| 14663 | if (eHAL_STATUS_SUCCESS != status) |
| 14664 | { |
| 14665 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14666 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14667 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14668 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14669 | } |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14670 | pHddCtx->isPnoEnable = FALSE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14671 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14672 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14673 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14674 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14675 | |
| 14676 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14677 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14678 | } |
| 14679 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14680 | /* |
| 14681 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 14682 | * NL interface to disable PNO |
| 14683 | */ |
| 14684 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 14685 | struct net_device *dev) |
| 14686 | { |
| 14687 | int ret; |
| 14688 | |
| 14689 | vos_ssr_protect(__func__); |
| 14690 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 14691 | vos_ssr_unprotect(__func__); |
| 14692 | |
| 14693 | return ret; |
| 14694 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14695 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 14696 | |
| 14697 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14698 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14699 | #if TDLS_MGMT_VERSION2 |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14700 | 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] | 14701 | u8 *peer, u8 action_code, u8 dialog_token, |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14702 | u16 status_code, u32 peer_capability, const u8 *buf, size_t len) |
| 14703 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14704 | 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] | 14705 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14706 | u16 status_code, const u8 *buf, size_t len) |
| 14707 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14708 | { |
| 14709 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14710 | hdd_adapter_t *pAdapter; |
| 14711 | hdd_context_t *pHddCtx; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14712 | u8 peerMac[6]; |
| 14713 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14714 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14715 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14716 | long rc; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14717 | int ret; |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14718 | #if !(TDLS_MGMT_VERSION2) |
| 14719 | u32 peer_capability = 0; |
| 14720 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14721 | tANI_U16 numCurrTdlsPeers; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14722 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14723 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14724 | if (NULL == pAdapter) |
| 14725 | { |
| 14726 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14727 | "%s: Adapter is NULL",__func__); |
| 14728 | return -EINVAL; |
| 14729 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14730 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14731 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 14732 | pAdapter->sessionId, action_code)); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14733 | pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14734 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14735 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14736 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14737 | "Invalid arguments"); |
| 14738 | return -EINVAL; |
| 14739 | } |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14740 | if (pHddCtx->isLogpInProgress) |
| 14741 | { |
| 14742 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14743 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14744 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 14745 | peer, |
| 14746 | eTDLS_LINK_IDLE, |
| 14747 | eTDLS_LINK_UNSPECIFIED); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14748 | return -EBUSY; |
| 14749 | } |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14750 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
| 14751 | { |
| 14752 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14753 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14754 | return -EAGAIN; |
| 14755 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14756 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14757 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14758 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14759 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 14760 | MAC_ADDRESS_STR " action %d declined.", |
| 14761 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14762 | return -ENOTSUPP; |
| 14763 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14764 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14765 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 14766 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 14767 | { |
| 14768 | /* if tdls_mode is disabled to respond to peer's request */ |
| 14769 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 14770 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14771 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14772 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14773 | " TDLS mode is disabled. action %d declined.", |
| 14774 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14775 | |
| 14776 | return -ENOTSUPP; |
| 14777 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 14778 | |
| 14779 | if (vos_max_concurrent_connections_reached()) |
| 14780 | { |
| 14781 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 14782 | return -EINVAL; |
| 14783 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14784 | } |
| 14785 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14786 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 14787 | { |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 14788 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14789 | { |
| 14790 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14791 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14792 | " TDLS setup is ongoing. action %d declined.", |
| 14793 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 14794 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14795 | } |
| 14796 | } |
| 14797 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14798 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 14799 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14800 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14801 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 14802 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14803 | { |
| 14804 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 14805 | we return error code at 'add_station()'. Hence we have this |
| 14806 | check again in addtion to add_station(). |
| 14807 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14808 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14809 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14810 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14811 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14812 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 14813 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 14814 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 14815 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14816 | } |
| 14817 | else |
| 14818 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14819 | /* maximum reached. tweak to send error code to peer and return |
| 14820 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14821 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14822 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14823 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14824 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 14825 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 14826 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14827 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14828 | /* fall through to send setup resp with failure status |
| 14829 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14830 | } |
| 14831 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14832 | else |
| 14833 | { |
| 14834 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14835 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 14836 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14837 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14838 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14839 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 14840 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14841 | return -EPERM; |
| 14842 | } |
| 14843 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14844 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14845 | vos_mem_copy(peerMac, peer, 6); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14846 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14847 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 14848 | "%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] | 14849 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 14850 | action_code, dialog_token, status_code, len); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14851 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14852 | /*Except teardown responder will not be used so just make 0*/ |
| 14853 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14854 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14855 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14856 | |
| 14857 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14858 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14859 | |
| 14860 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 14861 | responder = pTdlsPeer->is_responder; |
| 14862 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14863 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14864 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 14865 | "%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] | 14866 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 14867 | dialog_token, status_code, len); |
| 14868 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14869 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14870 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14871 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14872 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 14873 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14874 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14875 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 14876 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14877 | { |
| 14878 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 14879 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14880 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14881 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14882 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 14883 | if (status != VOS_STATUS_SUCCESS) { |
| 14884 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
| 14885 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14886 | } |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14887 | if (SIR_MAC_TDLS_DIS_REQ != action_code) { |
| 14888 | if (0 != wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED)) { |
| 14889 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS capabilities")); |
| 14890 | } |
| 14891 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14892 | } |
| 14893 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14894 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 14895 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 14896 | { |
| 14897 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14898 | "%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] | 14899 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14900 | ret = -EBUSY; |
| 14901 | goto tx_failed; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14902 | } |
| 14903 | |
| 14904 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14905 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 14906 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14907 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 14908 | 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] | 14909 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14910 | if (VOS_STATUS_SUCCESS != status) |
| 14911 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14912 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14913 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14914 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14915 | ret = -EINVAL; |
| 14916 | goto tx_failed; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14917 | } |
| 14918 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14919 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 14920 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 14921 | |
| 14922 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14923 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14924 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 14925 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14926 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14927 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 14928 | |
| 14929 | if (pHddCtx->isLogpInProgress) |
| 14930 | { |
| 14931 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14932 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14933 | return -EAGAIN; |
| 14934 | } |
| 14935 | |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14936 | ret = -EINVAL; |
| 14937 | goto tx_failed; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14938 | } |
| 14939 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14940 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14941 | { |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14942 | ret = max_sta_failed; |
| 14943 | goto tx_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14944 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14945 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14946 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 14947 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14948 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE)) { |
| 14949 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 14950 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14951 | } |
| 14952 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 14953 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14954 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE)) { |
| 14955 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 14956 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14957 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14958 | |
| 14959 | return 0; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14960 | |
| 14961 | tx_failed: |
| 14962 | /* add_station will be called before sending TDLS_SETUP_REQ and |
| 14963 | * TDLS_SETUP_RSP and as part of add_station driver will enable |
| 14964 | * BMPS. NL80211_TDLS_DISABLE_LINK will be called if the tx of |
| 14965 | * TDLS_SETUP_REQ or TDLS_SETUP_RSP fails. BMPS will be enabled |
| 14966 | * as part of processing NL80211_TDLS_DISABLE_LINK. So need to |
| 14967 | * enable BMPS for TDLS_SETUP_REQ and TDLS_SETUP_RSP if tx fails. |
| 14968 | */ |
| 14969 | |
| 14970 | if ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 14971 | (SIR_MAC_TDLS_SETUP_RSP == action_code)) |
| 14972 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 14973 | return ret; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14974 | } |
| 14975 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14976 | #if TDLS_MGMT_VERSION2 |
| 14977 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 14978 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14979 | u16 status_code, u32 peer_capability, |
| 14980 | const u8 *buf, size_t len) |
| 14981 | #else |
| 14982 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 14983 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14984 | u16 status_code, const u8 *buf, size_t len) |
| 14985 | #endif |
| 14986 | { |
| 14987 | int ret; |
| 14988 | |
| 14989 | vos_ssr_protect(__func__); |
| 14990 | #if TDLS_MGMT_VERSION2 |
| 14991 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token, |
| 14992 | status_code, peer_capability, buf, len); |
| 14993 | #else |
| 14994 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token, |
| 14995 | status_code, buf, len); |
| 14996 | #endif |
| 14997 | vos_ssr_unprotect(__func__); |
| 14998 | |
| 14999 | return ret; |
| 15000 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15001 | |
| 15002 | int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter, |
| 15003 | u8 *peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15004 | tdls_req_params_t *tdls_peer_params, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15005 | cfg80211_exttdls_callback callback) |
| 15006 | { |
| 15007 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15008 | hddTdlsPeer_t *pTdlsPeer = NULL; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15009 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15010 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15011 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15012 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 15013 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15014 | |
| 15015 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 15016 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 15017 | |
| 15018 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15019 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 15020 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 15021 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15022 | return -ENOTSUPP; |
| 15023 | } |
| 15024 | |
| 15025 | /* To cater the requirement of establishing the TDLS link |
| 15026 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 15027 | */ |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 15028 | mutex_lock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15029 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 15030 | if (pTdlsPeer == NULL) { |
| 15031 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15032 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 15033 | __func__, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 15034 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15035 | return -EINVAL; |
| 15036 | } |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 15037 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15038 | |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 15039 | /* check FW TDLS Off Channel capability */ |
| 15040 | if ((TRUE == sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)) && |
| 15041 | (NULL != tdls_peer_params)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15042 | { |
| 15043 | pTdlsPeer->peerParams.channel = tdls_peer_params->channel; |
| 15044 | pTdlsPeer->peerParams.global_operating_class = |
| 15045 | tdls_peer_params->global_operating_class; |
| 15046 | pTdlsPeer->peerParams.max_latency_ms = tdls_peer_params->max_latency_ms; |
| 15047 | pTdlsPeer->peerParams.min_bandwidth_kbps = |
| 15048 | tdls_peer_params->min_bandwidth_kbps; |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15049 | /* check configured channel is valid, non dfs and |
| 15050 | * not current operating channel */ |
| 15051 | if ((sme_IsTdlsOffChannelValid(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15052 | tdls_peer_params->channel)) && |
| 15053 | (pHddStaCtx) && |
| 15054 | (tdls_peer_params->channel != |
| 15055 | pHddStaCtx->conn_info.operationChannel)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15056 | { |
| 15057 | pTdlsPeer->isOffChannelConfigured = TRUE; |
| 15058 | } |
| 15059 | else |
| 15060 | { |
| 15061 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 15062 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15063 | "%s: Configured Tdls Off Channel is not valid", __func__); |
| 15064 | |
| 15065 | } |
| 15066 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15067 | "%s: tdls_off_channel %d isOffChannelConfigured %d " |
| 15068 | "current operating channel %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15069 | __func__, pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15070 | pTdlsPeer->isOffChannelConfigured, |
| 15071 | (pHddStaCtx ? pHddStaCtx->conn_info.operationChannel : 0)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15072 | } |
| 15073 | else |
| 15074 | { |
| 15075 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 15076 | "%s: TDLS off channel FW capability %d or " |
| 15077 | "Invalid TDLS Peer Params", __func__, |
| 15078 | sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15079 | } |
| 15080 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15081 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 15082 | |
| 15083 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15084 | " %s TDLS Add Force Peer Failed", |
| 15085 | __func__); |
| 15086 | return -EINVAL; |
| 15087 | } |
| 15088 | /*EXT TDLS*/ |
| 15089 | |
| 15090 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) { |
| 15091 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15092 | " %s TDLS set callback Failed", |
| 15093 | __func__); |
| 15094 | return -EINVAL; |
| 15095 | } |
| 15096 | |
| 15097 | return(0); |
| 15098 | |
| 15099 | } |
| 15100 | |
| 15101 | int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, u8 *peer) |
| 15102 | { |
| 15103 | |
| 15104 | hddTdlsPeer_t *pTdlsPeer; |
| 15105 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15106 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15107 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 15108 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15109 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 15110 | if (0 != wlan_hdd_validate_context(pHddCtx)) { |
| 15111 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is NULL")); |
| 15112 | return -EINVAL; |
| 15113 | } |
| 15114 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15115 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 15116 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 15117 | |
| 15118 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15119 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 15120 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 15121 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15122 | return -ENOTSUPP; |
| 15123 | } |
| 15124 | |
| 15125 | |
| 15126 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 15127 | |
| 15128 | if ( NULL == pTdlsPeer ) { |
| 15129 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
| 15130 | " peer not exsting", |
| 15131 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15132 | return -EINVAL; |
| 15133 | } |
| 15134 | else { |
| 15135 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 15136 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15137 | /* if channel switch is configured, reset |
| 15138 | the channel for this peer */ |
| 15139 | if (TRUE == pTdlsPeer->isOffChannelConfigured) |
| 15140 | { |
| 15141 | pTdlsPeer->peerParams.channel = 0; |
| 15142 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 15143 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15144 | } |
| 15145 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15146 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) { |
| 15147 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set force peer")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15148 | return -EINVAL; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15149 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15150 | |
| 15151 | /*EXT TDLS*/ |
| 15152 | |
| 15153 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) { |
| 15154 | |
| 15155 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15156 | " %s TDLS set callback Failed", |
| 15157 | __func__); |
| 15158 | return -EINVAL; |
| 15159 | } |
| 15160 | return(0); |
| 15161 | |
| 15162 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15163 | 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] | 15164 | u8 *peer, enum nl80211_tdls_operation oper) |
| 15165 | { |
| 15166 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15167 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15168 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15169 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15170 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15171 | ENTER(); |
| 15172 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 15173 | if (!pAdapter) { |
| 15174 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 15175 | return -EINVAL; |
| 15176 | } |
| 15177 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15178 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15179 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 15180 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15181 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15182 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15183 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 15184 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15185 | return -EINVAL; |
| 15186 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15187 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15188 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15189 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 15190 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15191 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 15192 | } |
| 15193 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15194 | |
| 15195 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15196 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15197 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15198 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15199 | "TDLS Disabled in INI (%d) OR not enabled in FW (%d) " |
| 15200 | "Cannot process TDLS commands", |
| 15201 | pHddCtx->cfg_ini->fEnableTDLSSupport, |
| 15202 | sme_IsFeatureSupportedByFW(TDLS)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15203 | return -ENOTSUPP; |
| 15204 | } |
| 15205 | |
| 15206 | switch (oper) { |
| 15207 | case NL80211_TDLS_ENABLE_LINK: |
| 15208 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15209 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15210 | long ret; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15211 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15212 | WLAN_STADescType staDesc; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15213 | tANI_U16 numCurrTdlsPeers = 0; |
| 15214 | hddTdlsPeer_t *connPeer = NULL; |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15215 | tANI_U8 suppChannelLen = 0; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15216 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15217 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15218 | memset(&staDesc, 0, sizeof(staDesc)); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15219 | if ( NULL == pTdlsPeer ) { |
| 15220 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 15221 | " (oper %d) not exsting. ignored", |
| 15222 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 15223 | return -EINVAL; |
| 15224 | } |
| 15225 | |
| 15226 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15227 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 15228 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 15229 | "NL80211_TDLS_ENABLE_LINK"); |
| 15230 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 15231 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 15232 | { |
| 15233 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 15234 | MAC_ADDRESS_STR " failed", |
| 15235 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 15236 | return -EINVAL; |
| 15237 | } |
| 15238 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 15239 | /* before starting tdls connection, set tdls |
| 15240 | * off channel established status to default value */ |
| 15241 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15242 | /* TDLS Off Channel, Disable tdls channel switch, |
| 15243 | when there are more than one tdls link */ |
| 15244 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 15245 | if (numCurrTdlsPeers == 2) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15246 | { |
| 15247 | /* get connected peer and send disable tdls off chan */ |
| 15248 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15249 | if ((connPeer) && |
| 15250 | (connPeer->isOffChannelSupported == TRUE) && |
| 15251 | (connPeer->isOffChannelConfigured == TRUE)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15252 | { |
| 15253 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15254 | "%s: More then one peer connected, Disable " |
| 15255 | "TDLS channel switch", __func__); |
| 15256 | |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15257 | connPeer->isOffChannelEstablished = FALSE; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15258 | ret = sme_SendTdlsChanSwitchReq( |
| 15259 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15260 | pAdapter->sessionId, |
| 15261 | connPeer->peerMac, |
| 15262 | connPeer->peerParams.channel, |
| 15263 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15264 | TDLS_CHANNEL_SWITCH_DISABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15265 | if (ret != VOS_STATUS_SUCCESS) { |
| 15266 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel request")); |
| 15267 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15268 | } |
| 15269 | else |
| 15270 | { |
| 15271 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15272 | "%s: No TDLS Connected Peer or " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15273 | "isOffChannelSupported %d " |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15274 | "isOffChannelConfigured %d", |
| 15275 | __func__, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15276 | (connPeer ? (connPeer->isOffChannelSupported) |
| 15277 | : -1), |
| 15278 | (connPeer ? (connPeer->isOffChannelConfigured) |
| 15279 | : -1)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15280 | } |
| 15281 | } |
| 15282 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15283 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15284 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15285 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 15286 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15287 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 15288 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15289 | 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] | 15290 | return -EINVAL; |
| 15291 | } |
| 15292 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15293 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15294 | ret = sme_SendTdlsLinkEstablishParams( |
| 15295 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15296 | pAdapter->sessionId, peer, |
| 15297 | &tdlsLinkEstablishParams); |
| 15298 | if (ret != VOS_STATUS_SUCCESS) { |
| 15299 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send link establishment params")); |
| 15300 | } |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15301 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 15302 | * register with the TL on after the response for this operation |
| 15303 | * is received . |
| 15304 | */ |
| 15305 | ret = wait_for_completion_interruptible_timeout( |
| 15306 | &pAdapter->tdls_link_establish_req_comp, |
| 15307 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 15308 | if (ret <= 0) |
| 15309 | { |
| 15310 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15311 | "%s: Link Establish Request Faled Status %ld", |
| 15312 | __func__, ret); |
| 15313 | return -EINVAL; |
| 15314 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15315 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15316 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 15317 | eTDLS_LINK_CONNECTED, |
| 15318 | eTDLS_LINK_SUCCESS); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15319 | staDesc.ucSTAId = pTdlsPeer->staId; |
| 15320 | staDesc.ucQosEnabled = tdlsLinkEstablishParams.qos; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15321 | ret = WLANTL_UpdateTdlsSTAClient( |
| 15322 | pHddCtx->pvosContext, |
| 15323 | &staDesc); |
| 15324 | if (ret != VOS_STATUS_SUCCESS) { |
| 15325 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to update TDLS STA params")); |
| 15326 | } |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15327 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 15328 | /* Mark TDLS client Authenticated .*/ |
| 15329 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 15330 | pTdlsPeer->staId, |
| 15331 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 15332 | if (VOS_STATUS_SUCCESS == status) |
| 15333 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15334 | if (pTdlsPeer->is_responder == 0) |
| 15335 | { |
| 15336 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 15337 | |
| 15338 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 15339 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 15340 | WAIT_TIME_TDLS_INITIATOR); |
| 15341 | /* suspend initiator TX until it receives direct packet from the |
| 15342 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15343 | ret = WLANTL_SuspendDataTx( |
| 15344 | (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 15345 | &staId, NULL); |
| 15346 | if (ret != VOS_STATUS_SUCCESS) { |
| 15347 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to suspend data tx")); |
| 15348 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15349 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15350 | |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15351 | if ((TRUE == pTdlsPeer->isOffChannelSupported) && |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15352 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15353 | { |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15354 | suppChannelLen = |
| 15355 | tdlsLinkEstablishParams.supportedChannelsLen; |
| 15356 | |
| 15357 | if ((suppChannelLen > 0) && |
| 15358 | (suppChannelLen <= SIR_MAC_MAX_SUPP_CHANNELS)) |
| 15359 | { |
| 15360 | tANI_U8 suppPeerChannel = 0; |
| 15361 | int i = 0; |
| 15362 | for (i = 0U; i < suppChannelLen; i++) |
| 15363 | { |
| 15364 | suppPeerChannel = |
| 15365 | tdlsLinkEstablishParams.supportedChannels[i]; |
| 15366 | |
| 15367 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 15368 | if (suppPeerChannel == |
| 15369 | pTdlsPeer->peerParams.channel) |
| 15370 | { |
| 15371 | pTdlsPeer->isOffChannelSupported = TRUE; |
| 15372 | break; |
| 15373 | } |
| 15374 | } |
| 15375 | } |
| 15376 | else |
| 15377 | { |
| 15378 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 15379 | } |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15380 | } |
| 15381 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15382 | "%s: TDLS channel switch request for channel " |
| 15383 | "%d isOffChannelConfigured %d suppChannelLen " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15384 | "%d isOffChannelSupported %d", __func__, |
| 15385 | pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15386 | pTdlsPeer->isOffChannelConfigured, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15387 | suppChannelLen, |
| 15388 | pTdlsPeer->isOffChannelSupported); |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15389 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15390 | /* TDLS Off Channel, Enable tdls channel switch, |
| 15391 | when their is only one tdls link and it supports */ |
| 15392 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15393 | if ((numCurrTdlsPeers == 1) && |
| 15394 | (TRUE == pTdlsPeer->isOffChannelSupported) && |
| 15395 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
| 15396 | { |
| 15397 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15398 | "%s: Send TDLS channel switch request for channel %d", |
| 15399 | __func__, pTdlsPeer->peerParams.channel); |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15400 | |
| 15401 | pTdlsPeer->isOffChannelEstablished = TRUE; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15402 | ret = sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15403 | pAdapter->sessionId, |
| 15404 | pTdlsPeer->peerMac, |
| 15405 | pTdlsPeer->peerParams.channel, |
| 15406 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15407 | TDLS_CHANNEL_SWITCH_ENABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15408 | if (ret != VOS_STATUS_SUCCESS) { |
| 15409 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS offchannel: Failed to send TDLS switch channel req")); |
| 15410 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15411 | } |
| 15412 | else |
| 15413 | { |
| 15414 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15415 | "%s: TDLS channel switch request not sent" |
| 15416 | " numCurrTdlsPeers %d " |
| 15417 | "isOffChannelSupported %d " |
| 15418 | "isOffChannelConfigured %d", |
| 15419 | __func__, numCurrTdlsPeers, |
| 15420 | pTdlsPeer->isOffChannelSupported, |
| 15421 | pTdlsPeer->isOffChannelConfigured); |
| 15422 | } |
| 15423 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 15424 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15425 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15426 | |
| 15427 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15428 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 15429 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15430 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15431 | int ac; |
| 15432 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 15433 | WLANTL_AC_VI, |
| 15434 | WLANTL_AC_BK, |
| 15435 | WLANTL_AC_BE }; |
| 15436 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 15437 | for(ac=0; ac < 4; ac++) |
| 15438 | { |
| 15439 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 15440 | pTdlsPeer->staId, ucAc[ac], |
| 15441 | tlTid[ac], tlTid[ac], 0, 0, |
| 15442 | WLANTL_BI_DIR ); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15443 | if (status != VOS_STATUS_SUCCESS) { |
| 15444 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to enable UAPSD for AC")); |
| 15445 | } |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15446 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15447 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15448 | } |
| 15449 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15450 | } |
| 15451 | break; |
| 15452 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15453 | { |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15454 | tANI_U16 numCurrTdlsPeers = 0; |
| 15455 | hddTdlsPeer_t *connPeer = NULL; |
| 15456 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15457 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 15458 | |
| 15459 | if ( NULL == pTdlsPeer ) { |
| 15460 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 15461 | " (oper %d) not exsting. ignored", |
| 15462 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 15463 | return -EINVAL; |
| 15464 | } |
| 15465 | |
| 15466 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15467 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 15468 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 15469 | "NL80211_TDLS_DISABLE_LINK"); |
| 15470 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15471 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15472 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15473 | long status; |
| 15474 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 15475 | /* set tdls off channel status to false for this peer */ |
| 15476 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 15477 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 15478 | eTDLS_LINK_TEARING, |
| 15479 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 15480 | eTDLS_LINK_UNSPECIFIED: |
| 15481 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15482 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 15483 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15484 | status = sme_DeleteTdlsPeerSta( |
| 15485 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15486 | pAdapter->sessionId, peer ); |
| 15487 | if (status != VOS_STATUS_SUCCESS) { |
| 15488 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 15489 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15490 | |
| 15491 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 15492 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 15493 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
Atul Mittal | 454664b | 2014-10-10 11:03:46 +0530 | [diff] [blame] | 15494 | eTDLS_LINK_IDLE, |
| 15495 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15496 | if (status <= 0) |
| 15497 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15498 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15499 | "%s: Del station failed status %ld", |
| 15500 | __func__, status); |
| 15501 | return -EPERM; |
| 15502 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15503 | |
| 15504 | /* TDLS Off Channel, Enable tdls channel switch, |
| 15505 | when their is only one tdls link and it supports */ |
| 15506 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15507 | if (numCurrTdlsPeers == 1) |
| 15508 | { |
| 15509 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
| 15510 | if ((connPeer) && |
| 15511 | (connPeer->isOffChannelSupported == TRUE) && |
| 15512 | (connPeer->isOffChannelConfigured == TRUE)) |
| 15513 | { |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15514 | connPeer->isOffChannelEstablished = TRUE; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15515 | status = sme_SendTdlsChanSwitchReq( |
| 15516 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15517 | pAdapter->sessionId, |
| 15518 | connPeer->peerMac, |
| 15519 | connPeer->peerParams.channel, |
| 15520 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15521 | TDLS_CHANNEL_SWITCH_ENABLE); |
| 15522 | if (status != VOS_STATUS_SUCCESS) { |
| 15523 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel req")); |
| 15524 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15525 | } |
| 15526 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15527 | "%s: TDLS channel switch " |
| 15528 | "isOffChannelSupported %d " |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15529 | "isOffChannelConfigured %d " |
| 15530 | "isOffChannelEstablished %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15531 | __func__, |
| 15532 | (connPeer ? connPeer->isOffChannelSupported : -1), |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15533 | (connPeer ? connPeer->isOffChannelConfigured : -1), |
| 15534 | (connPeer ? connPeer->isOffChannelEstablished : -1)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15535 | } |
| 15536 | else |
| 15537 | { |
| 15538 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15539 | "%s: TDLS channel switch request not sent " |
| 15540 | "numCurrTdlsPeers %d ", |
| 15541 | __func__, numCurrTdlsPeers); |
| 15542 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15543 | } |
| 15544 | else |
| 15545 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15546 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15547 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15548 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15549 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15550 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15551 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15552 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15553 | status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15554 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15555 | if (0 != status) |
| 15556 | { |
| 15557 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15558 | "%s: Error in TDLS Teardown", __func__); |
| 15559 | return status; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15560 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15561 | break; |
| 15562 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15563 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15564 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15565 | status = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 15566 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15567 | NULL, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15568 | NULL); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15569 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15570 | if (0 != status) |
| 15571 | { |
| 15572 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15573 | "%s: Error in TDLS Setup", __func__); |
| 15574 | return status; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 15575 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 15576 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15577 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15578 | case NL80211_TDLS_DISCOVERY_REQ: |
| 15579 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15580 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 15581 | "%s: We don't support in-driver setup/teardown/discovery " |
| 15582 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15583 | return -ENOTSUPP; |
| 15584 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15585 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15586 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15587 | return -ENOTSUPP; |
| 15588 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15589 | |
| 15590 | EXIT(); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15591 | return 0; |
| 15592 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15593 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15594 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
| 15595 | u8 *peer, enum nl80211_tdls_operation oper) |
| 15596 | { |
| 15597 | int ret; |
| 15598 | |
| 15599 | vos_ssr_protect(__func__); |
| 15600 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 15601 | vos_ssr_unprotect(__func__); |
| 15602 | |
| 15603 | return ret; |
| 15604 | } |
| 15605 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15606 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 15607 | struct net_device *dev, u8 *peer) |
| 15608 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 15609 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 15610 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 15611 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15612 | |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15613 | #if TDLS_MGMT_VERSION2 |
| 15614 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 15615 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 15616 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15617 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 15618 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15619 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15620 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15621 | #endif |
| 15622 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15623 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 15624 | /* |
| 15625 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 15626 | * Callback rountine called upon receiving response for |
| 15627 | * get offload info |
| 15628 | */ |
| 15629 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 15630 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 15631 | { |
| 15632 | |
| 15633 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15634 | tANI_U8 tempReplayCounter[8]; |
| 15635 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15636 | |
| 15637 | ENTER(); |
| 15638 | |
| 15639 | if (NULL == pAdapter) |
| 15640 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 15641 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15642 | "%s: HDD adapter is Null", __func__); |
| 15643 | return ; |
| 15644 | } |
| 15645 | |
| 15646 | if (NULL == pGtkOffloadGetInfoRsp) |
| 15647 | { |
| 15648 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15649 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 15650 | return ; |
| 15651 | } |
| 15652 | |
| 15653 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 15654 | { |
| 15655 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15656 | "%s: wlan Failed to get replay counter value", |
| 15657 | __func__); |
| 15658 | return ; |
| 15659 | } |
| 15660 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15661 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15662 | /* Update replay counter */ |
| 15663 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 15664 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 15665 | |
| 15666 | { |
| 15667 | /* changing from little to big endian since supplicant |
| 15668 | * works on big endian format |
| 15669 | */ |
| 15670 | int i; |
| 15671 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 15672 | |
| 15673 | for (i = 0; i < 8; i++) |
| 15674 | { |
| 15675 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 15676 | } |
| 15677 | } |
| 15678 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15679 | /* Update replay counter to NL */ |
| 15680 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15681 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15682 | } |
| 15683 | |
| 15684 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15685 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15686 | * This function is used to offload GTK rekeying job to the firmware. |
| 15687 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15688 | 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] | 15689 | struct cfg80211_gtk_rekey_data *data) |
| 15690 | { |
| 15691 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15692 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 15693 | hdd_station_ctx_t *pHddStaCtx; |
| 15694 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15695 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15696 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15697 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 15698 | |
| 15699 | ENTER(); |
| 15700 | |
| 15701 | if (NULL == pAdapter) |
| 15702 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15703 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15704 | "%s: HDD adapter is Null", __func__); |
| 15705 | return -ENODEV; |
| 15706 | } |
| 15707 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15708 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15709 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 15710 | pAdapter->sessionId, pAdapter->device_mode)); |
| 15711 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15712 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15713 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15714 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15715 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15716 | } |
| 15717 | |
| 15718 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15719 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 15720 | if (NULL == hHal) |
| 15721 | { |
| 15722 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15723 | "%s: HAL context is Null!!!", __func__); |
| 15724 | return -EAGAIN; |
| 15725 | } |
| 15726 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15727 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 15728 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 15729 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 15730 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15731 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15732 | { |
| 15733 | /* changing from big to little endian since driver |
| 15734 | * works on little endian format |
| 15735 | */ |
| 15736 | tANI_U8 *p = |
| 15737 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 15738 | int i; |
| 15739 | |
| 15740 | for (i = 0; i < 8; i++) |
| 15741 | { |
| 15742 | p[7-i] = data->replay_ctr[i]; |
| 15743 | } |
| 15744 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15745 | |
| 15746 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 15747 | { |
| 15748 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15749 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 15750 | sizeof (tSirGtkOffloadParams)); |
| 15751 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15752 | pAdapter->sessionId); |
| 15753 | |
| 15754 | if (eHAL_STATUS_SUCCESS != status) |
| 15755 | { |
| 15756 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15757 | "%s: sme_SetGTKOffload failed, returned %d", |
| 15758 | __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 15759 | |
| 15760 | /* Need to clear any trace of key value in the memory. |
| 15761 | * Thus zero out the memory even though it is local |
| 15762 | * variable. |
| 15763 | */ |
| 15764 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 15765 | sizeof(hddGtkOffloadReqParams)); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15766 | return status; |
| 15767 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15768 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15769 | "%s: sme_SetGTKOffload successfull", __func__); |
| 15770 | } |
| 15771 | else |
| 15772 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15773 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15774 | "%s: wlan not suspended GTKOffload request is stored", |
| 15775 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15776 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15777 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 15778 | /* Need to clear any trace of key value in the memory. |
| 15779 | * Thus zero out the memory even though it is local |
| 15780 | * variable. |
| 15781 | */ |
| 15782 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 15783 | sizeof(hddGtkOffloadReqParams)); |
| 15784 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15785 | EXIT(); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15786 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15787 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15788 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15789 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 15790 | struct cfg80211_gtk_rekey_data *data) |
| 15791 | { |
| 15792 | int ret; |
| 15793 | |
| 15794 | vos_ssr_protect(__func__); |
| 15795 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 15796 | vos_ssr_unprotect(__func__); |
| 15797 | |
| 15798 | return ret; |
| 15799 | } |
| 15800 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15801 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15802 | * FUNCTION: __wlan_hdd_cfg80211_set_mac_acl |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15803 | * This function is used to set access control policy |
| 15804 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15805 | static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 15806 | struct net_device *dev, |
| 15807 | const struct cfg80211_acl_data *params) |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15808 | { |
| 15809 | int i; |
| 15810 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15811 | hdd_hostapd_state_t *pHostapdState; |
| 15812 | tsap_Config_t *pConfig; |
| 15813 | v_CONTEXT_t pVosContext = NULL; |
| 15814 | hdd_context_t *pHddCtx; |
| 15815 | int status; |
| 15816 | |
| 15817 | ENTER(); |
| 15818 | |
| 15819 | if (NULL == pAdapter) |
| 15820 | { |
| 15821 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15822 | "%s: HDD adapter is Null", __func__); |
| 15823 | return -ENODEV; |
| 15824 | } |
| 15825 | |
| 15826 | if (NULL == params) |
| 15827 | { |
| 15828 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15829 | "%s: params is Null", __func__); |
| 15830 | return -EINVAL; |
| 15831 | } |
| 15832 | |
| 15833 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15834 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15835 | if (0 != status) |
| 15836 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15837 | return status; |
| 15838 | } |
| 15839 | |
| 15840 | pVosContext = pHddCtx->pvosContext; |
| 15841 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 15842 | |
| 15843 | if (NULL == pHostapdState) |
| 15844 | { |
| 15845 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15846 | "%s: pHostapdState is Null", __func__); |
| 15847 | return -EINVAL; |
| 15848 | } |
| 15849 | |
| 15850 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 15851 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
| 15852 | |
| 15853 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 15854 | { |
| 15855 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 15856 | |
| 15857 | /* default value */ |
| 15858 | pConfig->num_accept_mac = 0; |
| 15859 | pConfig->num_deny_mac = 0; |
| 15860 | |
| 15861 | /** |
| 15862 | * access control policy |
| 15863 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 15864 | * listed in hostapd.deny file. |
| 15865 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 15866 | * listed in hostapd.accept file. |
| 15867 | */ |
| 15868 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 15869 | { |
| 15870 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 15871 | } |
| 15872 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 15873 | { |
| 15874 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 15875 | } |
| 15876 | else |
| 15877 | { |
| 15878 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15879 | "%s:Acl Policy : %d is not supported", |
| 15880 | __func__, params->acl_policy); |
| 15881 | return -ENOTSUPP; |
| 15882 | } |
| 15883 | |
| 15884 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 15885 | { |
| 15886 | pConfig->num_accept_mac = params->n_acl_entries; |
| 15887 | for (i = 0; i < params->n_acl_entries; i++) |
| 15888 | { |
| 15889 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15890 | "** Add ACL MAC entry %i in WhiletList :" |
| 15891 | MAC_ADDRESS_STR, i, |
| 15892 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 15893 | |
| 15894 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 15895 | sizeof(qcmacaddr)); |
| 15896 | } |
| 15897 | } |
| 15898 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 15899 | { |
| 15900 | pConfig->num_deny_mac = params->n_acl_entries; |
| 15901 | for (i = 0; i < params->n_acl_entries; i++) |
| 15902 | { |
| 15903 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15904 | "** Add ACL MAC entry %i in BlackList :" |
| 15905 | MAC_ADDRESS_STR, i, |
| 15906 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 15907 | |
| 15908 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 15909 | sizeof(qcmacaddr)); |
| 15910 | } |
| 15911 | } |
| 15912 | |
| 15913 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 15914 | { |
| 15915 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15916 | "%s: SAP Set Mac Acl fail", __func__); |
| 15917 | return -EINVAL; |
| 15918 | } |
| 15919 | } |
| 15920 | else |
| 15921 | { |
| 15922 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15923 | "%s: Invalid device_mode = %s (%d)", |
| 15924 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 15925 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15926 | return -EINVAL; |
| 15927 | } |
| 15928 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15929 | EXIT(); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15930 | return 0; |
| 15931 | } |
| 15932 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15933 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 15934 | struct net_device *dev, |
| 15935 | const struct cfg80211_acl_data *params) |
| 15936 | { |
| 15937 | int ret; |
| 15938 | vos_ssr_protect(__func__); |
| 15939 | ret = __wlan_hdd_cfg80211_set_mac_acl(wiphy, dev, params); |
| 15940 | vos_ssr_unprotect(__func__); |
| 15941 | |
| 15942 | return ret; |
| 15943 | } |
| 15944 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15945 | #ifdef WLAN_NL80211_TESTMODE |
| 15946 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15947 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15948 | ( |
| 15949 | void *pAdapter, |
| 15950 | void *indCont |
| 15951 | ) |
| 15952 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15953 | tSirLPHBInd *lphbInd; |
| 15954 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15955 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15956 | |
| 15957 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15958 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15959 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15960 | if (pAdapter == NULL) |
| 15961 | { |
| 15962 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15963 | "%s: pAdapter is NULL\n",__func__); |
| 15964 | return; |
| 15965 | } |
| 15966 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15967 | if (NULL == indCont) |
| 15968 | { |
| 15969 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15970 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15971 | return; |
| 15972 | } |
| 15973 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15974 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15975 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15976 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15977 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15978 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15979 | GFP_ATOMIC); |
| 15980 | if (!skb) |
| 15981 | { |
| 15982 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15983 | "LPHB timeout, NL buffer alloc fail"); |
| 15984 | return; |
| 15985 | } |
| 15986 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15987 | 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] | 15988 | { |
| 15989 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15990 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 15991 | goto nla_put_failure; |
| 15992 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15993 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15994 | { |
| 15995 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15996 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 15997 | goto nla_put_failure; |
| 15998 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15999 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16000 | sizeof(tSirLPHBInd), lphbInd)) |
| 16001 | { |
| 16002 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16003 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 16004 | goto nla_put_failure; |
| 16005 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16006 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 16007 | return; |
| 16008 | |
| 16009 | nla_put_failure: |
| 16010 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16011 | "NLA Put fail"); |
| 16012 | kfree_skb(skb); |
| 16013 | |
| 16014 | return; |
| 16015 | } |
| 16016 | #endif /* FEATURE_WLAN_LPHB */ |
| 16017 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16018 | 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] | 16019 | { |
| 16020 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 16021 | int err = 0; |
| 16022 | #ifdef FEATURE_WLAN_LPHB |
| 16023 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16024 | eHalStatus smeStatus; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16025 | |
| 16026 | ENTER(); |
| 16027 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16028 | err = wlan_hdd_validate_context(pHddCtx); |
| 16029 | if (0 != err) |
| 16030 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16031 | return err; |
| 16032 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16033 | #endif /* FEATURE_WLAN_LPHB */ |
| 16034 | |
| 16035 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 16036 | if (err) |
| 16037 | { |
| 16038 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16039 | "%s Testmode INV ATTR", __func__); |
| 16040 | return err; |
| 16041 | } |
| 16042 | |
| 16043 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 16044 | { |
| 16045 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16046 | "%s Testmode INV CMD", __func__); |
| 16047 | return -EINVAL; |
| 16048 | } |
| 16049 | |
| 16050 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 16051 | { |
| 16052 | #ifdef FEATURE_WLAN_LPHB |
| 16053 | /* Low Power Heartbeat configuration request */ |
| 16054 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 16055 | { |
| 16056 | int buf_len; |
| 16057 | void *buf; |
| 16058 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 16059 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16060 | |
| 16061 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 16062 | { |
| 16063 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16064 | "%s Testmode INV DATA", __func__); |
| 16065 | return -EINVAL; |
| 16066 | } |
| 16067 | |
| 16068 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 16069 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 16070 | |
| 16071 | hb_params_temp =(tSirLPHBReq *)buf; |
| 16072 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 16073 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 16074 | return -EINVAL; |
| 16075 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16076 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 16077 | if (NULL == hb_params) |
| 16078 | { |
| 16079 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16080 | "%s Request Buffer Alloc Fail", __func__); |
| 16081 | return -EINVAL; |
| 16082 | } |
| 16083 | |
| 16084 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16085 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 16086 | hb_params, |
| 16087 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 16088 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16089 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16090 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16091 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16092 | vos_mem_free(hb_params); |
| 16093 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16094 | return 0; |
| 16095 | } |
| 16096 | #endif /* FEATURE_WLAN_LPHB */ |
| 16097 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 16098 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16099 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16100 | return -EOPNOTSUPP; |
| 16101 | } |
| 16102 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16103 | EXIT(); |
| 16104 | return err; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16105 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16106 | |
| 16107 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) |
| 16108 | { |
| 16109 | int ret; |
| 16110 | |
| 16111 | vos_ssr_protect(__func__); |
| 16112 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 16113 | vos_ssr_unprotect(__func__); |
| 16114 | |
| 16115 | return ret; |
| 16116 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16117 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 16118 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16119 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16120 | struct net_device *dev, |
| 16121 | int idx, struct survey_info *survey) |
| 16122 | { |
| 16123 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16124 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16125 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16126 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16127 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16128 | v_S7_t snr,rssi; |
| 16129 | int status, i, j, filled = 0; |
| 16130 | |
| 16131 | ENTER(); |
| 16132 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16133 | if (NULL == pAdapter) |
| 16134 | { |
| 16135 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 16136 | "%s: HDD adapter is Null", __func__); |
| 16137 | return -ENODEV; |
| 16138 | } |
| 16139 | |
| 16140 | if (NULL == wiphy) |
| 16141 | { |
| 16142 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 16143 | "%s: wiphy is Null", __func__); |
| 16144 | return -ENODEV; |
| 16145 | } |
| 16146 | |
| 16147 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16148 | status = wlan_hdd_validate_context(pHddCtx); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16149 | if (0 != status) |
| 16150 | { |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16151 | return status; |
| 16152 | } |
| 16153 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16154 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 16155 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16156 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16157 | 0 != pAdapter->survey_idx || |
| 16158 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16159 | { |
| 16160 | /* The survey dump ops when implemented completely is expected to |
| 16161 | * return a survey of all channels and the ops is called by the |
| 16162 | * kernel with incremental values of the argument 'idx' till it |
| 16163 | * returns -ENONET. But we can only support the survey for the |
| 16164 | * operating channel for now. survey_idx is used to track |
| 16165 | * that the ops is called only once and then return -ENONET for |
| 16166 | * the next iteration |
| 16167 | */ |
| 16168 | pAdapter->survey_idx = 0; |
| 16169 | return -ENONET; |
| 16170 | } |
| 16171 | |
| 16172 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16173 | |
| 16174 | wlan_hdd_get_snr(pAdapter, &snr); |
| 16175 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 16176 | |
| 16177 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 16178 | hdd_wlan_get_freq(channel, &freq); |
| 16179 | |
| 16180 | |
| 16181 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 16182 | { |
| 16183 | if (NULL == wiphy->bands[i]) |
| 16184 | { |
| 16185 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 16186 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 16187 | continue; |
| 16188 | } |
| 16189 | |
| 16190 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 16191 | { |
| 16192 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 16193 | |
| 16194 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 16195 | { |
| 16196 | survey->channel = &band->channels[j]; |
| 16197 | /* The Rx BDs contain SNR values in dB for the received frames |
| 16198 | * while the supplicant expects noise. So we calculate and |
| 16199 | * return the value of noise (dBm) |
| 16200 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 16201 | */ |
| 16202 | survey->noise = rssi - snr; |
| 16203 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 16204 | filled = 1; |
| 16205 | } |
| 16206 | } |
| 16207 | } |
| 16208 | |
| 16209 | if (filled) |
| 16210 | pAdapter->survey_idx = 1; |
| 16211 | else |
| 16212 | { |
| 16213 | pAdapter->survey_idx = 0; |
| 16214 | return -ENONET; |
| 16215 | } |
| 16216 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16217 | EXIT(); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16218 | return 0; |
| 16219 | } |
| 16220 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16221 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 16222 | struct net_device *dev, |
| 16223 | int idx, struct survey_info *survey) |
| 16224 | { |
| 16225 | int ret; |
| 16226 | |
| 16227 | vos_ssr_protect(__func__); |
| 16228 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 16229 | vos_ssr_unprotect(__func__); |
| 16230 | |
| 16231 | return ret; |
| 16232 | } |
| 16233 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16234 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16235 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16236 | * this is called when cfg80211 driver resume |
| 16237 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 16238 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16239 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16240 | { |
| 16241 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 16242 | hdd_adapter_t *pAdapter; |
| 16243 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 16244 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 16245 | |
| 16246 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16247 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16248 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16249 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16250 | return 0; |
| 16251 | } |
| 16252 | |
| 16253 | spin_lock(&pHddCtx->schedScan_lock); |
| 16254 | pHddCtx->isWiphySuspended = FALSE; |
| 16255 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 16256 | { |
| 16257 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16258 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16259 | "%s: Return resume is not due to PNO indication", __func__); |
| 16260 | return 0; |
| 16261 | } |
| 16262 | // Reset flag to avoid updatating cfg80211 data old results again |
| 16263 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 16264 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16265 | |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16266 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16267 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 16268 | |
| 16269 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 16270 | { |
| 16271 | pAdapter = pAdapterNode->pAdapter; |
| 16272 | if ( (NULL != pAdapter) && |
| 16273 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 16274 | { |
| 16275 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16276 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16277 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 16278 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16279 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16280 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16281 | { |
| 16282 | /* Acquire wakelock to handle the case where APP's tries to |
| 16283 | * suspend immediately after updating the scan results. Whis |
| 16284 | * results in app's is in suspended state and not able to |
| 16285 | * process the connect request to AP |
| 16286 | */ |
| 16287 | hdd_prevent_suspend_timeout(2000); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16288 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16289 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16290 | |
| 16291 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16292 | "%s : cfg80211 scan result database updated", __func__); |
| 16293 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16294 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16295 | return 0; |
| 16296 | |
| 16297 | } |
| 16298 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 16299 | pAdapterNode = pNext; |
| 16300 | } |
| 16301 | |
| 16302 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16303 | "%s: Failed to find Adapter", __func__); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16304 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16305 | return 0; |
| 16306 | } |
| 16307 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16308 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 16309 | { |
| 16310 | int ret; |
| 16311 | |
| 16312 | vos_ssr_protect(__func__); |
| 16313 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 16314 | vos_ssr_unprotect(__func__); |
| 16315 | |
| 16316 | return ret; |
| 16317 | } |
| 16318 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16319 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16320 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16321 | * this is called when cfg80211 driver suspends |
| 16322 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16323 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16324 | struct cfg80211_wowlan *wow) |
| 16325 | { |
| 16326 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16327 | int ret = 0; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16328 | |
| 16329 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16330 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16331 | ret = wlan_hdd_validate_context(pHddCtx); |
| 16332 | if (0 != ret) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16333 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16334 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16335 | } |
| 16336 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16337 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16338 | pHddCtx->isWiphySuspended = TRUE; |
| 16339 | |
| 16340 | EXIT(); |
| 16341 | |
| 16342 | return 0; |
| 16343 | } |
| 16344 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16345 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 16346 | struct cfg80211_wowlan *wow) |
| 16347 | { |
| 16348 | int ret; |
| 16349 | |
| 16350 | vos_ssr_protect(__func__); |
| 16351 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 16352 | vos_ssr_unprotect(__func__); |
| 16353 | |
| 16354 | return ret; |
| 16355 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16356 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16357 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16358 | { |
| 16359 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 16360 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 16361 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 16362 | .change_station = wlan_hdd_change_station, |
| 16363 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 16364 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 16365 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 16366 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16367 | #else |
| 16368 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 16369 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 16370 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16371 | #endif |
| 16372 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 16373 | .add_key = wlan_hdd_cfg80211_add_key, |
| 16374 | .get_key = wlan_hdd_cfg80211_get_key, |
| 16375 | .del_key = wlan_hdd_cfg80211_del_key, |
| 16376 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 16377 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16378 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 16379 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16380 | .scan = wlan_hdd_cfg80211_scan, |
| 16381 | .connect = wlan_hdd_cfg80211_connect, |
| 16382 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 16383 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 16384 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 16385 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 16386 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 16387 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16388 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 16389 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 16390 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16391 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 16392 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 16393 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 16394 | .set_txq_params = wlan_hdd_set_txq_params, |
| 16395 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16396 | .get_station = wlan_hdd_cfg80211_get_station, |
| 16397 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 16398 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16399 | .add_station = wlan_hdd_cfg80211_add_station, |
| 16400 | #ifdef FEATURE_WLAN_LFR |
| 16401 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 16402 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 16403 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 16404 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16405 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 16406 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 16407 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16408 | #ifdef FEATURE_WLAN_TDLS |
| 16409 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 16410 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 16411 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16412 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 16413 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 16414 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16415 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 16416 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 16417 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 16418 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16419 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 16420 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16421 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16422 | #ifdef WLAN_NL80211_TESTMODE |
| 16423 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 16424 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16425 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16426 | }; |
| 16427 | |