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 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1918 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1919 | &linkLayerStatsSetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1920 | { |
| 1921 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1922 | "sme_LLStatsSetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1923 | return -EINVAL; |
| 1924 | } |
| 1925 | |
| 1926 | pAdapter->isLinkLayerStatsSet = 1; |
| 1927 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1928 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1929 | return 0; |
| 1930 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1931 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1932 | struct wireless_dev *wdev, |
| 1933 | const void *data, |
| 1934 | int data_len) |
| 1935 | { |
| 1936 | int ret = 0; |
| 1937 | |
| 1938 | vos_ssr_protect(__func__); |
| 1939 | ret = __wlan_hdd_cfg80211_ll_stats_set(wiphy, wdev, data, data_len); |
| 1940 | vos_ssr_unprotect(__func__); |
| 1941 | |
| 1942 | return ret; |
| 1943 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1944 | |
| 1945 | const struct |
| 1946 | nla_policy |
| 1947 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 1948 | { |
| 1949 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 1950 | * command. When reporting |
| 1951 | * the stats results, the driver uses the same value to indicate |
| 1952 | * which GET request the results |
| 1953 | * correspond to. |
| 1954 | */ |
| 1955 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 1956 | |
| 1957 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 1958 | requested for retrieval */ |
| 1959 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 1960 | }; |
| 1961 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1962 | static int __wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1963 | struct wireless_dev *wdev, |
| 1964 | const void *data, |
| 1965 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1966 | { |
| 1967 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1968 | 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] | 1969 | tSirLLStatsGetReq linkLayerStatsGetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1970 | struct net_device *dev = wdev->netdev; |
| 1971 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1972 | int status; |
| 1973 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1974 | ENTER(); |
| 1975 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1976 | status = wlan_hdd_validate_context(pHddCtx); |
| 1977 | if (0 != status) |
| 1978 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1979 | return -EINVAL ; |
| 1980 | } |
| 1981 | |
| 1982 | if (NULL == pAdapter) |
| 1983 | { |
| 1984 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1985 | "%s: HDD adapter is Null", __func__); |
| 1986 | return -ENODEV; |
| 1987 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1988 | /* check the LLStats Capability */ |
| 1989 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1990 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1991 | { |
| 1992 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1993 | FL("Link Layer Statistics not supported by Firmware")); |
| 1994 | return -EINVAL; |
| 1995 | } |
| 1996 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1997 | |
| 1998 | if (!pAdapter->isLinkLayerStatsSet) |
| 1999 | { |
| 2000 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2001 | "%s: isLinkLayerStatsSet : %d", |
| 2002 | __func__, pAdapter->isLinkLayerStatsSet); |
| 2003 | return -EINVAL; |
| 2004 | } |
| 2005 | |
| 2006 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 2007 | (struct nlattr *)data, |
| 2008 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 2009 | { |
| 2010 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 2011 | return -EINVAL; |
| 2012 | } |
| 2013 | |
| 2014 | if (!tb_vendor |
| 2015 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 2016 | { |
| 2017 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 2018 | return -EINVAL; |
| 2019 | } |
| 2020 | |
| 2021 | if (!tb_vendor |
| 2022 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 2023 | { |
| 2024 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 2025 | return -EINVAL; |
| 2026 | } |
| 2027 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2028 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2029 | linkLayerStatsGetReq.reqId = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2030 | nla_get_u32( tb_vendor[ |
| 2031 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2032 | linkLayerStatsGetReq.paramIdMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2033 | nla_get_u32( tb_vendor[ |
| 2034 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 2035 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2036 | vos_mem_copy(linkLayerStatsGetReq.macAddr, |
| 2037 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2038 | |
| 2039 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2040 | "LL_STATS_GET reqId = %d", linkLayerStatsGetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2041 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2042 | "LL_STATS_GET MAC = %pM", linkLayerStatsGetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2043 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2044 | "LL_STATS_GET paramIdMask = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2045 | linkLayerStatsGetReq.paramIdMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2046 | |
| 2047 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2048 | &linkLayerStatsGetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2049 | { |
| 2050 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2051 | "sme_LLStatsGetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2052 | return -EINVAL; |
| 2053 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2054 | |
| 2055 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2056 | return 0; |
| 2057 | } |
| 2058 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2059 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 2060 | struct wireless_dev *wdev, |
| 2061 | const void *data, |
| 2062 | int data_len) |
| 2063 | { |
| 2064 | int ret = 0; |
| 2065 | |
| 2066 | vos_ssr_protect(__func__); |
| 2067 | ret = __wlan_hdd_cfg80211_ll_stats_get(wiphy, wdev, data, data_len); |
| 2068 | vos_ssr_unprotect(__func__); |
| 2069 | |
| 2070 | return ret; |
| 2071 | } |
| 2072 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2073 | const struct |
| 2074 | nla_policy |
| 2075 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 2076 | { |
| 2077 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 2078 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 2079 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 2080 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 2081 | }; |
| 2082 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2083 | static int __wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 2084 | struct wireless_dev *wdev, |
| 2085 | const void *data, |
| 2086 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2087 | { |
| 2088 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 2089 | 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] | 2090 | tSirLLStatsClearReq linkLayerStatsClearReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2091 | struct net_device *dev = wdev->netdev; |
| 2092 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2093 | u32 statsClearReqMask; |
| 2094 | u8 stopReq; |
| 2095 | int status; |
| 2096 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2097 | ENTER(); |
| 2098 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2099 | status = wlan_hdd_validate_context(pHddCtx); |
| 2100 | if (0 != status) |
| 2101 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2102 | return -EINVAL; |
| 2103 | } |
| 2104 | |
| 2105 | if (NULL == pAdapter) |
| 2106 | { |
| 2107 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2108 | "%s: HDD adapter is Null", __func__); |
| 2109 | return -ENODEV; |
| 2110 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2111 | /* check the LLStats Capability */ |
| 2112 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 2113 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 2114 | { |
| 2115 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2116 | FL("Enable LLStats Capability")); |
| 2117 | return -EINVAL; |
| 2118 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2119 | |
| 2120 | if (!pAdapter->isLinkLayerStatsSet) |
| 2121 | { |
| 2122 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2123 | "%s: isLinkLayerStatsSet : %d", |
| 2124 | __func__, pAdapter->isLinkLayerStatsSet); |
| 2125 | return -EINVAL; |
| 2126 | } |
| 2127 | |
| 2128 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 2129 | (struct nlattr *)data, |
| 2130 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 2131 | { |
| 2132 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 2133 | return -EINVAL; |
| 2134 | } |
| 2135 | |
| 2136 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 2137 | |
| 2138 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 2139 | { |
| 2140 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 2141 | return -EINVAL; |
| 2142 | |
| 2143 | } |
| 2144 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2145 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2146 | statsClearReqMask = linkLayerStatsClearReq.statsClearReqMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2147 | nla_get_u32( |
| 2148 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 2149 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2150 | stopReq = linkLayerStatsClearReq.stopReq = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2151 | nla_get_u8( |
| 2152 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 2153 | |
| 2154 | // 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] | 2155 | linkLayerStatsClearReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2156 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2157 | vos_mem_copy(linkLayerStatsClearReq.macAddr, |
| 2158 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2159 | |
| 2160 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2161 | "LL_STATS_CLEAR reqId = %d", linkLayerStatsClearReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2162 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2163 | "LL_STATS_CLEAR MAC = %pM", linkLayerStatsClearReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2164 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2165 | "LL_STATS_CLEAR statsClearReqMask = 0x%X", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2166 | linkLayerStatsClearReq.statsClearReqMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2167 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2168 | "LL_STATS_CLEAR stopReq = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2169 | linkLayerStatsClearReq.stopReq); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2170 | |
| 2171 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2172 | &linkLayerStatsClearReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2173 | { |
| 2174 | struct sk_buff *temp_skbuff; |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 2175 | hdd_station_ctx_t *pHddStaCtx; |
| 2176 | |
| 2177 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2178 | if (VOS_STATUS_SUCCESS != |
| 2179 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 2180 | pHddStaCtx->conn_info.staId[0], statsClearReqMask)) |
| 2181 | { |
| 2182 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2183 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 2184 | return -EINVAL; |
| 2185 | } |
| 2186 | if ((statsClearReqMask & WIFI_STATS_IFACE_AC) || |
| 2187 | (statsClearReqMask & WIFI_STATS_IFACE)) { |
| 2188 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 2189 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 2190 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 2191 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 2192 | } |
| 2193 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2194 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 2195 | 2 * sizeof(u32) + |
| 2196 | NLMSG_HDRLEN); |
| 2197 | |
| 2198 | if (temp_skbuff != NULL) |
| 2199 | { |
| 2200 | |
| 2201 | if (nla_put_u32(temp_skbuff, |
| 2202 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 2203 | statsClearReqMask) || |
| 2204 | nla_put_u32(temp_skbuff, |
| 2205 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 2206 | stopReq)) |
| 2207 | { |
| 2208 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 2209 | kfree_skb(temp_skbuff); |
| 2210 | return -EINVAL; |
| 2211 | } |
| 2212 | /* If the ask is to stop the stats collection as part of clear |
| 2213 | * (stopReq = 1) , ensure that no further requests of get |
| 2214 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 2215 | * However it the stopReq as part of the clear request is 0 , |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2216 | * the request to get the statistics are honoured as in this |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2217 | * case the firmware is just asked to clear the statistics. |
| 2218 | */ |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2219 | if (linkLayerStatsClearReq.stopReq == 1) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2220 | pAdapter->isLinkLayerStatsSet = 0; |
| 2221 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 2222 | } |
| 2223 | return -ENOMEM; |
| 2224 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2225 | |
| 2226 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2227 | return -EINVAL; |
| 2228 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2229 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 2230 | struct wireless_dev *wdev, |
| 2231 | const void *data, |
| 2232 | int data_len) |
| 2233 | { |
| 2234 | int ret = 0; |
| 2235 | |
| 2236 | vos_ssr_protect(__func__); |
| 2237 | ret = __wlan_hdd_cfg80211_ll_stats_clear(wiphy, wdev, data, data_len); |
| 2238 | vos_ssr_unprotect(__func__); |
| 2239 | |
| 2240 | return ret; |
| 2241 | |
| 2242 | |
| 2243 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2244 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 2245 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2246 | #ifdef WLAN_FEATURE_EXTSCAN |
| 2247 | static const struct nla_policy |
| 2248 | wlan_hdd_extscan_config_policy |
| 2249 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = |
| 2250 | { |
| 2251 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = |
| 2252 | { .type = NLA_U32 }, |
| 2253 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = |
| 2254 | { .type = NLA_U32 }, |
| 2255 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 }, |
| 2256 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = |
| 2257 | { .type = NLA_U32 }, |
| 2258 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = { .type = NLA_U8 }, |
| 2259 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = { .type = NLA_U8 }, |
| 2260 | |
| 2261 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = { .type = NLA_U8 }, |
| 2262 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = { .type = NLA_U8 }, |
| 2263 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 }, |
| 2264 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = |
| 2265 | { .type = NLA_U8 }, |
| 2266 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = |
| 2267 | { .type = NLA_U32 }, |
| 2268 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = |
| 2269 | { .type = NLA_U32 }, |
| 2270 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = |
| 2271 | { .type = NLA_U32 }, |
| 2272 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD] = |
| 2273 | { .type = NLA_U8 }, |
| 2274 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = |
| 2275 | { .type = NLA_U8 }, |
| 2276 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = |
| 2277 | { .type = NLA_U8 }, |
| 2278 | |
| 2279 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = |
| 2280 | { .type = NLA_U32 }, |
| 2281 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = |
| 2282 | { .type = NLA_UNSPEC }, |
| 2283 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = |
| 2284 | { .type = NLA_S32 }, |
| 2285 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = |
| 2286 | { .type = NLA_S32 }, |
| 2287 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = |
| 2288 | { .type = NLA_U32 }, |
| 2289 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = |
| 2290 | { .type = NLA_U32 }, |
| 2291 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE] = |
| 2292 | { .type = NLA_U32 }, |
| 2293 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE] |
| 2294 | = { .type = NLA_U32 }, |
| 2295 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING] = |
| 2296 | { .type = NLA_U32 }, |
| 2297 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP] = { .type = |
| 2298 | NLA_U32 }, |
| 2299 | }; |
| 2300 | |
| 2301 | static void wlan_hdd_cfg80211_extscan_get_capabilities_ind(void *ctx, void *pMsg) |
| 2302 | { |
| 2303 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2304 | struct sk_buff *skb = NULL; |
| 2305 | tpSirEXTScanCapabilitiesEvent pData = |
| 2306 | (tpSirEXTScanCapabilitiesEvent) pMsg; |
| 2307 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2308 | ENTER(); |
| 2309 | |
| 2310 | if (wlan_hdd_validate_context(pHddCtx)) |
| 2311 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2312 | return; |
| 2313 | } |
| 2314 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2315 | if (!pMsg) |
| 2316 | { |
| 2317 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2318 | return; |
| 2319 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2320 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2321 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2322 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES_INDEX, |
| 2323 | GFP_KERNEL); |
| 2324 | |
| 2325 | if (!skb) { |
| 2326 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2327 | FL("cfg80211_vendor_event_alloc failed")); |
| 2328 | return; |
| 2329 | } |
| 2330 | |
| 2331 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2332 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan cache size (%u)", pData->scanCacheSize); |
| 2333 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan buckets (%u)", pData->scanBuckets); |
| 2334 | hddLog(VOS_TRACE_LEVEL_INFO, "Max AP per scan (%u)", pData->maxApPerScan); |
| 2335 | hddLog(VOS_TRACE_LEVEL_INFO, "maxRssiSampleSize (%u)", |
| 2336 | pData->maxRssiSampleSize); |
| 2337 | hddLog(VOS_TRACE_LEVEL_INFO, "maxScanReportingThreshold (%u)", |
| 2338 | pData->maxScanReportingThreshold); |
| 2339 | hddLog(VOS_TRACE_LEVEL_INFO, "maxHotlistAPs (%u)", pData->maxHotlistAPs); |
| 2340 | hddLog(VOS_TRACE_LEVEL_INFO, "maxSignificantWifiChangeAPs (%u)", |
| 2341 | pData->maxSignificantWifiChangeAPs); |
| 2342 | hddLog(VOS_TRACE_LEVEL_INFO, "maxBsidHistoryEntries (%u)", |
| 2343 | pData->maxBsidHistoryEntries); |
| 2344 | |
| 2345 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2346 | pData->requestId) || |
| 2347 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status) || |
| 2348 | nla_put_u32(skb, |
| 2349 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE, |
| 2350 | pData->scanCacheSize) || |
| 2351 | nla_put_u32(skb, |
| 2352 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS, |
| 2353 | pData->scanBuckets) || |
| 2354 | nla_put_u32(skb, |
| 2355 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN, |
| 2356 | pData->maxApPerScan) || |
| 2357 | nla_put_u32(skb, |
| 2358 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE, |
| 2359 | pData->maxRssiSampleSize) || |
| 2360 | nla_put_u32(skb, |
| 2361 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD, |
| 2362 | pData->maxScanReportingThreshold) || |
| 2363 | nla_put_u32(skb, |
| 2364 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_APS, |
| 2365 | pData->maxHotlistAPs) || |
| 2366 | nla_put_u32(skb, |
| 2367 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS, |
| 2368 | pData->maxSignificantWifiChangeAPs) || |
| 2369 | nla_put_u32(skb, |
| 2370 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES, |
| 2371 | pData->maxBsidHistoryEntries)) { |
| 2372 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2373 | goto nla_put_failure; |
| 2374 | } |
| 2375 | |
| 2376 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2377 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2378 | return; |
| 2379 | |
| 2380 | nla_put_failure: |
| 2381 | kfree_skb(skb); |
| 2382 | return; |
| 2383 | } |
| 2384 | |
| 2385 | |
| 2386 | static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg) |
| 2387 | { |
| 2388 | tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg; |
| 2389 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2390 | struct sk_buff *skb = NULL; |
| 2391 | tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal ); |
| 2392 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2393 | ENTER(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2394 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2395 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2396 | return; |
| 2397 | } |
| 2398 | if (!pMsg) |
| 2399 | { |
| 2400 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2401 | return; |
| 2402 | } |
| 2403 | |
| 2404 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2405 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2406 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START_INDEX, |
| 2407 | GFP_KERNEL); |
| 2408 | |
| 2409 | if (!skb) { |
| 2410 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2411 | FL("cfg80211_vendor_event_alloc failed")); |
| 2412 | return; |
| 2413 | } |
| 2414 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2415 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2416 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2417 | |
| 2418 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2419 | pData->requestId) || |
| 2420 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2421 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2422 | goto nla_put_failure; |
| 2423 | } |
| 2424 | |
| 2425 | /* |
| 2426 | * Store the Request ID for comparing with the requestID obtained |
| 2427 | * in other requests.HDD shall return a failure is the extscan_stop |
| 2428 | * request is issued with a different requestId as that of the |
| 2429 | * extscan_start request. Also, This requestId shall be used while |
| 2430 | * indicating the full scan results to the upper layers. |
| 2431 | * The requestId is stored with the assumption that the firmware |
| 2432 | * shall return the ext scan start request's requestId in ext scan |
| 2433 | * start response. |
| 2434 | */ |
| 2435 | if (pData->status == 0) |
| 2436 | pMac->sme.extScanStartReqId = pData->requestId; |
| 2437 | |
| 2438 | |
| 2439 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2440 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2441 | return; |
| 2442 | |
| 2443 | nla_put_failure: |
| 2444 | kfree_skb(skb); |
| 2445 | return; |
| 2446 | } |
| 2447 | |
| 2448 | |
| 2449 | static void wlan_hdd_cfg80211_extscan_stop_rsp(void *ctx, void *pMsg) |
| 2450 | { |
| 2451 | tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg; |
| 2452 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2453 | struct sk_buff *skb = NULL; |
| 2454 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2455 | ENTER(); |
| 2456 | |
| 2457 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2458 | return; |
| 2459 | } |
| 2460 | if (!pMsg) |
| 2461 | { |
| 2462 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2463 | return; |
| 2464 | } |
| 2465 | |
| 2466 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2467 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2468 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP_INDEX, |
| 2469 | GFP_KERNEL); |
| 2470 | |
| 2471 | if (!skb) { |
| 2472 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2473 | FL("cfg80211_vendor_event_alloc failed")); |
| 2474 | return; |
| 2475 | } |
| 2476 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2477 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2478 | |
| 2479 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2480 | pData->requestId) || |
| 2481 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2482 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2483 | goto nla_put_failure; |
| 2484 | } |
| 2485 | |
| 2486 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2487 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2488 | return; |
| 2489 | |
| 2490 | nla_put_failure: |
| 2491 | kfree_skb(skb); |
| 2492 | return; |
| 2493 | } |
| 2494 | |
| 2495 | |
| 2496 | static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx, |
| 2497 | void *pMsg) |
| 2498 | { |
| 2499 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2500 | struct sk_buff *skb = NULL; |
| 2501 | tpSirEXTScanSetBssidHotListRspParams pData = |
| 2502 | (tpSirEXTScanSetBssidHotListRspParams) pMsg; |
| 2503 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2504 | ENTER(); |
| 2505 | |
| 2506 | if (wlan_hdd_validate_context(pHddCtx)){ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2507 | return; |
| 2508 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2509 | if (!pMsg) |
| 2510 | { |
| 2511 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2512 | return; |
| 2513 | } |
| 2514 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2515 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2516 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2517 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST_INDEX, |
| 2518 | GFP_KERNEL); |
| 2519 | |
| 2520 | if (!skb) { |
| 2521 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2522 | FL("cfg80211_vendor_event_alloc failed")); |
| 2523 | return; |
| 2524 | } |
| 2525 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2526 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2527 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2528 | |
| 2529 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2530 | pData->requestId) || |
| 2531 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2532 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2533 | goto nla_put_failure; |
| 2534 | } |
| 2535 | |
| 2536 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2537 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2538 | return; |
| 2539 | |
| 2540 | nla_put_failure: |
| 2541 | kfree_skb(skb); |
| 2542 | return; |
| 2543 | } |
| 2544 | |
| 2545 | static void wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(void *ctx, |
| 2546 | void *pMsg) |
| 2547 | { |
| 2548 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2549 | struct sk_buff *skb = NULL; |
| 2550 | tpSirEXTScanResetBssidHotlistRspParams pData = |
| 2551 | (tpSirEXTScanResetBssidHotlistRspParams) pMsg; |
| 2552 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2553 | ENTER(); |
| 2554 | |
| 2555 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2556 | return; |
| 2557 | } |
| 2558 | if (!pMsg) |
| 2559 | { |
| 2560 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2561 | return; |
| 2562 | } |
| 2563 | |
| 2564 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2565 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2566 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST_INDEX, |
| 2567 | GFP_KERNEL); |
| 2568 | |
| 2569 | if (!skb) { |
| 2570 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2571 | FL("cfg80211_vendor_event_alloc failed")); |
| 2572 | return; |
| 2573 | } |
| 2574 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2575 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2576 | |
| 2577 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2578 | pData->requestId) || |
| 2579 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2580 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2581 | goto nla_put_failure; |
| 2582 | } |
| 2583 | |
| 2584 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2585 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2586 | return; |
| 2587 | |
| 2588 | nla_put_failure: |
| 2589 | kfree_skb(skb); |
| 2590 | return; |
| 2591 | } |
| 2592 | |
| 2593 | |
| 2594 | static void wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(void *ctx, |
| 2595 | void *pMsg) |
| 2596 | { |
| 2597 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2598 | struct sk_buff *skb = NULL; |
| 2599 | tpSirEXTScanSetSignificantChangeRspParams pData = |
| 2600 | (tpSirEXTScanSetSignificantChangeRspParams) pMsg; |
| 2601 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2602 | ENTER(); |
| 2603 | |
| 2604 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2605 | return; |
| 2606 | } |
| 2607 | if (!pMsg) |
| 2608 | { |
| 2609 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2610 | return; |
| 2611 | } |
| 2612 | |
| 2613 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2614 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2615 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE_INDEX, |
| 2616 | GFP_KERNEL); |
| 2617 | |
| 2618 | if (!skb) { |
| 2619 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2620 | FL("cfg80211_vendor_event_alloc failed")); |
| 2621 | return; |
| 2622 | } |
| 2623 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2624 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2625 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2626 | |
| 2627 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2628 | pData->requestId) || |
| 2629 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2630 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2631 | goto nla_put_failure; |
| 2632 | } |
| 2633 | |
| 2634 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2635 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2636 | return; |
| 2637 | |
| 2638 | nla_put_failure: |
| 2639 | kfree_skb(skb); |
| 2640 | return; |
| 2641 | } |
| 2642 | |
| 2643 | |
| 2644 | static void wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(void *ctx, |
| 2645 | void *pMsg) |
| 2646 | { |
| 2647 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2648 | struct sk_buff *skb = NULL; |
| 2649 | tpSirEXTScanResetSignificantChangeRspParams pData = |
| 2650 | (tpSirEXTScanResetSignificantChangeRspParams) pMsg; |
| 2651 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2652 | ENTER(); |
| 2653 | |
| 2654 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2655 | return; |
| 2656 | } |
| 2657 | if (!pMsg) |
| 2658 | { |
| 2659 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2660 | return; |
| 2661 | } |
| 2662 | |
| 2663 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2664 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2665 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE_INDEX, |
| 2666 | GFP_KERNEL); |
| 2667 | |
| 2668 | if (!skb) { |
| 2669 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2670 | FL("cfg80211_vendor_event_alloc failed")); |
| 2671 | return; |
| 2672 | } |
| 2673 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2674 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2675 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2676 | |
| 2677 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2678 | pData->requestId) || |
| 2679 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2680 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2681 | goto nla_put_failure; |
| 2682 | } |
| 2683 | |
| 2684 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2685 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2686 | return; |
| 2687 | |
| 2688 | nla_put_failure: |
| 2689 | kfree_skb(skb); |
| 2690 | return; |
| 2691 | } |
| 2692 | |
| 2693 | static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx, |
| 2694 | void *pMsg) |
| 2695 | { |
| 2696 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2697 | struct sk_buff *skb = NULL; |
| 2698 | tANI_U32 i = 0, j, resultsPerEvent; |
| 2699 | tANI_S32 totalResults; |
| 2700 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2701 | tpSirWifiScanResult pSirWifiScanResult; |
| 2702 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2703 | ENTER(); |
| 2704 | |
| 2705 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2706 | return; |
| 2707 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2708 | if (!pMsg) |
| 2709 | { |
| 2710 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2711 | return; |
| 2712 | } |
| 2713 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2714 | totalResults = pData->numOfAps; |
| 2715 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2716 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2717 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2718 | |
| 2719 | do{ |
| 2720 | resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ? |
| 2721 | EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults); |
| 2722 | totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND; |
| 2723 | |
| 2724 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2725 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2726 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS_INDEX, |
| 2727 | GFP_KERNEL); |
| 2728 | |
| 2729 | if (!skb) { |
| 2730 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2731 | FL("cfg80211_vendor_event_alloc failed")); |
| 2732 | return; |
| 2733 | } |
| 2734 | |
| 2735 | hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent); |
| 2736 | |
| 2737 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2738 | pData->requestId) || |
| 2739 | nla_put_u32(skb, |
| 2740 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2741 | resultsPerEvent)) { |
| 2742 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2743 | goto fail; |
| 2744 | } |
| 2745 | if (nla_put_u8(skb, |
| 2746 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2747 | pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 ))) |
| 2748 | { |
| 2749 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2750 | goto fail; |
| 2751 | } |
| 2752 | |
| 2753 | if (resultsPerEvent) { |
| 2754 | struct nlattr *aps; |
| 2755 | |
| 2756 | aps = nla_nest_start(skb, |
| 2757 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2758 | if (!aps) |
| 2759 | { |
| 2760 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2761 | goto fail; |
| 2762 | } |
| 2763 | |
| 2764 | for (j = 0; j < resultsPerEvent; j++, i++) { |
| 2765 | struct nlattr *ap; |
| 2766 | pSirWifiScanResult = (tpSirWifiScanResult) ((tANI_U8 *) |
| 2767 | pData->ap + ( i* sizeof(tSirWifiScanResult))); |
| 2768 | |
| 2769 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) " |
| 2770 | "Ssid (%s)" |
| 2771 | "Bssid: %pM " |
| 2772 | "Channel (%u)" |
| 2773 | "Rssi (%d)" |
| 2774 | "RTT (%u)" |
| 2775 | "RTT_SD (%u)", |
| 2776 | i, |
| 2777 | pSirWifiScanResult->ts, |
| 2778 | pSirWifiScanResult->ssid, |
| 2779 | pSirWifiScanResult->bssid, |
| 2780 | pSirWifiScanResult->channel, |
| 2781 | pSirWifiScanResult->rssi, |
| 2782 | pSirWifiScanResult->rtt, |
| 2783 | pSirWifiScanResult->rtt_sd); |
| 2784 | |
| 2785 | ap = nla_nest_start(skb, j + 1); |
| 2786 | if (!ap) |
| 2787 | { |
| 2788 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2789 | goto fail; |
| 2790 | } |
| 2791 | |
| 2792 | if (nla_put_u64(skb, |
| 2793 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2794 | pSirWifiScanResult->ts) ) |
| 2795 | { |
| 2796 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2797 | goto fail; |
| 2798 | } |
| 2799 | if (nla_put(skb, |
| 2800 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2801 | sizeof(pSirWifiScanResult->ssid), |
| 2802 | pSirWifiScanResult->ssid) ) |
| 2803 | { |
| 2804 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2805 | goto fail; |
| 2806 | } |
| 2807 | if (nla_put(skb, |
| 2808 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2809 | sizeof(pSirWifiScanResult->bssid), |
| 2810 | pSirWifiScanResult->bssid) ) |
| 2811 | { |
| 2812 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2813 | goto fail; |
| 2814 | } |
| 2815 | if (nla_put_u32(skb, |
| 2816 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2817 | pSirWifiScanResult->channel) ) |
| 2818 | { |
| 2819 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2820 | goto fail; |
| 2821 | } |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 2822 | if (nla_put_s32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2823 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2824 | pSirWifiScanResult->rssi) ) |
| 2825 | { |
| 2826 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2827 | goto fail; |
| 2828 | } |
| 2829 | if (nla_put_u32(skb, |
| 2830 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2831 | pSirWifiScanResult->rtt) ) |
| 2832 | { |
| 2833 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2834 | goto fail; |
| 2835 | } |
| 2836 | if (nla_put_u32(skb, |
| 2837 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2838 | pSirWifiScanResult->rtt_sd)) |
| 2839 | { |
| 2840 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2841 | goto fail; |
| 2842 | } |
| 2843 | |
| 2844 | nla_nest_end(skb, ap); |
| 2845 | } |
| 2846 | nla_nest_end(skb, aps); |
| 2847 | |
| 2848 | } |
| 2849 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2850 | } while (totalResults > 0); |
| 2851 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2852 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2853 | return; |
| 2854 | fail: |
| 2855 | kfree_skb(skb); |
| 2856 | return; |
| 2857 | } |
| 2858 | |
| 2859 | static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx, |
| 2860 | void *pMsg) |
| 2861 | { |
| 2862 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2863 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2864 | struct sk_buff *skb = NULL; |
| 2865 | tANI_U32 i; |
| 2866 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2867 | ENTER(); |
| 2868 | |
| 2869 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2870 | return; |
| 2871 | } |
| 2872 | if (!pMsg) |
| 2873 | { |
| 2874 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2875 | return; |
| 2876 | } |
| 2877 | |
| 2878 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2879 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2880 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX, |
| 2881 | GFP_KERNEL); |
| 2882 | |
| 2883 | if (!skb) { |
| 2884 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2885 | FL("cfg80211_vendor_event_alloc failed")); |
| 2886 | return; |
| 2887 | } |
| 2888 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2889 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2890 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2891 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2892 | |
| 2893 | for (i = 0; i < pData->numOfAps; i++) { |
| 2894 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) " |
| 2895 | "Ssid (%s) " |
| 2896 | "Bssid (" MAC_ADDRESS_STR ") " |
| 2897 | "Channel (%u) " |
| 2898 | "Rssi (%d) " |
| 2899 | "RTT (%u) " |
| 2900 | "RTT_SD (%u) ", |
| 2901 | i, |
| 2902 | pData->ap[i].ts, |
| 2903 | pData->ap[i].ssid, |
| 2904 | MAC_ADDR_ARRAY(pData->ap[i].bssid), |
| 2905 | pData->ap[i].channel, |
| 2906 | pData->ap[i].rssi, |
| 2907 | pData->ap[i].rtt, |
| 2908 | pData->ap[i].rtt_sd); |
| 2909 | } |
| 2910 | |
| 2911 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2912 | pData->requestId) || |
| 2913 | nla_put_u32(skb, |
| 2914 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2915 | pData->numOfAps)) { |
| 2916 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2917 | goto fail; |
| 2918 | } |
| 2919 | if (pData->numOfAps) { |
| 2920 | struct nlattr *aps; |
| 2921 | |
| 2922 | aps = nla_nest_start(skb, |
| 2923 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2924 | if (!aps) |
| 2925 | goto fail; |
| 2926 | |
| 2927 | for (i = 0; i < pData->numOfAps; i++) { |
| 2928 | struct nlattr *ap; |
| 2929 | |
| 2930 | ap = nla_nest_start(skb, i + 1); |
| 2931 | if (!ap) |
| 2932 | goto fail; |
| 2933 | |
| 2934 | if (nla_put_u64(skb, |
| 2935 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2936 | pData->ap[i].ts) || |
| 2937 | nla_put(skb, |
| 2938 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2939 | sizeof(pData->ap[i].ssid), |
| 2940 | pData->ap[i].ssid) || |
| 2941 | nla_put(skb, |
| 2942 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2943 | sizeof(pData->ap[i].bssid), |
| 2944 | pData->ap[i].bssid) || |
| 2945 | nla_put_u32(skb, |
| 2946 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2947 | pData->ap[i].channel) || |
| 2948 | nla_put_s32(skb, |
| 2949 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2950 | pData->ap[i].rssi) || |
| 2951 | nla_put_u32(skb, |
| 2952 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2953 | pData->ap[i].rtt) || |
| 2954 | nla_put_u32(skb, |
| 2955 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2956 | pData->ap[i].rtt_sd)) |
| 2957 | goto fail; |
| 2958 | |
| 2959 | nla_nest_end(skb, ap); |
| 2960 | } |
| 2961 | nla_nest_end(skb, aps); |
| 2962 | |
| 2963 | if (nla_put_u8(skb, |
| 2964 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2965 | pData->moreData)) |
| 2966 | goto fail; |
| 2967 | } |
| 2968 | |
| 2969 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2970 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2971 | return; |
| 2972 | |
| 2973 | fail: |
| 2974 | kfree_skb(skb); |
| 2975 | return; |
| 2976 | |
| 2977 | } |
| 2978 | static void wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(void *ctx, |
| 2979 | void *pMsg) |
| 2980 | { |
| 2981 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2982 | struct sk_buff *skb = NULL; |
| 2983 | tANI_U32 i, j; |
| 2984 | tpSirWifiSignificantChangeEvent pData = |
| 2985 | (tpSirWifiSignificantChangeEvent) pMsg; |
| 2986 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2987 | ENTER(); |
| 2988 | |
| 2989 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2990 | return; |
| 2991 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2992 | if (!pMsg) |
| 2993 | { |
| 2994 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2995 | return; |
| 2996 | } |
| 2997 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2998 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2999 | EXTSCAN_EVENT_BUF_SIZE, |
| 3000 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE_INDEX, |
| 3001 | GFP_KERNEL); |
| 3002 | |
| 3003 | if (!skb) { |
| 3004 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3005 | FL("cfg80211_vendor_event_alloc failed")); |
| 3006 | return; |
| 3007 | } |
| 3008 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3009 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 3010 | hddLog(VOS_TRACE_LEVEL_INFO, "total List Size %u ", pData->numSigRssiBss); |
| 3011 | hddLog(VOS_TRACE_LEVEL_INFO, " CUrrent List size (%u)", |
| 3012 | pData->numSigRssiBss); |
| 3013 | hddLog(VOS_TRACE_LEVEL_INFO, "moreData (%u)", pData->moreData); |
| 3014 | |
| 3015 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 3016 | hddLog(VOS_TRACE_LEVEL_INFO , "Rssi List [%d] BSSID: (%pM) Channel %u " |
| 3017 | " num RSSI %u ", |
| 3018 | i, pData->sigRssiResult[i].bssid, |
| 3019 | pData->sigRssiResult[i].channel, |
| 3020 | pData->sigRssiResult[i].numRssi); |
| 3021 | |
| 3022 | for (j = 0; j < pData->sigRssiResult[i].numRssi; j++){ |
| 3023 | |
| 3024 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3025 | " [%d]", |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 3026 | pData->sigRssiResult[i].rssi[j]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3027 | |
| 3028 | } |
| 3029 | } |
| 3030 | |
| 3031 | |
| 3032 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3033 | pData->requestId) || |
| 3034 | nla_put_u32(skb, |
| 3035 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3036 | pData->numSigRssiBss)) { |
| 3037 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3038 | goto fail; |
| 3039 | } |
| 3040 | |
| 3041 | if (pData->numSigRssiBss) { |
| 3042 | struct nlattr *aps; |
| 3043 | aps = nla_nest_start(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 3044 | if (!aps) |
| 3045 | goto fail; |
| 3046 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 3047 | struct nlattr *ap; |
| 3048 | |
| 3049 | ap = nla_nest_start(skb, i); |
| 3050 | if (!ap) |
| 3051 | goto fail; |
| 3052 | if (nla_put(skb, |
| 3053 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_BSSID, |
| 3054 | sizeof(tSirMacAddr), pData->sigRssiResult[i].bssid) || |
| 3055 | nla_put_u32(skb, |
| 3056 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_CHANNEL, |
| 3057 | pData->sigRssiResult[i].channel) || |
| 3058 | nla_put_u32(skb, |
| 3059 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_NUM_RSSI, |
| 3060 | pData->sigRssiResult[i].numRssi) || |
| 3061 | nla_put(skb, |
| 3062 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_RSSI_LIST, |
| 3063 | sizeof(s32) * pData->sigRssiResult[i].numRssi, |
| 3064 | pData->sigRssiResult[i].rssi)) |
| 3065 | goto fail; |
| 3066 | nla_nest_end(skb, ap); |
| 3067 | } |
| 3068 | nla_nest_end(skb, aps); |
| 3069 | if (nla_put_u8(skb, |
| 3070 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 3071 | pData->moreData)) |
| 3072 | goto fail; |
| 3073 | } |
| 3074 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3075 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3076 | return; |
| 3077 | fail: |
| 3078 | kfree_skb(skb); |
| 3079 | return; |
| 3080 | } |
| 3081 | |
| 3082 | static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx, |
| 3083 | void *pMsg) |
| 3084 | { |
| 3085 | struct sk_buff *skb; |
| 3086 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3087 | tpSirWifiFullScanResultEvent pData = |
| 3088 | (tpSirWifiFullScanResultEvent) (pMsg); |
| 3089 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3090 | ENTER(); |
| 3091 | |
| 3092 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 3093 | return; |
| 3094 | } |
| 3095 | if (!pMsg) |
| 3096 | { |
| 3097 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3098 | return; |
| 3099 | } |
| 3100 | |
| 3101 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 3102 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3103 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX, |
| 3104 | GFP_KERNEL); |
| 3105 | |
| 3106 | if (!skb) { |
| 3107 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3108 | FL("cfg80211_vendor_event_alloc failed")); |
| 3109 | return; |
| 3110 | } |
| 3111 | |
| 3112 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3113 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId); |
| 3114 | hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData); |
| 3115 | hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) " |
| 3116 | "Ssid (%s)" |
| 3117 | "Bssid (" MAC_ADDRESS_STR ")" |
| 3118 | "Channel (%u)" |
| 3119 | "Rssi (%d)" |
| 3120 | "RTT (%u)" |
| 3121 | "RTT_SD (%u)"), |
| 3122 | pData->ap.ts, |
| 3123 | pData->ap.ssid, |
| 3124 | MAC_ADDR_ARRAY(pData->ap.bssid), |
| 3125 | pData->ap.channel, |
| 3126 | pData->ap.rssi, |
| 3127 | pData->ap.rtt, |
| 3128 | pData->ap.rtt_sd); |
| 3129 | hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength); |
| 3130 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3131 | pData->requestId) || |
| 3132 | nla_put_u64(skb, |
| 3133 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 3134 | pData->ap.ts) || |
| 3135 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 3136 | sizeof(pData->ap.ssid), |
| 3137 | pData->ap.ssid) || |
| 3138 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 3139 | WNI_CFG_BSSID_LEN, |
| 3140 | pData->ap.bssid) || |
| 3141 | nla_put_u32(skb, |
| 3142 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 3143 | pData->ap.channel) || |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 3144 | 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] | 3145 | pData->ap.rssi) || |
| 3146 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 3147 | pData->ap.rtt) || |
| 3148 | nla_put_u32(skb, |
| 3149 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 3150 | pData->ap.rtt_sd) || |
| 3151 | nla_put_u16(skb, |
| 3152 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 3153 | pData->ap.beaconPeriod) || |
| 3154 | nla_put_u16(skb, |
| 3155 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 3156 | pData->ap.capability) || |
| 3157 | nla_put_u32(skb, |
| 3158 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
| 3159 | pData->ieLength)) |
| 3160 | { |
| 3161 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3162 | goto nla_put_failure; |
| 3163 | } |
| 3164 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 3165 | pData->ieLength, |
| 3166 | pData->ie)) |
| 3167 | { |
| 3168 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3169 | goto nla_put_failure; |
| 3170 | } |
| 3171 | |
| 3172 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3173 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3174 | return; |
| 3175 | |
| 3176 | nla_put_failure: |
| 3177 | kfree_skb(skb); |
| 3178 | return; |
| 3179 | } |
| 3180 | |
| 3181 | static void wlan_hdd_cfg80211_extscan_scan_res_available_event(void *ctx, |
| 3182 | void *pMsg) |
| 3183 | { |
| 3184 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3185 | struct sk_buff *skb = NULL; |
| 3186 | tpSirEXTScanResultsAvailableIndParams pData = |
| 3187 | (tpSirEXTScanResultsAvailableIndParams) pMsg; |
| 3188 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3189 | ENTER(); |
| 3190 | |
| 3191 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 3192 | return; |
| 3193 | } |
| 3194 | if (!pMsg) |
| 3195 | { |
| 3196 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3197 | return; |
| 3198 | } |
| 3199 | |
| 3200 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 3201 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3202 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX, |
| 3203 | GFP_KERNEL); |
| 3204 | |
| 3205 | if (!skb) { |
| 3206 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3207 | FL("cfg80211_vendor_event_alloc failed")); |
| 3208 | return; |
| 3209 | } |
| 3210 | |
| 3211 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3212 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 3213 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", |
| 3214 | pData->numResultsAvailable); |
| 3215 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3216 | pData->requestId) || |
| 3217 | nla_put_u32(skb, |
| 3218 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3219 | pData->numResultsAvailable)) { |
| 3220 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3221 | goto nla_put_failure; |
| 3222 | } |
| 3223 | |
| 3224 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3225 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3226 | return; |
| 3227 | |
| 3228 | nla_put_failure: |
| 3229 | kfree_skb(skb); |
| 3230 | return; |
| 3231 | } |
| 3232 | |
| 3233 | static void wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx, void *pMsg) |
| 3234 | { |
| 3235 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3236 | struct sk_buff *skb = NULL; |
| 3237 | tpSirEXTScanProgressIndParams pData = |
| 3238 | (tpSirEXTScanProgressIndParams) pMsg; |
| 3239 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3240 | ENTER(); |
| 3241 | |
| 3242 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 3243 | return; |
| 3244 | } |
| 3245 | if (!pMsg) |
| 3246 | { |
| 3247 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3248 | return; |
| 3249 | } |
| 3250 | |
| 3251 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 3252 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3253 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX, |
| 3254 | GFP_KERNEL); |
| 3255 | |
| 3256 | if (!skb) { |
| 3257 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3258 | FL("cfg80211_vendor_event_alloc failed")); |
| 3259 | return; |
| 3260 | } |
| 3261 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3262 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)", |
| 3263 | pData->extScanEventType); |
| 3264 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)", |
| 3265 | pData->status); |
| 3266 | |
| 3267 | if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE, |
| 3268 | pData->extScanEventType) || |
| 3269 | nla_put_u32(skb, |
Dasari Srinivas | 5a28865 | 2014-06-30 17:13:22 +0530 | [diff] [blame] | 3270 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3271 | pData->requestId) || |
| 3272 | nla_put_u32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3273 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS, |
| 3274 | pData->status)) { |
| 3275 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3276 | goto nla_put_failure; |
| 3277 | } |
| 3278 | |
| 3279 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3280 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3281 | return; |
| 3282 | |
| 3283 | nla_put_failure: |
| 3284 | kfree_skb(skb); |
| 3285 | return; |
| 3286 | } |
| 3287 | |
| 3288 | void wlan_hdd_cfg80211_extscan_callback(void *ctx, const tANI_U16 evType, |
| 3289 | void *pMsg) |
| 3290 | { |
| 3291 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3292 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3293 | ENTER(); |
| 3294 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3295 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3296 | return; |
| 3297 | } |
| 3298 | |
| 3299 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 3300 | |
| 3301 | |
| 3302 | switch(evType) { |
| 3303 | case SIR_HAL_EXTSCAN_START_RSP: |
| 3304 | wlan_hdd_cfg80211_extscan_start_rsp(ctx, pMsg); |
| 3305 | break; |
| 3306 | |
| 3307 | case SIR_HAL_EXTSCAN_STOP_RSP: |
| 3308 | wlan_hdd_cfg80211_extscan_stop_rsp(ctx, pMsg); |
| 3309 | break; |
| 3310 | case SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP: |
| 3311 | /* There is no need to send this response to upper layer |
| 3312 | Just log the message */ |
| 3313 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3314 | FL("Rcvd SIR_HAL_EXTSCAN_CACHED_RESULTS_RSP")); |
| 3315 | break; |
| 3316 | case SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP: |
| 3317 | wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(ctx, pMsg); |
| 3318 | break; |
| 3319 | |
| 3320 | case SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP: |
| 3321 | wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg); |
| 3322 | break; |
| 3323 | |
| 3324 | case SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP: |
| 3325 | wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(ctx, pMsg); |
| 3326 | break; |
| 3327 | |
| 3328 | case SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP: |
| 3329 | wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(ctx, pMsg); |
| 3330 | break; |
| 3331 | case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP: |
| 3332 | wlan_hdd_cfg80211_extscan_get_capabilities_ind(ctx, pMsg); |
| 3333 | break; |
| 3334 | case SIR_HAL_EXTSCAN_PROGRESS_IND: |
| 3335 | wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg); |
| 3336 | break; |
| 3337 | case SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND: |
| 3338 | wlan_hdd_cfg80211_extscan_scan_res_available_event(ctx, pMsg); |
| 3339 | break; |
| 3340 | case SIR_HAL_EXTSCAN_SCAN_RESULT_IND: |
| 3341 | wlan_hdd_cfg80211_extscan_cached_results_ind(ctx, pMsg); |
| 3342 | break; |
| 3343 | case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND: |
| 3344 | wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg); |
| 3345 | break; |
| 3346 | case SIR_HAL_EXTSCAN_SIGNF_WIFI_CHANGE_IND: |
| 3347 | wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(ctx, pMsg); |
| 3348 | break; |
| 3349 | case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 3350 | wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg); |
| 3351 | break; |
| 3352 | default: |
| 3353 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 3354 | break; |
| 3355 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3356 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3357 | } |
| 3358 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3359 | static int __wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3360 | struct wireless_dev *wdev, |
| 3361 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3362 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3363 | tSirGetEXTScanCapabilitiesReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3364 | struct net_device *dev = wdev->netdev; |
| 3365 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3366 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3367 | struct nlattr |
| 3368 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3369 | eHalStatus status; |
| 3370 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3371 | ENTER(); |
| 3372 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3373 | status = wlan_hdd_validate_context(pHddCtx); |
| 3374 | if (0 != status) |
| 3375 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3376 | return -EINVAL; |
| 3377 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3378 | /* check the EXTScan Capability */ |
| 3379 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3380 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3381 | { |
| 3382 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3383 | FL("EXTScan not enabled/supported by Firmware")); |
| 3384 | return -EINVAL; |
| 3385 | } |
| 3386 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3387 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3388 | data, dataLen, |
| 3389 | wlan_hdd_extscan_config_policy)) { |
| 3390 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3391 | return -EINVAL; |
| 3392 | } |
| 3393 | |
| 3394 | /* Parse and fetch request Id */ |
| 3395 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3396 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3397 | return -EINVAL; |
| 3398 | } |
| 3399 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3400 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3401 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3402 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3403 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3404 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3405 | reqMsg.sessionId = pAdapter->sessionId; |
| 3406 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3407 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3408 | status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3409 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3410 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3411 | FL("sme_EXTScanGetCapabilities failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3412 | return -EINVAL; |
| 3413 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3414 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3415 | return 0; |
| 3416 | } |
| 3417 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3418 | static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3419 | struct wireless_dev *wdev, |
| 3420 | const void *data, int dataLen) |
| 3421 | { |
| 3422 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3423 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3424 | vos_ssr_protect(__func__); |
| 3425 | ret = __wlan_hdd_cfg80211_extscan_get_capabilities(wiphy, wdev, data, dataLen); |
| 3426 | vos_ssr_unprotect(__func__); |
| 3427 | |
| 3428 | return ret; |
| 3429 | } |
| 3430 | |
| 3431 | static int __wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3432 | struct wireless_dev *wdev, |
| 3433 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3434 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3435 | tSirEXTScanGetCachedResultsReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3436 | struct net_device *dev = wdev->netdev; |
| 3437 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3438 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3439 | struct nlattr |
| 3440 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3441 | eHalStatus status; |
| 3442 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3443 | ENTER(); |
| 3444 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3445 | status = wlan_hdd_validate_context(pHddCtx); |
| 3446 | if (0 != status) |
| 3447 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3448 | return -EINVAL; |
| 3449 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3450 | /* check the EXTScan Capability */ |
| 3451 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3452 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3453 | { |
| 3454 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3455 | FL("EXTScan not enabled/supported by Firmware")); |
| 3456 | return -EINVAL; |
| 3457 | } |
| 3458 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3459 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3460 | data, dataLen, |
| 3461 | wlan_hdd_extscan_config_policy)) { |
| 3462 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3463 | return -EINVAL; |
| 3464 | } |
| 3465 | /* Parse and fetch request Id */ |
| 3466 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3467 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3468 | return -EINVAL; |
| 3469 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3470 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3471 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3472 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3473 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3474 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
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.sessionId = pAdapter->sessionId; |
| 3477 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3478 | |
| 3479 | /* Parse and fetch flush parameter */ |
| 3480 | if (!tb |
| 3481 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]) |
| 3482 | { |
| 3483 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed")); |
| 3484 | goto failed; |
| 3485 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3486 | reqMsg.flush = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3487 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]); |
| 3488 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3489 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3490 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3491 | status = sme_getCachedResults(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3492 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3493 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3494 | FL("sme_getCachedResults failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3495 | return -EINVAL; |
| 3496 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3497 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3498 | return 0; |
| 3499 | |
| 3500 | failed: |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3501 | return -EINVAL; |
| 3502 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3503 | static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3504 | struct wireless_dev *wdev, |
| 3505 | const void *data, int dataLen) |
| 3506 | { |
| 3507 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3508 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3509 | vos_ssr_protect(__func__); |
| 3510 | ret = __wlan_hdd_cfg80211_extscan_get_cached_results(wiphy, wdev, data, dataLen); |
| 3511 | vos_ssr_unprotect(__func__); |
| 3512 | |
| 3513 | return ret; |
| 3514 | } |
| 3515 | |
| 3516 | static int __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3517 | struct wireless_dev *wdev, |
Edhar, Mahesh Kumar | ed8631f | 2015-01-20 14:31:47 +0530 | [diff] [blame] | 3518 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3519 | { |
| 3520 | tpSirEXTScanSetBssidHotListReqParams pReqMsg = NULL; |
| 3521 | struct net_device *dev = wdev->netdev; |
| 3522 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3523 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3524 | struct nlattr |
| 3525 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3526 | struct nlattr |
| 3527 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3528 | struct nlattr *apTh; |
| 3529 | eHalStatus status; |
| 3530 | tANI_U8 i = 0; |
| 3531 | int rem; |
| 3532 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3533 | ENTER(); |
| 3534 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3535 | status = wlan_hdd_validate_context(pHddCtx); |
| 3536 | if (0 != status) |
| 3537 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3538 | return -EINVAL; |
| 3539 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3540 | /* check the EXTScan Capability */ |
| 3541 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3542 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3543 | { |
| 3544 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3545 | FL("EXTScan not enabled/supported by Firmware")); |
| 3546 | return -EINVAL; |
| 3547 | } |
| 3548 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3549 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3550 | data, dataLen, |
| 3551 | wlan_hdd_extscan_config_policy)) { |
| 3552 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3553 | return -EINVAL; |
| 3554 | } |
| 3555 | |
| 3556 | /* Parse and fetch request Id */ |
| 3557 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3558 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3559 | return -EINVAL; |
| 3560 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3561 | pReqMsg = (tpSirEXTScanSetBssidHotListReqParams) |
| 3562 | vos_mem_malloc(sizeof(*pReqMsg)); |
| 3563 | if (!pReqMsg) { |
| 3564 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3565 | return -ENOMEM; |
| 3566 | } |
| 3567 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3568 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3569 | pReqMsg->requestId = nla_get_u32( |
| 3570 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3571 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3572 | |
| 3573 | /* Parse and fetch number of APs */ |
| 3574 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]) { |
| 3575 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3576 | goto fail; |
| 3577 | } |
| 3578 | |
| 3579 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3580 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3581 | |
| 3582 | pReqMsg->numAp = nla_get_u32( |
| 3583 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]); |
| 3584 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3585 | |
| 3586 | nla_for_each_nested(apTh, |
| 3587 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3588 | if(nla_parse(tb2, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3589 | nla_data(apTh), nla_len(apTh), |
| 3590 | NULL)) { |
| 3591 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3592 | goto fail; |
| 3593 | } |
| 3594 | |
| 3595 | /* Parse and fetch MAC address */ |
| 3596 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3597 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3598 | goto fail; |
| 3599 | } |
| 3600 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3601 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3602 | sizeof(tSirMacAddr)); |
| 3603 | hddLog(VOS_TRACE_LEVEL_INFO, FL("BSSID: %pM "), pReqMsg->ap[i].bssid); |
| 3604 | |
| 3605 | /* Parse and fetch low RSSI */ |
| 3606 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3607 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3608 | goto fail; |
| 3609 | } |
| 3610 | pReqMsg->ap[i].low = nla_get_s32( |
| 3611 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3612 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3613 | |
| 3614 | /* Parse and fetch high RSSI */ |
| 3615 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3616 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3617 | goto fail; |
| 3618 | } |
| 3619 | pReqMsg->ap[i].high = nla_get_s32( |
| 3620 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3621 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"), |
| 3622 | pReqMsg->ap[i].high); |
| 3623 | |
| 3624 | /* Parse and fetch channel */ |
| 3625 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3626 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3627 | goto fail; |
| 3628 | } |
| 3629 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3630 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3631 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3632 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3633 | i++; |
| 3634 | } |
| 3635 | status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg); |
| 3636 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3637 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3638 | FL("sme_SetBssHotlist failed(err=%d)"), status); |
| 3639 | vos_mem_free(pReqMsg); |
| 3640 | return -EINVAL; |
| 3641 | } |
| 3642 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3643 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3644 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3645 | return 0; |
| 3646 | |
| 3647 | fail: |
| 3648 | vos_mem_free(pReqMsg); |
| 3649 | return -EINVAL; |
| 3650 | } |
| 3651 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3652 | static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
| 3653 | struct wireless_dev *wdev, |
| 3654 | const void *data, int dataLen) |
| 3655 | { |
| 3656 | int ret = 0; |
| 3657 | |
| 3658 | vos_ssr_protect(__func__); |
| 3659 | ret = __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(wiphy, wdev, data, |
| 3660 | dataLen); |
| 3661 | vos_ssr_unprotect(__func__); |
| 3662 | |
| 3663 | return ret; |
| 3664 | } |
| 3665 | |
| 3666 | static int __wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3667 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3668 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3669 | { |
| 3670 | tpSirEXTScanSetSignificantChangeReqParams pReqMsg = NULL; |
| 3671 | struct net_device *dev = wdev->netdev; |
| 3672 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3673 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3674 | struct nlattr |
| 3675 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3676 | struct nlattr |
| 3677 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3678 | struct nlattr *apTh; |
| 3679 | eHalStatus status; |
| 3680 | int i = 0; |
| 3681 | int rem; |
| 3682 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3683 | ENTER(); |
| 3684 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3685 | status = wlan_hdd_validate_context(pHddCtx); |
| 3686 | if (0 != status) |
| 3687 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3688 | return -EINVAL; |
| 3689 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3690 | /* check the EXTScan Capability */ |
| 3691 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3692 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3693 | { |
| 3694 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3695 | FL("EXTScan not enabled/supported by Firmware")); |
| 3696 | return -EINVAL; |
| 3697 | } |
| 3698 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3699 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3700 | data, dataLen, |
| 3701 | wlan_hdd_extscan_config_policy)) { |
| 3702 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3703 | return -EINVAL; |
| 3704 | } |
| 3705 | |
| 3706 | /* Parse and fetch request Id */ |
| 3707 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3708 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3709 | return -EINVAL; |
| 3710 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3711 | pReqMsg = (tpSirEXTScanSetSignificantChangeReqParams) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3712 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3713 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3714 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3715 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3716 | } |
| 3717 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3718 | |
| 3719 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3720 | pReqMsg->requestId = nla_get_u32( |
| 3721 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3722 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3723 | |
| 3724 | /* Parse and fetch RSSI sample size */ |
| 3725 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]) |
| 3726 | { |
| 3727 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr RSSI sample size failed")); |
| 3728 | goto fail; |
| 3729 | } |
| 3730 | pReqMsg->rssiSampleSize = nla_get_u32( |
| 3731 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]); |
| 3732 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3733 | FL("RSSI sample size (%u)"), pReqMsg->rssiSampleSize); |
| 3734 | |
| 3735 | /* Parse and fetch lost AP sample size */ |
| 3736 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]) |
| 3737 | { |
| 3738 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr lost AP sample size failed")); |
| 3739 | goto fail; |
| 3740 | } |
| 3741 | pReqMsg->lostApSampleSize = nla_get_u32( |
| 3742 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]); |
| 3743 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3744 | FL("Lost AP sample size (%u)"), pReqMsg->lostApSampleSize); |
| 3745 | /* Parse and fetch minimum Breaching */ |
| 3746 | if (!tb |
| 3747 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]) { |
| 3748 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr minBreaching failed")); |
| 3749 | goto fail; |
| 3750 | } |
| 3751 | pReqMsg->minBreaching = nla_get_u32( |
| 3752 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]); |
| 3753 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Breaching (%d)"), pReqMsg->minBreaching); |
| 3754 | |
| 3755 | /* Parse and fetch number of APs */ |
| 3756 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]) { |
| 3757 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3758 | goto fail; |
| 3759 | } |
| 3760 | pReqMsg->numAp = nla_get_u32( |
| 3761 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]); |
| 3762 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3763 | |
| 3764 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3765 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3766 | |
| 3767 | nla_for_each_nested(apTh, |
| 3768 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3769 | if(nla_parse(tb2, |
| 3770 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3771 | nla_data(apTh), nla_len(apTh), |
| 3772 | NULL)) { |
| 3773 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3774 | goto fail; |
| 3775 | } |
| 3776 | |
| 3777 | /* Parse and fetch MAC address */ |
| 3778 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3779 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3780 | goto fail; |
| 3781 | } |
| 3782 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3783 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3784 | sizeof(tSirMacAddr)); |
| 3785 | |
| 3786 | /* Parse and fetch low RSSI */ |
| 3787 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3788 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3789 | goto fail; |
| 3790 | } |
| 3791 | pReqMsg->ap[i].low = nla_get_s32( |
| 3792 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3793 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3794 | |
| 3795 | /* Parse and fetch high RSSI */ |
| 3796 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3797 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3798 | goto fail; |
| 3799 | } |
| 3800 | pReqMsg->ap[i].high = nla_get_s32( |
| 3801 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3802 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3803 | FL("RSSI High (%d)"), pReqMsg->ap[i].high); |
| 3804 | |
| 3805 | /* Parse and fetch channel */ |
| 3806 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3807 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3808 | goto fail; |
| 3809 | } |
| 3810 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3811 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3812 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3813 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3814 | i++; |
| 3815 | } |
| 3816 | |
| 3817 | status = sme_SetSignificantChange(pHddCtx->hHal, pReqMsg); |
| 3818 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3819 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3820 | FL("sme_SetSignificantChange failed(err=%d)"), status); |
| 3821 | vos_mem_free(pReqMsg); |
| 3822 | return -EINVAL; |
| 3823 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3824 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3825 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3826 | return 0; |
| 3827 | |
| 3828 | fail: |
| 3829 | vos_mem_free(pReqMsg); |
| 3830 | return -EINVAL; |
| 3831 | } |
| 3832 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3833 | static int wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
| 3834 | struct wireless_dev *wdev, |
| 3835 | const void *data, int dataLen) |
| 3836 | { |
| 3837 | int ret = 0; |
| 3838 | |
| 3839 | vos_ssr_protect(__func__); |
| 3840 | ret = __wlan_hdd_cfg80211_extscan_set_significant_change(wiphy, wdev, data, |
| 3841 | dataLen); |
| 3842 | vos_ssr_unprotect(__func__); |
| 3843 | |
| 3844 | return ret; |
| 3845 | } |
| 3846 | |
| 3847 | static int __wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3848 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3849 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3850 | { |
| 3851 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3852 | tANI_U32 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 3853 | tANI_U8 numChannels = 0; |
| 3854 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3855 | tANI_U32 requestId; |
| 3856 | tWifiBand wifiBand; |
| 3857 | eHalStatus status; |
| 3858 | struct sk_buff *replySkb; |
| 3859 | tANI_U8 i; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3860 | int ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3861 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3862 | ENTER(); |
| 3863 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3864 | status = wlan_hdd_validate_context(pHddCtx); |
| 3865 | if (0 != status) |
| 3866 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3867 | return -EINVAL; |
| 3868 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3869 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3870 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3871 | data, dataLen, |
| 3872 | wlan_hdd_extscan_config_policy)) { |
| 3873 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3874 | return -EINVAL; |
| 3875 | } |
| 3876 | |
| 3877 | /* Parse and fetch request Id */ |
| 3878 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3879 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3880 | return -EINVAL; |
| 3881 | } |
| 3882 | requestId = nla_get_u32( |
| 3883 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3884 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); |
| 3885 | |
| 3886 | /* Parse and fetch wifi band */ |
| 3887 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) |
| 3888 | { |
| 3889 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3890 | return -EINVAL; |
| 3891 | } |
| 3892 | wifiBand = nla_get_u32( |
| 3893 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); |
| 3894 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); |
| 3895 | |
| 3896 | status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), |
| 3897 | wifiBand, ChannelList, |
| 3898 | &numChannels); |
| 3899 | if (eHAL_STATUS_SUCCESS != status) { |
| 3900 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3901 | FL("sme_GetValidChannelsByBand failed (err=%d)"), status); |
| 3902 | return -EINVAL; |
| 3903 | } |
| 3904 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of channels (%d)"), numChannels); |
| 3905 | for (i = 0; i < numChannels; i++) |
| 3906 | hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %u ", ChannelList[i]); |
| 3907 | |
| 3908 | replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 3909 | sizeof(u32) * numChannels + |
| 3910 | NLMSG_HDRLEN); |
| 3911 | |
| 3912 | if (!replySkb) { |
| 3913 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3914 | FL("valid channels: buffer alloc fail")); |
| 3915 | return -EINVAL; |
| 3916 | } |
| 3917 | if (nla_put_u32(replySkb, |
| 3918 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS, |
| 3919 | numChannels) || |
| 3920 | nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS, |
| 3921 | sizeof(u32) * numChannels, ChannelList)) { |
| 3922 | |
| 3923 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3924 | kfree_skb(replySkb); |
| 3925 | return -EINVAL; |
| 3926 | } |
| 3927 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3928 | ret = cfg80211_vendor_cmd_reply(replySkb); |
| 3929 | |
| 3930 | EXIT(); |
| 3931 | return ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3932 | } |
| 3933 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3934 | static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
| 3935 | struct wireless_dev *wdev, |
| 3936 | const void *data, int dataLen) |
| 3937 | { |
| 3938 | int ret = 0; |
| 3939 | |
| 3940 | vos_ssr_protect(__func__); |
| 3941 | ret = __wlan_hdd_cfg80211_extscan_get_valid_channels(wiphy, wdev, data, |
| 3942 | dataLen); |
| 3943 | vos_ssr_unprotect(__func__); |
| 3944 | |
| 3945 | return ret; |
| 3946 | } |
| 3947 | |
| 3948 | static int __wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3949 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3950 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3951 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3952 | tpSirEXTScanStartReqParams pReqMsg = NULL; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3953 | struct net_device *dev = wdev->netdev; |
| 3954 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3955 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3956 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3957 | struct nlattr *bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3958 | struct nlattr *channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3959 | struct nlattr *buckets; |
| 3960 | struct nlattr *channels; |
| 3961 | int rem1; |
| 3962 | int rem2; |
| 3963 | eHalStatus status; |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3964 | tANI_U32 j = 0, index = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3965 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3966 | ENTER(); |
| 3967 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3968 | status = wlan_hdd_validate_context(pHddCtx); |
| 3969 | if (0 != status) |
| 3970 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3971 | return -EINVAL; |
| 3972 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3973 | /* check the EXTScan Capability */ |
| 3974 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3975 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3976 | { |
| 3977 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3978 | FL("EXTScan not enabled/supported by Firmware")); |
| 3979 | return -EINVAL; |
| 3980 | } |
| 3981 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3982 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3983 | data, dataLen, |
| 3984 | wlan_hdd_extscan_config_policy)) { |
| 3985 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3986 | return -EINVAL; |
| 3987 | } |
| 3988 | |
| 3989 | /* Parse and fetch request Id */ |
| 3990 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3991 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3992 | return -EINVAL; |
| 3993 | } |
| 3994 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3995 | pReqMsg = (tpSirEXTScanStartReqParams) |
| 3996 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3997 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3998 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3999 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4000 | } |
| 4001 | |
| 4002 | pReqMsg->requestId = nla_get_u32( |
| 4003 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 4004 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 4005 | |
| 4006 | pReqMsg->sessionId = pAdapter->sessionId; |
| 4007 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 4008 | |
| 4009 | /* Parse and fetch base period */ |
| 4010 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]) { |
| 4011 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed")); |
| 4012 | goto fail; |
| 4013 | } |
| 4014 | pReqMsg->basePeriod = nla_get_u32( |
| 4015 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]); |
| 4016 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"), |
| 4017 | pReqMsg->basePeriod); |
| 4018 | |
| 4019 | /* Parse and fetch max AP per scan */ |
| 4020 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]) { |
| 4021 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed")); |
| 4022 | goto fail; |
| 4023 | } |
| 4024 | pReqMsg->maxAPperScan = nla_get_u32( |
| 4025 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]); |
| 4026 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"), |
| 4027 | pReqMsg->maxAPperScan); |
| 4028 | |
| 4029 | /* Parse and fetch report threshold */ |
| 4030 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]) { |
| 4031 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed")); |
| 4032 | goto fail; |
| 4033 | } |
| 4034 | pReqMsg->reportThreshold = nla_get_u8( |
| 4035 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]); |
| 4036 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"), |
| 4037 | pReqMsg->reportThreshold); |
| 4038 | |
| 4039 | /* Parse and fetch number of buckets */ |
| 4040 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]) { |
| 4041 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed")); |
| 4042 | goto fail; |
| 4043 | } |
| 4044 | pReqMsg->numBuckets = nla_get_u8( |
| 4045 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]); |
| 4046 | if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) { |
| 4047 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets " |
| 4048 | "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS); |
| 4049 | pReqMsg->numBuckets = WLAN_EXTSCAN_MAX_BUCKETS; |
| 4050 | } |
| 4051 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"), |
| 4052 | pReqMsg->numBuckets); |
| 4053 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) { |
| 4054 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed")); |
| 4055 | goto fail; |
| 4056 | } |
| 4057 | |
| 4058 | nla_for_each_nested(buckets, |
| 4059 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) { |
| 4060 | if(nla_parse(bucket, |
| 4061 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4062 | nla_data(buckets), nla_len(buckets), NULL)) { //policy |
| 4063 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 4064 | goto fail; |
| 4065 | } |
| 4066 | |
| 4067 | /* Parse and fetch bucket spec */ |
| 4068 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) { |
| 4069 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket index failed")); |
| 4070 | goto fail; |
| 4071 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4072 | |
| 4073 | pReqMsg->buckets[index].bucket = nla_get_u8( |
| 4074 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]); |
| 4075 | |
| 4076 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bucket spec Index (%d)"), |
| 4077 | pReqMsg->buckets[index].bucket); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4078 | |
| 4079 | /* Parse and fetch wifi band */ |
| 4080 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) { |
| 4081 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 4082 | goto fail; |
| 4083 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4084 | pReqMsg->buckets[index].band = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4085 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]); |
| 4086 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4087 | pReqMsg->buckets[index].band); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4088 | |
| 4089 | /* Parse and fetch period */ |
| 4090 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) { |
| 4091 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr period failed")); |
| 4092 | goto fail; |
| 4093 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4094 | pReqMsg->buckets[index].period = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4095 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]); |
| 4096 | hddLog(VOS_TRACE_LEVEL_INFO, FL("period (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4097 | pReqMsg->buckets[index].period); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4098 | |
| 4099 | /* Parse and fetch report events */ |
| 4100 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) { |
| 4101 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report events failed")); |
| 4102 | goto fail; |
| 4103 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4104 | pReqMsg->buckets[index].reportEvents = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4105 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]); |
| 4106 | hddLog(VOS_TRACE_LEVEL_INFO, FL("report events (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4107 | pReqMsg->buckets[index].reportEvents); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4108 | |
| 4109 | /* Parse and fetch number of channels */ |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4110 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) |
| 4111 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4112 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr num channels failed")); |
| 4113 | goto fail; |
| 4114 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4115 | pReqMsg->buckets[index].numChannels = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4116 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]); |
| 4117 | hddLog(VOS_TRACE_LEVEL_INFO, FL("num channels (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4118 | pReqMsg->buckets[index].numChannels); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4119 | |
| 4120 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) { |
| 4121 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel spec failed")); |
| 4122 | goto fail; |
| 4123 | } |
| 4124 | |
| 4125 | j = 0; |
| 4126 | nla_for_each_nested(channels, |
| 4127 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) { |
| 4128 | if(nla_parse(channel, |
| 4129 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4130 | nla_data(channels), nla_len(channels), |
| 4131 | NULL)) { //wlan_hdd_extscan_config_policy here |
| 4132 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 4133 | goto fail; |
| 4134 | } |
| 4135 | |
| 4136 | /* Parse and fetch channel */ |
| 4137 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) { |
| 4138 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 4139 | goto fail; |
| 4140 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4141 | pReqMsg->buckets[index].channels[j].channel = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4142 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]); |
| 4143 | hddLog(VOS_TRACE_LEVEL_INFO, FL("channel (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4144 | pReqMsg->buckets[index].channels[j].channel); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4145 | |
| 4146 | /* Parse and fetch dwell time */ |
| 4147 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) { |
| 4148 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dwelltime failed")); |
| 4149 | goto fail; |
| 4150 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4151 | pReqMsg->buckets[index].channels[j].dwellTimeMs = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4152 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]); |
| 4153 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Dwell time (%u ms)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4154 | pReqMsg->buckets[index].channels[j].dwellTimeMs); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4155 | |
| 4156 | /* Parse and fetch channel spec passive */ |
| 4157 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) { |
| 4158 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4159 | FL("attr channel spec passive failed")); |
| 4160 | goto fail; |
| 4161 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4162 | pReqMsg->buckets[index].channels[j].passive = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4163 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]); |
| 4164 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Chnl spec passive (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4165 | pReqMsg->buckets[index].channels[j].passive); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4166 | j++; |
| 4167 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4168 | index++; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4169 | } |
| 4170 | status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg); |
| 4171 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4172 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4173 | FL("sme_EXTScanStart failed(err=%d)"), status); |
| 4174 | vos_mem_free(pReqMsg); |
| 4175 | return -EINVAL; |
| 4176 | } |
| 4177 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4178 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4179 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4180 | return 0; |
| 4181 | |
| 4182 | fail: |
| 4183 | vos_mem_free(pReqMsg); |
| 4184 | return -EINVAL; |
| 4185 | } |
| 4186 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4187 | static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
| 4188 | struct wireless_dev *wdev, |
| 4189 | const void *data, int dataLen) |
| 4190 | { |
| 4191 | int ret = 0; |
| 4192 | |
| 4193 | vos_ssr_protect(__func__); |
| 4194 | ret = __wlan_hdd_cfg80211_extscan_start(wiphy, wdev, data, dataLen); |
| 4195 | vos_ssr_unprotect(__func__); |
| 4196 | |
| 4197 | return ret; |
| 4198 | } |
| 4199 | |
| 4200 | static int __wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4201 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4202 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4203 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4204 | tSirEXTScanStopReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4205 | struct net_device *dev = wdev->netdev; |
| 4206 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4207 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4208 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4209 | eHalStatus status; |
| 4210 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4211 | ENTER(); |
| 4212 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4213 | status = wlan_hdd_validate_context(pHddCtx); |
| 4214 | if (0 != status) |
| 4215 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4216 | return -EINVAL; |
| 4217 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4218 | /* check the EXTScan Capability */ |
| 4219 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4220 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4221 | { |
| 4222 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4223 | FL("EXTScan not enabled/supported by Firmware")); |
| 4224 | return -EINVAL; |
| 4225 | } |
| 4226 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4227 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4228 | data, dataLen, |
| 4229 | wlan_hdd_extscan_config_policy)) { |
| 4230 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4231 | return -EINVAL; |
| 4232 | } |
| 4233 | |
| 4234 | /* Parse and fetch request Id */ |
| 4235 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4236 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4237 | return -EINVAL; |
| 4238 | } |
| 4239 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4240 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4241 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4242 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4243 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4244 | reqMsg.sessionId = pAdapter->sessionId; |
| 4245 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4246 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4247 | status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4248 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4249 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4250 | FL("sme_EXTScanStop failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4251 | return -EINVAL; |
| 4252 | } |
| 4253 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4254 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4255 | return 0; |
| 4256 | } |
| 4257 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4258 | static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
| 4259 | struct wireless_dev *wdev, |
| 4260 | const void *data, int dataLen) |
| 4261 | { |
| 4262 | int ret = 0; |
| 4263 | |
| 4264 | vos_ssr_protect(__func__); |
| 4265 | ret = __wlan_hdd_cfg80211_extscan_stop(wiphy, wdev, data, dataLen); |
| 4266 | vos_ssr_unprotect(__func__); |
| 4267 | |
| 4268 | return ret; |
| 4269 | } |
| 4270 | |
| 4271 | static int __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4272 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4273 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4274 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4275 | tSirEXTScanResetBssidHotlistReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4276 | struct net_device *dev = wdev->netdev; |
| 4277 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4278 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4279 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4280 | eHalStatus status; |
| 4281 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4282 | ENTER(); |
| 4283 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4284 | status = wlan_hdd_validate_context(pHddCtx); |
| 4285 | if (0 != status) |
| 4286 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4287 | return -EINVAL; |
| 4288 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4289 | /* check the EXTScan Capability */ |
| 4290 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4291 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4292 | { |
| 4293 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4294 | FL("EXTScan not enabled/supported by Firmware")); |
| 4295 | return -EINVAL; |
| 4296 | } |
| 4297 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4298 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4299 | data, dataLen, |
| 4300 | wlan_hdd_extscan_config_policy)) { |
| 4301 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4302 | return -EINVAL; |
| 4303 | } |
| 4304 | |
| 4305 | /* Parse and fetch request Id */ |
| 4306 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4307 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4308 | return -EINVAL; |
| 4309 | } |
| 4310 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4311 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4312 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4313 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4314 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4315 | reqMsg.sessionId = pAdapter->sessionId; |
| 4316 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4317 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4318 | status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4319 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4320 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4321 | FL("sme_ResetBssHotlist failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4322 | return -EINVAL; |
| 4323 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4324 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4325 | return 0; |
| 4326 | } |
| 4327 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4328 | static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
| 4329 | struct wireless_dev *wdev, |
| 4330 | const void *data, int dataLen) |
| 4331 | { |
| 4332 | int ret = 0; |
| 4333 | |
| 4334 | vos_ssr_protect(__func__); |
| 4335 | ret = __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(wiphy, wdev, data, dataLen); |
| 4336 | vos_ssr_unprotect(__func__); |
| 4337 | |
| 4338 | return ret; |
| 4339 | } |
| 4340 | |
| 4341 | static int __wlan_hdd_cfg80211_extscan_reset_significant_change( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4342 | struct wiphy *wiphy, |
| 4343 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4344 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4345 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4346 | tSirEXTScanResetSignificantChangeReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4347 | struct net_device *dev = wdev->netdev; |
| 4348 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4349 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4350 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4351 | eHalStatus status; |
| 4352 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4353 | ENTER(); |
| 4354 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4355 | status = wlan_hdd_validate_context(pHddCtx); |
| 4356 | if (0 != status) |
| 4357 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4358 | return -EINVAL; |
| 4359 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4360 | /* check the EXTScan Capability */ |
| 4361 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4362 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4363 | { |
| 4364 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4365 | FL("EXTScan not enabled/supported by Firmware")); |
| 4366 | return -EINVAL; |
| 4367 | } |
| 4368 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4369 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4370 | data, dataLen, |
| 4371 | wlan_hdd_extscan_config_policy)) { |
| 4372 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4373 | return -EINVAL; |
| 4374 | } |
| 4375 | |
| 4376 | /* Parse and fetch request Id */ |
| 4377 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4378 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4379 | return -EINVAL; |
| 4380 | } |
| 4381 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4382 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4383 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4384 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4385 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4386 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4387 | reqMsg.sessionId = pAdapter->sessionId; |
| 4388 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4389 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4390 | status = sme_ResetSignificantChange(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4391 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4392 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4393 | FL("sme_ResetSignificantChange failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4394 | return -EINVAL; |
| 4395 | } |
| 4396 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4397 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4398 | return 0; |
| 4399 | } |
| 4400 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4401 | static int wlan_hdd_cfg80211_extscan_reset_significant_change( |
| 4402 | struct wiphy *wiphy, |
| 4403 | struct wireless_dev *wdev, |
| 4404 | const void *data, int dataLen) |
| 4405 | { |
| 4406 | int ret = 0; |
| 4407 | |
| 4408 | vos_ssr_protect(__func__); |
| 4409 | ret = __wlan_hdd_cfg80211_extscan_reset_significant_change(wiphy, |
| 4410 | wdev, data, |
| 4411 | dataLen); |
| 4412 | vos_ssr_unprotect(__func__); |
| 4413 | |
| 4414 | return ret; |
| 4415 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4416 | #endif /* WLAN_FEATURE_EXTSCAN */ |
| 4417 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4418 | /*EXT TDLS*/ |
| 4419 | static const struct nla_policy |
| 4420 | wlan_hdd_tdls_config_enable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX +1] = |
| 4421 | { |
| 4422 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4423 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL] = {.type = NLA_S32 }, |
| 4424 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS] = |
| 4425 | {.type = NLA_S32 }, |
| 4426 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS] = {.type = NLA_S32 }, |
| 4427 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS] = {.type = NLA_S32 }, |
| 4428 | |
| 4429 | }; |
| 4430 | |
| 4431 | static const struct nla_policy |
| 4432 | wlan_hdd_tdls_config_disable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX +1] = |
| 4433 | { |
| 4434 | [QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4435 | |
| 4436 | }; |
| 4437 | |
| 4438 | static const struct nla_policy |
| 4439 | wlan_hdd_tdls_config_state_change_policy[ |
| 4440 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAX +1] = |
| 4441 | { |
| 4442 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4443 | [QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE] = {.type = NLA_S32 }, |
| 4444 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4445 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL] = {.type = NLA_S32 }, |
| 4446 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS] = |
| 4447 | {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4448 | |
| 4449 | }; |
| 4450 | |
| 4451 | static const struct nla_policy |
| 4452 | wlan_hdd_tdls_config_get_status_policy[ |
| 4453 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX +1] = |
| 4454 | { |
| 4455 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4456 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE] = {.type = NLA_S32 }, |
| 4457 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4458 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL] = {.type = NLA_S32 }, |
| 4459 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS] |
| 4460 | = {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4461 | |
| 4462 | }; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4463 | |
| 4464 | static const struct nla_policy |
| 4465 | wlan_hdd_mac_config[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX+1] = |
| 4466 | { |
| 4467 | [QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI] = {.type = NLA_UNSPEC }, |
| 4468 | }; |
| 4469 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4470 | static int __wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4471 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4472 | const void *data, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4473 | int data_len) |
| 4474 | { |
| 4475 | |
| 4476 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4477 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX + 1]; |
| 4478 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4479 | ENTER(); |
| 4480 | |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4481 | if (0 != wlan_hdd_validate_context(pHddCtx)){ |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4482 | return -EINVAL; |
| 4483 | } |
| 4484 | if (FALSE == pHddCtx->cfg_ini->enableMacSpoofing) { |
| 4485 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN disabled in ini")); |
| 4486 | return -ENOTSUPP; |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4487 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4488 | if (TRUE != sme_IsFeatureSupportedByFW(MAC_SPOOFED_SCAN)){ |
| 4489 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN not supported by FW")); |
| 4490 | return -ENOTSUPP; |
| 4491 | } |
| 4492 | |
| 4493 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX, |
| 4494 | data, data_len, wlan_hdd_mac_config)) { |
| 4495 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4496 | return -EINVAL; |
| 4497 | } |
| 4498 | |
| 4499 | /* Parse and fetch mac address */ |
| 4500 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]) { |
| 4501 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4502 | return -EINVAL; |
| 4503 | } |
| 4504 | |
| 4505 | memcpy(pHddCtx->spoofMacAddr.randomMacAddr.bytes, nla_data( |
| 4506 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4507 | VOS_MAC_ADDR_LAST_3_BYTES); |
| 4508 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4509 | pHddCtx->spoofMacAddr.isEnabled = TRUE; |
| 4510 | |
| 4511 | 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] | 4512 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4513 | VOS_MAC_ADDR_FIRST_3_BYTES); |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4514 | if ((pHddCtx->spoofMacAddr.randomMacAddr.bytes[0] == 0) && |
| 4515 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[1] == 0) && |
| 4516 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[2] == 0)) |
| 4517 | { |
| 4518 | hddLog(LOG1, FL("ZERO MAC OUI Recieved. Disabling Spoofing")); |
| 4519 | vos_mem_zero(pHddCtx->spoofMacAddr.randomMacAddr.bytes, |
| 4520 | VOS_MAC_ADDRESS_LEN); |
| 4521 | pHddCtx->spoofMacAddr.isEnabled = FALSE; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4522 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4523 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4524 | if (VOS_STATUS_SUCCESS != hdd_processSpoofMacAddrRequest(pHddCtx)) |
| 4525 | { |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4526 | hddLog(LOGE, FL("Failed to send Spoof Mac Addr to FW")); |
| 4527 | } |
| 4528 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4529 | EXIT(); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4530 | return 0; |
| 4531 | } |
| 4532 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4533 | static int wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
| 4534 | struct wireless_dev *wdev, |
| 4535 | const void *data, |
| 4536 | int data_len) |
| 4537 | { |
| 4538 | int ret = 0; |
| 4539 | |
| 4540 | vos_ssr_protect(__func__); |
| 4541 | ret = __wlan_hdd_cfg80211_set_spoofed_mac_oui(wiphy, wdev, data, data_len); |
| 4542 | vos_ssr_unprotect(__func__); |
| 4543 | |
| 4544 | return ret; |
| 4545 | } |
| 4546 | |
| 4547 | static int __wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4548 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4549 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4550 | int data_len) |
| 4551 | { |
| 4552 | u8 peer[6] = {0}; |
| 4553 | struct net_device *dev = wdev->netdev; |
| 4554 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4555 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4556 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; |
| 4557 | eHalStatus ret; |
| 4558 | tANI_S32 state; |
| 4559 | tANI_S32 reason; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4560 | tANI_S32 global_operating_class = 0; |
| 4561 | tANI_S32 channel = 0; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4562 | struct sk_buff *skb = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4563 | int retVal; |
| 4564 | |
| 4565 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4566 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4567 | if (!pAdapter) { |
| 4568 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 4569 | return -EINVAL; |
| 4570 | } |
| 4571 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4572 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4573 | if (0 != ret) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4574 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4575 | return -EINVAL; |
| 4576 | } |
| 4577 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4578 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4579 | return -ENOTSUPP; |
| 4580 | } |
| 4581 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, |
| 4582 | data, data_len, |
| 4583 | wlan_hdd_tdls_config_get_status_policy)) { |
| 4584 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4585 | return -EINVAL; |
| 4586 | } |
| 4587 | |
| 4588 | /* Parse and fetch mac address */ |
| 4589 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]) { |
| 4590 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4591 | return -EINVAL; |
| 4592 | } |
| 4593 | |
| 4594 | memcpy(peer, nla_data( |
| 4595 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]), |
| 4596 | sizeof(peer)); |
| 4597 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4598 | |
Konamki, Sreelakshmi | abb59ed | 2015-06-12 12:13:23 +0530 | [diff] [blame] | 4599 | wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4600 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4601 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4602 | 4 * sizeof(s32) + |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4603 | NLMSG_HDRLEN); |
| 4604 | |
| 4605 | if (!skb) { |
| 4606 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4607 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 4608 | return -EINVAL; |
| 4609 | } |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4610 | 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] | 4611 | reason, |
| 4612 | state, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4613 | global_operating_class, |
| 4614 | channel, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4615 | MAC_ADDR_ARRAY(peer)); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4616 | if (nla_put_s32(skb, |
| 4617 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE, |
| 4618 | state) || |
| 4619 | nla_put_s32(skb, |
| 4620 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON, |
| 4621 | reason) || |
| 4622 | nla_put_s32(skb, |
| 4623 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS, |
| 4624 | global_operating_class) || |
| 4625 | nla_put_s32(skb, |
| 4626 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL, |
| 4627 | channel)) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4628 | |
| 4629 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4630 | goto nla_put_failure; |
| 4631 | } |
| 4632 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4633 | retVal = cfg80211_vendor_cmd_reply(skb); |
| 4634 | EXIT(); |
| 4635 | return retVal; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4636 | |
| 4637 | nla_put_failure: |
| 4638 | kfree_skb(skb); |
| 4639 | return -EINVAL; |
| 4640 | } |
| 4641 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4642 | static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
| 4643 | struct wireless_dev *wdev, |
| 4644 | const void *data, |
| 4645 | int data_len) |
| 4646 | { |
| 4647 | int ret = 0; |
| 4648 | |
| 4649 | vos_ssr_protect(__func__); |
| 4650 | ret = __wlan_hdd_cfg80211_exttdls_get_status(wiphy, wdev, data, data_len); |
| 4651 | vos_ssr_unprotect(__func__); |
| 4652 | |
| 4653 | return ret; |
| 4654 | } |
| 4655 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4656 | static int wlan_hdd_cfg80211_exttdls_callback(tANI_U8* mac, |
| 4657 | tANI_S32 state, |
| 4658 | tANI_S32 reason, |
| 4659 | void *ctx) |
| 4660 | { |
| 4661 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)ctx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4662 | struct sk_buff *skb = NULL; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4663 | tANI_S32 global_operating_class = 0; |
| 4664 | tANI_S32 channel = 0; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4665 | hdd_context_t *pHddCtx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4666 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4667 | ENTER(); |
| 4668 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4669 | if (!pAdapter) { |
| 4670 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 4671 | return -EINVAL; |
| 4672 | } |
| 4673 | |
| 4674 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4675 | if (wlan_hdd_validate_context(pHddCtx)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4676 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4677 | return -EINVAL; |
| 4678 | } |
| 4679 | |
| 4680 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4681 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4682 | return -ENOTSUPP; |
| 4683 | } |
| 4684 | skb = cfg80211_vendor_event_alloc( |
| 4685 | pHddCtx->wiphy, |
| 4686 | EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 4687 | QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX, |
| 4688 | GFP_KERNEL); |
| 4689 | |
| 4690 | if (!skb) { |
| 4691 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4692 | FL("cfg80211_vendor_event_alloc failed")); |
| 4693 | return -EINVAL; |
| 4694 | } |
| 4695 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4696 | hddLog(VOS_TRACE_LEVEL_INFO, "Reason: (%d) Status: (%d) Class: (%d) Channel: (%d)", |
| 4697 | reason, |
| 4698 | state, |
| 4699 | global_operating_class, |
| 4700 | channel); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4701 | hddLog(VOS_TRACE_LEVEL_WARN, "tdls peer " MAC_ADDRESS_STR, |
| 4702 | MAC_ADDR_ARRAY(mac)); |
| 4703 | |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4704 | if (nla_put(skb, |
| 4705 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR, |
| 4706 | VOS_MAC_ADDR_SIZE, mac) || |
| 4707 | nla_put_s32(skb, |
| 4708 | QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE, |
| 4709 | state) || |
| 4710 | nla_put_s32(skb, |
| 4711 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON, |
| 4712 | reason) || |
| 4713 | nla_put_s32(skb, |
| 4714 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL, |
| 4715 | channel) || |
| 4716 | nla_put_s32(skb, |
| 4717 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS, |
| 4718 | global_operating_class) |
| 4719 | ) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4720 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4721 | goto nla_put_failure; |
| 4722 | } |
| 4723 | |
| 4724 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4725 | EXIT(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4726 | return (0); |
| 4727 | |
| 4728 | nla_put_failure: |
| 4729 | kfree_skb(skb); |
| 4730 | return -EINVAL; |
| 4731 | } |
| 4732 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4733 | static int __wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4734 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4735 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4736 | int data_len) |
| 4737 | { |
| 4738 | u8 peer[6] = {0}; |
| 4739 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4740 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4741 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1]; |
| 4742 | eHalStatus status; |
| 4743 | tdls_req_params_t pReqMsg = {0}; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4744 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4745 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4746 | |
| 4747 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4748 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4749 | if (!dev) { |
| 4750 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 4751 | return -EINVAL; |
| 4752 | } |
| 4753 | |
| 4754 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4755 | if (!pAdapter) { |
| 4756 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 4757 | return -EINVAL; |
| 4758 | } |
| 4759 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4760 | status = wlan_hdd_validate_context(pHddCtx); |
| 4761 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4762 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4763 | return -EINVAL; |
| 4764 | } |
| 4765 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4766 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4767 | return -ENOTSUPP; |
| 4768 | } |
| 4769 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX, |
| 4770 | data, data_len, |
| 4771 | wlan_hdd_tdls_config_enable_policy)) { |
| 4772 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4773 | return -EINVAL; |
| 4774 | } |
| 4775 | |
| 4776 | /* Parse and fetch mac address */ |
| 4777 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]) { |
| 4778 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4779 | return -EINVAL; |
| 4780 | } |
| 4781 | |
| 4782 | memcpy(peer, nla_data( |
| 4783 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]), |
| 4784 | sizeof(peer)); |
| 4785 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4786 | |
| 4787 | /* Parse and fetch channel */ |
| 4788 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]) { |
| 4789 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 4790 | return -EINVAL; |
| 4791 | } |
| 4792 | pReqMsg.channel = nla_get_s32( |
| 4793 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]); |
| 4794 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Channel Num (%d)"), pReqMsg.channel); |
| 4795 | |
| 4796 | /* Parse and fetch global operating class */ |
| 4797 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]) { |
| 4798 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr operating class failed")); |
| 4799 | return -EINVAL; |
| 4800 | } |
| 4801 | pReqMsg.global_operating_class = nla_get_s32( |
| 4802 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]); |
| 4803 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Operating class (%d)"), |
| 4804 | pReqMsg.global_operating_class); |
| 4805 | |
| 4806 | /* Parse and fetch latency ms */ |
| 4807 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]) { |
| 4808 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr latency failed")); |
| 4809 | return -EINVAL; |
| 4810 | } |
| 4811 | pReqMsg.max_latency_ms = nla_get_s32( |
| 4812 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]); |
| 4813 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Latency (%d)"), |
| 4814 | pReqMsg.max_latency_ms); |
| 4815 | |
| 4816 | /* Parse and fetch required bandwidth kbps */ |
| 4817 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]) { |
| 4818 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bandwidth failed")); |
| 4819 | return -EINVAL; |
| 4820 | } |
| 4821 | |
| 4822 | pReqMsg.min_bandwidth_kbps = nla_get_s32( |
| 4823 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]); |
| 4824 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bandwidth (%d)"), |
| 4825 | pReqMsg.min_bandwidth_kbps); |
| 4826 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4827 | ret = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4828 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 4829 | &pReqMsg, |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4830 | wlan_hdd_cfg80211_exttdls_callback); |
| 4831 | |
| 4832 | EXIT(); |
| 4833 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4834 | } |
| 4835 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4836 | static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
| 4837 | struct wireless_dev *wdev, |
| 4838 | const void *data, |
| 4839 | int data_len) |
| 4840 | { |
| 4841 | int ret = 0; |
| 4842 | |
| 4843 | vos_ssr_protect(__func__); |
| 4844 | ret = __wlan_hdd_cfg80211_exttdls_enable(wiphy, wdev, data, data_len); |
| 4845 | vos_ssr_unprotect(__func__); |
| 4846 | |
| 4847 | return ret; |
| 4848 | } |
| 4849 | |
| 4850 | static int __wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4851 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4852 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4853 | int data_len) |
| 4854 | { |
| 4855 | u8 peer[6] = {0}; |
| 4856 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4857 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4858 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1]; |
| 4859 | eHalStatus status; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4860 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4861 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4862 | |
| 4863 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4864 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4865 | if (!dev) { |
| 4866 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 4867 | return -EINVAL; |
| 4868 | } |
| 4869 | |
| 4870 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4871 | if (!pAdapter) { |
| 4872 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 4873 | return -EINVAL; |
| 4874 | } |
| 4875 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4876 | status = wlan_hdd_validate_context(pHddCtx); |
| 4877 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4878 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4879 | return -EINVAL; |
| 4880 | } |
| 4881 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4882 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4883 | return -ENOTSUPP; |
| 4884 | } |
| 4885 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX, |
| 4886 | data, data_len, |
| 4887 | wlan_hdd_tdls_config_disable_policy)) { |
| 4888 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4889 | return -EINVAL; |
| 4890 | } |
| 4891 | /* Parse and fetch mac address */ |
| 4892 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]) { |
| 4893 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4894 | return -EINVAL; |
| 4895 | } |
| 4896 | |
| 4897 | memcpy(peer, nla_data( |
| 4898 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]), |
| 4899 | sizeof(peer)); |
| 4900 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4901 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4902 | ret = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
| 4903 | |
| 4904 | EXIT(); |
| 4905 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4906 | } |
| 4907 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4908 | static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
| 4909 | struct wireless_dev *wdev, |
| 4910 | const void *data, |
| 4911 | int data_len) |
| 4912 | { |
| 4913 | int ret = 0; |
| 4914 | |
| 4915 | vos_ssr_protect(__func__); |
| 4916 | ret = __wlan_hdd_cfg80211_exttdls_disable(wiphy, wdev, data, data_len); |
| 4917 | vos_ssr_unprotect(__func__); |
| 4918 | |
| 4919 | return ret; |
| 4920 | } |
| 4921 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4922 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4923 | __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4924 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4925 | const void *data, int data_len) |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4926 | { |
| 4927 | struct net_device *dev = wdev->netdev; |
| 4928 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4929 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4930 | struct sk_buff *skb = NULL; |
| 4931 | tANI_U32 fset = 0; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4932 | int ret = 0; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4933 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4934 | ENTER(); |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4935 | |
| 4936 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4937 | if (0 != ret) |
| 4938 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4939 | return ret; |
| 4940 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4941 | if (wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { |
| 4942 | hddLog(LOG1, FL("Infra Station mode is supported by driver")); |
| 4943 | fset |= WIFI_FEATURE_INFRA; |
| 4944 | } |
| 4945 | |
| 4946 | if (TRUE == hdd_is_5g_supported(pHddCtx)) { |
| 4947 | hddLog(LOG1, FL("INFRA_5G is supported by firmware")); |
| 4948 | fset |= WIFI_FEATURE_INFRA_5G; |
| 4949 | } |
| 4950 | |
| 4951 | #ifdef WLAN_FEATURE_P2P |
| 4952 | if ((wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) && |
| 4953 | (wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_GO))) { |
| 4954 | hddLog(LOG1, FL("WiFi-Direct is supported by driver")); |
| 4955 | fset |= WIFI_FEATURE_P2P; |
| 4956 | } |
| 4957 | #endif |
| 4958 | |
| 4959 | /* Soft-AP is supported currently by default */ |
| 4960 | fset |= WIFI_FEATURE_SOFT_AP; |
| 4961 | |
Kanchanapally, Vidyullatha | 683aed0 | 2015-03-24 16:58:38 +0530 | [diff] [blame] | 4962 | /* HOTSPOT is a supplicant feature, enable it by default */ |
| 4963 | fset |= WIFI_FEATURE_HOTSPOT; |
| 4964 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4965 | #ifdef WLAN_FEATURE_EXTSCAN |
| 4966 | if ((TRUE == pHddCtx->cfg_ini->fEnableEXTScan) && |
| 4967 | sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) { |
| 4968 | hddLog(LOG1, FL("EXTScan is supported by firmware")); |
| 4969 | fset |= WIFI_FEATURE_EXTSCAN; |
| 4970 | } |
| 4971 | #endif |
| 4972 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4973 | if (sme_IsFeatureSupportedByFW(NAN)) { |
| 4974 | hddLog(LOG1, FL("NAN is supported by firmware")); |
| 4975 | fset |= WIFI_FEATURE_NAN; |
| 4976 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4977 | |
| 4978 | /* D2D RTT is not supported currently by default */ |
| 4979 | if (sme_IsFeatureSupportedByFW(RTT)) { |
| 4980 | hddLog(LOG1, FL("RTT is supported by firmware")); |
| 4981 | fset |= WIFI_FEATURE_D2AP_RTT; |
| 4982 | } |
| 4983 | |
| 4984 | #ifdef FEATURE_WLAN_BATCH_SCAN |
| 4985 | if (fset & WIFI_FEATURE_EXTSCAN) { |
| 4986 | hddLog(LOG1, FL("Batch scan is supported as extscan is supported")); |
| 4987 | fset &= ~WIFI_FEATURE_BATCH_SCAN; |
| 4988 | } else if (sme_IsFeatureSupportedByFW(BATCH_SCAN)) { |
| 4989 | hddLog(LOG1, FL("Batch scan is supported by firmware")); |
| 4990 | fset |= WIFI_FEATURE_BATCH_SCAN; |
| 4991 | } |
| 4992 | #endif |
| 4993 | |
| 4994 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 4995 | if (pHddCtx->cfg_ini->configPNOScanSupport && |
| 4996 | (eHAL_STATUS_SUCCESS == wlan_hdd_is_pno_allowed(pAdapter))) { |
| 4997 | hddLog(LOG1, FL("PNO is supported by firmware")); |
| 4998 | fset |= WIFI_FEATURE_PNO; |
| 4999 | } |
| 5000 | #endif |
| 5001 | |
| 5002 | /* STA+STA is supported currently by default */ |
| 5003 | fset |= WIFI_FEATURE_ADDITIONAL_STA; |
| 5004 | |
| 5005 | #ifdef FEATURE_WLAN_TDLS |
| 5006 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSSupport) && |
| 5007 | sme_IsFeatureSupportedByFW(TDLS)) { |
| 5008 | hddLog(LOG1, FL("TDLS is supported by firmware")); |
| 5009 | fset |= WIFI_FEATURE_TDLS; |
| 5010 | } |
| 5011 | |
| 5012 | /* TDLS_OFFCHANNEL is not supported currently by default */ |
| 5013 | #endif |
| 5014 | |
| 5015 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 5016 | /* AP+STA concurrency is supported currently by default */ |
| 5017 | fset |= WIFI_FEATURE_AP_STA; |
| 5018 | #endif |
| 5019 | |
| 5020 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) + |
| 5021 | NLMSG_HDRLEN); |
| 5022 | |
| 5023 | if (!skb) { |
| 5024 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 5025 | return -EINVAL; |
| 5026 | } |
| 5027 | hddLog(LOG1, FL("Supported Features : 0x%x"), fset); |
| 5028 | |
| 5029 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_FEATURE_SET, fset)) { |
| 5030 | hddLog(LOGE, FL("nla put fail")); |
| 5031 | goto nla_put_failure; |
| 5032 | } |
| 5033 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5034 | ret = cfg80211_vendor_cmd_reply(skb); |
| 5035 | EXIT(); |
| 5036 | return ret; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5037 | |
| 5038 | nla_put_failure: |
| 5039 | kfree_skb(skb); |
| 5040 | return -EINVAL; |
| 5041 | } |
| 5042 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5043 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5044 | wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
| 5045 | struct wireless_dev *wdev, |
| 5046 | const void *data, int data_len) |
| 5047 | { |
| 5048 | int ret = 0; |
| 5049 | |
| 5050 | vos_ssr_protect(__func__); |
| 5051 | ret = __wlan_hdd_cfg80211_get_supported_features(wiphy, wdev, data, data_len); |
| 5052 | vos_ssr_unprotect(__func__); |
| 5053 | |
| 5054 | return ret; |
| 5055 | } |
| 5056 | |
| 5057 | static int |
| 5058 | __wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5059 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5060 | const void *data, int data_len) |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5061 | { |
| 5062 | uint32_t feature_set_matrix[WLAN_HDD_MAX_FEATURE_SET] = {0}; |
| 5063 | uint8_t i, feature_sets, max_feature_sets; |
| 5064 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX + 1]; |
| 5065 | struct sk_buff *reply_skb; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5066 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5067 | int ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5068 | |
| 5069 | ENTER(); |
| 5070 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5071 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5072 | if (0 != ret) |
| 5073 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5074 | return ret; |
| 5075 | } |
| 5076 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5077 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX, |
| 5078 | data, data_len, NULL)) { |
| 5079 | hddLog(LOGE, FL("Invalid ATTR")); |
| 5080 | return -EINVAL; |
| 5081 | } |
| 5082 | |
| 5083 | /* Parse and fetch max feature set */ |
| 5084 | if (!tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]) { |
| 5085 | hddLog(LOGE, FL("Attr max feature set size failed")); |
| 5086 | return -EINVAL; |
| 5087 | } |
| 5088 | max_feature_sets = nla_get_u32( |
| 5089 | tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]); |
| 5090 | hddLog(LOG1, FL("Max feature set size (%d)"), max_feature_sets); |
| 5091 | |
| 5092 | /* Fill feature combination matrix */ |
| 5093 | feature_sets = 0; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5094 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5095 | WIFI_FEATURE_P2P; |
| 5096 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5097 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5098 | WIFI_FEATURE_SOFT_AP; |
| 5099 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5100 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_P2P | |
| 5101 | WIFI_FEATURE_SOFT_AP; |
| 5102 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5103 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5104 | WIFI_FEATURE_SOFT_AP | |
| 5105 | WIFI_FEATURE_P2P; |
| 5106 | |
| 5107 | /* Add more feature combinations here */ |
| 5108 | |
| 5109 | feature_sets = VOS_MIN(feature_sets, max_feature_sets); |
| 5110 | hddLog(LOG1, FL("Number of feature sets (%d)"), feature_sets); |
| 5111 | hddLog(LOG1, "Feature set matrix"); |
| 5112 | for (i = 0; i < feature_sets; i++) |
| 5113 | hddLog(LOG1, "[%d] 0x%02X", i, feature_set_matrix[i]); |
| 5114 | |
| 5115 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 5116 | sizeof(u32) * feature_sets + |
| 5117 | NLMSG_HDRLEN); |
| 5118 | |
| 5119 | if (reply_skb) { |
| 5120 | if (nla_put_u32(reply_skb, |
| 5121 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET_SIZE, |
| 5122 | feature_sets) || |
| 5123 | nla_put(reply_skb, |
| 5124 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET, |
| 5125 | sizeof(u32) * feature_sets, feature_set_matrix)) { |
| 5126 | hddLog(LOGE, FL("nla put fail")); |
| 5127 | kfree_skb(reply_skb); |
| 5128 | return -EINVAL; |
| 5129 | } |
| 5130 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5131 | ret = cfg80211_vendor_cmd_reply(reply_skb); |
| 5132 | EXIT(); |
| 5133 | return ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5134 | } |
| 5135 | hddLog(LOGE, FL("Feature set matrix: buffer alloc fail")); |
| 5136 | return -ENOMEM; |
| 5137 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5138 | } |
| 5139 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5140 | static int |
| 5141 | wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
| 5142 | struct wireless_dev *wdev, |
| 5143 | const void *data, int data_len) |
| 5144 | { |
| 5145 | int ret = 0; |
| 5146 | |
| 5147 | vos_ssr_protect(__func__); |
| 5148 | ret = __wlan_hdd_cfg80211_get_concurrency_matrix(wiphy, wdev, data, |
| 5149 | data_len); |
| 5150 | vos_ssr_unprotect(__func__); |
| 5151 | |
| 5152 | return ret; |
| 5153 | } |
| 5154 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5155 | static const struct nla_policy |
| 5156 | wlan_hdd_set_no_dfs_flag_config_policy[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX |
| 5157 | +1] = |
| 5158 | { |
| 5159 | [QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG] = {.type = NLA_U32 }, |
| 5160 | }; |
| 5161 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5162 | static int __wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5163 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5164 | const void *data, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5165 | int data_len) |
| 5166 | { |
| 5167 | struct net_device *dev = wdev->netdev; |
| 5168 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5169 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5170 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5171 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX + 1]; |
| 5172 | eHalStatus status; |
| 5173 | u32 dfsFlag = 0; |
| 5174 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5175 | ENTER(); |
| 5176 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5177 | status = wlan_hdd_validate_context(pHddCtx); |
| 5178 | if (0 != status) { |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5179 | return -EINVAL; |
| 5180 | } |
| 5181 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX, |
| 5182 | data, data_len, |
| 5183 | wlan_hdd_set_no_dfs_flag_config_policy)) { |
| 5184 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5185 | return -EINVAL; |
| 5186 | } |
| 5187 | |
| 5188 | /* Parse and fetch required bandwidth kbps */ |
| 5189 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]) { |
| 5190 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dfs flag failed")); |
| 5191 | return -EINVAL; |
| 5192 | } |
| 5193 | |
| 5194 | dfsFlag = nla_get_u32( |
| 5195 | tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]); |
| 5196 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" DFS flag (%d)"), |
| 5197 | dfsFlag); |
| 5198 | |
| 5199 | pHddCtx->disable_dfs_flag = dfsFlag; |
| 5200 | |
| 5201 | sme_disable_dfs_channel(hHal, dfsFlag); |
| 5202 | sme_FilterScanResults(hHal, pAdapter->sessionId); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5203 | |
| 5204 | EXIT(); |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5205 | return 0; |
| 5206 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5207 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5208 | static int wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
| 5209 | struct wireless_dev *wdev, |
| 5210 | const void *data, |
| 5211 | int data_len) |
| 5212 | { |
| 5213 | int ret = 0; |
| 5214 | |
| 5215 | vos_ssr_protect(__func__); |
| 5216 | ret = __wlan_hdd_cfg80211_disable_dfs_channels(wiphy, wdev, data, data_len); |
| 5217 | vos_ssr_unprotect(__func__); |
| 5218 | |
| 5219 | return ret; |
| 5220 | |
| 5221 | } |
| 5222 | |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5223 | const struct |
| 5224 | nla_policy qca_wlan_vendor_attr[QCA_WLAN_VENDOR_ATTR_MAX+1] = |
| 5225 | { |
| 5226 | [QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY] = { .type = NLA_U32 }, |
| 5227 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { .type = NLA_UNSPEC }, |
| 5228 | }; |
| 5229 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5230 | static int __wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5231 | struct wireless_dev *wdev, const void *data, int data_len) |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5232 | { |
| 5233 | |
| 5234 | u8 bssid[6] = {0}; |
| 5235 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5236 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 5237 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5238 | v_U32_t isFwrRoamEnabled = FALSE; |
| 5239 | int ret; |
| 5240 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5241 | ENTER(); |
| 5242 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5243 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5244 | if (0 != ret) { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5245 | return ret; |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5246 | } |
| 5247 | |
| 5248 | ret = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, |
| 5249 | data, data_len, |
| 5250 | qca_wlan_vendor_attr); |
| 5251 | if (ret){ |
| 5252 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5253 | return -EINVAL; |
| 5254 | } |
| 5255 | |
| 5256 | /* Parse and fetch Enable flag */ |
| 5257 | if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]) { |
| 5258 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr enable failed")); |
| 5259 | return -EINVAL; |
| 5260 | } |
| 5261 | |
| 5262 | isFwrRoamEnabled = nla_get_u32( |
| 5263 | tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]); |
| 5264 | |
| 5265 | hddLog(VOS_TRACE_LEVEL_INFO, FL("isFwrRoamEnabled (%d)"), isFwrRoamEnabled); |
| 5266 | |
| 5267 | /* Parse and fetch bssid */ |
| 5268 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 5269 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bss id failed")); |
| 5270 | return -EINVAL; |
| 5271 | } |
| 5272 | |
| 5273 | memcpy(bssid, nla_data( |
| 5274 | tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 5275 | sizeof(bssid)); |
| 5276 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(bssid)); |
| 5277 | |
| 5278 | //Update roaming |
| 5279 | status = sme_ConfigFwrRoaming((tHalHandle)(pHddCtx->hHal), isFwrRoamEnabled); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5280 | EXIT(); |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5281 | return status; |
| 5282 | } |
| 5283 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5284 | static int wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
| 5285 | struct wireless_dev *wdev, const void *data, int data_len) |
| 5286 | { |
| 5287 | int ret = 0; |
| 5288 | |
| 5289 | vos_ssr_protect(__func__); |
| 5290 | ret = __wlan_hdd_cfg80211_firmware_roaming(wiphy, wdev, data, data_len); |
| 5291 | vos_ssr_unprotect(__func__); |
| 5292 | |
| 5293 | return ret; |
| 5294 | } |
| 5295 | |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 5296 | /** |
| 5297 | * __wlan_hdd_cfg80211_setband() - set band |
| 5298 | * @wiphy: Pointer to wireless phy |
| 5299 | * @wdev: Pointer to wireless device |
| 5300 | * @data: Pointer to data |
| 5301 | * @data_len: Data length |
| 5302 | * |
| 5303 | * Return: 0 on success, negative errno on failure |
| 5304 | */ |
| 5305 | static int |
| 5306 | __wlan_hdd_cfg80211_setband(struct wiphy *wiphy, |
| 5307 | struct wireless_dev *wdev, |
| 5308 | const void *data, |
| 5309 | int data_len) |
| 5310 | { |
| 5311 | struct net_device *dev = wdev->netdev; |
| 5312 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 5313 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 5314 | int ret; |
| 5315 | static const struct nla_policy policy[QCA_WLAN_VENDOR_ATTR_MAX + 1] |
| 5316 | = {[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE] = { .type = NLA_U32 }}; |
| 5317 | |
| 5318 | ENTER(); |
| 5319 | |
| 5320 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5321 | if (0 != ret) { |
| 5322 | hddLog(LOGE, FL("HDD context is not valid")); |
| 5323 | return ret; |
| 5324 | } |
| 5325 | |
| 5326 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len, |
| 5327 | policy)) { |
| 5328 | hddLog(LOGE, FL("Invalid ATTR")); |
| 5329 | return -EINVAL; |
| 5330 | } |
| 5331 | |
| 5332 | if (!tb[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE]) { |
| 5333 | hddLog(LOGE, FL("attr QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE failed")); |
| 5334 | return -EINVAL; |
| 5335 | } |
| 5336 | |
| 5337 | return hdd_setBand(dev, |
| 5338 | nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE])); |
| 5339 | } |
| 5340 | |
| 5341 | /** |
| 5342 | * wlan_hdd_cfg80211_setband() - Wrapper to offload packets |
| 5343 | * @wiphy: wiphy structure pointer |
| 5344 | * @wdev: Wireless device structure pointer |
| 5345 | * @data: Pointer to the data received |
| 5346 | * @data_len: Length of @data |
| 5347 | * |
| 5348 | * Return: 0 on success; errno on failure |
| 5349 | */ |
| 5350 | static int wlan_hdd_cfg80211_setband(struct wiphy *wiphy, |
| 5351 | struct wireless_dev *wdev, |
| 5352 | const void *data, |
| 5353 | int data_len) |
| 5354 | { |
| 5355 | int ret = 0; |
| 5356 | |
| 5357 | vos_ssr_protect(__func__); |
| 5358 | ret = __wlan_hdd_cfg80211_setband(wiphy, |
| 5359 | wdev, data, data_len); |
| 5360 | vos_ssr_unprotect(__func__); |
| 5361 | |
| 5362 | return ret; |
| 5363 | } |
| 5364 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5365 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 5366 | { |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5367 | { |
| 5368 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5369 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAMING, |
| 5370 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5371 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5372 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5373 | .doit = wlan_hdd_cfg80211_firmware_roaming |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5374 | }, |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 5375 | |
| 5376 | { |
| 5377 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5378 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN, |
| 5379 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5380 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5381 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 5382 | .doit = wlan_hdd_cfg80211_nan_request |
| 5383 | }, |
| 5384 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5385 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5386 | { |
| 5387 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5388 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 5389 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5390 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5391 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5392 | .doit = wlan_hdd_cfg80211_ll_stats_clear |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5393 | }, |
| 5394 | |
| 5395 | { |
| 5396 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5397 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 5398 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5399 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5400 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5401 | .doit = wlan_hdd_cfg80211_ll_stats_set |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5402 | }, |
| 5403 | |
| 5404 | { |
| 5405 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5406 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 5407 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5408 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5409 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5410 | .doit = wlan_hdd_cfg80211_ll_stats_get |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5411 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5412 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5413 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5414 | { |
| 5415 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5416 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START, |
| 5417 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5418 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5419 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5420 | .doit = wlan_hdd_cfg80211_extscan_start |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5421 | }, |
| 5422 | { |
| 5423 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5424 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP, |
| 5425 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5426 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5427 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5428 | .doit = wlan_hdd_cfg80211_extscan_stop |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5429 | }, |
| 5430 | { |
| 5431 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5432 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS, |
| 5433 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5434 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5435 | .doit = wlan_hdd_cfg80211_extscan_get_valid_channels |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5436 | }, |
| 5437 | { |
| 5438 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5439 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES, |
| 5440 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5441 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5442 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5443 | .doit = wlan_hdd_cfg80211_extscan_get_capabilities |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5444 | }, |
| 5445 | { |
| 5446 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5447 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS, |
| 5448 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5449 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5450 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5451 | .doit = wlan_hdd_cfg80211_extscan_get_cached_results |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5452 | }, |
| 5453 | { |
| 5454 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5455 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST, |
| 5456 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5457 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5458 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5459 | .doit = wlan_hdd_cfg80211_extscan_set_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5460 | }, |
| 5461 | { |
| 5462 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5463 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST, |
| 5464 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5465 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5466 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5467 | .doit = wlan_hdd_cfg80211_extscan_reset_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5468 | }, |
| 5469 | { |
| 5470 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5471 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE, |
| 5472 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5473 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5474 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5475 | .doit = wlan_hdd_cfg80211_extscan_set_significant_change |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5476 | }, |
| 5477 | { |
| 5478 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5479 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE, |
| 5480 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5481 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5482 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5483 | .doit = wlan_hdd_cfg80211_extscan_reset_significant_change |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5484 | }, |
| 5485 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5486 | /*EXT TDLS*/ |
| 5487 | { |
| 5488 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5489 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE, |
| 5490 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5491 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5492 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5493 | .doit = wlan_hdd_cfg80211_exttdls_enable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5494 | }, |
| 5495 | { |
| 5496 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5497 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE, |
| 5498 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5499 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5500 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5501 | .doit = wlan_hdd_cfg80211_exttdls_disable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5502 | }, |
| 5503 | { |
| 5504 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5505 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS, |
| 5506 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5507 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5508 | .doit = wlan_hdd_cfg80211_exttdls_get_status |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5509 | }, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5510 | { |
| 5511 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5512 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES, |
| 5513 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5514 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5515 | .doit = wlan_hdd_cfg80211_get_supported_features |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5516 | }, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5517 | { |
| 5518 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5519 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG, |
| 5520 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5521 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5522 | .doit = wlan_hdd_cfg80211_disable_dfs_channels |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5523 | }, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5524 | { |
| 5525 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5526 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MAC_OUI, |
| 5527 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5528 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5529 | .doit = wlan_hdd_cfg80211_set_spoofed_mac_oui |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5530 | }, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5531 | { |
| 5532 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5533 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX, |
| 5534 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5535 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5536 | .doit = wlan_hdd_cfg80211_get_concurrency_matrix |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5537 | }, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 5538 | { |
| 5539 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5540 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SETBAND, |
| 5541 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5542 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5543 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 5544 | .doit = wlan_hdd_cfg80211_setband |
| 5545 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5546 | }; |
| 5547 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5548 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5549 | static const |
| 5550 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5551 | { |
| 5552 | #ifdef FEATURE_WLAN_CH_AVOID |
| 5553 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5554 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5555 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5556 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5557 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 5558 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5559 | { |
| 5560 | /* Index = 1*/ |
| 5561 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5562 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 5563 | }, |
| 5564 | { |
| 5565 | /* Index = 2*/ |
| 5566 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5567 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 5568 | }, |
| 5569 | { |
| 5570 | /* Index = 3*/ |
| 5571 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5572 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 5573 | }, |
| 5574 | { |
| 5575 | /* Index = 4*/ |
| 5576 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5577 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 5578 | }, |
| 5579 | { |
| 5580 | /* Index = 5*/ |
| 5581 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5582 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 5583 | }, |
| 5584 | { |
| 5585 | /* Index = 6*/ |
| 5586 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5587 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 5588 | }, |
| 5589 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5590 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5591 | { |
| 5592 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5593 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START |
| 5594 | }, |
| 5595 | { |
| 5596 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5597 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP |
| 5598 | }, |
| 5599 | { |
| 5600 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5601 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES |
| 5602 | }, |
| 5603 | { |
| 5604 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5605 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS |
| 5606 | }, |
| 5607 | { |
| 5608 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5609 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE |
| 5610 | }, |
| 5611 | { |
| 5612 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5613 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT |
| 5614 | }, |
| 5615 | { |
| 5616 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5617 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT |
| 5618 | }, |
| 5619 | { |
| 5620 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5621 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND |
| 5622 | }, |
| 5623 | { |
| 5624 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5625 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST |
| 5626 | }, |
| 5627 | { |
| 5628 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5629 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST |
| 5630 | }, |
| 5631 | { |
| 5632 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5633 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE |
| 5634 | }, |
| 5635 | { |
| 5636 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5637 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE |
| 5638 | }, |
| 5639 | { |
| 5640 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5641 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE |
| 5642 | }, |
| 5643 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5644 | /*EXT TDLS*/ |
| 5645 | { |
| 5646 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5647 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE |
| 5648 | }, |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 5649 | |
| 5650 | { |
| 5651 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5652 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN |
| 5653 | }, |
| 5654 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5655 | }; |
| 5656 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5657 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5658 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5659 | * This function is called by hdd_wlan_startup() |
| 5660 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5661 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5662 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5663 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5664 | { |
| 5665 | struct wiphy *wiphy; |
| 5666 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5667 | /* |
| 5668 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5669 | */ |
| 5670 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 5671 | |
| 5672 | if (!wiphy) |
| 5673 | { |
| 5674 | /* Print error and jump into err label and free the memory */ |
| 5675 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 5676 | return NULL; |
| 5677 | } |
| 5678 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5679 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5680 | return wiphy; |
| 5681 | } |
| 5682 | |
| 5683 | /* |
| 5684 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5685 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5686 | * private ioctl to change the band value |
| 5687 | */ |
| 5688 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 5689 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5690 | int i, j; |
| 5691 | eNVChannelEnabledType channelEnabledState; |
| 5692 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5693 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5694 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5695 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5696 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5697 | |
| 5698 | if (NULL == wiphy->bands[i]) |
| 5699 | { |
| 5700 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 5701 | __func__, i); |
| 5702 | continue; |
| 5703 | } |
| 5704 | |
| 5705 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 5706 | { |
| 5707 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 5708 | |
| 5709 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 5710 | band->channels[j].hw_value); |
| 5711 | |
| 5712 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 5713 | { |
Abhishek Singh | 678227a | 2014-11-04 10:52:38 +0530 | [diff] [blame] | 5714 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5715 | continue; |
| 5716 | } |
| 5717 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 5718 | { |
| 5719 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5720 | continue; |
| 5721 | } |
| 5722 | |
| 5723 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 5724 | NV_CHANNEL_INVALID == channelEnabledState) |
| 5725 | { |
| 5726 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5727 | } |
| 5728 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 5729 | { |
| 5730 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 5731 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 5732 | } |
| 5733 | else |
| 5734 | { |
| 5735 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 5736 | |IEEE80211_CHAN_RADAR); |
| 5737 | } |
| 5738 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5739 | } |
| 5740 | return 0; |
| 5741 | } |
| 5742 | /* |
| 5743 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5744 | * This function is called by hdd_wlan_startup() |
| 5745 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5746 | * This function is used to initialize and register wiphy structure. |
| 5747 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5748 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5749 | struct wiphy *wiphy, |
| 5750 | hdd_config_t *pCfg |
| 5751 | ) |
| 5752 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5753 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 5754 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5755 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5756 | ENTER(); |
| 5757 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5758 | /* Now bind the underlying wlan device with wiphy */ |
| 5759 | set_wiphy_dev(wiphy, dev); |
| 5760 | |
| 5761 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5762 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5763 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 5764 | /* the flag for the other case would be initialzed in |
| 5765 | vos_init_wiphy_from_nv_bin */ |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 5766 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5767 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5768 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5769 | /* This will disable updating of NL channels from passive to |
| 5770 | * active if a beacon is received on passive channel. */ |
| 5771 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Amar Singhal | f007319 | 2013-09-20 12:34:56 -0700 | [diff] [blame] | 5772 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5773 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5774 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5775 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 5776 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 5777 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 5778 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5779 | | WIPHY_FLAG_OFFCHAN_TX; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5780 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5781 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5782 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5783 | #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] | 5784 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 5785 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 5786 | || pCfg->isFastRoamIniFeatureEnabled |
| 5787 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5788 | #ifdef FEATURE_WLAN_ESE |
| 5789 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 5790 | #endif |
| 5791 | ) |
| 5792 | { |
| 5793 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 5794 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 5795 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5796 | #ifdef FEATURE_WLAN_TDLS |
| 5797 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 5798 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 5799 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 5800 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 5801 | if (pCfg->configPNOScanSupport) |
| 5802 | { |
| 5803 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 5804 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 5805 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 5806 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 5807 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 5808 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5809 | |
Abhishek Singh | 10d8597 | 2015-04-17 10:27:23 +0530 | [diff] [blame] | 5810 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 5811 | wiphy->features |= NL80211_FEATURE_HT_IBSS; |
| 5812 | #endif |
| 5813 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5814 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 5815 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 5816 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5817 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 5818 | driver need to determine what to do with both |
| 5819 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5820 | |
| 5821 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5822 | #else |
| 5823 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5824 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5825 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5826 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 5827 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 5828 | wiphy->max_scan_ie_len = SIR_MAC_MAX_ADD_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5829 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 5830 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 5831 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5832 | /* Supports STATION & AD-HOC modes right now */ |
Bhargav Shah | 0d2e3e5 | 2015-07-24 16:51:01 +0530 | [diff] [blame] | 5833 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
| 5834 | | BIT(NL80211_IFTYPE_ADHOC) |
| 5835 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 5836 | | BIT(NL80211_IFTYPE_P2P_GO) |
| 5837 | | BIT(NL80211_IFTYPE_AP); |
| 5838 | |
| 5839 | if (VOS_MONITOR_MODE == hdd_get_conparam()) |
| 5840 | { |
| 5841 | wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); |
| 5842 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5843 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5844 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5845 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5846 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 5847 | if( pCfg->enableMCC ) |
| 5848 | { |
| 5849 | /* Currently, supports up to two channels */ |
| 5850 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5851 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5852 | if( !pCfg->allowMCCGODiffBI ) |
| 5853 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5854 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5855 | } |
| 5856 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 5857 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5858 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5859 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5860 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5861 | /* Before registering we need to update the ht capabilitied based |
| 5862 | * on ini values*/ |
| 5863 | if( !pCfg->ShortGI20MhzEnable ) |
| 5864 | { |
| 5865 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5866 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5867 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5868 | } |
| 5869 | |
| 5870 | if( !pCfg->ShortGI40MhzEnable ) |
| 5871 | { |
| 5872 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 5873 | } |
| 5874 | |
| 5875 | if( !pCfg->nChannelBondingMode5GHz ) |
| 5876 | { |
| 5877 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 5878 | } |
| 5879 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5880 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 5881 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 5882 | { |
| 5883 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 5884 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5885 | |
| 5886 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 5887 | { |
| 5888 | |
| 5889 | if (NULL == wiphy->bands[i]) |
| 5890 | { |
| 5891 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 5892 | __func__, i); |
| 5893 | continue; |
| 5894 | } |
| 5895 | |
| 5896 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 5897 | { |
| 5898 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 5899 | |
| 5900 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 5901 | { |
| 5902 | // Enable social channels for P2P |
| 5903 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 5904 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 5905 | else |
| 5906 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5907 | continue; |
| 5908 | } |
| 5909 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 5910 | { |
| 5911 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5912 | continue; |
| 5913 | } |
| 5914 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5915 | } |
| 5916 | /*Initialise the supported cipher suite details*/ |
| 5917 | wiphy->cipher_suites = hdd_cipher_suites; |
| 5918 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 5919 | |
| 5920 | /*signal strength in mBm (100*dBm) */ |
| 5921 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 5922 | |
| 5923 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 5924 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5925 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5926 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5927 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 5928 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5929 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 5930 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 5931 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5932 | EXIT(); |
| 5933 | return 0; |
| 5934 | } |
| 5935 | |
| 5936 | /* In this function we are registering wiphy. */ |
| 5937 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 5938 | { |
| 5939 | ENTER(); |
| 5940 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5941 | if (0 > wiphy_register(wiphy)) |
| 5942 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5943 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5944 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 5945 | return -EIO; |
| 5946 | } |
| 5947 | |
| 5948 | EXIT(); |
| 5949 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5950 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5951 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5952 | /* In this function we are updating channel list when, |
| 5953 | regulatory domain is FCC and country code is US. |
| 5954 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 5955 | As per FCC smart phone is not a indoor device. |
| 5956 | GO should not opeate on indoor channels */ |
| 5957 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 5958 | { |
| 5959 | int j; |
| 5960 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5961 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 5962 | //Default counrtycode from NV at the time of wiphy initialization. |
| 5963 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 5964 | &defaultCountryCode[0])) |
| 5965 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 5966 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5967 | } |
| 5968 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 5969 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5970 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 5971 | { |
| 5972 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 5973 | return; |
| 5974 | } |
| 5975 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 5976 | { |
| 5977 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 5978 | // Mark UNII -1 band channel as passive |
| 5979 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 5980 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 5981 | } |
| 5982 | } |
| 5983 | } |
| 5984 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 5985 | /* This function registers for all frame which supplicant is interested in */ |
| 5986 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5987 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5988 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5989 | /* Register for all P2P action, public action etc frames */ |
| 5990 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 5991 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5992 | ENTER(); |
| 5993 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5994 | /* Right now we are registering these frame when driver is getting |
| 5995 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 5996 | frame register ops, we will move this code as a part of that */ |
| 5997 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5998 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5999 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 6000 | |
| 6001 | /* GAS Initial Response */ |
| 6002 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6003 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6004 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6005 | /* GAS Comeback Request */ |
| 6006 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6007 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 6008 | |
| 6009 | /* GAS Comeback Response */ |
| 6010 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6011 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 6012 | |
| 6013 | /* P2P Public Action */ |
| 6014 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6015 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6016 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 6017 | |
| 6018 | /* P2P Action */ |
| 6019 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6020 | (v_U8_t*)P2P_ACTION_FRAME, |
| 6021 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6022 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 6023 | /* WNM BSS Transition Request frame */ |
| 6024 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6025 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 6026 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 6027 | |
| 6028 | /* WNM-Notification */ |
| 6029 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6030 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 6031 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6032 | } |
| 6033 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 6034 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6035 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6036 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6037 | /* Register for all P2P action, public action etc frames */ |
| 6038 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 6039 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6040 | ENTER(); |
| 6041 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6042 | /* Right now we are registering these frame when driver is getting |
| 6043 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 6044 | frame register ops, we will move this code as a part of that */ |
| 6045 | /* GAS Initial Request */ |
| 6046 | |
| 6047 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6048 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 6049 | |
| 6050 | /* GAS Initial Response */ |
| 6051 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6052 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6053 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6054 | /* GAS Comeback Request */ |
| 6055 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6056 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 6057 | |
| 6058 | /* GAS Comeback Response */ |
| 6059 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6060 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 6061 | |
| 6062 | /* P2P Public Action */ |
| 6063 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6064 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6065 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 6066 | |
| 6067 | /* P2P Action */ |
| 6068 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6069 | (v_U8_t*)P2P_ACTION_FRAME, |
| 6070 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 6071 | /* WNM-Notification */ |
| 6072 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6073 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 6074 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6075 | } |
| 6076 | |
| 6077 | #ifdef FEATURE_WLAN_WAPI |
| 6078 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
| 6079 | const u8 *mac_addr, u8 *key , int key_Len) |
| 6080 | { |
| 6081 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6082 | tCsrRoamSetKey setKey; |
| 6083 | v_BOOL_t isConnected = TRUE; |
| 6084 | int status = 0; |
| 6085 | v_U32_t roamId= 0xFF; |
| 6086 | tANI_U8 *pKeyPtr = NULL; |
| 6087 | int n = 0; |
| 6088 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6089 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 6090 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6091 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6092 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 6093 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6094 | setKey.keyId = key_index; // Store Key ID |
| 6095 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 6096 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 6097 | setKey.paeRole = 0 ; // the PAE role |
| 6098 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 6099 | { |
| 6100 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 6101 | } |
| 6102 | else |
| 6103 | { |
| 6104 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 6105 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 6106 | } |
| 6107 | setKey.keyLength = key_Len; |
| 6108 | pKeyPtr = setKey.Key; |
| 6109 | memcpy( pKeyPtr, key, key_Len); |
| 6110 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6111 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6112 | __func__, key_Len); |
| 6113 | for (n = 0 ; n < key_Len; n++) |
| 6114 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 6115 | __func__,n,setKey.Key[n]); |
| 6116 | |
| 6117 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 6118 | if ( isConnected ) |
| 6119 | { |
| 6120 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6121 | pAdapter->sessionId, &setKey, &roamId ); |
| 6122 | } |
| 6123 | if ( status != 0 ) |
| 6124 | { |
| 6125 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6126 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 6127 | __LINE__, status ); |
| 6128 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 6129 | } |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 6130 | /* Need to clear any trace of key value in the memory. |
| 6131 | * Thus zero out the memory even though it is local |
| 6132 | * variable. |
| 6133 | */ |
| 6134 | vos_mem_zero(&setKey, sizeof(setKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6135 | } |
| 6136 | #endif /* FEATURE_WLAN_WAPI*/ |
| 6137 | |
| 6138 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6139 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6140 | beacon_data_t **ppBeacon, |
| 6141 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6142 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6143 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6144 | beacon_data_t **ppBeacon, |
| 6145 | struct cfg80211_beacon_data *params, |
| 6146 | int dtim_period) |
| 6147 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6148 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6149 | int size; |
| 6150 | beacon_data_t *beacon = NULL; |
| 6151 | beacon_data_t *old = NULL; |
| 6152 | int head_len,tail_len; |
| 6153 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6154 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6155 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6156 | { |
| 6157 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6158 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6159 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6160 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6161 | |
| 6162 | old = pAdapter->sessionCtx.ap.beacon; |
| 6163 | |
| 6164 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6165 | { |
| 6166 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6167 | FL("session(%d) old and new heads points to NULL"), |
| 6168 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6169 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6170 | } |
| 6171 | |
| 6172 | if (params->tail && !params->tail_len) |
| 6173 | { |
| 6174 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6175 | FL("tail_len is zero but tail is not NULL")); |
| 6176 | return -EINVAL; |
| 6177 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6178 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6179 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 6180 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 6181 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6182 | { |
| 6183 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6184 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6185 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6186 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6187 | #endif |
| 6188 | |
| 6189 | if(params->head) |
| 6190 | head_len = params->head_len; |
| 6191 | else |
| 6192 | head_len = old->head_len; |
| 6193 | |
| 6194 | if(params->tail || !old) |
| 6195 | tail_len = params->tail_len; |
| 6196 | else |
| 6197 | tail_len = old->tail_len; |
| 6198 | |
| 6199 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 6200 | |
| 6201 | beacon = kzalloc(size, GFP_KERNEL); |
| 6202 | |
| 6203 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6204 | { |
| 6205 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6206 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6207 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6208 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6209 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6210 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6211 | if(params->dtim_period || !old ) |
| 6212 | beacon->dtim_period = params->dtim_period; |
| 6213 | else |
| 6214 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6215 | #else |
| 6216 | if(dtim_period || !old ) |
| 6217 | beacon->dtim_period = dtim_period; |
| 6218 | else |
| 6219 | beacon->dtim_period = old->dtim_period; |
| 6220 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6221 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6222 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 6223 | beacon->tail = beacon->head + head_len; |
| 6224 | beacon->head_len = head_len; |
| 6225 | beacon->tail_len = tail_len; |
| 6226 | |
| 6227 | if(params->head) { |
| 6228 | memcpy (beacon->head,params->head,beacon->head_len); |
| 6229 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6230 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6231 | if(old) |
| 6232 | memcpy (beacon->head,old->head,beacon->head_len); |
| 6233 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6234 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6235 | if(params->tail) { |
| 6236 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 6237 | } |
| 6238 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6239 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6240 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 6241 | } |
| 6242 | |
| 6243 | *ppBeacon = beacon; |
| 6244 | |
| 6245 | kfree(old); |
| 6246 | |
| 6247 | return 0; |
| 6248 | |
| 6249 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6250 | |
| 6251 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid) |
| 6252 | { |
| 6253 | int left = length; |
| 6254 | v_U8_t *ptr = pIes; |
| 6255 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6256 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6257 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6258 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6259 | elem_id = ptr[0]; |
| 6260 | elem_len = ptr[1]; |
| 6261 | left -= 2; |
| 6262 | if(elem_len > left) |
| 6263 | { |
| 6264 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 6265 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6266 | eid,elem_len,left); |
| 6267 | return NULL; |
| 6268 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6269 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6270 | { |
| 6271 | return ptr; |
| 6272 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6273 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6274 | left -= elem_len; |
| 6275 | ptr += (elem_len + 2); |
| 6276 | } |
| 6277 | return NULL; |
| 6278 | } |
| 6279 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6280 | /* Check if rate is 11g rate or not */ |
| 6281 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 6282 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 6283 | 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] | 6284 | u8 i; |
| 6285 | for (i = 0; i < 8; i++) |
| 6286 | { |
| 6287 | if(rate == gRateArray[i]) |
| 6288 | return TRUE; |
| 6289 | } |
| 6290 | return FALSE; |
| 6291 | } |
| 6292 | |
| 6293 | /* Check for 11g rate and set proper 11g only mode */ |
| 6294 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 6295 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 6296 | { |
| 6297 | u8 i, num_rates = pIe[0]; |
| 6298 | |
| 6299 | pIe += 1; |
| 6300 | for ( i = 0; i < num_rates; i++) |
| 6301 | { |
| 6302 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 6303 | { |
| 6304 | /* If rate set have 11g rate than change the mode to 11G */ |
| 6305 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 6306 | if (pIe[i] & BASIC_RATE_MASK) |
| 6307 | { |
| 6308 | /* If we have 11g rate as basic rate, it means mode |
| 6309 | is 11g only mode. |
| 6310 | */ |
| 6311 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 6312 | *pCheckRatesfor11g = FALSE; |
| 6313 | } |
| 6314 | } |
| 6315 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 6316 | { |
| 6317 | *require_ht = TRUE; |
| 6318 | } |
| 6319 | } |
| 6320 | return; |
| 6321 | } |
| 6322 | |
| 6323 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 6324 | { |
| 6325 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 6326 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6327 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 6328 | u8 checkRatesfor11g = TRUE; |
| 6329 | u8 require_ht = FALSE; |
| 6330 | u8 *pIe=NULL; |
| 6331 | |
| 6332 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 6333 | |
| 6334 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 6335 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 6336 | if (pIe != NULL) |
| 6337 | { |
| 6338 | pIe += 1; |
| 6339 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 6340 | &pConfig->SapHw_mode); |
| 6341 | } |
| 6342 | |
| 6343 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 6344 | WLAN_EID_EXT_SUPP_RATES); |
| 6345 | if (pIe != NULL) |
| 6346 | { |
| 6347 | |
| 6348 | pIe += 1; |
| 6349 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 6350 | &pConfig->SapHw_mode); |
| 6351 | } |
| 6352 | |
| 6353 | if( pConfig->channel > 14 ) |
| 6354 | { |
| 6355 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 6356 | } |
| 6357 | |
| 6358 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 6359 | WLAN_EID_HT_CAPABILITY); |
| 6360 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6361 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6362 | { |
| 6363 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 6364 | if(require_ht) |
| 6365 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 6366 | } |
| 6367 | } |
| 6368 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6369 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 6370 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 6371 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6372 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6373 | v_U8_t *pIe = NULL; |
| 6374 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6375 | |
| 6376 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 6377 | pBeacon->tail, pBeacon->tail_len); |
| 6378 | |
| 6379 | if (pIe) |
| 6380 | { |
| 6381 | ielen = pIe[1] + 2; |
| 6382 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 6383 | { |
| 6384 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 6385 | } |
| 6386 | else |
| 6387 | { |
| 6388 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 6389 | return -EINVAL; |
| 6390 | } |
| 6391 | *total_ielen += ielen; |
| 6392 | } |
| 6393 | return 0; |
| 6394 | } |
| 6395 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6396 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 6397 | v_U8_t *genie, v_U8_t *total_ielen) |
| 6398 | { |
| 6399 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6400 | int left = pBeacon->tail_len; |
| 6401 | v_U8_t *ptr = pBeacon->tail; |
| 6402 | v_U8_t elem_id, elem_len; |
| 6403 | v_U16_t ielen = 0; |
| 6404 | |
| 6405 | if ( NULL == ptr || 0 == left ) |
| 6406 | return; |
| 6407 | |
| 6408 | while (left >= 2) |
| 6409 | { |
| 6410 | elem_id = ptr[0]; |
| 6411 | elem_len = ptr[1]; |
| 6412 | left -= 2; |
| 6413 | if (elem_len > left) |
| 6414 | { |
| 6415 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 6416 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 6417 | elem_id, elem_len, left); |
| 6418 | return; |
| 6419 | } |
| 6420 | if (IE_EID_VENDOR == elem_id) |
| 6421 | { |
| 6422 | /* skipping the VSIE's which we don't want to include or |
| 6423 | * it will be included by existing code |
| 6424 | */ |
| 6425 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 6426 | #ifdef WLAN_FEATURE_WFD |
| 6427 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 6428 | #endif |
| 6429 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6430 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6431 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 6432 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6433 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 6434 | { |
| 6435 | ielen = ptr[1] + 2; |
| 6436 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 6437 | { |
| 6438 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 6439 | *total_ielen += ielen; |
| 6440 | } |
| 6441 | else |
| 6442 | { |
| 6443 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 6444 | "IE Length is too big " |
| 6445 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 6446 | elem_id, elem_len, *total_ielen); |
| 6447 | } |
| 6448 | } |
| 6449 | } |
| 6450 | |
| 6451 | left -= elem_len; |
| 6452 | ptr += (elem_len + 2); |
| 6453 | } |
| 6454 | return; |
| 6455 | } |
| 6456 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6457 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6458 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 6459 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6460 | #else |
| 6461 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 6462 | struct cfg80211_beacon_data *params) |
| 6463 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6464 | { |
| 6465 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6466 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6467 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6468 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6469 | |
| 6470 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 6471 | |
| 6472 | if(genie == NULL) { |
| 6473 | |
| 6474 | return -ENOMEM; |
| 6475 | } |
| 6476 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6477 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6478 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6479 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6480 | hddLog(LOGE, |
| 6481 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6482 | ret = -EINVAL; |
| 6483 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6484 | } |
| 6485 | |
| 6486 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6487 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6488 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 6489 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6490 | hddLog(LOGE, |
| 6491 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6492 | ret = -EINVAL; |
| 6493 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6494 | } |
| 6495 | #endif |
| 6496 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6497 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6498 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6499 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6500 | hddLog(LOGE, |
| 6501 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6502 | ret = -EINVAL; |
| 6503 | goto done; |
| 6504 | } |
| 6505 | |
| 6506 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 6507 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6508 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6509 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6510 | |
| 6511 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6512 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 6513 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 6514 | { |
| 6515 | hddLog(LOGE, |
| 6516 | "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] | 6517 | ret = -EINVAL; |
| 6518 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6519 | } |
| 6520 | |
| 6521 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6522 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 6523 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6524 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6525 | ==eHAL_STATUS_FAILURE) |
| 6526 | { |
| 6527 | hddLog(LOGE, |
| 6528 | "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] | 6529 | ret = -EINVAL; |
| 6530 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6531 | } |
| 6532 | |
| 6533 | // Added for ProResp IE |
| 6534 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 6535 | { |
| 6536 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 6537 | u8 probe_rsp_ie_len[3] = {0}; |
| 6538 | u8 counter = 0; |
| 6539 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 6540 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 6541 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 6542 | Store More then 255 bytes into One Variable. |
| 6543 | */ |
| 6544 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 6545 | { |
| 6546 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 6547 | { |
| 6548 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 6549 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 6550 | } |
| 6551 | else |
| 6552 | { |
| 6553 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 6554 | rem_probe_resp_ie_len = 0; |
| 6555 | } |
| 6556 | } |
| 6557 | |
| 6558 | rem_probe_resp_ie_len = 0; |
| 6559 | |
| 6560 | if (probe_rsp_ie_len[0] > 0) |
| 6561 | { |
| 6562 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6563 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 6564 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6565 | probe_rsp_ie_len[0], NULL, |
| 6566 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6567 | { |
| 6568 | hddLog(LOGE, |
| 6569 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6570 | ret = -EINVAL; |
| 6571 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6572 | } |
| 6573 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 6574 | } |
| 6575 | |
| 6576 | if (probe_rsp_ie_len[1] > 0) |
| 6577 | { |
| 6578 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6579 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 6580 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6581 | probe_rsp_ie_len[1], NULL, |
| 6582 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6583 | { |
| 6584 | hddLog(LOGE, |
| 6585 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6586 | ret = -EINVAL; |
| 6587 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6588 | } |
| 6589 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 6590 | } |
| 6591 | |
| 6592 | if (probe_rsp_ie_len[2] > 0) |
| 6593 | { |
| 6594 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6595 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 6596 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6597 | probe_rsp_ie_len[2], NULL, |
| 6598 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6599 | { |
| 6600 | hddLog(LOGE, |
| 6601 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6602 | ret = -EINVAL; |
| 6603 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6604 | } |
| 6605 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 6606 | } |
| 6607 | |
| 6608 | if (probe_rsp_ie_len[1] == 0 ) |
| 6609 | { |
| 6610 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6611 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 6612 | eANI_BOOLEAN_FALSE) ) |
| 6613 | { |
| 6614 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6615 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6616 | } |
| 6617 | } |
| 6618 | |
| 6619 | if (probe_rsp_ie_len[2] == 0 ) |
| 6620 | { |
| 6621 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6622 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 6623 | eANI_BOOLEAN_FALSE) ) |
| 6624 | { |
| 6625 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6626 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6627 | } |
| 6628 | } |
| 6629 | |
| 6630 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6631 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 6632 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6633 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6634 | == eHAL_STATUS_FAILURE) |
| 6635 | { |
| 6636 | hddLog(LOGE, |
| 6637 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6638 | ret = -EINVAL; |
| 6639 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6640 | } |
| 6641 | } |
| 6642 | else |
| 6643 | { |
| 6644 | // Reset WNI_CFG_PROBE_RSP Flags |
| 6645 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 6646 | |
| 6647 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6648 | "%s: No Probe Response IE received in set beacon", |
| 6649 | __func__); |
| 6650 | } |
| 6651 | |
| 6652 | // Added for AssocResp IE |
| 6653 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 6654 | { |
| 6655 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6656 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 6657 | params->assocresp_ies_len, NULL, |
| 6658 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6659 | { |
| 6660 | hddLog(LOGE, |
| 6661 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6662 | ret = -EINVAL; |
| 6663 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6664 | } |
| 6665 | |
| 6666 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6667 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 6668 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6669 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6670 | == eHAL_STATUS_FAILURE) |
| 6671 | { |
| 6672 | hddLog(LOGE, |
| 6673 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6674 | ret = -EINVAL; |
| 6675 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6676 | } |
| 6677 | } |
| 6678 | else |
| 6679 | { |
| 6680 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6681 | "%s: No Assoc Response IE received in set beacon", |
| 6682 | __func__); |
| 6683 | |
| 6684 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6685 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 6686 | eANI_BOOLEAN_FALSE) ) |
| 6687 | { |
| 6688 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6689 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6690 | } |
| 6691 | } |
| 6692 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6693 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6694 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6695 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6696 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6697 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6698 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6699 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 6700 | * called by wlan_hdd_cfg80211_start_bss() and |
| 6701 | * wlan_hdd_cfg80211_set_channel() |
| 6702 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6703 | * channel list. |
| 6704 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 6705 | 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] | 6706 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6707 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6708 | v_U32_t num_ch = 0; |
| 6709 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 6710 | u32 indx = 0; |
| 6711 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6712 | v_U8_t fValidChannel = FALSE, count = 0; |
| 6713 | 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] | 6714 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6715 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6716 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6717 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6718 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6719 | /* Validate the channel */ |
| 6720 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6721 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6722 | if ( channel == rfChannels[count].channelNum ) |
| 6723 | { |
| 6724 | fValidChannel = TRUE; |
| 6725 | break; |
| 6726 | } |
| 6727 | } |
| 6728 | if (fValidChannel != TRUE) |
| 6729 | { |
| 6730 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6731 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6732 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6733 | } |
| 6734 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6735 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6736 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6737 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 6738 | valid_ch, &num_ch)) |
| 6739 | { |
| 6740 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6741 | "%s: failed to get valid channel list", __func__); |
| 6742 | return VOS_STATUS_E_FAILURE; |
| 6743 | } |
| 6744 | for (indx = 0; indx < num_ch; indx++) |
| 6745 | { |
| 6746 | if (channel == valid_ch[indx]) |
| 6747 | { |
| 6748 | break; |
| 6749 | } |
| 6750 | } |
| 6751 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6752 | if (indx >= num_ch) |
| 6753 | { |
| 6754 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6755 | { |
| 6756 | eCsrBand band; |
| 6757 | unsigned int freq; |
| 6758 | |
| 6759 | sme_GetFreqBand(hHal, &band); |
| 6760 | |
| 6761 | if (eCSR_BAND_5G == band) |
| 6762 | { |
| 6763 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 6764 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 6765 | { |
| 6766 | freq = ieee80211_channel_to_frequency(channel, |
| 6767 | IEEE80211_BAND_2GHZ); |
| 6768 | } |
| 6769 | else |
| 6770 | { |
| 6771 | freq = ieee80211_channel_to_frequency(channel, |
| 6772 | IEEE80211_BAND_5GHZ); |
| 6773 | } |
| 6774 | #else |
| 6775 | freq = ieee80211_channel_to_frequency(channel); |
| 6776 | #endif |
| 6777 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 6778 | return VOS_STATUS_SUCCESS; |
| 6779 | } |
| 6780 | } |
| 6781 | |
| 6782 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6783 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6784 | return VOS_STATUS_E_FAILURE; |
| 6785 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6786 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6787 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6788 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6789 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6790 | } |
| 6791 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6792 | /** |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6793 | * FUNCTION: __wlan_hdd_cfg80211_set_channel |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6794 | * This function is used to set the channel number |
| 6795 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6796 | 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] | 6797 | struct ieee80211_channel *chan, |
| 6798 | enum nl80211_channel_type channel_type |
| 6799 | ) |
| 6800 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6801 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6802 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6803 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6804 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6805 | hdd_context_t *pHddCtx; |
| 6806 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6807 | |
| 6808 | ENTER(); |
| 6809 | |
| 6810 | if( NULL == dev ) |
| 6811 | { |
| 6812 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6813 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6814 | return -ENODEV; |
| 6815 | } |
| 6816 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6817 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6818 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6819 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 6820 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6821 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6822 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 6823 | hdd_device_modetoString(pAdapter->device_mode), |
| 6824 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6825 | |
| 6826 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6827 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6828 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6829 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6830 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6831 | } |
| 6832 | |
| 6833 | /* |
| 6834 | * Do freq to chan conversion |
| 6835 | * TODO: for 11a |
| 6836 | */ |
| 6837 | |
| 6838 | channel = ieee80211_frequency_to_channel(freq); |
| 6839 | |
| 6840 | /* Check freq range */ |
| 6841 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 6842 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 6843 | { |
| 6844 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6845 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6846 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 6847 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 6848 | return -EINVAL; |
| 6849 | } |
| 6850 | |
| 6851 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6852 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 6853 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 6854 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6855 | { |
| 6856 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6857 | { |
| 6858 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6859 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6860 | return -EINVAL; |
| 6861 | } |
| 6862 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 6863 | "%s: set channel to [%d] for device mode =%d", |
| 6864 | __func__, channel,pAdapter->device_mode); |
| 6865 | } |
| 6866 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6867 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6868 | ) |
| 6869 | { |
| 6870 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6871 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 6872 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6873 | |
| 6874 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 6875 | { |
| 6876 | /* Link is up then return cant set channel*/ |
| 6877 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6878 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6879 | return -EINVAL; |
| 6880 | } |
| 6881 | |
| 6882 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 6883 | pHddStaCtx->conn_info.operationChannel = channel; |
| 6884 | pRoamProfile->ChannelInfo.ChannelList = |
| 6885 | &pHddStaCtx->conn_info.operationChannel; |
| 6886 | } |
| 6887 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6888 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6889 | ) |
| 6890 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6891 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6892 | { |
| 6893 | if(VOS_STATUS_SUCCESS != |
| 6894 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6895 | { |
| 6896 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6897 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6898 | return -EINVAL; |
| 6899 | } |
| 6900 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 6901 | } |
| 6902 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6903 | { |
| 6904 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 6905 | |
| 6906 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 6907 | channel set by supplicant |
| 6908 | */ |
| 6909 | if ( cfg_param->apAutoChannelSelection ) |
| 6910 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6911 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 6912 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6913 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6914 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 6915 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6916 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6917 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6918 | else |
| 6919 | { |
| 6920 | if(VOS_STATUS_SUCCESS != |
| 6921 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6922 | { |
| 6923 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6924 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6925 | return -EINVAL; |
| 6926 | } |
| 6927 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 6928 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6929 | } |
| 6930 | } |
| 6931 | else |
| 6932 | { |
| 6933 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 6934 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 6935 | return -EINVAL; |
| 6936 | } |
| 6937 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6938 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6939 | } |
| 6940 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6941 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, |
| 6942 | struct net_device *dev, |
| 6943 | struct ieee80211_channel *chan, |
| 6944 | enum nl80211_channel_type channel_type |
| 6945 | ) |
| 6946 | { |
| 6947 | int ret; |
| 6948 | |
| 6949 | vos_ssr_protect(__func__); |
| 6950 | ret = __wlan_hdd_cfg80211_set_channel(wiphy, dev, chan, channel_type); |
| 6951 | vos_ssr_unprotect(__func__); |
| 6952 | |
| 6953 | return ret; |
| 6954 | } |
| 6955 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6956 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 6957 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 6958 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6959 | #else |
| 6960 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 6961 | struct cfg80211_beacon_data *params, |
| 6962 | const u8 *ssid, size_t ssid_len, |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 6963 | enum nl80211_hidden_ssid hidden_ssid, |
| 6964 | v_U8_t auth_type) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6965 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6966 | { |
| 6967 | tsap_Config_t *pConfig; |
| 6968 | beacon_data_t *pBeacon = NULL; |
| 6969 | struct ieee80211_mgmt *pMgmt_frame; |
| 6970 | v_U8_t *pIe=NULL; |
| 6971 | v_U16_t capab_info; |
| 6972 | eCsrAuthType RSNAuthType; |
| 6973 | eCsrEncryptionType RSNEncryptType; |
| 6974 | eCsrEncryptionType mcRSNEncryptType; |
| 6975 | int status = VOS_STATUS_SUCCESS; |
| 6976 | tpWLAN_SAPEventCB pSapEventCallback; |
| 6977 | hdd_hostapd_state_t *pHostapdState; |
| 6978 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 6979 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6980 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6981 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6982 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6983 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 6984 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6985 | tSmeConfigParams *psmeConfig; |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 6986 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 6987 | v_BOOL_t MFPRequired = VOS_FALSE; |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 6988 | v_BOOL_t sapEnable11AC = |
| 6989 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapEnable11AC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6990 | ENTER(); |
| 6991 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6992 | iniConfig = pHddCtx->cfg_ini; |
| 6993 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6994 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 6995 | |
| 6996 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 6997 | |
| 6998 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6999 | |
| 7000 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 7001 | |
| 7002 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 7003 | |
| 7004 | //channel is already set in the set_channel Call back |
| 7005 | //pConfig->channel = pCommitConfig->channel; |
| 7006 | |
| 7007 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7008 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7009 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 7010 | |
| 7011 | pConfig->dtim_period = pBeacon->dtim_period; |
| 7012 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7013 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7014 | pConfig->dtim_period); |
| 7015 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 7016 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7017 | { |
| 7018 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7019 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 7020 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 7021 | { |
| 7022 | tANI_BOOLEAN restartNeeded; |
| 7023 | pConfig->ieee80211d = 1; |
| 7024 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 7025 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 7026 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 7027 | } |
| 7028 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7029 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7030 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7031 | pConfig->ieee80211d = 1; |
| 7032 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 7033 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 7034 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7035 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7036 | else |
| 7037 | { |
| 7038 | pConfig->ieee80211d = 0; |
| 7039 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 7040 | /* |
| 7041 | * If auto channel is configured i.e. channel is 0, |
| 7042 | * so skip channel validation. |
| 7043 | */ |
| 7044 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 7045 | { |
| 7046 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 7047 | { |
| 7048 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7049 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 7050 | return -EINVAL; |
| 7051 | } |
| 7052 | } |
| 7053 | else |
| 7054 | { |
| 7055 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 7056 | { |
| 7057 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 7058 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 7059 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 7060 | } |
| 7061 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 7062 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7063 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7064 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7065 | { |
| 7066 | pConfig->ieee80211d = 0; |
| 7067 | } |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 7068 | |
| 7069 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7070 | if (params->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
| 7071 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 7072 | else if (params->auth_type == NL80211_AUTHTYPE_SHARED_KEY) |
| 7073 | pConfig->authType = eSAP_SHARED_KEY; |
| 7074 | else |
| 7075 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 7076 | #else |
| 7077 | if (auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
| 7078 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 7079 | else if (auth_type == NL80211_AUTHTYPE_SHARED_KEY) |
| 7080 | pConfig->authType = eSAP_SHARED_KEY; |
| 7081 | else |
| 7082 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 7083 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7084 | |
| 7085 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7086 | |
| 7087 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7088 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 7089 | |
| 7090 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 7091 | |
| 7092 | /*Set wps station to configured*/ |
| 7093 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 7094 | |
| 7095 | if(pIe) |
| 7096 | { |
| 7097 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 7098 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7099 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7100 | return -EINVAL; |
| 7101 | } |
| 7102 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 7103 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 7104 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7105 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 7106 | * WPS state |
| 7107 | */ |
| 7108 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 7109 | { |
| 7110 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 7111 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 7112 | { |
| 7113 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 7114 | } |
| 7115 | } |
| 7116 | } |
| 7117 | else |
| 7118 | { |
| 7119 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 7120 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7121 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7122 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 7123 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 7124 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 7125 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 7126 | eCSR_ENCRYPT_TYPE_NONE; |
| 7127 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7128 | pConfig->RSNWPAReqIELength = 0; |
| 7129 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7130 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7131 | WLAN_EID_RSN); |
| 7132 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7133 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7134 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 7135 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 7136 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7137 | /* The actual processing may eventually be more extensive than |
| 7138 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7139 | * by the app. |
| 7140 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7141 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7142 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 7143 | &RSNEncryptType, |
| 7144 | &mcRSNEncryptType, |
| 7145 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7146 | &MFPCapable, |
| 7147 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7148 | pConfig->pRSNWPAReqIE[1]+2, |
| 7149 | pConfig->pRSNWPAReqIE ); |
| 7150 | |
| 7151 | if( VOS_STATUS_SUCCESS == status ) |
| 7152 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7153 | /* Now copy over all the security attributes you have |
| 7154 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7155 | * */ |
| 7156 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 7157 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 7158 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 7159 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 7160 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7161 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7162 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 7163 | } |
| 7164 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7165 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7166 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7167 | pBeacon->tail, pBeacon->tail_len); |
| 7168 | |
| 7169 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 7170 | { |
| 7171 | if (pConfig->pRSNWPAReqIE) |
| 7172 | { |
| 7173 | /*Mixed mode WPA/WPA2*/ |
| 7174 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 7175 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 7176 | } |
| 7177 | else |
| 7178 | { |
| 7179 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 7180 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 7181 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7182 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7183 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 7184 | &RSNEncryptType, |
| 7185 | &mcRSNEncryptType, |
| 7186 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7187 | &MFPCapable, |
| 7188 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7189 | pConfig->pRSNWPAReqIE[1]+2, |
| 7190 | pConfig->pRSNWPAReqIE ); |
| 7191 | |
| 7192 | if( VOS_STATUS_SUCCESS == status ) |
| 7193 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7194 | /* Now copy over all the security attributes you have |
| 7195 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7196 | * */ |
| 7197 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 7198 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 7199 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 7200 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 7201 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7202 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7203 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 7204 | } |
| 7205 | } |
| 7206 | } |
| 7207 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7208 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 7209 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 7210 | return -EINVAL; |
| 7211 | } |
| 7212 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7213 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 7214 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7215 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7216 | if (params->ssid != NULL) |
| 7217 | { |
| 7218 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 7219 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 7220 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 7221 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 7222 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7223 | #else |
| 7224 | if (ssid != NULL) |
| 7225 | { |
| 7226 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 7227 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 7228 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 7229 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 7230 | } |
| 7231 | #endif |
| 7232 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7233 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7234 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7235 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7236 | /* default value */ |
| 7237 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 7238 | pConfig->num_accept_mac = 0; |
| 7239 | pConfig->num_deny_mac = 0; |
| 7240 | |
| 7241 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7242 | pBeacon->tail, pBeacon->tail_len); |
| 7243 | |
| 7244 | /* pIe for black list is following form: |
| 7245 | type : 1 byte |
| 7246 | length : 1 byte |
| 7247 | OUI : 4 bytes |
| 7248 | acl type : 1 byte |
| 7249 | no of mac addr in black list: 1 byte |
| 7250 | 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] | 7251 | */ |
| 7252 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7253 | { |
| 7254 | pConfig->SapMacaddr_acl = pIe[6]; |
| 7255 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7256 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7257 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7258 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 7259 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7260 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 7261 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 7262 | { |
| 7263 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 7264 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7265 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7266 | } |
| 7267 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7268 | pBeacon->tail, pBeacon->tail_len); |
| 7269 | |
| 7270 | /* pIe for white list is following form: |
| 7271 | type : 1 byte |
| 7272 | length : 1 byte |
| 7273 | OUI : 4 bytes |
| 7274 | acl type : 1 byte |
| 7275 | no of mac addr in white list: 1 byte |
| 7276 | 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] | 7277 | */ |
| 7278 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7279 | { |
| 7280 | pConfig->SapMacaddr_acl = pIe[6]; |
| 7281 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7282 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7283 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7284 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 7285 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7286 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 7287 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 7288 | { |
| 7289 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 7290 | acl_entry++; |
| 7291 | } |
| 7292 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7293 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7294 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 7295 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7296 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 7297 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 7298 | * This is valid only if mode is set to 11n in hostapd, sapEnable11AC |
| 7299 | * 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] | 7300 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 7301 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 7302 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 7303 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 7304 | (sapEnable11AC) && (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 7305 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7306 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7307 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7308 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7309 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7310 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 7311 | /* If ACS disable and selected channel <= 14 |
| 7312 | * OR |
| 7313 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 7314 | * AND |
| 7315 | * VHT in 2.4G Disabled |
| 7316 | * THEN |
| 7317 | * Fallback to 11N mode |
| 7318 | */ |
| 7319 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 7320 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 7321 | operatingBand == eSAP_RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 7322 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7323 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7324 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 7325 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7326 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 7327 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7328 | } |
| 7329 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7330 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7331 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 7332 | pConfig->ht_capab = |
| 7333 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 7334 | |
| 7335 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 7336 | { |
| 7337 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 7338 | return -EINVAL; |
| 7339 | } |
| 7340 | |
| 7341 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7342 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7343 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 7344 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7345 | pConfig->obssProtEnabled = |
| 7346 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7347 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7348 | #ifdef WLAN_FEATURE_11W |
| 7349 | pConfig->mfpCapable = MFPCapable; |
| 7350 | pConfig->mfpRequired = MFPRequired; |
| 7351 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 7352 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 7353 | #endif |
| 7354 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7355 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7356 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7357 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 7358 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 7359 | (int)pConfig->channel); |
| 7360 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 7361 | pConfig->SapHw_mode, pConfig->privacy, |
| 7362 | pConfig->authType); |
| 7363 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 7364 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 7365 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 7366 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7367 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7368 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7369 | { |
| 7370 | //Bss already started. just return. |
| 7371 | //TODO Probably it should update some beacon params. |
| 7372 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 7373 | EXIT(); |
| 7374 | return 0; |
| 7375 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7376 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7377 | if (vos_max_concurrent_connections_reached()) { |
| 7378 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7379 | return -EINVAL; |
| 7380 | } |
| 7381 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7382 | pConfig->persona = pHostapdAdapter->device_mode; |
| 7383 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7384 | psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams)); |
| 7385 | if ( NULL != psmeConfig) |
| 7386 | { |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 7387 | vos_mem_zero(psmeConfig, sizeof (tSmeConfigParams)); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7388 | sme_GetConfigParam(hHal, psmeConfig); |
| 7389 | pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference; |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 7390 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 7391 | if (((pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 7392 | || (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 7393 | && pHddCtx->cfg_ini->apHT40_24GEnabled) |
| 7394 | { |
| 7395 | psmeConfig->csrConfig.apHT40_24GEnabled = 1; |
| 7396 | sme_UpdateConfig (hHal, psmeConfig); |
| 7397 | } |
| 7398 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7399 | vos_mem_free(psmeConfig); |
| 7400 | } |
Peng Xu | afc34e3 | 2014-09-25 13:23:55 +0530 | [diff] [blame] | 7401 | pConfig->acsBandSwitchThreshold = iniConfig->acsBandSwitchThreshold; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7402 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7403 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 7404 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 7405 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 7406 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7407 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7408 | return -EINVAL; |
| 7409 | } |
| 7410 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7411 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7412 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 7413 | |
| 7414 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7415 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7416 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7417 | { |
| 7418 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7419 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 7420 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7421 | VOS_ASSERT(0); |
| 7422 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7423 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7424 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Kaushik, Sushant | f607080 | 2014-10-15 15:09:23 +0530 | [diff] [blame] | 7425 | /* Initialize WMM configuation */ |
| 7426 | hdd_wmm_init(pHostapdAdapter); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7427 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7428 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7429 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7430 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 7431 | { |
| 7432 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 7433 | { |
| 7434 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 7435 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 7436 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7437 | } |
| 7438 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 7439 | { |
| 7440 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 7441 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 7442 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7443 | } |
| 7444 | } |
| 7445 | #endif |
| 7446 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7447 | pHostapdState->bCommit = TRUE; |
| 7448 | EXIT(); |
| 7449 | |
| 7450 | return 0; |
| 7451 | } |
| 7452 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7453 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7454 | static int __wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7455 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7456 | struct beacon_parameters *params) |
| 7457 | { |
| 7458 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7459 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7460 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7461 | |
| 7462 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7463 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7464 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7465 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 7466 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7467 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 7468 | hdd_device_modetoString(pAdapter->device_mode), |
| 7469 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7470 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7471 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7472 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7473 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7474 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7475 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7476 | } |
| 7477 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7478 | if (vos_max_concurrent_connections_reached()) { |
| 7479 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7480 | return -EINVAL; |
| 7481 | } |
| 7482 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7483 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7484 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7485 | ) |
| 7486 | { |
| 7487 | beacon_data_t *old,*new; |
| 7488 | |
| 7489 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7490 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7491 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7492 | { |
| 7493 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 7494 | FL("already beacon info added to session(%d)"), |
| 7495 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7496 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7497 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7498 | |
| 7499 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 7500 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7501 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7502 | { |
| 7503 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7504 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7505 | return -EINVAL; |
| 7506 | } |
| 7507 | |
| 7508 | pAdapter->sessionCtx.ap.beacon = new; |
| 7509 | |
| 7510 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 7511 | } |
| 7512 | |
| 7513 | EXIT(); |
| 7514 | return status; |
| 7515 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7516 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7517 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 7518 | struct net_device *dev, |
| 7519 | struct beacon_parameters *params) |
| 7520 | { |
| 7521 | int ret; |
| 7522 | |
| 7523 | vos_ssr_protect(__func__); |
| 7524 | ret = __wlan_hdd_cfg80211_add_beacon(wiphy, dev, params); |
| 7525 | vos_ssr_unprotect(__func__); |
| 7526 | |
| 7527 | return ret; |
| 7528 | } |
| 7529 | |
| 7530 | static int __wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7531 | struct net_device *dev, |
| 7532 | struct beacon_parameters *params) |
| 7533 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7534 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7535 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7536 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7537 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7538 | |
| 7539 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 7540 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7541 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7542 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 7543 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 7544 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7545 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7546 | pAdapter->device_mode); |
| 7547 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7548 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7549 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7550 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7551 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7552 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7553 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7554 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7555 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7556 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7557 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7558 | { |
| 7559 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7560 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7561 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7562 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7563 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7564 | { |
| 7565 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7566 | FL("session(%d) old and new heads points to NULL"), |
| 7567 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7568 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7569 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7570 | |
| 7571 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 7572 | |
| 7573 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7574 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7575 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7576 | return -EINVAL; |
| 7577 | } |
| 7578 | |
| 7579 | pAdapter->sessionCtx.ap.beacon = new; |
| 7580 | |
| 7581 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 7582 | } |
| 7583 | |
| 7584 | EXIT(); |
| 7585 | return status; |
| 7586 | } |
| 7587 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7588 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
| 7589 | struct net_device *dev, |
| 7590 | struct beacon_parameters *params) |
| 7591 | { |
| 7592 | int ret; |
| 7593 | |
| 7594 | vos_ssr_protect(__func__); |
| 7595 | ret = __wlan_hdd_cfg80211_set_beacon(wiphy, dev, params); |
| 7596 | vos_ssr_unprotect(__func__); |
| 7597 | |
| 7598 | return ret; |
| 7599 | } |
| 7600 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7601 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7602 | |
| 7603 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7604 | static int __wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7605 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7606 | #else |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7607 | static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7608 | struct net_device *dev) |
| 7609 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7610 | { |
| 7611 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7612 | hdd_context_t *pHddCtx = NULL; |
| 7613 | hdd_scaninfo_t *pScanInfo = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7614 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7615 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7616 | |
| 7617 | ENTER(); |
| 7618 | |
| 7619 | if (NULL == pAdapter) |
| 7620 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7621 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7622 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7623 | return -ENODEV; |
| 7624 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7625 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7626 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7627 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 7628 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7629 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7630 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7631 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7632 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7633 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7634 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7635 | |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7636 | pScanInfo = &pHddCtx->scan_info; |
| 7637 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7638 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7639 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7640 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7641 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7642 | ret = wlan_hdd_scan_abort(pAdapter); |
| 7643 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 7644 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7645 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7646 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7647 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7648 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7649 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7650 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7651 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7652 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 7653 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7654 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7655 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7656 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7657 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7658 | } |
| 7659 | |
Rashmi Ramanna | 1f0948d | 2014-08-28 15:33:48 +0530 | [diff] [blame] | 7660 | /* Delete all associated STAs before stopping AP/P2P GO */ |
| 7661 | hdd_del_all_sta(pAdapter); |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 7662 | hdd_hostapd_stop(dev); |
| 7663 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7664 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7665 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7666 | ) |
| 7667 | { |
| 7668 | beacon_data_t *old; |
| 7669 | |
| 7670 | old = pAdapter->sessionCtx.ap.beacon; |
| 7671 | |
| 7672 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7673 | { |
| 7674 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7675 | FL("session(%d) beacon data points to NULL"), |
| 7676 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7677 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7678 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7679 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7680 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7681 | |
| 7682 | mutex_lock(&pHddCtx->sap_lock); |
| 7683 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 7684 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7685 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7686 | { |
| 7687 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 7688 | |
| 7689 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 7690 | |
| 7691 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 7692 | { |
| 7693 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7694 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7695 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7696 | } |
| 7697 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7698 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7699 | /* BSS stopped, clear the active sessions for this device mode */ |
| 7700 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7701 | } |
| 7702 | mutex_unlock(&pHddCtx->sap_lock); |
| 7703 | |
| 7704 | if(status != VOS_STATUS_SUCCESS) |
| 7705 | { |
| 7706 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7707 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7708 | return -EINVAL; |
| 7709 | } |
| 7710 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7711 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7712 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 7713 | ==eHAL_STATUS_FAILURE) |
| 7714 | { |
| 7715 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7716 | "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] | 7717 | } |
| 7718 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7719 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7720 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 7721 | eANI_BOOLEAN_FALSE) ) |
| 7722 | { |
| 7723 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7724 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7725 | } |
| 7726 | |
| 7727 | // Reset WNI_CFG_PROBE_RSP Flags |
| 7728 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 7729 | |
| 7730 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 7731 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7732 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7733 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 7734 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 7735 | { |
| 7736 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 7737 | "GO got removed"); |
| 7738 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 7739 | } |
| 7740 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7741 | } |
| 7742 | EXIT(); |
| 7743 | return status; |
| 7744 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7745 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7746 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7747 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 7748 | struct net_device *dev) |
| 7749 | { |
| 7750 | int ret; |
| 7751 | |
| 7752 | vos_ssr_protect(__func__); |
| 7753 | ret = __wlan_hdd_cfg80211_del_beacon(wiphy, dev); |
| 7754 | vos_ssr_unprotect(__func__); |
| 7755 | |
| 7756 | return ret; |
| 7757 | } |
| 7758 | #else |
| 7759 | static int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, |
| 7760 | struct net_device *dev) |
| 7761 | { |
| 7762 | int ret; |
| 7763 | |
| 7764 | vos_ssr_protect(__func__); |
| 7765 | ret = __wlan_hdd_cfg80211_stop_ap(wiphy, dev); |
| 7766 | vos_ssr_unprotect(__func__); |
| 7767 | |
| 7768 | return ret; |
| 7769 | } |
| 7770 | #endif |
| 7771 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7772 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 7773 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7774 | static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7775 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7776 | struct cfg80211_ap_settings *params) |
| 7777 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7778 | hdd_adapter_t *pAdapter; |
| 7779 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7780 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7781 | |
| 7782 | ENTER(); |
| 7783 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7784 | if (NULL == dev || NULL == params) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7785 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7786 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7787 | "%s: Device or params is Null", __func__); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7788 | return -ENODEV; |
| 7789 | } |
| 7790 | |
| 7791 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7792 | if (NULL == pAdapter) |
| 7793 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7794 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7795 | "%s: HDD adapter is Null", __func__); |
| 7796 | return -ENODEV; |
| 7797 | } |
| 7798 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7799 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7800 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 7801 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7802 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 7803 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7804 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7805 | "%s: HDD adapter magic is invalid", __func__); |
| 7806 | return -ENODEV; |
| 7807 | } |
| 7808 | |
| 7809 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7810 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7811 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7812 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7813 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7814 | } |
| 7815 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7816 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 7817 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7818 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7819 | |
| 7820 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7821 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7822 | ) |
| 7823 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7824 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7825 | |
| 7826 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7827 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7828 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7829 | { |
| 7830 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 7831 | FL("already beacon info added to session(%d)"), |
| 7832 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7833 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7834 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7835 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7836 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7837 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 7838 | &new, |
| 7839 | ¶ms->beacon); |
| 7840 | #else |
| 7841 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 7842 | &new, |
| 7843 | ¶ms->beacon, |
| 7844 | params->dtim_period); |
| 7845 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7846 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7847 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7848 | { |
| 7849 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7850 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7851 | return -EINVAL; |
| 7852 | } |
| 7853 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7854 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 7855 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 7856 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 7857 | params->channel, params->channel_type); |
| 7858 | #else |
| 7859 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 7860 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7861 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7862 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 7863 | params->ssid_len, params->hidden_ssid, |
| 7864 | params->auth_type); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7865 | } |
| 7866 | |
| 7867 | EXIT(); |
| 7868 | return status; |
| 7869 | } |
| 7870 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7871 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 7872 | struct net_device *dev, |
| 7873 | struct cfg80211_ap_settings *params) |
| 7874 | { |
| 7875 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7876 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7877 | vos_ssr_protect(__func__); |
| 7878 | ret = __wlan_hdd_cfg80211_start_ap(wiphy, dev, params); |
| 7879 | vos_ssr_unprotect(__func__); |
| 7880 | |
| 7881 | return ret; |
| 7882 | } |
| 7883 | |
| 7884 | static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7885 | struct net_device *dev, |
| 7886 | struct cfg80211_beacon_data *params) |
| 7887 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7888 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7889 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7890 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7891 | |
| 7892 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7893 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7894 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7895 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 7896 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7897 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7898 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7899 | |
| 7900 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7901 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7902 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7903 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7904 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7905 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7906 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7907 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7908 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7909 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7910 | { |
| 7911 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7912 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7913 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7914 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7915 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7916 | { |
| 7917 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7918 | FL("session(%d) beacon data points to NULL"), |
| 7919 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7920 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7921 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7922 | |
| 7923 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 7924 | |
| 7925 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7926 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7927 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7928 | return -EINVAL; |
| 7929 | } |
| 7930 | |
| 7931 | pAdapter->sessionCtx.ap.beacon = new; |
| 7932 | |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 7933 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0, |
| 7934 | pAdapter->sessionCtx.ap.sapConfig.authType); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7935 | } |
| 7936 | |
| 7937 | EXIT(); |
| 7938 | return status; |
| 7939 | } |
| 7940 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7941 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
| 7942 | struct net_device *dev, |
| 7943 | struct cfg80211_beacon_data *params) |
| 7944 | { |
| 7945 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7946 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7947 | vos_ssr_protect(__func__); |
| 7948 | ret = __wlan_hdd_cfg80211_change_beacon(wiphy, dev, params); |
| 7949 | vos_ssr_unprotect(__func__); |
| 7950 | |
| 7951 | return ret; |
| 7952 | } |
| 7953 | |
| 7954 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7955 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 7956 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7957 | struct net_device *dev, |
| 7958 | struct bss_parameters *params) |
| 7959 | { |
| 7960 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7961 | hdd_context_t *pHddCtx; |
| 7962 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7963 | |
| 7964 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7965 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7966 | if (NULL == pAdapter) |
| 7967 | { |
| 7968 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7969 | "%s: HDD adapter is Null", __func__); |
| 7970 | return -ENODEV; |
| 7971 | } |
| 7972 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7973 | ret = wlan_hdd_validate_context(pHddCtx); |
| 7974 | if (0 != ret) |
| 7975 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7976 | return ret; |
| 7977 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7978 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7979 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 7980 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7981 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7982 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7983 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7984 | |
| 7985 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7986 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7987 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7988 | { |
| 7989 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 7990 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7991 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7992 | { |
| 7993 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7994 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7995 | } |
| 7996 | |
| 7997 | EXIT(); |
| 7998 | return 0; |
| 7999 | } |
| 8000 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 8001 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 8002 | struct net_device *dev, |
| 8003 | struct bss_parameters *params) |
| 8004 | { |
| 8005 | int ret; |
| 8006 | |
| 8007 | vos_ssr_protect(__func__); |
| 8008 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 8009 | vos_ssr_unprotect(__func__); |
| 8010 | |
| 8011 | return ret; |
| 8012 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8013 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 8014 | * to wait for contry code completion |
| 8015 | */ |
| 8016 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 8017 | { |
| 8018 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 8019 | complete(&call_back_pAdapter->change_country_code); |
| 8020 | return NULL; |
| 8021 | } |
| 8022 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8023 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 8024 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8025 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 8026 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 8027 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8028 | struct net_device *ndev, |
| 8029 | enum nl80211_iftype type, |
| 8030 | u32 *flags, |
| 8031 | struct vif_params *params |
| 8032 | ) |
| 8033 | { |
| 8034 | struct wireless_dev *wdev; |
| 8035 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 8036 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8037 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8038 | tCsrRoamProfile *pRoamProfile = NULL; |
| 8039 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8040 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8041 | eMib_dot11DesiredBssType connectedBssType; |
| 8042 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8043 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8044 | |
| 8045 | ENTER(); |
| 8046 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8047 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 8048 | { |
| 8049 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8050 | "%s: Adapter context is null", __func__); |
| 8051 | return VOS_STATUS_E_FAILURE; |
| 8052 | } |
| 8053 | |
| 8054 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8055 | if (!pHddCtx) |
| 8056 | { |
| 8057 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8058 | "%s: HDD context is null", __func__); |
| 8059 | return VOS_STATUS_E_FAILURE; |
| 8060 | } |
| 8061 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8062 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8063 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 8064 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8065 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8066 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8067 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8068 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8069 | } |
| 8070 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8071 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8072 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8073 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8074 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 8075 | if (vos_max_concurrent_connections_reached()) { |
| 8076 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 8077 | return -EINVAL; |
| 8078 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8079 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8080 | wdev = ndev->ieee80211_ptr; |
| 8081 | |
| 8082 | #ifdef WLAN_BTAMP_FEATURE |
| 8083 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 8084 | (NL80211_IFTYPE_ADHOC == type)|| |
| 8085 | (NL80211_IFTYPE_AP == type)|| |
| 8086 | (NL80211_IFTYPE_P2P_GO == type)) |
| 8087 | { |
| 8088 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 8089 | // stop AMP traffic |
| 8090 | status = WLANBAP_StopAmp(); |
| 8091 | if(VOS_STATUS_SUCCESS != status ) |
| 8092 | { |
| 8093 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 8094 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 8095 | "%s: Failed to stop AMP", __func__); |
| 8096 | return -EINVAL; |
| 8097 | } |
| 8098 | } |
| 8099 | #endif //WLAN_BTAMP_FEATURE |
| 8100 | /* Reset the current device mode bit mask*/ |
| 8101 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 8102 | |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 8103 | /* Notify Mode change in case of concurrency. |
| 8104 | * Below function invokes TDLS teardown Functionality Since TDLS is |
| 8105 | * not Supported in case of concurrency i.e Once P2P session |
| 8106 | * is detected disable offchannel and teardown TDLS links |
| 8107 | */ |
| 8108 | hdd_tdls_notify_mode_change(pAdapter, pHddCtx); |
| 8109 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8110 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8111 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8112 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8113 | ) |
| 8114 | { |
| 8115 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 8116 | if (!pWextState) |
| 8117 | { |
| 8118 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8119 | "%s: pWextState is null", __func__); |
| 8120 | return VOS_STATUS_E_FAILURE; |
| 8121 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8122 | pRoamProfile = &pWextState->roamProfile; |
| 8123 | LastBSSType = pRoamProfile->BSSType; |
| 8124 | |
| 8125 | switch (type) |
| 8126 | { |
| 8127 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8128 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8129 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8130 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 8131 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8132 | #ifdef WLAN_FEATURE_11AC |
| 8133 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 8134 | { |
| 8135 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 8136 | } |
| 8137 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8138 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8139 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8140 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8141 | //Check for sub-string p2p to confirm its a p2p interface |
| 8142 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8143 | { |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8144 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 8145 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 8146 | } |
| 8147 | else |
| 8148 | { |
| 8149 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8150 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8151 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8152 | break; |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 8153 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8154 | case NL80211_IFTYPE_ADHOC: |
| 8155 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8156 | "%s: setting interface Type to ADHOC", __func__); |
| 8157 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 8158 | pRoamProfile->phyMode = |
| 8159 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 8160 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8161 | wdev->iftype = type; |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 8162 | hdd_set_ibss_ops( pAdapter ); |
| 8163 | hdd_ibss_init_tx_rx( pAdapter ); |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 8164 | |
| 8165 | status = hdd_sta_id_hash_attach(pAdapter); |
| 8166 | if (VOS_STATUS_SUCCESS != status) { |
| 8167 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8168 | FL("Failed to initialize hash for IBSS")); |
| 8169 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8170 | break; |
| 8171 | |
| 8172 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8173 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8174 | { |
| 8175 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 8176 | "%s: setting interface Type to %s", __func__, |
| 8177 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 8178 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8179 | //Cancel any remain on channel for GO mode |
| 8180 | if (NL80211_IFTYPE_P2P_GO == type) |
| 8181 | { |
| 8182 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 8183 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8184 | if (NL80211_IFTYPE_AP == type) |
| 8185 | { |
| 8186 | /* As Loading WLAN Driver one interface being created for p2p device |
| 8187 | * address. This will take one HW STA and the max number of clients |
| 8188 | * that can connect to softAP will be reduced by one. so while changing |
| 8189 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 8190 | * interface as it is not required in SoftAP mode. |
| 8191 | */ |
| 8192 | |
| 8193 | // Get P2P Adapter |
| 8194 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 8195 | |
| 8196 | if (pP2pAdapter) |
| 8197 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 8198 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8199 | hdd_deinit_adapter(pHddCtx, pP2pAdapter, TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8200 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 8201 | } |
| 8202 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 8203 | //Disable IMPS & BMPS for SAP/GO |
| 8204 | if(VOS_STATUS_E_FAILURE == |
| 8205 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 8206 | { |
| 8207 | //Fail to Exit BMPS |
| 8208 | VOS_ASSERT(0); |
| 8209 | } |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 8210 | |
| 8211 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
| 8212 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8213 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8214 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8215 | /* A Mutex Lock is introduced while changing the mode to |
| 8216 | * protect the concurrent access for the Adapters by TDLS |
| 8217 | * module. |
| 8218 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8219 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8220 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8221 | //De-init the adapter. |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8222 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8223 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8224 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 8225 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8226 | #ifdef FEATURE_WLAN_TDLS |
| 8227 | mutex_unlock(&pHddCtx->tdls_lock); |
| 8228 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 8229 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 8230 | (pConfig->apRandomBssidEnabled)) |
| 8231 | { |
| 8232 | /* To meet Android requirements create a randomized |
| 8233 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 8234 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 8235 | ndev->dev_addr[0] = 0x02; |
| 8236 | ndev->dev_addr[1] = 0x1A; |
| 8237 | ndev->dev_addr[2] = 0x11; |
| 8238 | ndev->dev_addr[3] |= 0xF0; |
| 8239 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 8240 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 8241 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 8242 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 8243 | } |
| 8244 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8245 | hdd_set_ap_ops( pAdapter->dev ); |
| 8246 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8247 | /* This is for only SAP mode where users can |
| 8248 | * control country through ini. |
| 8249 | * P2P GO follows station country code |
| 8250 | * acquired during the STA scanning. */ |
| 8251 | if((NL80211_IFTYPE_AP == type) && |
| 8252 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 8253 | { |
| 8254 | int status = 0; |
| 8255 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 8256 | "%s: setting country code from INI ", __func__); |
| 8257 | init_completion(&pAdapter->change_country_code); |
| 8258 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 8259 | (void *)(tSmeChangeCountryCallback) |
| 8260 | wlan_hdd_change_country_code_cb, |
| 8261 | pConfig->apCntryCode, pAdapter, |
| 8262 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 8263 | eSIR_FALSE, |
| 8264 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8265 | if (eHAL_STATUS_SUCCESS == status) |
| 8266 | { |
| 8267 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8268 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8269 | &pAdapter->change_country_code, |
| 8270 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8271 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8272 | { |
| 8273 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8274 | FL("SME Timed out while setting country code %ld"), |
| 8275 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 8276 | |
| 8277 | if (pHddCtx->isLogpInProgress) |
| 8278 | { |
| 8279 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8280 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 8281 | return -EAGAIN; |
| 8282 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8283 | } |
| 8284 | } |
| 8285 | else |
| 8286 | { |
| 8287 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8288 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8289 | return -EINVAL; |
| 8290 | } |
| 8291 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8292 | status = hdd_init_ap_mode(pAdapter); |
| 8293 | if(status != VOS_STATUS_SUCCESS) |
| 8294 | { |
| 8295 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 8296 | "%s: Error initializing the ap mode", __func__); |
| 8297 | return -EINVAL; |
| 8298 | } |
| 8299 | hdd_set_conparam(1); |
| 8300 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 8301 | status = hdd_sta_id_hash_attach(pAdapter); |
| 8302 | if (VOS_STATUS_SUCCESS != status) |
| 8303 | { |
| 8304 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8305 | FL("Failed to initialize hash for AP")); |
| 8306 | return -EINVAL; |
| 8307 | } |
| 8308 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8309 | /*interface type changed update in wiphy structure*/ |
| 8310 | if(wdev) |
| 8311 | { |
| 8312 | wdev->iftype = type; |
| 8313 | pHddCtx->change_iface = type; |
| 8314 | } |
| 8315 | else |
| 8316 | { |
| 8317 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8318 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 8319 | return -EINVAL; |
| 8320 | } |
| 8321 | goto done; |
| 8322 | } |
| 8323 | |
| 8324 | default: |
| 8325 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 8326 | __func__); |
| 8327 | return -EOPNOTSUPP; |
| 8328 | } |
| 8329 | } |
| 8330 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8331 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8332 | ) |
| 8333 | { |
| 8334 | switch(type) |
| 8335 | { |
| 8336 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8337 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8338 | case NL80211_IFTYPE_ADHOC: |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 8339 | |
| 8340 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8341 | #ifdef FEATURE_WLAN_TDLS |
| 8342 | |
| 8343 | /* A Mutex Lock is introduced while changing the mode to |
| 8344 | * protect the concurrent access for the Adapters by TDLS |
| 8345 | * module. |
| 8346 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8347 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8348 | #endif |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8349 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8350 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8351 | //Check for sub-string p2p to confirm its a p2p interface |
| 8352 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8353 | { |
| 8354 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 8355 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 8356 | } |
| 8357 | else |
| 8358 | { |
| 8359 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8360 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8361 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8362 | hdd_set_conparam(0); |
| 8363 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8364 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 8365 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8366 | #ifdef FEATURE_WLAN_TDLS |
| 8367 | mutex_unlock(&pHddCtx->tdls_lock); |
| 8368 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 8369 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8370 | if( VOS_STATUS_SUCCESS != status ) |
| 8371 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8372 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 8373 | * This is the right place to enable back bmps_imps() |
| 8374 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 8375 | if (pHddCtx->hdd_wlan_suspended) |
| 8376 | { |
| 8377 | hdd_set_pwrparams(pHddCtx); |
| 8378 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8379 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8380 | goto done; |
| 8381 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8382 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8383 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8384 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 8385 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8386 | goto done; |
| 8387 | default: |
| 8388 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 8389 | __func__); |
| 8390 | return -EOPNOTSUPP; |
| 8391 | |
| 8392 | } |
| 8393 | |
| 8394 | } |
| 8395 | else |
| 8396 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8397 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 8398 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8399 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8400 | return -EOPNOTSUPP; |
| 8401 | } |
| 8402 | |
| 8403 | |
| 8404 | if(pRoamProfile) |
| 8405 | { |
| 8406 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 8407 | { |
| 8408 | /*interface type changed update in wiphy structure*/ |
| 8409 | wdev->iftype = type; |
| 8410 | |
| 8411 | /*the BSS mode changed, We need to issue disconnect |
| 8412 | if connected or in IBSS disconnect state*/ |
| 8413 | if ( hdd_connGetConnectedBssType( |
| 8414 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 8415 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 8416 | { |
| 8417 | /*need to issue a disconnect to CSR.*/ |
| 8418 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 8419 | if( eHAL_STATUS_SUCCESS == |
| 8420 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8421 | pAdapter->sessionId, |
| 8422 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 8423 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8424 | ret = wait_for_completion_interruptible_timeout( |
| 8425 | &pAdapter->disconnect_comp_var, |
| 8426 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 8427 | if (ret <= 0) |
| 8428 | { |
| 8429 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8430 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 8431 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8432 | } |
| 8433 | } |
| 8434 | } |
| 8435 | } |
| 8436 | |
| 8437 | done: |
| 8438 | /*set bitmask based on updated value*/ |
| 8439 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 8440 | |
| 8441 | /* Only STA mode support TM now |
| 8442 | * all other mode, TM feature should be disabled */ |
| 8443 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 8444 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 8445 | { |
| 8446 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 8447 | } |
| 8448 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8449 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8450 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 8451 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8452 | { |
| 8453 | //we are ok to do AMP |
| 8454 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 8455 | } |
| 8456 | #endif //WLAN_BTAMP_FEATURE |
| 8457 | EXIT(); |
| 8458 | return 0; |
| 8459 | } |
| 8460 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 8461 | /* |
| 8462 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 8463 | * wrapper function to protect the actual implementation from SSR. |
| 8464 | */ |
| 8465 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 8466 | struct net_device *ndev, |
| 8467 | enum nl80211_iftype type, |
| 8468 | u32 *flags, |
| 8469 | struct vif_params *params |
| 8470 | ) |
| 8471 | { |
| 8472 | int ret; |
| 8473 | |
| 8474 | vos_ssr_protect(__func__); |
| 8475 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 8476 | vos_ssr_unprotect(__func__); |
| 8477 | |
| 8478 | return ret; |
| 8479 | } |
| 8480 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8481 | #ifdef FEATURE_WLAN_TDLS |
| 8482 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
| 8483 | struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams) |
| 8484 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8485 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8486 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8487 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8488 | tANI_U16 numCurrTdlsPeers; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 8489 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8490 | |
| 8491 | ENTER(); |
| 8492 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 8493 | if (!dev) { |
| 8494 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 8495 | return -EINVAL; |
| 8496 | } |
| 8497 | |
| 8498 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8499 | if (!pAdapter) { |
| 8500 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 8501 | return -EINVAL; |
| 8502 | } |
| 8503 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8504 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8505 | { |
| 8506 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8507 | "Invalid arguments"); |
| 8508 | return -EINVAL; |
| 8509 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8510 | |
| 8511 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 8512 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 8513 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8514 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8515 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 8516 | MAC_ADDRESS_STR " Request declined.", |
| 8517 | __func__, MAC_ADDR_ARRAY(mac)); |
| 8518 | return -ENOTSUPP; |
| 8519 | } |
| 8520 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8521 | if (pHddCtx->isLogpInProgress) |
| 8522 | { |
| 8523 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8524 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8525 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8526 | mac, |
| 8527 | eTDLS_LINK_IDLE, |
| 8528 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8529 | return -EBUSY; |
| 8530 | } |
| 8531 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 8532 | mutex_lock(&pHddCtx->tdls_lock); |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 8533 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8534 | |
| 8535 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8536 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8537 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 8538 | __func__, MAC_ADDR_ARRAY(mac), update); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 8539 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8540 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8541 | } |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 8542 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8543 | |
| 8544 | /* in add station, we accept existing valid staId if there is */ |
| 8545 | if ((0 == update) && |
| 8546 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 8547 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8548 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8549 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8550 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8551 | " link_status %d. staId %d. add station ignored.", |
| 8552 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 8553 | return 0; |
| 8554 | } |
| 8555 | /* in change station, we accept only when staId is valid */ |
| 8556 | if ((1 == update) && |
| 8557 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 8558 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 8559 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8560 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8561 | "%s: " MAC_ADDRESS_STR |
| 8562 | " link status %d. staId %d. change station %s.", |
| 8563 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 8564 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 8565 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8566 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8567 | |
| 8568 | /* 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] | 8569 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8570 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8571 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8572 | "%s: " MAC_ADDRESS_STR |
| 8573 | " TDLS setup is ongoing. Request declined.", |
| 8574 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8575 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8576 | } |
| 8577 | |
| 8578 | /* first to check if we reached to maximum supported TDLS peer. |
| 8579 | TODO: for now, return -EPERM looks working fine, |
| 8580 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8581 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 8582 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8583 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8584 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8585 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8586 | " TDLS Max peer already connected. Request declined." |
| 8587 | " Num of peers (%d), Max allowed (%d).", |
| 8588 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 8589 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8590 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8591 | } |
| 8592 | else |
| 8593 | { |
| 8594 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8595 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8596 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8597 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8598 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8599 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 8600 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8601 | return -EPERM; |
| 8602 | } |
| 8603 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8604 | if (0 == update) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8605 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8606 | mac, |
| 8607 | eTDLS_LINK_CONNECTING, |
| 8608 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8609 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 8610 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8611 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8612 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8613 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8614 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8615 | if(StaParams->htcap_present) |
| 8616 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8617 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8618 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8619 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8620 | "ht_capa->extended_capabilities: %0x", |
| 8621 | StaParams->HTCap.extendedHtCapInfo); |
| 8622 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8623 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8624 | "params->capability: %0x",StaParams->capability); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8625 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8626 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8627 | if(StaParams->vhtcap_present) |
| 8628 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8629 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8630 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 8631 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 8632 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 8633 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8634 | { |
| 8635 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8636 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8637 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8638 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8639 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 8640 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 8641 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8642 | else if ((1 == update) && (NULL == StaParams)) |
| 8643 | { |
| 8644 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8645 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 8646 | return -EPERM; |
| 8647 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8648 | |
| 8649 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 8650 | |
| 8651 | if (!update) |
| 8652 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8653 | ret = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8654 | pAdapter->sessionId, mac); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8655 | if (ret != eHAL_STATUS_SUCCESS) { |
| 8656 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to add TDLS peer STA")); |
| 8657 | return -EPERM; |
| 8658 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8659 | } |
| 8660 | else |
| 8661 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8662 | ret = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8663 | pAdapter->sessionId, mac, StaParams); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8664 | if (ret != eHAL_STATUS_SUCCESS) { |
| 8665 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to change TDLS peer STA params")); |
| 8666 | return -EPERM; |
| 8667 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8668 | } |
| 8669 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8670 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8671 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 8672 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8673 | if (ret <= 0) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8674 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8675 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8676 | "%s: timeout waiting for tdls add station indication %ld", |
| 8677 | __func__, ret); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8678 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8679 | } |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8680 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8681 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 8682 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8683 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8684 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8685 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8686 | } |
| 8687 | |
| 8688 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8689 | |
| 8690 | error: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8691 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8692 | mac, |
| 8693 | eTDLS_LINK_IDLE, |
| 8694 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8695 | return -EPERM; |
| 8696 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8697 | } |
| 8698 | #endif |
| 8699 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8700 | static int __wlan_hdd_change_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8701 | struct net_device *dev, |
| 8702 | u8 *mac, |
| 8703 | struct station_parameters *params) |
| 8704 | { |
| 8705 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8706 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8707 | hdd_context_t *pHddCtx; |
| 8708 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8709 | v_MACADDR_t STAMacAddress; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8710 | int ret = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8711 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8712 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8713 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8714 | tANI_U8 isOffChannelSupported = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8715 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8716 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8717 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8718 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8719 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8720 | if ((NULL == pAdapter)) |
| 8721 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8722 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8723 | "invalid adapter "); |
| 8724 | return -EINVAL; |
| 8725 | } |
| 8726 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8727 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8728 | TRACE_CODE_HDD_CHANGE_STATION, |
| 8729 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8730 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8731 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8732 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8733 | if (0 != ret) |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8734 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8735 | return ret; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8736 | } |
| 8737 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8738 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8739 | |
| 8740 | if (NULL == pHddStaCtx) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8741 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8742 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8743 | "invalid HDD station context"); |
| 8744 | return -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8745 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8746 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 8747 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8748 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 8749 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8750 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8751 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8752 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8753 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8754 | WLANTL_STA_AUTHENTICATED); |
| 8755 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8756 | if (status != VOS_STATUS_SUCCESS) |
| 8757 | { |
| 8758 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8759 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 8760 | return -EINVAL; |
| 8761 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8762 | } |
| 8763 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 8764 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 8765 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8766 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8767 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 8768 | StaParams.capability = params->capability; |
| 8769 | StaParams.uapsd_queues = params->uapsd_queues; |
| 8770 | StaParams.max_sp = params->max_sp; |
| 8771 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8772 | /* Convert (first channel , number of channels) tuple to |
| 8773 | * the total list of channels. This goes with the assumption |
| 8774 | * that if the first channel is < 14, then the next channels |
| 8775 | * are an incremental of 1 else an incremental of 4 till the number |
| 8776 | * of channels. |
| 8777 | */ |
| 8778 | if (0 != params->supported_channels_len) { |
| 8779 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 8780 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 8781 | { |
| 8782 | int wifi_chan_index; |
| 8783 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 8784 | wifi_chan_index = |
| 8785 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 8786 | no_of_channels = params->supported_channels[i+1]; |
| 8787 | for(k=1; k <= no_of_channels; k++) |
| 8788 | { |
| 8789 | StaParams.supported_channels[j+1] = |
| 8790 | StaParams.supported_channels[j] + wifi_chan_index; |
| 8791 | j+=1; |
| 8792 | } |
| 8793 | } |
| 8794 | StaParams.supported_channels_len = j; |
| 8795 | } |
| 8796 | vos_mem_copy(StaParams.supported_oper_classes, |
| 8797 | params->supported_oper_classes, |
| 8798 | params->supported_oper_classes_len); |
| 8799 | StaParams.supported_oper_classes_len = |
| 8800 | params->supported_oper_classes_len; |
| 8801 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8802 | if (0 != params->ext_capab_len) |
| 8803 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 8804 | sizeof(StaParams.extn_capability)); |
| 8805 | |
| 8806 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8807 | { |
| 8808 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8809 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8810 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8811 | |
| 8812 | StaParams.supported_rates_len = params->supported_rates_len; |
| 8813 | |
| 8814 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 8815 | * The supported_rates array , for all the structures propogating till Add Sta |
| 8816 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 8817 | * modified to send more rates. |
| 8818 | */ |
| 8819 | |
| 8820 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 8821 | */ |
| 8822 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 8823 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 8824 | |
| 8825 | if (0 != StaParams.supported_rates_len) { |
| 8826 | int i = 0; |
| 8827 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 8828 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8829 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8830 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 8831 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8832 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8833 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 8834 | } |
| 8835 | |
| 8836 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8837 | { |
| 8838 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8839 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8840 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8841 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8842 | if (0 != params->ext_capab_len ) { |
| 8843 | /*Define A Macro : TODO Sunil*/ |
| 8844 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 8845 | isBufSta = 1; |
| 8846 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8847 | /* TDLS Channel Switching Support */ |
| 8848 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 8849 | isOffChannelSupported = 1; |
| 8850 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8851 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8852 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 8853 | &StaParams, isBufSta, |
| 8854 | isOffChannelSupported); |
| 8855 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8856 | if (VOS_STATUS_SUCCESS != status) { |
| 8857 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8858 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 8859 | return -EINVAL; |
| 8860 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8861 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 8862 | |
| 8863 | if (VOS_STATUS_SUCCESS != status) { |
| 8864 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8865 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 8866 | return -EINVAL; |
| 8867 | } |
| 8868 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8869 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 8870 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8871 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8872 | return status; |
| 8873 | } |
| 8874 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8875 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 8876 | struct net_device *dev, |
| 8877 | u8 *mac, |
| 8878 | struct station_parameters *params) |
| 8879 | { |
| 8880 | int ret; |
| 8881 | |
| 8882 | vos_ssr_protect(__func__); |
| 8883 | ret = __wlan_hdd_change_station(wiphy, dev, mac, params); |
| 8884 | vos_ssr_unprotect(__func__); |
| 8885 | |
| 8886 | return ret; |
| 8887 | } |
| 8888 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8889 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8890 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8891 | * This function is used to initialize the key information |
| 8892 | */ |
| 8893 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8894 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8895 | struct net_device *ndev, |
| 8896 | u8 key_index, bool pairwise, |
| 8897 | const u8 *mac_addr, |
| 8898 | struct key_params *params |
| 8899 | ) |
| 8900 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8901 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8902 | struct net_device *ndev, |
| 8903 | u8 key_index, const u8 *mac_addr, |
| 8904 | struct key_params *params |
| 8905 | ) |
| 8906 | #endif |
| 8907 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8908 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8909 | tCsrRoamSetKey setKey; |
| 8910 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8911 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8912 | v_U32_t roamId= 0xFF; |
| 8913 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8914 | hdd_hostapd_state_t *pHostapdState; |
| 8915 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8916 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8917 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8918 | |
| 8919 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8920 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8921 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8922 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 8923 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8924 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8925 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8926 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8927 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8928 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8929 | } |
| 8930 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8931 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8932 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8933 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8934 | |
| 8935 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8936 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8937 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8938 | key_index); |
| 8939 | |
| 8940 | return -EINVAL; |
| 8941 | } |
| 8942 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8943 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 8944 | { |
| 8945 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 8946 | params->key_len); |
| 8947 | |
| 8948 | return -EINVAL; |
| 8949 | } |
| 8950 | |
| 8951 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8952 | "%s: called with key index = %d & key length %d", |
| 8953 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8954 | |
| 8955 | /*extract key idx, key len and key*/ |
| 8956 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8957 | setKey.keyId = key_index; |
| 8958 | setKey.keyLength = params->key_len; |
| 8959 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 8960 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8961 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8962 | { |
| 8963 | case WLAN_CIPHER_SUITE_WEP40: |
| 8964 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 8965 | break; |
| 8966 | |
| 8967 | case WLAN_CIPHER_SUITE_WEP104: |
| 8968 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 8969 | break; |
| 8970 | |
| 8971 | case WLAN_CIPHER_SUITE_TKIP: |
| 8972 | { |
| 8973 | u8 *pKey = &setKey.Key[0]; |
| 8974 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 8975 | |
| 8976 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 8977 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8978 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8979 | |
| 8980 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8981 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8982 | |--------------|----------|----------| |
| 8983 | <---16bytes---><--8bytes--><--8bytes--> |
| 8984 | |
| 8985 | */ |
| 8986 | /*Sme expects the 32 bytes key to be in the below order |
| 8987 | |
| 8988 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8989 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8990 | |--------------|----------|----------| |
| 8991 | <---16bytes---><--8bytes--><--8bytes--> |
| 8992 | */ |
| 8993 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8994 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8995 | |
| 8996 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8997 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8998 | |
| 8999 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9000 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9001 | |
| 9002 | |
| 9003 | break; |
| 9004 | } |
| 9005 | |
| 9006 | case WLAN_CIPHER_SUITE_CCMP: |
| 9007 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 9008 | break; |
| 9009 | |
| 9010 | #ifdef FEATURE_WLAN_WAPI |
| 9011 | case WLAN_CIPHER_SUITE_SMS4: |
| 9012 | { |
| 9013 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9014 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 9015 | params->key, params->key_len); |
| 9016 | return 0; |
| 9017 | } |
| 9018 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 9019 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9020 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9021 | case WLAN_CIPHER_SUITE_KRK: |
| 9022 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 9023 | break; |
| 9024 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 9025 | |
| 9026 | #ifdef WLAN_FEATURE_11W |
| 9027 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 9028 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 9029 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 9030 | #endif |
| 9031 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9032 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 9033 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9034 | __func__, params->cipher); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9035 | status = -EOPNOTSUPP; |
| 9036 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9037 | } |
| 9038 | |
| 9039 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 9040 | __func__, setKey.encType); |
| 9041 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9042 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9043 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9044 | (!pairwise) |
| 9045 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9046 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9047 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9048 | ) |
| 9049 | { |
| 9050 | /* set group key*/ |
| 9051 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9052 | "%s- %d: setting Broadcast key", |
| 9053 | __func__, __LINE__); |
| 9054 | setKey.keyDirection = eSIR_RX_ONLY; |
| 9055 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 9056 | } |
| 9057 | else |
| 9058 | { |
| 9059 | /* set pairwise key*/ |
| 9060 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9061 | "%s- %d: setting pairwise key", |
| 9062 | __func__, __LINE__); |
| 9063 | setKey.keyDirection = eSIR_TX_RX; |
| 9064 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 9065 | } |
| 9066 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 9067 | { |
| 9068 | setKey.keyDirection = eSIR_TX_RX; |
| 9069 | /*Set the group key*/ |
| 9070 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9071 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9072 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9073 | if ( 0 != status ) |
| 9074 | { |
| 9075 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9076 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9077 | status = -EINVAL; |
| 9078 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9079 | } |
| 9080 | /*Save the keys here and call sme_RoamSetKey for setting |
| 9081 | the PTK after peer joins the IBSS network*/ |
| 9082 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 9083 | &setKey, sizeof(tCsrRoamSetKey)); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9084 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9085 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9086 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 9087 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 9088 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9089 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9090 | if( pHostapdState->bssState == BSS_START ) |
| 9091 | { |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9092 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9093 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 9094 | |
| 9095 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 9096 | { |
| 9097 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9098 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 9099 | __LINE__, vos_status ); |
| 9100 | |
| 9101 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 9102 | |
| 9103 | status = -EINVAL; |
| 9104 | goto end; |
| 9105 | } |
| 9106 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9107 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 9108 | |
| 9109 | if ( status != eHAL_STATUS_SUCCESS ) |
| 9110 | { |
| 9111 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9112 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 9113 | __LINE__, status ); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9114 | status = -EINVAL; |
| 9115 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9116 | } |
| 9117 | } |
| 9118 | |
| 9119 | /* Saving WEP keys */ |
| 9120 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 9121 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 9122 | { |
| 9123 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 9124 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 9125 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 9126 | } |
| 9127 | else |
| 9128 | { |
| 9129 | //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] | 9130 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9131 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 9132 | } |
| 9133 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9134 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 9135 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9136 | { |
| 9137 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9138 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9139 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9140 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9141 | if (!pairwise) |
| 9142 | #else |
| 9143 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 9144 | #endif |
| 9145 | { |
| 9146 | /* set group key*/ |
| 9147 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 9148 | { |
| 9149 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9150 | "%s- %d: Perform Set key Complete", |
| 9151 | __func__, __LINE__); |
| 9152 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 9153 | } |
| 9154 | } |
| 9155 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9156 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 9157 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 9158 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 9159 | |
| 9160 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9161 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9162 | params->key, params->key_len); |
| 9163 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9164 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9165 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 9166 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9167 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9168 | "%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] | 9169 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9170 | setKey.peerMac[2], setKey.peerMac[3], |
| 9171 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9172 | setKey.keyDirection); |
| 9173 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9174 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 9175 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9176 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 9177 | { |
| 9178 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9179 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 9180 | __LINE__, vos_status ); |
| 9181 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9182 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9183 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9184 | status = -EINVAL; |
| 9185 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9186 | |
| 9187 | } |
| 9188 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9189 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9190 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 9191 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 9192 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9193 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9194 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9195 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9196 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 9197 | "%s: Update PreAuth Key success", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9198 | status = 0; |
| 9199 | goto end; |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9200 | } |
| 9201 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 9202 | { |
| 9203 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9204 | "%s: Update PreAuth Key failed", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9205 | status = -EINVAL; |
| 9206 | goto end; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9207 | } |
| 9208 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9209 | |
| 9210 | /* issue set key request to SME*/ |
| 9211 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9212 | pAdapter->sessionId, &setKey, &roamId ); |
| 9213 | |
| 9214 | if ( 0 != status ) |
| 9215 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9216 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9217 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 9218 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9219 | status = -EINVAL; |
| 9220 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9221 | } |
| 9222 | |
| 9223 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9224 | /* in case of IBSS as there was no information available about WEP keys during |
| 9225 | * 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] | 9226 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9227 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 9228 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 9229 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9230 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 9231 | ) |
| 9232 | && |
| 9233 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 9234 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 9235 | ) |
| 9236 | ) |
| 9237 | { |
| 9238 | setKey.keyDirection = eSIR_RX_ONLY; |
| 9239 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 9240 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9241 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9242 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9243 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9244 | setKey.peerMac[2], setKey.peerMac[3], |
| 9245 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9246 | setKey.keyDirection); |
| 9247 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9248 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9249 | pAdapter->sessionId, &setKey, &roamId ); |
| 9250 | |
| 9251 | if ( 0 != status ) |
| 9252 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9253 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9254 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9255 | __func__, status); |
| 9256 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9257 | status = -EINVAL; |
| 9258 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9259 | } |
| 9260 | } |
| 9261 | } |
| 9262 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9263 | end: |
| 9264 | /* Need to clear any trace of key value in the memory. |
| 9265 | * Thus zero out the memory even though it is local |
| 9266 | * variable. |
| 9267 | */ |
| 9268 | vos_mem_zero(&setKey, sizeof(setKey)); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9269 | EXIT(); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9270 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9271 | } |
| 9272 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9273 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9274 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 9275 | struct net_device *ndev, |
| 9276 | u8 key_index, bool pairwise, |
| 9277 | const u8 *mac_addr, |
| 9278 | struct key_params *params |
| 9279 | ) |
| 9280 | #else |
| 9281 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 9282 | struct net_device *ndev, |
| 9283 | u8 key_index, const u8 *mac_addr, |
| 9284 | struct key_params *params |
| 9285 | ) |
| 9286 | #endif |
| 9287 | { |
| 9288 | int ret; |
| 9289 | vos_ssr_protect(__func__); |
| 9290 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9291 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 9292 | mac_addr, params); |
| 9293 | #else |
| 9294 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 9295 | params); |
| 9296 | #endif |
| 9297 | vos_ssr_unprotect(__func__); |
| 9298 | |
| 9299 | return ret; |
| 9300 | } |
| 9301 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9302 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9303 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9304 | * This function is used to get the key information |
| 9305 | */ |
| 9306 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9307 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9308 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9309 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9310 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9311 | const u8 *mac_addr, void *cookie, |
| 9312 | void (*callback)(void *cookie, struct key_params*) |
| 9313 | ) |
| 9314 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9315 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9316 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9317 | struct net_device *ndev, |
| 9318 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 9319 | void (*callback)(void *cookie, struct key_params*) |
| 9320 | ) |
| 9321 | #endif |
| 9322 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9323 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9324 | hdd_wext_state_t *pWextState = NULL; |
| 9325 | tCsrRoamProfile *pRoamProfile = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9326 | struct key_params params; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9327 | hdd_context_t *pHddCtx; |
| 9328 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9329 | |
| 9330 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9331 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9332 | if (NULL == pAdapter) |
| 9333 | { |
| 9334 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9335 | "%s: HDD adapter is Null", __func__); |
| 9336 | return -ENODEV; |
| 9337 | } |
| 9338 | |
| 9339 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9340 | ret = wlan_hdd_validate_context(pHddCtx); |
| 9341 | if (0 != ret) |
| 9342 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9343 | return ret; |
| 9344 | } |
| 9345 | |
| 9346 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9347 | pRoamProfile = &(pWextState->roamProfile); |
| 9348 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9349 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 9350 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9351 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9352 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9353 | memset(¶ms, 0, sizeof(params)); |
| 9354 | |
| 9355 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9356 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9357 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9358 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9359 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9360 | |
| 9361 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 9362 | { |
| 9363 | case eCSR_ENCRYPT_TYPE_NONE: |
| 9364 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 9365 | break; |
| 9366 | |
| 9367 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 9368 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 9369 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 9370 | break; |
| 9371 | |
| 9372 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 9373 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 9374 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 9375 | break; |
| 9376 | |
| 9377 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 9378 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 9379 | break; |
| 9380 | |
| 9381 | case eCSR_ENCRYPT_TYPE_AES: |
| 9382 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 9383 | break; |
| 9384 | |
| 9385 | default: |
| 9386 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 9387 | break; |
| 9388 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9389 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 9390 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9391 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 9392 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9393 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9394 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 9395 | params.seq_len = 0; |
| 9396 | params.seq = NULL; |
| 9397 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 9398 | callback(cookie, ¶ms); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9399 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9400 | return 0; |
| 9401 | } |
| 9402 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9403 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9404 | static int wlan_hdd_cfg80211_get_key( |
| 9405 | struct wiphy *wiphy, |
| 9406 | struct net_device *ndev, |
| 9407 | u8 key_index, bool pairwise, |
| 9408 | const u8 *mac_addr, void *cookie, |
| 9409 | void (*callback)(void *cookie, struct key_params*) |
| 9410 | ) |
| 9411 | #else |
| 9412 | static int wlan_hdd_cfg80211_get_key( |
| 9413 | struct wiphy *wiphy, |
| 9414 | struct net_device *ndev, |
| 9415 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 9416 | void (*callback)(void *cookie, struct key_params*) |
| 9417 | ) |
| 9418 | #endif |
| 9419 | { |
| 9420 | int ret; |
| 9421 | |
| 9422 | vos_ssr_protect(__func__); |
| 9423 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9424 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 9425 | mac_addr, cookie, callback); |
| 9426 | #else |
| 9427 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 9428 | callback); |
| 9429 | #endif |
| 9430 | vos_ssr_unprotect(__func__); |
| 9431 | |
| 9432 | return ret; |
| 9433 | } |
| 9434 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9435 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9436 | * FUNCTION: __wlan_hdd_cfg80211_del_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9437 | * This function is used to delete the key information |
| 9438 | */ |
| 9439 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9440 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9441 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9442 | u8 key_index, |
| 9443 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9444 | const u8 *mac_addr |
| 9445 | ) |
| 9446 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9447 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9448 | struct net_device *ndev, |
| 9449 | u8 key_index, |
| 9450 | const u8 *mac_addr |
| 9451 | ) |
| 9452 | #endif |
| 9453 | { |
| 9454 | int status = 0; |
| 9455 | |
| 9456 | //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] | 9457 | //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] | 9458 | //it is observed that this is invalidating peer |
| 9459 | //key index whenever re-key is done. This is affecting data link. |
| 9460 | //It should be ok to ignore del_key. |
| 9461 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9462 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 9463 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9464 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 9465 | tCsrRoamSetKey setKey; |
| 9466 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9467 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9468 | ENTER(); |
| 9469 | |
| 9470 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 9471 | __func__,pAdapter->device_mode); |
| 9472 | |
| 9473 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9474 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9475 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9476 | key_index); |
| 9477 | |
| 9478 | return -EINVAL; |
| 9479 | } |
| 9480 | |
| 9481 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9482 | setKey.keyId = key_index; |
| 9483 | |
| 9484 | if (mac_addr) |
| 9485 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 9486 | else |
| 9487 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 9488 | |
| 9489 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 9490 | |
| 9491 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9492 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9493 | ) |
| 9494 | { |
| 9495 | |
| 9496 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9497 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 9498 | if( pHostapdState->bssState == BSS_START) |
| 9499 | { |
| 9500 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9501 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9502 | if ( status != eHAL_STATUS_SUCCESS ) |
| 9503 | { |
| 9504 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9505 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 9506 | __LINE__, status ); |
| 9507 | } |
| 9508 | } |
| 9509 | } |
| 9510 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9511 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9512 | ) |
| 9513 | { |
| 9514 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9515 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9516 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 9517 | |
| 9518 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9519 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9520 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9521 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9522 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9523 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 9524 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9525 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9526 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9527 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9528 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9529 | if ( 0 != status ) |
| 9530 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9531 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9532 | "%s: sme_RoamSetKey failure, returned %d", |
| 9533 | __func__, status); |
| 9534 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 9535 | return -EINVAL; |
| 9536 | } |
| 9537 | } |
| 9538 | } |
| 9539 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9540 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9541 | return status; |
| 9542 | } |
| 9543 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9544 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9545 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 9546 | struct net_device *ndev, |
| 9547 | u8 key_index, |
| 9548 | bool pairwise, |
| 9549 | const u8 *mac_addr |
| 9550 | ) |
| 9551 | #else |
| 9552 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 9553 | struct net_device *ndev, |
| 9554 | u8 key_index, |
| 9555 | const u8 *mac_addr |
| 9556 | ) |
| 9557 | #endif |
| 9558 | { |
| 9559 | int ret; |
| 9560 | |
| 9561 | vos_ssr_protect(__func__); |
| 9562 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9563 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, pairwise, |
| 9564 | mac_addr); |
| 9565 | #else |
| 9566 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, mac_addr); |
| 9567 | #endif |
| 9568 | vos_ssr_unprotect(__func__); |
| 9569 | |
| 9570 | return ret; |
| 9571 | } |
| 9572 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9573 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9574 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9575 | * This function is used to set the default tx key index |
| 9576 | */ |
| 9577 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9578 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9579 | struct net_device *ndev, |
| 9580 | u8 key_index, |
| 9581 | bool unicast, bool multicast) |
| 9582 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9583 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9584 | struct net_device *ndev, |
| 9585 | u8 key_index) |
| 9586 | #endif |
| 9587 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9588 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9589 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9590 | hdd_wext_state_t *pWextState; |
| 9591 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9592 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9593 | |
| 9594 | ENTER(); |
| 9595 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9596 | if ((NULL == pAdapter)) |
| 9597 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9598 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9599 | "invalid adapter"); |
| 9600 | return -EINVAL; |
| 9601 | } |
| 9602 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9603 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9604 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 9605 | pAdapter->sessionId, key_index)); |
| 9606 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9607 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9608 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9609 | |
| 9610 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 9611 | { |
| 9612 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9613 | "invalid Wext state or HDD context"); |
| 9614 | return -EINVAL; |
| 9615 | } |
| 9616 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9617 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9618 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9619 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9620 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9621 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9622 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9623 | key_index); |
| 9624 | |
| 9625 | return -EINVAL; |
| 9626 | } |
| 9627 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9628 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9629 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9630 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9631 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9632 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9633 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9634 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9635 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9636 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9637 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9638 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9639 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 9640 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9641 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 9642 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9643 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9644 | { |
| 9645 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9646 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9647 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9648 | tCsrRoamSetKey setKey; |
| 9649 | v_U32_t roamId= 0xFF; |
| 9650 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9651 | |
| 9652 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9653 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9654 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9655 | Keys->defaultIndex = (u8)key_index; |
| 9656 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9657 | setKey.keyId = key_index; |
| 9658 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9659 | |
| 9660 | vos_mem_copy(&setKey.Key[0], |
| 9661 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9662 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9663 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9664 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9665 | |
| 9666 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9667 | &pHddStaCtx->conn_info.bssId[0], |
| 9668 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9669 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9670 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 9671 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 9672 | eCSR_ENCRYPT_TYPE_WEP104) |
| 9673 | { |
| 9674 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 9675 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 9676 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 9677 | type(104) and switching encryption type to 40*/ |
| 9678 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 9679 | eCSR_ENCRYPT_TYPE_WEP40; |
| 9680 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 9681 | eCSR_ENCRYPT_TYPE_WEP40; |
| 9682 | } |
| 9683 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9684 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9685 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9686 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9687 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9688 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9689 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9690 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9691 | if ( 0 != status ) |
| 9692 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9693 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9694 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9695 | status); |
| 9696 | return -EINVAL; |
| 9697 | } |
| 9698 | } |
| 9699 | } |
| 9700 | |
| 9701 | /* In SoftAp mode setting key direction for default mode */ |
| 9702 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 9703 | { |
| 9704 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 9705 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 9706 | (eCSR_ENCRYPT_TYPE_AES != |
| 9707 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 9708 | ) |
| 9709 | { |
| 9710 | /* Saving key direction for default key index to TX default */ |
| 9711 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 9712 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 9713 | } |
| 9714 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9715 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9716 | return status; |
| 9717 | } |
| 9718 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9719 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9720 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 9721 | struct net_device *ndev, |
| 9722 | u8 key_index, |
| 9723 | bool unicast, bool multicast) |
| 9724 | #else |
| 9725 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 9726 | struct net_device *ndev, |
| 9727 | u8 key_index) |
| 9728 | #endif |
| 9729 | { |
| 9730 | int ret; |
| 9731 | vos_ssr_protect(__func__); |
| 9732 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9733 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 9734 | multicast); |
| 9735 | #else |
| 9736 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 9737 | #endif |
| 9738 | vos_ssr_unprotect(__func__); |
| 9739 | |
| 9740 | return ret; |
| 9741 | } |
| 9742 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9743 | /* |
| 9744 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 9745 | * This function is used to inform the BSS details to nl80211 interface. |
| 9746 | */ |
| 9747 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 9748 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 9749 | { |
| 9750 | struct net_device *dev = pAdapter->dev; |
| 9751 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 9752 | struct wiphy *wiphy = wdev->wiphy; |
| 9753 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 9754 | int chan_no; |
| 9755 | int ie_length; |
| 9756 | const char *ie; |
| 9757 | unsigned int freq; |
| 9758 | struct ieee80211_channel *chan; |
| 9759 | int rssi = 0; |
| 9760 | struct cfg80211_bss *bss = NULL; |
| 9761 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9762 | if( NULL == pBssDesc ) |
| 9763 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9764 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9765 | return bss; |
| 9766 | } |
| 9767 | |
| 9768 | chan_no = pBssDesc->channelId; |
| 9769 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 9770 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 9771 | |
| 9772 | if( NULL == ie ) |
| 9773 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9774 | 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] | 9775 | return bss; |
| 9776 | } |
| 9777 | |
| 9778 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 9779 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 9780 | { |
| 9781 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9782 | } |
| 9783 | else |
| 9784 | { |
| 9785 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9786 | } |
| 9787 | #else |
| 9788 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9789 | #endif |
| 9790 | |
| 9791 | chan = __ieee80211_get_channel(wiphy, freq); |
| 9792 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 9793 | if (!chan) { |
| 9794 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 9795 | return NULL; |
| 9796 | } |
| 9797 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9798 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9799 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9800 | return cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9801 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9802 | pBssDesc->capabilityInfo, |
| 9803 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9804 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9805 | } |
| 9806 | |
| 9807 | |
| 9808 | |
| 9809 | /* |
| 9810 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 9811 | * This function is used to inform the BSS details to nl80211 interface. |
| 9812 | */ |
| 9813 | struct cfg80211_bss* |
| 9814 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 9815 | tSirBssDescription *bss_desc |
| 9816 | ) |
| 9817 | { |
| 9818 | /* |
| 9819 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 9820 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 9821 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 9822 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 9823 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 9824 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 9825 | cfg80211_inform_bss_frame. |
| 9826 | */ |
| 9827 | struct net_device *dev = pAdapter->dev; |
| 9828 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 9829 | struct wiphy *wiphy = wdev->wiphy; |
| 9830 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 9831 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 9832 | qcom_ie_age *qie_age = NULL; |
| 9833 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 9834 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9835 | 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] | 9836 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9837 | const char *ie = |
| 9838 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 9839 | unsigned int freq; |
| 9840 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 9841 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9842 | struct cfg80211_bss *bss_status = NULL; |
| 9843 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 9844 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9845 | hdd_context_t *pHddCtx; |
| 9846 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9847 | #ifdef WLAN_OPEN_SOURCE |
| 9848 | struct timespec ts; |
| 9849 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9850 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9851 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9852 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9853 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9854 | if (0 != status) |
| 9855 | { |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 9856 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9857 | } |
| 9858 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 9859 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9860 | if (!mgmt) |
| 9861 | { |
| 9862 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9863 | "%s: memory allocation failed ", __func__); |
| 9864 | return NULL; |
| 9865 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 9866 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9867 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9868 | |
| 9869 | #ifdef WLAN_OPEN_SOURCE |
| 9870 | /* Android does not want the timestamp from the frame. |
| 9871 | Instead it wants a monotonic increasing value */ |
| 9872 | get_monotonic_boottime(&ts); |
| 9873 | mgmt->u.probe_resp.timestamp = |
| 9874 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 9875 | #else |
| 9876 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9877 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 9878 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9879 | |
| 9880 | #endif |
| 9881 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9882 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 9883 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 9884 | |
| 9885 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 9886 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 9887 | /* Assuming this is the last IE, copy at the end */ |
| 9888 | ie_length -=sizeof(qcom_ie_age); |
| 9889 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 9890 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 9891 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 9892 | qie_age->oui_1 = QCOM_OUI1; |
| 9893 | qie_age->oui_2 = QCOM_OUI2; |
| 9894 | qie_age->oui_3 = QCOM_OUI3; |
| 9895 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 9896 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 9897 | #endif |
| 9898 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9899 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 9900 | if (bss_desc->fProbeRsp) |
| 9901 | { |
| 9902 | mgmt->frame_control |= |
| 9903 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 9904 | } |
| 9905 | else |
| 9906 | { |
| 9907 | mgmt->frame_control |= |
| 9908 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 9909 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9910 | |
| 9911 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9912 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9913 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 9914 | { |
| 9915 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9916 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9917 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9918 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 9919 | |
| 9920 | { |
| 9921 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9922 | } |
| 9923 | else |
| 9924 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9925 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 9926 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9927 | kfree(mgmt); |
| 9928 | return NULL; |
| 9929 | } |
| 9930 | #else |
| 9931 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9932 | #endif |
| 9933 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 9934 | /*when the band is changed on the fly using the GUI, three things are done |
| 9935 | * 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) |
| 9936 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 9937 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 9938 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 9939 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 9940 | * 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 |
| 9941 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 9942 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 9943 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 9944 | * So drop the bss and continue to next bss. |
| 9945 | */ |
| 9946 | if(chan == NULL) |
| 9947 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9948 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 9949 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 9950 | return NULL; |
| 9951 | } |
Hanumantha Reddy Pothula | 904bcef | 2015-06-19 11:56:29 +0530 | [diff] [blame] | 9952 | /*To keep the rssi icon of the connected AP in the scan window |
| 9953 | *and the rssi icon of the wireless networks in sync |
| 9954 | * */ |
| 9955 | if (( eConnectionState_Associated == |
| 9956 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 9957 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 9958 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 9959 | WNI_CFG_BSSID_LEN)) && |
| 9960 | (pHddCtx->hdd_wlan_suspended == FALSE)) |
| 9961 | { |
| 9962 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 9963 | rssi = (pAdapter->rssi * 100); |
| 9964 | } |
| 9965 | else |
| 9966 | { |
| 9967 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 9968 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9969 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9970 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
Sushant Kaushik | 0b34342 | 2015-05-25 17:15:55 +0530 | [diff] [blame] | 9971 | " RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 9972 | vos_freq_to_chan(chan->center_freq), (int)(rssi/100)); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9973 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9974 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 9975 | frame_len, rssi, GFP_KERNEL); |
| 9976 | kfree(mgmt); |
| 9977 | return bss_status; |
| 9978 | } |
| 9979 | |
| 9980 | /* |
| 9981 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 9982 | * This function is used to update the BSS data base of CFG8011 |
| 9983 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9984 | 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] | 9985 | tCsrRoamInfo *pRoamInfo |
| 9986 | ) |
| 9987 | { |
| 9988 | tCsrRoamConnectedProfile roamProfile; |
| 9989 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9990 | struct cfg80211_bss *bss = NULL; |
| 9991 | |
| 9992 | ENTER(); |
| 9993 | |
| 9994 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 9995 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 9996 | |
| 9997 | if (NULL != roamProfile.pBssDesc) |
| 9998 | { |
Girish Gowli | f4b6802 | 2014-08-28 23:18:57 +0530 | [diff] [blame] | 9999 | bss = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 10000 | roamProfile.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10001 | |
| 10002 | if (NULL == bss) |
| 10003 | { |
| 10004 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 10005 | __func__); |
| 10006 | } |
| 10007 | |
| 10008 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 10009 | } |
| 10010 | else |
| 10011 | { |
| 10012 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 10013 | __func__); |
| 10014 | } |
| 10015 | return bss; |
| 10016 | } |
| 10017 | |
| 10018 | /* |
| 10019 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 10020 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10021 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 10022 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10023 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10024 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10025 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10026 | tCsrScanResultInfo *pScanResult; |
| 10027 | eHalStatus status = 0; |
| 10028 | tScanResultHandle pResult; |
| 10029 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10030 | hdd_context_t *pHddCtx; |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 10031 | bool is_p2p_scan = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10032 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10033 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10034 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10035 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 10036 | NO_SESSION, pAdapter->sessionId)); |
| 10037 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10038 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10039 | |
| 10040 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10041 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10042 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 10043 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 10044 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10045 | } |
| 10046 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10047 | |
| 10048 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 10049 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10050 | { |
| 10051 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10052 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 10053 | return VOS_STATUS_E_PERM; |
| 10054 | } |
| 10055 | |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 10056 | if (pAdapter->request != NULL) |
| 10057 | { |
| 10058 | if ((pAdapter->request->n_ssids == 1) |
| 10059 | && (pAdapter->request->ssids != NULL) |
| 10060 | && vos_mem_compare(&pAdapter->request->ssids[0], "DIRECT-", 7)) |
| 10061 | is_p2p_scan = true; |
| 10062 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10063 | /* |
| 10064 | * start getting scan results and populate cgf80211 BSS database |
| 10065 | */ |
| 10066 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 10067 | |
| 10068 | /* no scan results */ |
| 10069 | if (NULL == pResult) |
| 10070 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10071 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 10072 | __func__, status); |
Mahesh A Saptasagar | 51dc36c | 2015-06-16 12:07:15 +0530 | [diff] [blame] | 10073 | wlan_hdd_get_frame_logs(pAdapter, |
| 10074 | WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10075 | return status; |
| 10076 | } |
| 10077 | |
| 10078 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 10079 | |
| 10080 | while (pScanResult) |
| 10081 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10082 | /* |
| 10083 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 10084 | * entry already exists in bss data base of cfg80211 for that |
| 10085 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 10086 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 10087 | * mgmt packet as input. As of now there is no possibility to get |
| 10088 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10089 | * ieee80211_mgmt(probe response) and passing to c |
| 10090 | * fg80211_inform_bss_frame. |
| 10091 | * */ |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 10092 | if(is_p2p_scan && (pScanResult->ssId.ssId != NULL) && |
| 10093 | !vos_mem_compare( pScanResult->ssId.ssId, "DIRECT-", 7) ) |
| 10094 | { |
| 10095 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Non P2P BSS skipped: =%s:"), |
| 10096 | pScanResult->ssId.ssId); |
| 10097 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 10098 | continue; //Skip the non p2p bss entries |
| 10099 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10100 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 10101 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10102 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10103 | |
| 10104 | if (NULL == bss_status) |
| 10105 | { |
| 10106 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10107 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10108 | } |
| 10109 | else |
| 10110 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 10111 | cfg80211_put_bss( |
| 10112 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 10113 | wiphy, |
| 10114 | #endif |
| 10115 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10116 | } |
| 10117 | |
| 10118 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 10119 | } |
| 10120 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10121 | sme_ScanResultPurge(hHal, pResult); |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 10122 | is_p2p_scan = false; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10123 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10124 | } |
| 10125 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10126 | void |
| 10127 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 10128 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10129 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 10130 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10131 | } /****** end hddPrintMacAddr() ******/ |
| 10132 | |
| 10133 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 10134 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10135 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10136 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10137 | "%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] | 10138 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 10139 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 10140 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10141 | } /****** end hddPrintPmkId() ******/ |
| 10142 | |
| 10143 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 10144 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 10145 | |
| 10146 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 10147 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 10148 | |
| 10149 | #define dump_bssid(bssid) \ |
| 10150 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10151 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 10152 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10153 | } |
| 10154 | |
| 10155 | #define dump_pmkid(pMac, pmkid) \ |
| 10156 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10157 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 10158 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10159 | } |
| 10160 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 10161 | #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] | 10162 | /* |
| 10163 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 10164 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 10165 | */ |
| 10166 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10167 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10168 | int index, bool preauth ) |
| 10169 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10170 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10171 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10172 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10173 | |
| 10174 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10175 | 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] | 10176 | |
| 10177 | if( NULL == pRoamInfo ) |
| 10178 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10179 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10180 | return -EINVAL; |
| 10181 | } |
| 10182 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10183 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 10184 | { |
| 10185 | dump_bssid(pRoamInfo->bssid); |
| 10186 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10187 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10188 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10189 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10190 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10191 | } |
| 10192 | #endif //FEATURE_WLAN_LFR |
| 10193 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 10194 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 10195 | /* |
| 10196 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 10197 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 10198 | * |
| 10199 | */ |
| 10200 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 10201 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 10202 | tCsrRoamInfo *pRoamInfo) |
| 10203 | { |
| 10204 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10205 | union iwreq_data wrqu; |
| 10206 | |
| 10207 | ENTER(); |
| 10208 | |
| 10209 | if (NULL == pAdapter) |
| 10210 | { |
| 10211 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10212 | return VOS_STATUS_E_FAILURE; |
| 10213 | } |
| 10214 | |
| 10215 | /* create the event */ |
| 10216 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10217 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10218 | |
| 10219 | wrqu.data.pointer = metrics_notification; |
| 10220 | wrqu.data.length = scnprintf(metrics_notification, |
| 10221 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 10222 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10223 | |
| 10224 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10225 | |
| 10226 | EXIT(); |
| 10227 | |
| 10228 | return VOS_STATUS_SUCCESS; |
| 10229 | } |
| 10230 | |
| 10231 | /* |
| 10232 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 10233 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 10234 | * or failure |
| 10235 | */ |
| 10236 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 10237 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 10238 | { |
| 10239 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10240 | union iwreq_data wrqu; |
| 10241 | |
| 10242 | ENTER(); |
| 10243 | |
| 10244 | if (NULL == pAdapter) |
| 10245 | { |
| 10246 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10247 | return VOS_STATUS_E_FAILURE; |
| 10248 | } |
| 10249 | |
| 10250 | /* create the event */ |
| 10251 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10252 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10253 | |
| 10254 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 10255 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 10256 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10257 | |
| 10258 | if (1 == preauth_status) |
| 10259 | strncat(metrics_notification, " TRUE", 5); |
| 10260 | else |
| 10261 | strncat(metrics_notification, " FALSE", 6); |
| 10262 | |
| 10263 | wrqu.data.pointer = metrics_notification; |
| 10264 | wrqu.data.length = strlen(metrics_notification); |
| 10265 | |
| 10266 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10267 | |
| 10268 | EXIT(); |
| 10269 | |
| 10270 | return VOS_STATUS_SUCCESS; |
| 10271 | } |
| 10272 | |
| 10273 | /* |
| 10274 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 10275 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 10276 | * |
| 10277 | */ |
| 10278 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 10279 | tCsrRoamInfo *pRoamInfo) |
| 10280 | { |
| 10281 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10282 | union iwreq_data wrqu; |
| 10283 | |
| 10284 | ENTER(); |
| 10285 | |
| 10286 | if (NULL == pAdapter) |
| 10287 | { |
| 10288 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10289 | return VOS_STATUS_E_FAILURE; |
| 10290 | } |
| 10291 | |
| 10292 | /* create the event */ |
| 10293 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10294 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10295 | |
| 10296 | wrqu.data.pointer = metrics_notification; |
| 10297 | wrqu.data.length = scnprintf(metrics_notification, |
| 10298 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 10299 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10300 | |
| 10301 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10302 | |
| 10303 | EXIT(); |
| 10304 | |
| 10305 | return VOS_STATUS_SUCCESS; |
| 10306 | } |
| 10307 | #endif |
| 10308 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10309 | /* |
| 10310 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 10311 | * scanning callback function, called after finishing scan |
| 10312 | * |
| 10313 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10314 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10315 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 10316 | { |
| 10317 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10318 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10319 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10320 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10321 | struct cfg80211_scan_request *req = NULL; |
| 10322 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10323 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10324 | long waitRet = 0; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10325 | tANI_U8 i; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10326 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10327 | |
| 10328 | ENTER(); |
| 10329 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10330 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Siddharth Bhal | 5c2e02d | 2015-05-05 17:35:29 +0530 | [diff] [blame] | 10331 | if (NULL == pHddCtx) { |
| 10332 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is Null")); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10333 | goto allow_suspend; |
| 10334 | } |
| 10335 | |
| 10336 | pScanInfo = &pHddCtx->scan_info; |
| 10337 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10338 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10339 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10340 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10341 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 10342 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10343 | pScanInfo->mScanPendingCounter = 0; |
| 10344 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10345 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10346 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10347 | &pScanInfo->scan_req_completion_event, |
| 10348 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10349 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10350 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10351 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10352 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10353 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10354 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10355 | } |
| 10356 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 10357 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10358 | { |
| 10359 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10360 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10361 | } |
| 10362 | |
| 10363 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10364 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10365 | { |
| 10366 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10367 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10368 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10369 | (int) scanId); |
| 10370 | } |
| 10371 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10372 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10373 | pAdapter); |
| 10374 | |
| 10375 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10376 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10377 | |
| 10378 | |
| 10379 | /* If any client wait scan result through WEXT |
| 10380 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10381 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10382 | { |
| 10383 | /* The other scan request waiting for current scan finish |
| 10384 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10385 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10386 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10387 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10388 | } |
| 10389 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10390 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10391 | { |
| 10392 | struct net_device *dev = pAdapter->dev; |
| 10393 | union iwreq_data wrqu; |
| 10394 | int we_event; |
| 10395 | char *msg; |
| 10396 | |
| 10397 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 10398 | we_event = SIOCGIWSCAN; |
| 10399 | msg = NULL; |
| 10400 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 10401 | } |
| 10402 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10403 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10404 | |
| 10405 | /* Get the Scan Req */ |
| 10406 | req = pAdapter->request; |
| 10407 | |
| 10408 | if (!req) |
| 10409 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10410 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10411 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10412 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10413 | } |
| 10414 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10415 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10416 | /* Scan is no longer pending */ |
| 10417 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10418 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10419 | /* last_scan_timestamp is used to decide if new scan |
| 10420 | * is needed or not on station interface. If last station |
| 10421 | * scan time and new station scan time is less then |
| 10422 | * last_scan_timestamp ; driver will return cached scan. |
| 10423 | */ |
| 10424 | if (req->no_cck == FALSE && status == eCSR_SCAN_SUCCESS) // no_cck will be set during p2p find |
| 10425 | { |
| 10426 | pScanInfo->last_scan_timestamp = vos_timer_get_system_time(); |
| 10427 | |
| 10428 | if ( req->n_channels ) |
| 10429 | { |
| 10430 | for (i = 0; i < req->n_channels ; i++ ) |
| 10431 | { |
| 10432 | pHddCtx->scan_info.last_scan_channelList[i] = req->channels[i]->hw_value; |
| 10433 | } |
| 10434 | /* store no of channel scanned */ |
| 10435 | pHddCtx->scan_info.last_scan_numChannels= req->n_channels; |
| 10436 | } |
| 10437 | |
| 10438 | } |
| 10439 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 10440 | /* |
| 10441 | * cfg80211_scan_done informing NL80211 about completion |
| 10442 | * of scanning |
| 10443 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10444 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 10445 | { |
| 10446 | aborted = true; |
| 10447 | } |
| 10448 | cfg80211_scan_done(req, aborted); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 10449 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10450 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10451 | if (pHddCtx->spoofMacAddr.isEnabled || pHddCtx->spoofMacAddr.isReqDeferred) { |
| 10452 | /* Generate new random mac addr for next scan */ |
| 10453 | hddLog(VOS_TRACE_LEVEL_INFO, "scan completed - generate new spoof mac addr"); |
| 10454 | hdd_processSpoofMacAddrRequest(pHddCtx); |
| 10455 | } |
| 10456 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10457 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10458 | /* release the wake lock at the end of the scan*/ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 10459 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10460 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 10461 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 10462 | * immediatly after the driver gets connect request(i.e after scan) |
| 10463 | * from supplicant, this result in app's is suspending and not able |
| 10464 | * to process the connect request to AP */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 10465 | hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 10466 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 10467 | #ifdef FEATURE_WLAN_TDLS |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10468 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 10469 | #endif |
| 10470 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10471 | EXIT(); |
| 10472 | return 0; |
| 10473 | } |
| 10474 | |
| 10475 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10476 | * FUNCTION: hdd_isConnectionInProgress |
| 10477 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10478 | * |
| 10479 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10480 | v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10481 | { |
| 10482 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 10483 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 10484 | hdd_adapter_t *pAdapter = NULL; |
| 10485 | VOS_STATUS status = 0; |
| 10486 | v_U8_t staId = 0; |
| 10487 | v_U8_t *staMac = NULL; |
| 10488 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 10489 | if (TRUE == pHddCtx->btCoexModeSet) |
| 10490 | { |
| 10491 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10492 | FL("BTCoex Mode operation in progress")); |
| 10493 | return VOS_TRUE; |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 10494 | } |
| 10495 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10496 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 10497 | |
| 10498 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 10499 | { |
| 10500 | pAdapter = pAdapterNode->pAdapter; |
| 10501 | |
| 10502 | if( pAdapter ) |
| 10503 | { |
| 10504 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10505 | "%s: Adapter with device mode %s (%d) exists", |
| 10506 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10507 | pAdapter->device_mode); |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10508 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10509 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10510 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 10511 | (eConnectionState_Connecting == |
| 10512 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 10513 | { |
| 10514 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10515 | "%s: %p(%d) Connection is in progress", __func__, |
| 10516 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 10517 | return VOS_TRUE; |
| 10518 | } |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10519 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Padma, Santhosh Kumar | 3b9657d | 2015-02-04 19:37:32 +0530 | [diff] [blame] | 10520 | smeNeighborMiddleOfRoaming(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10521 | { |
| 10522 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10523 | "%s: %p(%d) Reassociation is in progress", __func__, |
| 10524 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 10525 | return VOS_TRUE; |
| 10526 | } |
| 10527 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10528 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10529 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10530 | { |
| 10531 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10532 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10533 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10534 | { |
| 10535 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 10536 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10537 | "%s: client " MAC_ADDRESS_STR |
| 10538 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 10539 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10540 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10541 | } |
| 10542 | } |
| 10543 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 10544 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 10545 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10546 | v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 10547 | ptSapContext pSapCtx = NULL; |
| 10548 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 10549 | if(pSapCtx == NULL){ |
| 10550 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10551 | FL("psapCtx is NULL")); |
| 10552 | return VOS_FALSE; |
| 10553 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10554 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 10555 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10556 | if ((pSapCtx->aStaInfo[staId].isUsed) && |
| 10557 | (WLANTL_STA_CONNECTED == pSapCtx->aStaInfo[staId].tlSTAState)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10558 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10559 | staMac = (v_U8_t *) &(pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10560 | |
| 10561 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10562 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 10563 | "middle of WPS/EAPOL exchange.", __func__, |
| 10564 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10565 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10566 | } |
| 10567 | } |
| 10568 | } |
| 10569 | } |
| 10570 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 10571 | pAdapterNode = pNext; |
| 10572 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10573 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10574 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10575 | |
| 10576 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10577 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10578 | * this scan respond to scan trigger and update cfg80211 scan database |
| 10579 | * later, scan dump command can be used to recieve scan results |
| 10580 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10581 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 10582 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10583 | struct net_device *dev, |
| 10584 | #endif |
| 10585 | struct cfg80211_scan_request *request) |
| 10586 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10587 | hdd_adapter_t *pAdapter = NULL; |
| 10588 | hdd_context_t *pHddCtx = NULL; |
| 10589 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10590 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10591 | tCsrScanRequest scanRequest; |
| 10592 | tANI_U8 *channelList = NULL, i; |
| 10593 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10594 | int status; |
| 10595 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10596 | v_U8_t* pP2pIe = NULL; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10597 | int ret = 0; |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 10598 | v_U8_t *pWpsIe=NULL; |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 10599 | bool is_p2p_scan = false; |
Hanumantha Reddy Pothula | 2e282d1 | 2015-06-19 14:01:26 +0530 | [diff] [blame] | 10600 | v_S7_t rssi=0; |
| 10601 | hdd_station_ctx_t *pHddStaCtx=NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10602 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10603 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 10604 | struct net_device *dev = NULL; |
| 10605 | if (NULL == request) |
| 10606 | { |
| 10607 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10608 | "%s: scan req param null", __func__); |
| 10609 | return -EINVAL; |
| 10610 | } |
| 10611 | dev = request->wdev->netdev; |
| 10612 | #endif |
| 10613 | |
| 10614 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 10615 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 10616 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10617 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10618 | ENTER(); |
| 10619 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10620 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 10621 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10622 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10623 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10624 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10625 | if (0 != status) |
| 10626 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10627 | return status; |
| 10628 | } |
| 10629 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10630 | if (NULL == pwextBuf) |
| 10631 | { |
| 10632 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 10633 | __func__); |
| 10634 | return -EIO; |
| 10635 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10636 | cfg_param = pHddCtx->cfg_ini; |
| 10637 | pScanInfo = &pHddCtx->scan_info; |
| 10638 | |
Hanumantha Reddy Pothula | 2e282d1 | 2015-06-19 14:01:26 +0530 | [diff] [blame] | 10639 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10640 | if ( (pHddStaCtx != NULL) && (TRUE == hdd_connIsConnected(pHddStaCtx))) |
| 10641 | { |
| 10642 | wlan_hdd_get_roam_rssi(pAdapter, &rssi); |
| 10643 | hddLog(VOS_TRACE_LEVEL_INFO, FL("rssi: %d"), rssi); |
| 10644 | } |
| 10645 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10646 | #ifdef WLAN_BTAMP_FEATURE |
| 10647 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10648 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10649 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 10650 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10651 | "%s: No scanning when AMP is on", __func__); |
| 10652 | return -EOPNOTSUPP; |
| 10653 | } |
| 10654 | #endif |
| 10655 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10656 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10657 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10658 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10659 | "%s: Not scanning on device_mode = %s (%d)", |
| 10660 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10661 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10662 | return -EOPNOTSUPP; |
| 10663 | } |
| 10664 | |
| 10665 | if (TRUE == pScanInfo->mScanPending) |
| 10666 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10667 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 10668 | { |
| 10669 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 10670 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10671 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10672 | } |
| 10673 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10674 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10675 | //Channel and action frame is pending |
| 10676 | //Otherwise Cancel Remain On Channel and allow Scan |
| 10677 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10678 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10679 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10680 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10681 | return -EBUSY; |
| 10682 | } |
| 10683 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10684 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 10685 | { |
| 10686 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 10687 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10688 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10689 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10690 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 10691 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10692 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10693 | "%s: MAX TM Level Scan not allowed", __func__); |
| 10694 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10695 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10696 | } |
| 10697 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 10698 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10699 | /* Check if scan is allowed at this point of time. |
| 10700 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10701 | if (hdd_isConnectionInProgress(pHddCtx)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10702 | { |
| 10703 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 10704 | return -EBUSY; |
| 10705 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10706 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10707 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 10708 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10709 | hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d", |
| 10710 | (int)request->n_ssids); |
| 10711 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10712 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10713 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 10714 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 10715 | * is not aging out the scan results. |
| 10716 | */ |
| 10717 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10718 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10719 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10720 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10721 | |
| 10722 | if ((request->ssids) && (0 < request->n_ssids)) |
| 10723 | { |
| 10724 | tCsrSSIDInfo *SsidInfo; |
| 10725 | int j; |
| 10726 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 10727 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 10728 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 10729 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 10730 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 10731 | |
| 10732 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 10733 | { |
| 10734 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10735 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 10736 | return -ENOMEM; |
| 10737 | } |
| 10738 | |
| 10739 | /* copy all the ssid's and their length */ |
| 10740 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 10741 | { |
| 10742 | /* get the ssid length */ |
| 10743 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 10744 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 10745 | SsidInfo->SSID.length); |
| 10746 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 10747 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 10748 | j, SsidInfo->SSID.ssId); |
| 10749 | } |
| 10750 | /* set the scan type to active */ |
| 10751 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 10752 | } |
| 10753 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10754 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10755 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10756 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 10757 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10758 | /* set the scan type to active */ |
| 10759 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10760 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10761 | else |
| 10762 | { |
| 10763 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 10764 | scanRequest.scanType = pScanInfo->scan_mode; |
| 10765 | } |
| 10766 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 10767 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10768 | |
| 10769 | /* set BSSType to default type */ |
| 10770 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 10771 | |
| 10772 | /*TODO: scan the requested channels only*/ |
| 10773 | |
| 10774 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10775 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10776 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10777 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10778 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 10779 | request->n_channels = MAX_CHANNEL; |
| 10780 | } |
| 10781 | |
| 10782 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10783 | "No of Scan Channels: %d", request->n_channels); |
| 10784 | |
| 10785 | |
| 10786 | if( request->n_channels ) |
| 10787 | { |
| 10788 | char chList [(request->n_channels*5)+1]; |
| 10789 | int len; |
| 10790 | channelList = vos_mem_malloc( request->n_channels ); |
| 10791 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10792 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10793 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10794 | "%s: memory alloc failed channelList", __func__); |
| 10795 | status = -ENOMEM; |
| 10796 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10797 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10798 | |
| 10799 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 10800 | { |
| 10801 | channelList[i] = request->channels[i]->hw_value; |
| 10802 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 10803 | } |
| 10804 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10805 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10806 | "Channel-List: %s ", chList); |
| 10807 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10808 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10809 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 10810 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 10811 | |
| 10812 | /* set requestType to full scan */ |
| 10813 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 10814 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10815 | /* if there is back to back scan happening in driver with in |
| 10816 | * nDeferScanTimeInterval interval driver should defer new scan request |
| 10817 | * and should provide last cached scan results instead of new channel list. |
| 10818 | * This rule is not applicable if scan is p2p scan. |
| 10819 | * This condition will work only in case when last request no of channels |
| 10820 | * and channels are exactly same as new request. |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10821 | * This should be done only in connected state |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 10822 | * Scan shouldn't be defered for WPS scan case. |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10823 | */ |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10824 | |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 10825 | pWpsIe = wlan_hdd_get_wps_ie_ptr((v_U8_t*)request->ie,request->ie_len); |
| 10826 | /* if wps ie is NULL , then only defer scan */ |
| 10827 | if ( pWpsIe == NULL && |
| 10828 | (VOS_STATUS_SUCCESS == hdd_is_any_session_connected(pHddCtx))) |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10829 | { |
| 10830 | if ( pScanInfo->last_scan_timestamp !=0 && |
| 10831 | ((vos_timer_get_system_time() - pScanInfo->last_scan_timestamp ) < pHddCtx->cfg_ini->nDeferScanTimeInterval)) |
| 10832 | { |
| 10833 | if ( request->no_cck == FALSE && scanRequest.ChannelInfo.numOfChannels != 1 && |
| 10834 | (pScanInfo->last_scan_numChannels == scanRequest.ChannelInfo.numOfChannels) && |
| 10835 | vos_mem_compare(pScanInfo->last_scan_channelList, |
| 10836 | channelList, pScanInfo->last_scan_numChannels)) |
| 10837 | { |
| 10838 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10839 | " New and old station scan time differ is less then %u", |
| 10840 | pHddCtx->cfg_ini->nDeferScanTimeInterval); |
| 10841 | |
| 10842 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10843 | pAdapter); |
| 10844 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10845 | hddLog(VOS_TRACE_LEVEL_WARN, |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 10846 | "Return old cached scan as all channels and no of channels are same"); |
| 10847 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10848 | if (0 > ret) |
| 10849 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10850 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10851 | cfg80211_scan_done(request, eCSR_SCAN_SUCCESS); |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 10852 | |
| 10853 | status = eHAL_STATUS_SUCCESS; |
| 10854 | goto free_mem; |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10855 | } |
| 10856 | } |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10857 | } |
| 10858 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10859 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 10860 | * search (Flush on both full scan and social scan but not on single |
| 10861 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 10862 | */ |
| 10863 | |
| 10864 | /* Supplicant does single channel scan after 8-way handshake |
| 10865 | * and in that case driver shoudnt flush scan results. If |
| 10866 | * driver flushes the scan results here and unfortunately if |
| 10867 | * the AP doesnt respond to our probe req then association |
| 10868 | * fails which is not desired |
| 10869 | */ |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 10870 | if ((request->n_ssids == 1) |
| 10871 | && (request->ssids != NULL) |
| 10872 | && vos_mem_compare(&request->ssids[0], "DIRECT-", 7)) |
| 10873 | is_p2p_scan = true; |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10874 | |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 10875 | if( is_p2p_scan || |
| 10876 | (request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN) ) |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10877 | { |
| 10878 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 10879 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10880 | pAdapter->sessionId ); |
| 10881 | } |
| 10882 | |
| 10883 | if( request->ie_len ) |
| 10884 | { |
| 10885 | /* save this for future association (join requires this) */ |
| 10886 | /*TODO: Array needs to be converted to dynamic allocation, |
| 10887 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 10888 | * CR 597966 |
| 10889 | */ |
| 10890 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 10891 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 10892 | pScanInfo->scanAddIE.length = request->ie_len; |
| 10893 | |
| 10894 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 10895 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10896 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10897 | { |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 10898 | if (request->ie_len <= SIR_MAC_MAX_ADD_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10899 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10900 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 10901 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 10902 | request->ie, request->ie_len); |
| 10903 | } |
| 10904 | else |
| 10905 | { |
| 10906 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 10907 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10908 | } |
| 10909 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10910 | } |
| 10911 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 10912 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 10913 | |
| 10914 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 10915 | request->ie_len); |
| 10916 | if (pP2pIe != NULL) |
| 10917 | { |
| 10918 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 10919 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 10920 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 10921 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10922 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10923 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 10924 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 10925 | "Go nego completed to Connection is started"); |
| 10926 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 10927 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10928 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10929 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 10930 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10931 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10932 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 10933 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 10934 | "Disconnected state to Connection is started"); |
| 10935 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 10936 | "for 4way Handshake"); |
| 10937 | } |
| 10938 | #endif |
| 10939 | |
| 10940 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 10941 | if(TRUE == request->no_cck) |
| 10942 | { |
| 10943 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10944 | "%s: This is a P2P Search", __func__); |
| 10945 | scanRequest.p2pSearch = 1; |
| 10946 | |
| 10947 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10948 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10949 | /* set requestType to P2P Discovery */ |
| 10950 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 10951 | } |
| 10952 | |
| 10953 | /* |
| 10954 | Skip Dfs Channel in case of P2P Search |
| 10955 | if it is set in ini file |
| 10956 | */ |
| 10957 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 10958 | { |
| 10959 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10960 | } |
| 10961 | else |
| 10962 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10963 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10964 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10965 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10966 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10967 | } |
| 10968 | } |
| 10969 | |
| 10970 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 10971 | |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10972 | #ifdef FEATURE_WLAN_TDLS |
| 10973 | /* if tdls disagree scan right now, return immediately. |
| 10974 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 10975 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 10976 | */ |
| 10977 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 10978 | wiphy, |
| 10979 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10980 | dev, |
| 10981 | #endif |
| 10982 | request); |
| 10983 | if(status <= 0) |
| 10984 | { |
| 10985 | if(!status) |
| 10986 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 10987 | "scan rejected %d", __func__, status); |
| 10988 | else |
| 10989 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 10990 | __func__, status); |
| 10991 | |
| 10992 | return status; |
| 10993 | } |
| 10994 | #endif |
| 10995 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10996 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 10997 | * address the following issues. |
| 10998 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 10999 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 11000 | * for long time, this result in apps running at full power for long time. |
| 11001 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 11002 | * be stuck in full power because of resume BMPS |
| 11003 | */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 11004 | hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11005 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 11006 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 11007 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11008 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 11009 | scanRequest.requestType, scanRequest.scanType, |
| 11010 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 11011 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 11012 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 11013 | if (pHddCtx->spoofMacAddr.isEnabled) |
| 11014 | { |
| 11015 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11016 | "%s: MAC Spoofing enabled for current scan", __func__); |
| 11017 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 11018 | * to fill TxBds for probe request during current scan |
| 11019 | */ |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 11020 | status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 11021 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 11022 | |
| 11023 | if(status != VOS_STATUS_SUCCESS) |
| 11024 | { |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 11025 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 11026 | status = -EFAULT; |
Ganesh Kondabattini | 6d3b490 | 2015-05-12 23:19:22 +0530 | [diff] [blame] | 11027 | #ifdef FEATURE_WLAN_TDLS |
| 11028 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 11029 | #endif |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 11030 | goto free_mem; |
| 11031 | } |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 11032 | } |
Mahesh A Saptasagar | 51dc36c | 2015-06-16 12:07:15 +0530 | [diff] [blame] | 11033 | wlan_hdd_get_frame_logs(pAdapter, WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11034 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11035 | pAdapter->sessionId, &scanRequest, &scanId, |
| 11036 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11037 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11038 | if (eHAL_STATUS_SUCCESS != status) |
| 11039 | { |
| 11040 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11041 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 11042 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 11043 | if(eHAL_STATUS_RESOURCES == status) |
| 11044 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 11045 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 11046 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 11047 | status = -EBUSY; |
| 11048 | } else { |
| 11049 | status = -EIO; |
| 11050 | } |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 11051 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 11052 | |
| 11053 | #ifdef FEATURE_WLAN_TDLS |
| 11054 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 11055 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11056 | goto free_mem; |
| 11057 | } |
| 11058 | |
| 11059 | pScanInfo->mScanPending = TRUE; |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 11060 | pScanInfo->sessionId = pAdapter->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11061 | pAdapter->request = request; |
| 11062 | pScanInfo->scanId = scanId; |
| 11063 | |
| 11064 | complete(&pScanInfo->scan_req_completion_event); |
| 11065 | |
| 11066 | free_mem: |
| 11067 | if( scanRequest.SSIDs.SSIDList ) |
| 11068 | { |
| 11069 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 11070 | } |
| 11071 | |
| 11072 | if( channelList ) |
| 11073 | vos_mem_free( channelList ); |
| 11074 | |
| 11075 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11076 | return status; |
| 11077 | } |
| 11078 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11079 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 11080 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 11081 | struct net_device *dev, |
| 11082 | #endif |
| 11083 | struct cfg80211_scan_request *request) |
| 11084 | { |
| 11085 | int ret; |
| 11086 | |
| 11087 | vos_ssr_protect(__func__); |
| 11088 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 11089 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 11090 | dev, |
| 11091 | #endif |
| 11092 | request); |
| 11093 | vos_ssr_unprotect(__func__); |
| 11094 | |
| 11095 | return ret; |
| 11096 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11097 | |
| 11098 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 11099 | { |
| 11100 | v_U8_t iniDot11Mode = |
| 11101 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 11102 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 11103 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11104 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 11105 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11106 | switch ( iniDot11Mode ) |
| 11107 | { |
| 11108 | case eHDD_DOT11_MODE_AUTO: |
| 11109 | case eHDD_DOT11_MODE_11ac: |
| 11110 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 11111 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 4b1d235 | 2014-08-01 21:59:28 +0530 | [diff] [blame] | 11112 | if ( sme_IsFeatureSupportedByDriver(DOT11AC) && |
| 11113 | sme_IsFeatureSupportedByFW(DOT11AC) ) |
| 11114 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 11115 | else |
| 11116 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11117 | #else |
| 11118 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 11119 | #endif |
| 11120 | break; |
| 11121 | case eHDD_DOT11_MODE_11n: |
| 11122 | case eHDD_DOT11_MODE_11n_ONLY: |
| 11123 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 11124 | break; |
| 11125 | default: |
| 11126 | hddDot11Mode = iniDot11Mode; |
| 11127 | break; |
| 11128 | } |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 11129 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 11130 | if (operationChannel > SIR_11B_CHANNEL_END) |
| 11131 | #endif |
| 11132 | { |
| 11133 | /* This call decides required channel bonding mode */ |
| 11134 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11135 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 11136 | operationChannel); |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 11137 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11138 | } |
| 11139 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11140 | /* |
| 11141 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11142 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11143 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11144 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11145 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11146 | { |
| 11147 | int status = 0; |
| 11148 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11149 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11150 | v_U32_t roamId; |
| 11151 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11152 | eCsrAuthType RSNAuthType; |
| 11153 | |
| 11154 | ENTER(); |
| 11155 | |
| 11156 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11157 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11158 | |
| 11159 | status = wlan_hdd_validate_context(pHddCtx); |
| 11160 | if (status) |
| 11161 | { |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11162 | return status; |
| 11163 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11164 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11165 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 11166 | { |
| 11167 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 11168 | return -EINVAL; |
| 11169 | } |
| 11170 | |
| 11171 | pRoamProfile = &pWextState->roamProfile; |
| 11172 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11173 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11174 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11175 | hdd_station_ctx_t *pHddStaCtx; |
| 11176 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11177 | |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 11178 | wlan_hdd_get_frame_logs(pAdapter, WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR); |
| 11179 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11180 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11181 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 11182 | { |
| 11183 | /*QoS not enabled in cfg file*/ |
| 11184 | pRoamProfile->uapsd_mask = 0; |
| 11185 | } |
| 11186 | else |
| 11187 | { |
| 11188 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11189 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11190 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 11191 | } |
| 11192 | |
| 11193 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 11194 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 11195 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11196 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11197 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 11198 | ssid, ssid_len); |
| 11199 | |
| 11200 | if (bssid) |
| 11201 | { |
| 11202 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 11203 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 11204 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11205 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 11206 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11207 | case of join failure we should send valid BSSID to supplicant |
| 11208 | */ |
| 11209 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 11210 | WNI_CFG_BSSID_LEN); |
| 11211 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 11212 | else |
| 11213 | { |
| 11214 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 11215 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11216 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11217 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 11218 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11219 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 11220 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11221 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11222 | /*set gen ie*/ |
| 11223 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 11224 | /*set auth*/ |
| 11225 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 11226 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11227 | #ifdef FEATURE_WLAN_WAPI |
| 11228 | if (pAdapter->wapi_info.nWapiMode) |
| 11229 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11230 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11231 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 11232 | { |
| 11233 | case WAPI_AUTH_MODE_PSK: |
| 11234 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11235 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11236 | pAdapter->wapi_info.wapiAuthMode); |
| 11237 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 11238 | break; |
| 11239 | } |
| 11240 | case WAPI_AUTH_MODE_CERT: |
| 11241 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11242 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11243 | pAdapter->wapi_info.wapiAuthMode); |
| 11244 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 11245 | break; |
| 11246 | } |
| 11247 | } // End of switch |
| 11248 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 11249 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 11250 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11251 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11252 | pRoamProfile->AuthType.numEntries = 1; |
| 11253 | pRoamProfile->EncryptionType.numEntries = 1; |
| 11254 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 11255 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 11256 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 11257 | } |
| 11258 | } |
| 11259 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11260 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11261 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11262 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 11263 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 11264 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11265 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 11266 | sizeof (tSirGtkOffloadParams)); |
| 11267 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11268 | } |
| 11269 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11270 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 11271 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11272 | if( operatingChannel ) |
| 11273 | { |
| 11274 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 11275 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 11276 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11277 | else |
| 11278 | { |
| 11279 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 11280 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 11281 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11282 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 11283 | { |
| 11284 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 11285 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11286 | |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11287 | /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect() |
| 11288 | * 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] | 11289 | * 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] | 11290 | * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback() |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11291 | * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. |
| 11292 | */ |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 11293 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 11294 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 11295 | { |
| 11296 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11297 | "%s: Set HDD connState to eConnectionState_Connecting", |
| 11298 | __func__); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11299 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 11300 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 11301 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11302 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11303 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 11304 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 11305 | if ((eHAL_STATUS_SUCCESS != status) && |
| 11306 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 11307 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11308 | |
| 11309 | { |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11310 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with " |
| 11311 | "status %d. -> NotConnected", __func__, pAdapter->sessionId, status); |
| 11312 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11313 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11314 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11315 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11316 | |
| 11317 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 11318 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 11319 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11320 | } |
| 11321 | else |
| 11322 | { |
| 11323 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 11324 | return -EINVAL; |
| 11325 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 11326 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11327 | return status; |
| 11328 | } |
| 11329 | |
| 11330 | /* |
| 11331 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 11332 | * This function is used to set the authentication type (OPEN/SHARED). |
| 11333 | * |
| 11334 | */ |
| 11335 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 11336 | enum nl80211_auth_type auth_type) |
| 11337 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11338 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11339 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11340 | |
| 11341 | ENTER(); |
| 11342 | |
| 11343 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11344 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11345 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11346 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11347 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11348 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 11349 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 11350 | break; |
| 11351 | |
| 11352 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11353 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11354 | case NL80211_AUTHTYPE_FT: |
| 11355 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11356 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11357 | "%s: set authentication type to OPEN", __func__); |
| 11358 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 11359 | break; |
| 11360 | |
| 11361 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11362 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11363 | "%s: set authentication type to SHARED", __func__); |
| 11364 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 11365 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11366 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11367 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11368 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11369 | "%s: set authentication type to CCKM WPA", __func__); |
| 11370 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 11371 | break; |
| 11372 | #endif |
| 11373 | |
| 11374 | |
| 11375 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11376 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11377 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11378 | auth_type); |
| 11379 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 11380 | return -EINVAL; |
| 11381 | } |
| 11382 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11383 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11384 | pHddStaCtx->conn_info.authType; |
| 11385 | return 0; |
| 11386 | } |
| 11387 | |
| 11388 | /* |
| 11389 | * FUNCTION: wlan_hdd_set_akm_suite |
| 11390 | * This function is used to set the key mgmt type(PSK/8021x). |
| 11391 | * |
| 11392 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11393 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11394 | u32 key_mgmt |
| 11395 | ) |
| 11396 | { |
| 11397 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11398 | ENTER(); |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11399 | /* Should be in ieee802_11_defs.h */ |
| 11400 | #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05 |
| 11401 | #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11402 | /*set key mgmt type*/ |
| 11403 | switch(key_mgmt) |
| 11404 | { |
| 11405 | case WLAN_AKM_SUITE_PSK: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11406 | case WLAN_AKM_SUITE_PSK_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 11407 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11408 | case WLAN_AKM_SUITE_FT_PSK: |
| 11409 | #endif |
| 11410 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11411 | __func__); |
| 11412 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 11413 | break; |
| 11414 | |
| 11415 | case WLAN_AKM_SUITE_8021X: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11416 | case WLAN_AKM_SUITE_8021X_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 11417 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11418 | case WLAN_AKM_SUITE_FT_8021X: |
| 11419 | #endif |
| 11420 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11421 | __func__); |
| 11422 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 11423 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11424 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11425 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 11426 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 11427 | case WLAN_AKM_SUITE_CCKM: |
| 11428 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 11429 | __func__); |
| 11430 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 11431 | break; |
| 11432 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 11433 | #ifndef WLAN_AKM_SUITE_OSEN |
| 11434 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 11435 | case WLAN_AKM_SUITE_OSEN: |
| 11436 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 11437 | __func__); |
| 11438 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 11439 | break; |
| 11440 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11441 | |
| 11442 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11443 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11444 | __func__, key_mgmt); |
| 11445 | return -EINVAL; |
| 11446 | |
| 11447 | } |
| 11448 | return 0; |
| 11449 | } |
| 11450 | |
| 11451 | /* |
| 11452 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11453 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11454 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 11455 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11456 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 11457 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11458 | bool ucast |
| 11459 | ) |
| 11460 | { |
| 11461 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11462 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11463 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11464 | |
| 11465 | ENTER(); |
| 11466 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11467 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11468 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11469 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11470 | __func__, cipher); |
| 11471 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11472 | } |
| 11473 | else |
| 11474 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11475 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11476 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11477 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11478 | { |
| 11479 | case IW_AUTH_CIPHER_NONE: |
| 11480 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11481 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11482 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11483 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11484 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11485 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11486 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11487 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11488 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11489 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11490 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11491 | case WLAN_CIPHER_SUITE_TKIP: |
| 11492 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 11493 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11494 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11495 | case WLAN_CIPHER_SUITE_CCMP: |
| 11496 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 11497 | break; |
| 11498 | #ifdef FEATURE_WLAN_WAPI |
| 11499 | case WLAN_CIPHER_SUITE_SMS4: |
| 11500 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 11501 | break; |
| 11502 | #endif |
| 11503 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11504 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11505 | case WLAN_CIPHER_SUITE_KRK: |
| 11506 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 11507 | break; |
| 11508 | #endif |
| 11509 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11510 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11511 | __func__, cipher); |
| 11512 | return -EOPNOTSUPP; |
| 11513 | } |
| 11514 | } |
| 11515 | |
| 11516 | if (ucast) |
| 11517 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11518 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11519 | __func__, encryptionType); |
| 11520 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 11521 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11522 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11523 | encryptionType; |
| 11524 | } |
| 11525 | else |
| 11526 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11527 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11528 | __func__, encryptionType); |
| 11529 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 11530 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 11531 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 11532 | } |
| 11533 | |
| 11534 | return 0; |
| 11535 | } |
| 11536 | |
| 11537 | |
| 11538 | /* |
| 11539 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 11540 | * This function is used to parse WPA/RSN IE's. |
| 11541 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11542 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
| 11543 | u8 *ie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11544 | size_t ie_len |
| 11545 | ) |
| 11546 | { |
| 11547 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11548 | u8 *genie = ie; |
| 11549 | v_U16_t remLen = ie_len; |
| 11550 | #ifdef FEATURE_WLAN_WAPI |
| 11551 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 11552 | u16 *tmp; |
| 11553 | v_U16_t akmsuiteCount; |
| 11554 | int *akmlist; |
| 11555 | #endif |
| 11556 | ENTER(); |
| 11557 | |
| 11558 | /* clear previous assocAddIE */ |
| 11559 | pWextState->assocAddIE.length = 0; |
| 11560 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11561 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11562 | |
| 11563 | while (remLen >= 2) |
| 11564 | { |
| 11565 | v_U16_t eLen = 0; |
| 11566 | v_U8_t elementId; |
| 11567 | elementId = *genie++; |
| 11568 | eLen = *genie++; |
| 11569 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11570 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11571 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11572 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11573 | |
| 11574 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11575 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11576 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11577 | 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] | 11578 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11579 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11580 | "%s: Invalid WPA IE", __func__); |
| 11581 | return -EINVAL; |
| 11582 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11583 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11584 | { |
| 11585 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11586 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11587 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11588 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11589 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11590 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11591 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 11592 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11593 | VOS_ASSERT(0); |
| 11594 | return -ENOMEM; |
| 11595 | } |
| 11596 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 11597 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11598 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11599 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11600 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 11601 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11602 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11603 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11604 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 11605 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11606 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 11607 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 11608 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 11609 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 11610 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 11611 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11612 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 11613 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11614 | { |
| 11615 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11616 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11617 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11618 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11619 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11620 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11621 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11622 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11623 | VOS_ASSERT(0); |
| 11624 | return -ENOMEM; |
| 11625 | } |
| 11626 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 11627 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11628 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11629 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11630 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11631 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11632 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11633 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11634 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 11635 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11636 | /*Consider WFD IE, only for P2P Client */ |
| 11637 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 11638 | { |
| 11639 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11640 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11641 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11642 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11643 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11644 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11645 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11646 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11647 | VOS_ASSERT(0); |
| 11648 | return -ENOMEM; |
| 11649 | } |
| 11650 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 11651 | // WPS IE + P2P IE + WFD IE |
| 11652 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11653 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11654 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11655 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11656 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11657 | } |
| 11658 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11659 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11660 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11661 | HS20_OUI_TYPE_SIZE)) ) |
| 11662 | { |
| 11663 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11664 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11665 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11666 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11667 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11668 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11669 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11670 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11671 | VOS_ASSERT(0); |
| 11672 | return -ENOMEM; |
| 11673 | } |
| 11674 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11675 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11676 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11677 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11678 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11679 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11680 | /* Appending OSEN Information Element in Assiciation Request */ |
| 11681 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 11682 | OSEN_OUI_TYPE_SIZE)) ) |
| 11683 | { |
| 11684 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 11685 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 11686 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11687 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11688 | 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] | 11689 | { |
| 11690 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11691 | "Need bigger buffer space"); |
| 11692 | VOS_ASSERT(0); |
| 11693 | return -ENOMEM; |
| 11694 | } |
| 11695 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11696 | pWextState->assocAddIE.length += eLen + 2; |
| 11697 | |
| 11698 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 11699 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11700 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11701 | } |
| 11702 | |
Abhishek Singh | 4322e62 | 2015-06-10 15:42:54 +0530 | [diff] [blame] | 11703 | /* Update only for WPA IE */ |
| 11704 | if (!memcmp(genie, WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) && |
| 11705 | (WLAN_HDD_IBSS == pAdapter->device_mode)) { |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 11706 | |
| 11707 | /* populating as ADDIE in beacon frames */ |
| 11708 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11709 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie - 2, eLen + 2, |
| 11710 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 11711 | { |
| 11712 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11713 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 11714 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 11715 | { |
| 11716 | hddLog(LOGE, |
| 11717 | "Coldn't pass " |
| 11718 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 11719 | } |
| 11720 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 11721 | else |
| 11722 | hddLog(LOGE, |
| 11723 | "Could not pass on " |
| 11724 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 11725 | |
| 11726 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 11727 | beaconIE's need to be populated in probe response frames */ |
| 11728 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 11729 | { |
| 11730 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 11731 | u8 probe_rsp_ie_len[3] = {0}; |
| 11732 | u8 counter = 0; |
| 11733 | |
| 11734 | /* Check Probe Resp Length if it is greater then 255 then |
| 11735 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 11736 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 11737 | not able Store More then 255 bytes into One Variable */ |
| 11738 | |
| 11739 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 11740 | { |
| 11741 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 11742 | { |
| 11743 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 11744 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 11745 | } |
| 11746 | else |
| 11747 | { |
| 11748 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 11749 | rem_probe_resp_ie_len = 0; |
| 11750 | } |
| 11751 | } |
| 11752 | |
| 11753 | rem_probe_resp_ie_len = 0; |
| 11754 | |
| 11755 | if (probe_rsp_ie_len[0] > 0) |
| 11756 | { |
| 11757 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11758 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 11759 | (tANI_U8*)(genie - 2), |
| 11760 | probe_rsp_ie_len[0], NULL, |
| 11761 | eANI_BOOLEAN_FALSE) |
| 11762 | == eHAL_STATUS_FAILURE) |
| 11763 | { |
| 11764 | hddLog(LOGE, |
| 11765 | "Could not pass" |
| 11766 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 11767 | } |
| 11768 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 11769 | } |
| 11770 | |
| 11771 | if (probe_rsp_ie_len[1] > 0) |
| 11772 | { |
| 11773 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11774 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 11775 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 11776 | probe_rsp_ie_len[1], NULL, |
| 11777 | eANI_BOOLEAN_FALSE) |
| 11778 | == eHAL_STATUS_FAILURE) |
| 11779 | { |
| 11780 | hddLog(LOGE, |
| 11781 | "Could not pass" |
| 11782 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 11783 | } |
| 11784 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 11785 | } |
| 11786 | |
| 11787 | if (probe_rsp_ie_len[2] > 0) |
| 11788 | { |
| 11789 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11790 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 11791 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 11792 | probe_rsp_ie_len[2], NULL, |
| 11793 | eANI_BOOLEAN_FALSE) |
| 11794 | == eHAL_STATUS_FAILURE) |
| 11795 | { |
| 11796 | hddLog(LOGE, |
| 11797 | "Could not pass" |
| 11798 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 11799 | } |
| 11800 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 11801 | } |
| 11802 | |
| 11803 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11804 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 11805 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 11806 | { |
| 11807 | hddLog(LOGE, |
| 11808 | "Could not pass" |
| 11809 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 11810 | } |
| 11811 | } |
| 11812 | else |
| 11813 | { |
| 11814 | // Reset WNI_CFG_PROBE_RSP Flags |
| 11815 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 11816 | |
| 11817 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11818 | "%s: No Probe Response IE received in set beacon", |
| 11819 | __func__); |
| 11820 | } |
| 11821 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11822 | break; |
| 11823 | case DOT11F_EID_RSN: |
| 11824 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 11825 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 11826 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 11827 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 11828 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 11829 | break; |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 11830 | |
| 11831 | /* Appending Extended Capabilities with Interworking bit set |
| 11832 | * in Assoc Req. |
| 11833 | * |
| 11834 | * In assoc req this EXT Cap will only be taken into account if |
| 11835 | * interworkingService bit is set to 1. Currently |
| 11836 | * driver is only interested in interworkingService capability |
| 11837 | * from supplicant. If in future any other EXT Cap info is |
| 11838 | * required from supplicat, it needs to be handled while |
| 11839 | * sending Assoc Req in LIM. |
| 11840 | */ |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11841 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11842 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11843 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11844 | 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] | 11845 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11846 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11847 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11848 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11849 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11850 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11851 | VOS_ASSERT(0); |
| 11852 | return -ENOMEM; |
| 11853 | } |
| 11854 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11855 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11856 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11857 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11858 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11859 | break; |
| 11860 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11861 | #ifdef FEATURE_WLAN_WAPI |
| 11862 | case WLAN_EID_WAPI: |
| 11863 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 11864 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11865 | pAdapter->wapi_info.nWapiMode); |
| 11866 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11867 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11868 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 11869 | tmp = tmp + 1; |
| 11870 | akmlist = (int *)(tmp); |
| 11871 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 11872 | { |
| 11873 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 11874 | } |
| 11875 | else |
| 11876 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11877 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11878 | VOS_ASSERT(0); |
| 11879 | return -EINVAL; |
| 11880 | } |
| 11881 | |
| 11882 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 11883 | { |
| 11884 | 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] | 11885 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11886 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11887 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11888 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11889 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11890 | 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] | 11891 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11892 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 11893 | } |
| 11894 | break; |
| 11895 | #endif |
| 11896 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11897 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11898 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11899 | /* when Unknown IE is received we should break and continue |
| 11900 | * to the next IE in the buffer instead we were returning |
| 11901 | * so changing this to break */ |
| 11902 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11903 | } |
| 11904 | genie += eLen; |
| 11905 | remLen -= eLen; |
| 11906 | } |
| 11907 | EXIT(); |
| 11908 | return 0; |
| 11909 | } |
| 11910 | |
| 11911 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 11912 | * FUNCTION: hdd_isWPAIEPresent |
| 11913 | * Parse the received IE to find the WPA IE |
| 11914 | * |
| 11915 | */ |
| 11916 | static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len) |
| 11917 | { |
| 11918 | v_U8_t eLen = 0; |
| 11919 | v_U16_t remLen = ie_len; |
| 11920 | v_U8_t elementId = 0; |
| 11921 | |
| 11922 | while (remLen >= 2) |
| 11923 | { |
| 11924 | elementId = *ie++; |
| 11925 | eLen = *ie++; |
| 11926 | remLen -= 2; |
| 11927 | if (eLen > remLen) |
| 11928 | { |
| 11929 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11930 | "%s: IE length is wrong %d", __func__, eLen); |
| 11931 | return FALSE; |
| 11932 | } |
| 11933 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 11934 | { |
| 11935 | /* OUI - 0x00 0X50 0XF2 |
| 11936 | WPA Information Element - 0x01 |
| 11937 | WPA version - 0x01*/ |
| 11938 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 11939 | return TRUE; |
| 11940 | } |
| 11941 | ie += eLen; |
| 11942 | remLen -= eLen; |
| 11943 | } |
| 11944 | return FALSE; |
| 11945 | } |
| 11946 | |
| 11947 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11948 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11949 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11950 | * parameters during connect operation. |
| 11951 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11952 | int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11953 | struct cfg80211_connect_params *req |
| 11954 | ) |
| 11955 | { |
| 11956 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11957 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11958 | ENTER(); |
| 11959 | |
| 11960 | /*set wpa version*/ |
| 11961 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 11962 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11963 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11964 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 11965 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11966 | { |
| 11967 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 11968 | } |
| 11969 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 11970 | { |
| 11971 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 11972 | } |
| 11973 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11974 | |
| 11975 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11976 | pWextState->wpaVersion); |
| 11977 | |
| 11978 | /*set authentication type*/ |
| 11979 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 11980 | |
| 11981 | if (0 > status) |
| 11982 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11983 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11984 | "%s: failed to set authentication type ", __func__); |
| 11985 | return status; |
| 11986 | } |
| 11987 | |
| 11988 | /*set key mgmt type*/ |
| 11989 | if (req->crypto.n_akm_suites) |
| 11990 | { |
| 11991 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 11992 | if (0 > status) |
| 11993 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11994 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11995 | __func__); |
| 11996 | return status; |
| 11997 | } |
| 11998 | } |
| 11999 | |
| 12000 | /*set pairwise cipher type*/ |
| 12001 | if (req->crypto.n_ciphers_pairwise) |
| 12002 | { |
| 12003 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 12004 | req->crypto.ciphers_pairwise[0], true); |
| 12005 | if (0 > status) |
| 12006 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12007 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12008 | "%s: failed to set unicast cipher type", __func__); |
| 12009 | return status; |
| 12010 | } |
| 12011 | } |
| 12012 | else |
| 12013 | { |
| 12014 | /*Reset previous cipher suite to none*/ |
| 12015 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 12016 | if (0 > status) |
| 12017 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12018 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12019 | "%s: failed to set unicast cipher type", __func__); |
| 12020 | return status; |
| 12021 | } |
| 12022 | } |
| 12023 | |
| 12024 | /*set group cipher type*/ |
| 12025 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 12026 | false); |
| 12027 | |
| 12028 | if (0 > status) |
| 12029 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12030 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12031 | __func__); |
| 12032 | return status; |
| 12033 | } |
| 12034 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12035 | #ifdef WLAN_FEATURE_11W |
| 12036 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 12037 | #endif |
| 12038 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12039 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 12040 | if (req->ie_len) |
| 12041 | { |
| 12042 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 12043 | if ( 0 > status) |
| 12044 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12045 | 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] | 12046 | __func__); |
| 12047 | return status; |
| 12048 | } |
| 12049 | } |
| 12050 | |
| 12051 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12052 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12053 | { |
| 12054 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 12055 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 12056 | ) |
| 12057 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12058 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12059 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 12060 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12061 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12062 | __func__); |
| 12063 | return -EOPNOTSUPP; |
| 12064 | } |
| 12065 | else |
| 12066 | { |
| 12067 | u8 key_len = req->key_len; |
| 12068 | u8 key_idx = req->key_idx; |
| 12069 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12070 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12071 | && (CSR_MAX_NUM_KEY > key_idx) |
| 12072 | ) |
| 12073 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12074 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12075 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12076 | __func__, key_idx, key_len); |
| 12077 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12078 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12079 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12080 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12081 | (u8)key_len; |
| 12082 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 12083 | } |
| 12084 | } |
| 12085 | } |
| 12086 | } |
| 12087 | |
| 12088 | return status; |
| 12089 | } |
| 12090 | |
| 12091 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12092 | * FUNCTION: wlan_hdd_try_disconnect |
| 12093 | * This function is used to disconnect from previous |
| 12094 | * connection |
| 12095 | */ |
| 12096 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 12097 | { |
| 12098 | long ret = 0; |
| 12099 | hdd_station_ctx_t *pHddStaCtx; |
| 12100 | eMib_dot11DesiredBssType connectedBssType; |
| 12101 | |
| 12102 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12103 | |
| 12104 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 12105 | |
| 12106 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 12107 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 12108 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 12109 | { |
| 12110 | /* Issue disconnect to CSR */ |
| 12111 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 12112 | if( eHAL_STATUS_SUCCESS == |
| 12113 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12114 | pAdapter->sessionId, |
| 12115 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 12116 | { |
| 12117 | ret = wait_for_completion_interruptible_timeout( |
| 12118 | &pAdapter->disconnect_comp_var, |
| 12119 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 12120 | if (0 >= ret) |
| 12121 | { |
| 12122 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 12123 | return -EALREADY; |
| 12124 | } |
| 12125 | } |
| 12126 | } |
| 12127 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 12128 | { |
| 12129 | ret = wait_for_completion_interruptible_timeout( |
| 12130 | &pAdapter->disconnect_comp_var, |
| 12131 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 12132 | if (0 >= ret) |
| 12133 | { |
| 12134 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 12135 | return -EALREADY; |
| 12136 | } |
| 12137 | } |
| 12138 | |
| 12139 | return 0; |
| 12140 | } |
| 12141 | |
| 12142 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12143 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 12144 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12145 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12146 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12147 | struct net_device *ndev, |
| 12148 | struct cfg80211_connect_params *req |
| 12149 | ) |
| 12150 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12151 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12152 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12153 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 12154 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12155 | |
| 12156 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12157 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12158 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12159 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 12160 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12161 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12162 | "%s: device_mode = %s (%d)", __func__, |
| 12163 | hdd_device_modetoString(pAdapter->device_mode), |
| 12164 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12165 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12166 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 12167 | if (!pHddCtx) |
| 12168 | { |
| 12169 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12170 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12171 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 12172 | } |
| 12173 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12174 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12175 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12176 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12177 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12178 | } |
| 12179 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12180 | if (vos_max_concurrent_connections_reached()) { |
| 12181 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 12182 | return -ECONNREFUSED; |
| 12183 | } |
| 12184 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12185 | #ifdef WLAN_BTAMP_FEATURE |
| 12186 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12187 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12188 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12189 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12190 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 12191 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12192 | } |
| 12193 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12194 | |
| 12195 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 12196 | //P2P Mode will be taken care in Open/close adapter |
| 12197 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12198 | (vos_concurrent_open_sessions_running())) { |
| 12199 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 12200 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12201 | } |
| 12202 | |
| 12203 | /*Try disconnecting if already in connected state*/ |
| 12204 | status = wlan_hdd_try_disconnect(pAdapter); |
| 12205 | if ( 0 > status) |
| 12206 | { |
| 12207 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 12208 | " connection")); |
| 12209 | return -EALREADY; |
| 12210 | } |
| 12211 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12212 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12213 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12214 | |
| 12215 | if ( 0 > status) |
| 12216 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12217 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12218 | __func__); |
| 12219 | return status; |
| 12220 | } |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 12221 | if ( req->channel ) |
| 12222 | { |
| 12223 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 12224 | req->ssid_len, req->bssid, |
| 12225 | req->channel->hw_value); |
| 12226 | } |
| 12227 | else |
| 12228 | { |
| 12229 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12230 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 12231 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12232 | |
Sushant Kaushik | d708398 | 2015-03-18 14:33:24 +0530 | [diff] [blame] | 12233 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12234 | { |
| 12235 | //ReEnable BMPS if disabled |
| 12236 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 12237 | (NULL != pHddCtx)) |
| 12238 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 12239 | if (pHddCtx->hdd_wlan_suspended) |
| 12240 | { |
| 12241 | hdd_set_pwrparams(pHddCtx); |
| 12242 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12243 | //ReEnable Bmps and Imps back |
| 12244 | hdd_enable_bmps_imps(pHddCtx); |
| 12245 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12246 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12247 | return status; |
| 12248 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12249 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12250 | EXIT(); |
| 12251 | return status; |
| 12252 | } |
| 12253 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12254 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 12255 | struct net_device *ndev, |
| 12256 | struct cfg80211_connect_params *req) |
| 12257 | { |
| 12258 | int ret; |
| 12259 | vos_ssr_protect(__func__); |
| 12260 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 12261 | vos_ssr_unprotect(__func__); |
| 12262 | |
| 12263 | return ret; |
| 12264 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12265 | |
| 12266 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12267 | * FUNCTION: wlan_hdd_disconnect |
| 12268 | * This function is used to issue a disconnect request to SME |
| 12269 | */ |
| 12270 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 12271 | { |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12272 | int status, result = 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12273 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12274 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12275 | long ret; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12276 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12277 | ENTER(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12278 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12279 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12280 | if (0 != status) |
| 12281 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12282 | return status; |
| 12283 | } |
| 12284 | |
Sushant Kaushik | b4834d2 | 2015-07-15 15:29:05 +0530 | [diff] [blame] | 12285 | if (pHddStaCtx->conn_info.connState == eConnectionState_Connecting) |
| 12286 | { |
| 12287 | sme_abortConnection(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12288 | pAdapter->sessionId); |
| 12289 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12290 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12291 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12292 | /* Need to apply spin lock before decreasing active sessions |
| 12293 | * as there can be chance for double decrement if context switch |
| 12294 | * Calls hdd_DisConnectHandler. |
| 12295 | */ |
| 12296 | |
| 12297 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12298 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 12299 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12300 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 12301 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12302 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 12303 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12304 | |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 12305 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12306 | FL( "Set HDD connState to eConnectionState_Disconnecting" )); |
| 12307 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12308 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12309 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12310 | /* |
| 12311 | * stop tx queues before deleting STA/BSS context from the firmware. |
| 12312 | * tx has to be disabled because the firmware can get busy dropping |
| 12313 | * the tx frames after BSS/STA has been deleted and will not send |
| 12314 | * back a response resulting in WDI timeout |
| 12315 | */ |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 12316 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12317 | netif_tx_disable(pAdapter->dev); |
| 12318 | netif_carrier_off(pAdapter->dev); |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 12319 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12320 | /*issue disconnect*/ |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12321 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12322 | pAdapter->sessionId, reason); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12323 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
| 12324 | { |
| 12325 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12326 | FL("status = %d, already disconnected"), |
| 12327 | (int)status ); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12328 | |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12329 | } |
| 12330 | else if ( 0 != status ) |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12331 | { |
| 12332 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12333 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12334 | __func__, (int)status ); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12335 | result = -EINVAL; |
| 12336 | goto disconnected; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12337 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12338 | ret = wait_for_completion_interruptible_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12339 | &pAdapter->disconnect_comp_var, |
| 12340 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12341 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status )) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12342 | { |
| 12343 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12344 | "%s: Failed to disconnect, timed out", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12345 | result = -ETIMEDOUT; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12346 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12347 | else if (ret == -ERESTARTSYS) |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12348 | { |
| 12349 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12350 | "%s: Failed to disconnect, wait interrupted", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12351 | result = -ERESTARTSYS; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12352 | } |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12353 | disconnected: |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12354 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12355 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 12356 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 12357 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12358 | EXIT(); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12359 | return result; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12360 | } |
| 12361 | |
| 12362 | |
| 12363 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12364 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12365 | * This function is used to issue a disconnect request to SME |
| 12366 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12367 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12368 | struct net_device *dev, |
| 12369 | u16 reason |
| 12370 | ) |
| 12371 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12372 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12373 | int status; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12374 | tCsrRoamProfile *pRoamProfile; |
| 12375 | hdd_station_ctx_t *pHddStaCtx; |
| 12376 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12377 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12378 | tANI_U8 staIdx; |
| 12379 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12380 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12381 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12382 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12383 | if (!pAdapter) { |
| 12384 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 12385 | return -EINVAL; |
| 12386 | } |
| 12387 | |
| 12388 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12389 | if (!pHddStaCtx) { |
| 12390 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD STA context is NULL")); |
| 12391 | return -EINVAL; |
| 12392 | } |
| 12393 | |
| 12394 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12395 | status = wlan_hdd_validate_context(pHddCtx); |
| 12396 | if (0 != status) |
| 12397 | { |
| 12398 | return status; |
| 12399 | } |
| 12400 | |
| 12401 | pRoamProfile = &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
| 12402 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12403 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12404 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 12405 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12406 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 12407 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12408 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12409 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12410 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 12411 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12412 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12413 | if (NULL != pRoamProfile) |
| 12414 | { |
| 12415 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 12416 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 12417 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12418 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12419 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12420 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12421 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12422 | switch(reason) |
| 12423 | { |
| 12424 | case WLAN_REASON_MIC_FAILURE: |
| 12425 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 12426 | break; |
| 12427 | |
| 12428 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 12429 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 12430 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 12431 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 12432 | break; |
| 12433 | |
| 12434 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 12435 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 12436 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12437 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 12438 | break; |
| 12439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12440 | default: |
| 12441 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 12442 | break; |
| 12443 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12444 | pScanInfo = &pHddCtx->scan_info; |
| 12445 | if (pScanInfo->mScanPending) |
| 12446 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 12447 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12448 | "Aborting Scan"); |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 12449 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 12450 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12451 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12452 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12453 | #ifdef FEATURE_WLAN_TDLS |
| 12454 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12455 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12456 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12457 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 12458 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12459 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12460 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12461 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12462 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12463 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12464 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12465 | MAC_ADDR_ARRAY(mac)); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 12466 | status = sme_DeleteTdlsPeerSta( |
| 12467 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12468 | pAdapter->sessionId, |
| 12469 | mac); |
| 12470 | if (status != eHAL_STATUS_SUCCESS) { |
| 12471 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 12472 | return -EPERM; |
| 12473 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12474 | } |
| 12475 | } |
| 12476 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 12477 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12478 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 12479 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12480 | { |
| 12481 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12482 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12483 | __func__, (int)status ); |
| 12484 | return -EINVAL; |
| 12485 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12486 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 12487 | else |
| 12488 | { |
| 12489 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 12490 | "called while in %d state", __func__, |
| 12491 | pHddStaCtx->conn_info.connState); |
| 12492 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12493 | } |
| 12494 | else |
| 12495 | { |
| 12496 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 12497 | } |
| 12498 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12499 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12500 | return status; |
| 12501 | } |
| 12502 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12503 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 12504 | struct net_device *dev, |
| 12505 | u16 reason |
| 12506 | ) |
| 12507 | { |
| 12508 | int ret; |
| 12509 | vos_ssr_protect(__func__); |
| 12510 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 12511 | vos_ssr_unprotect(__func__); |
| 12512 | |
| 12513 | return ret; |
| 12514 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12515 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12516 | /* |
| 12517 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12518 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12519 | * settings in IBSS mode. |
| 12520 | */ |
| 12521 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12522 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12523 | struct cfg80211_ibss_params *params |
| 12524 | ) |
| 12525 | { |
| 12526 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12527 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12528 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 12529 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12530 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12531 | ENTER(); |
| 12532 | |
| 12533 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 12534 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12535 | |
| 12536 | if (params->ie_len && ( NULL != params->ie) ) |
| 12537 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12538 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 12539 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12540 | { |
| 12541 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 12542 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 12543 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12544 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12545 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12546 | tDot11fIEWPA dot11WPAIE; |
| 12547 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12548 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12549 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 12550 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12551 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 12552 | params->ie_len, DOT11F_EID_WPA); |
| 12553 | if ( NULL != ie ) |
| 12554 | { |
| 12555 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 12556 | // Unpack the WPA IE |
| 12557 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 12558 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 12559 | &ie[2+4], |
| 12560 | ie[1] - 4, |
| 12561 | &dot11WPAIE); |
| 12562 | /*Extract the multicast cipher, the encType for unicast |
| 12563 | cipher for wpa-none is none*/ |
| 12564 | encryptionType = |
| 12565 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 12566 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12567 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12568 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12569 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 12570 | |
| 12571 | if (0 > status) |
| 12572 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12573 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12574 | __func__); |
| 12575 | return status; |
| 12576 | } |
| 12577 | } |
| 12578 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12579 | pWextState->roamProfile.AuthType.authType[0] = |
| 12580 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12581 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 12582 | |
| 12583 | if (params->privacy) |
| 12584 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12585 | /* Security enabled IBSS, At this time there is no information available |
| 12586 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12587 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12588 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12589 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12590 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12591 | *enable privacy bit in beacons */ |
| 12592 | |
| 12593 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 12594 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12595 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 12596 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12597 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 12598 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 12599 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12600 | return status; |
| 12601 | } |
| 12602 | |
| 12603 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12604 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12605 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12606 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12607 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12608 | struct net_device *dev, |
| 12609 | struct cfg80211_ibss_params *params |
| 12610 | ) |
| 12611 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12612 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12613 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12614 | tCsrRoamProfile *pRoamProfile; |
| 12615 | int status; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12616 | bool alloc_bssid = VOS_FALSE; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12617 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12618 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12619 | |
| 12620 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12621 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12622 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12623 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 12624 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12625 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12626 | "%s: device_mode = %s (%d)", __func__, |
| 12627 | hdd_device_modetoString(pAdapter->device_mode), |
| 12628 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12629 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12630 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12631 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12632 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12633 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12634 | } |
| 12635 | |
| 12636 | if (NULL == pWextState) |
| 12637 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12638 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12639 | __func__); |
| 12640 | return -EIO; |
| 12641 | } |
| 12642 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12643 | if (vos_max_concurrent_connections_reached()) { |
| 12644 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 12645 | return -ECONNREFUSED; |
| 12646 | } |
| 12647 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12648 | /*Try disconnecting if already in connected state*/ |
| 12649 | status = wlan_hdd_try_disconnect(pAdapter); |
| 12650 | if ( 0 > status) |
| 12651 | { |
| 12652 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 12653 | " IBSS connection")); |
| 12654 | return -EALREADY; |
| 12655 | } |
| 12656 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12657 | pRoamProfile = &pWextState->roamProfile; |
| 12658 | |
| 12659 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 12660 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12661 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12662 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12663 | return -EINVAL; |
| 12664 | } |
| 12665 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12666 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 12667 | if (NULL != params->bssid) { |
| 12668 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 12669 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 12670 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12671 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 12672 | return -EIO; |
| 12673 | } |
| 12674 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12675 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 12676 | { |
| 12677 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 12678 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 12679 | { |
| 12680 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12681 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 12682 | return -EIO; |
| 12683 | } |
Sachin Ahuja | 46ff491 | 2015-03-23 22:48:43 +0530 | [diff] [blame] | 12684 | params->bssid = vos_mem_malloc(VOS_MAC_ADDR_SIZE); |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12685 | if (!params->bssid) |
| 12686 | { |
| 12687 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12688 | "%s:Failed memory allocation", __func__); |
| 12689 | return -EIO; |
| 12690 | } |
| 12691 | vos_mem_copy((v_U8_t *)params->bssid, |
| 12692 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
| 12693 | VOS_MAC_ADDR_SIZE); |
| 12694 | alloc_bssid = VOS_TRUE; |
| 12695 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12696 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12697 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12698 | if (NULL != |
| 12699 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 12700 | params->chandef.chan) |
| 12701 | #else |
| 12702 | params->channel) |
| 12703 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12704 | { |
| 12705 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12706 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 12707 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 12708 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12709 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12710 | |
| 12711 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12712 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12713 | ieee80211_frequency_to_channel( |
| 12714 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 12715 | params->chandef.chan->center_freq); |
| 12716 | #else |
| 12717 | params->channel->center_freq); |
| 12718 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12719 | |
| 12720 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 12721 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12722 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12723 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 12724 | __func__); |
| 12725 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12726 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12727 | |
| 12728 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12729 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12730 | if (channelNum == validChan[indx]) |
| 12731 | { |
| 12732 | break; |
| 12733 | } |
| 12734 | } |
| 12735 | if (indx >= numChans) |
| 12736 | { |
| 12737 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12738 | __func__, channelNum); |
| 12739 | return -EINVAL; |
| 12740 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12741 | /* Set the Operational Channel */ |
| 12742 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 12743 | channelNum); |
| 12744 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 12745 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 12746 | pRoamProfile->ChannelInfo.ChannelList = |
| 12747 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12748 | } |
| 12749 | |
| 12750 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12751 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12752 | if (status < 0) |
| 12753 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12754 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12755 | __func__); |
| 12756 | return status; |
| 12757 | } |
| 12758 | |
| 12759 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12760 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12761 | params->ssid_len, params->bssid, |
| 12762 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12763 | |
| 12764 | if (0 > status) |
| 12765 | { |
| 12766 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 12767 | return status; |
| 12768 | } |
| 12769 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12770 | if (NULL != params->bssid && |
| 12771 | pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0 && |
| 12772 | alloc_bssid == VOS_TRUE) |
| 12773 | { |
| 12774 | vos_mem_free(params->bssid); |
| 12775 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12776 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12777 | return 0; |
| 12778 | } |
| 12779 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12780 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 12781 | struct net_device *dev, |
| 12782 | struct cfg80211_ibss_params *params |
| 12783 | ) |
| 12784 | { |
| 12785 | int ret = 0; |
| 12786 | |
| 12787 | vos_ssr_protect(__func__); |
| 12788 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 12789 | vos_ssr_unprotect(__func__); |
| 12790 | |
| 12791 | return ret; |
| 12792 | } |
| 12793 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12794 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12795 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12796 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12797 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12798 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12799 | struct net_device *dev |
| 12800 | ) |
| 12801 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12802 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12803 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12804 | tCsrRoamProfile *pRoamProfile; |
| 12805 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12806 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12807 | |
| 12808 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12809 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12810 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12811 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 12812 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12813 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12814 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12815 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12816 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12817 | } |
| 12818 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12819 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 12820 | hdd_device_modetoString(pAdapter->device_mode), |
| 12821 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12822 | if (NULL == pWextState) |
| 12823 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12824 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12825 | __func__); |
| 12826 | return -EIO; |
| 12827 | } |
| 12828 | |
| 12829 | pRoamProfile = &pWextState->roamProfile; |
| 12830 | |
| 12831 | /* Issue disconnect only if interface type is set to IBSS */ |
| 12832 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 12833 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12834 | 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] | 12835 | __func__); |
| 12836 | return -EINVAL; |
| 12837 | } |
| 12838 | |
| 12839 | /* Issue Disconnect request */ |
| 12840 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 12841 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 12842 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 12843 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12844 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12845 | return 0; |
| 12846 | } |
| 12847 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12848 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 12849 | struct net_device *dev |
| 12850 | ) |
| 12851 | { |
| 12852 | int ret = 0; |
| 12853 | |
| 12854 | vos_ssr_protect(__func__); |
| 12855 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 12856 | vos_ssr_unprotect(__func__); |
| 12857 | |
| 12858 | return ret; |
| 12859 | } |
| 12860 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12861 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12862 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12863 | * This function is used to set the phy parameters |
| 12864 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 12865 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12866 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12867 | u32 changed) |
| 12868 | { |
| 12869 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 12870 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12871 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12872 | |
| 12873 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12874 | |
| 12875 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12876 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 12877 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12878 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12879 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12880 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12881 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12882 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12883 | } |
| 12884 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12885 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 12886 | { |
| 12887 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 12888 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 12889 | wiphy->rts_threshold; |
| 12890 | |
| 12891 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12892 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12893 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12894 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12895 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12896 | __func__, rts_threshold); |
| 12897 | return -EINVAL; |
| 12898 | } |
| 12899 | |
| 12900 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 12901 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12902 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12903 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12904 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12905 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12906 | __func__, rts_threshold); |
| 12907 | return -EIO; |
| 12908 | } |
| 12909 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12910 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12911 | rts_threshold); |
| 12912 | } |
| 12913 | |
| 12914 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 12915 | { |
| 12916 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 12917 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 12918 | wiphy->frag_threshold; |
| 12919 | |
| 12920 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12921 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12922 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12923 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12924 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12925 | frag_threshold); |
| 12926 | return -EINVAL; |
| 12927 | } |
| 12928 | |
| 12929 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 12930 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12931 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12932 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12933 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12934 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12935 | __func__, frag_threshold); |
| 12936 | return -EIO; |
| 12937 | } |
| 12938 | |
| 12939 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 12940 | frag_threshold); |
| 12941 | } |
| 12942 | |
| 12943 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 12944 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 12945 | { |
| 12946 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 12947 | wiphy->retry_short : |
| 12948 | wiphy->retry_long; |
| 12949 | |
| 12950 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 12951 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 12952 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12953 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12954 | __func__, retry_value); |
| 12955 | return -EINVAL; |
| 12956 | } |
| 12957 | |
| 12958 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 12959 | { |
| 12960 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 12961 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12962 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12963 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12964 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12965 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12966 | __func__, retry_value); |
| 12967 | return -EIO; |
| 12968 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12969 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12970 | __func__, retry_value); |
| 12971 | } |
| 12972 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 12973 | { |
| 12974 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 12975 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12976 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12977 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12978 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12979 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12980 | __func__, retry_value); |
| 12981 | return -EIO; |
| 12982 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12983 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12984 | __func__, retry_value); |
| 12985 | } |
| 12986 | } |
| 12987 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12988 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12989 | return 0; |
| 12990 | } |
| 12991 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12992 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 12993 | u32 changed) |
| 12994 | { |
| 12995 | int ret; |
| 12996 | |
| 12997 | vos_ssr_protect(__func__); |
| 12998 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 12999 | vos_ssr_unprotect(__func__); |
| 13000 | |
| 13001 | return ret; |
| 13002 | } |
| 13003 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13004 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 13005 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13006 | * This function is used to set the txpower |
| 13007 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 13008 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 13009 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13010 | struct wireless_dev *wdev, |
| 13011 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13012 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13013 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13014 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13015 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13016 | #endif |
| 13017 | int dbm) |
| 13018 | { |
| 13019 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13020 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13021 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 13022 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13023 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13024 | |
| 13025 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13026 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13027 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13028 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 13029 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13030 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13031 | if (0 != status) |
| 13032 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13033 | return status; |
| 13034 | } |
| 13035 | |
| 13036 | hHal = pHddCtx->hHal; |
| 13037 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13038 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 13039 | dbm, ccmCfgSetCallback, |
| 13040 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13041 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13042 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13043 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 13044 | return -EIO; |
| 13045 | } |
| 13046 | |
| 13047 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 13048 | dbm); |
| 13049 | |
| 13050 | switch(type) |
| 13051 | { |
| 13052 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 13053 | /* Fall through */ |
| 13054 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 13055 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 13056 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13057 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 13058 | __func__); |
| 13059 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13060 | } |
| 13061 | break; |
| 13062 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13063 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13064 | __func__); |
| 13065 | return -EOPNOTSUPP; |
| 13066 | break; |
| 13067 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13068 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 13069 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13070 | return -EIO; |
| 13071 | } |
| 13072 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13073 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13074 | return 0; |
| 13075 | } |
| 13076 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 13077 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 13078 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13079 | struct wireless_dev *wdev, |
| 13080 | #endif |
| 13081 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 13082 | enum tx_power_setting type, |
| 13083 | #else |
| 13084 | enum nl80211_tx_power_setting type, |
| 13085 | #endif |
| 13086 | int dbm) |
| 13087 | { |
| 13088 | int ret; |
| 13089 | vos_ssr_protect(__func__); |
| 13090 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 13091 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13092 | wdev, |
| 13093 | #endif |
| 13094 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 13095 | type, |
| 13096 | #else |
| 13097 | type, |
| 13098 | #endif |
| 13099 | dbm); |
| 13100 | vos_ssr_unprotect(__func__); |
| 13101 | |
| 13102 | return ret; |
| 13103 | } |
| 13104 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13105 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13106 | * FUNCTION: __wlan_hdd_cfg80211_get_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13107 | * This function is used to read the txpower |
| 13108 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13109 | static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 13110 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13111 | struct wireless_dev *wdev, |
| 13112 | #endif |
| 13113 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13114 | { |
| 13115 | |
| 13116 | hdd_adapter_t *pAdapter; |
| 13117 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13118 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13119 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13120 | ENTER(); |
| 13121 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13122 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13123 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13124 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13125 | *dbm = 0; |
| 13126 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13127 | } |
| 13128 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13129 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 13130 | if (NULL == pAdapter) |
| 13131 | { |
| 13132 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 13133 | return -ENOENT; |
| 13134 | } |
| 13135 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 13136 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13137 | TRACE_CODE_HDD_CFG80211_GET_TXPOWER, |
| 13138 | pAdapter->sessionId, pAdapter->device_mode)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13139 | wlan_hdd_get_classAstats(pAdapter); |
| 13140 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 13141 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13142 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13143 | return 0; |
| 13144 | } |
| 13145 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13146 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 13147 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13148 | struct wireless_dev *wdev, |
| 13149 | #endif |
| 13150 | int *dbm) |
| 13151 | { |
| 13152 | int ret; |
| 13153 | |
| 13154 | vos_ssr_protect(__func__); |
| 13155 | ret = __wlan_hdd_cfg80211_get_txpower(wiphy, |
| 13156 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13157 | wdev, |
| 13158 | #endif |
| 13159 | dbm); |
| 13160 | vos_ssr_unprotect(__func__); |
| 13161 | |
| 13162 | return ret; |
| 13163 | } |
| 13164 | |
| 13165 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13166 | 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] | 13167 | u8* mac, struct station_info *sinfo) |
| 13168 | { |
| 13169 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 13170 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13171 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13172 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13173 | |
| 13174 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 13175 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13176 | |
| 13177 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 13178 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 13179 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 13180 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 13181 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 13182 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 13183 | tANI_U16 maxRate = 0; |
| 13184 | tANI_U16 myRate; |
| 13185 | tANI_U16 currentRate = 0; |
| 13186 | tANI_U8 maxSpeedMCS = 0; |
| 13187 | tANI_U8 maxMCSIdx = 0; |
| 13188 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13189 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 13190 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13191 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13192 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13193 | #ifdef WLAN_FEATURE_11AC |
| 13194 | tANI_U32 vht_mcs_map; |
| 13195 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 13196 | #endif /* WLAN_FEATURE_11AC */ |
| 13197 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13198 | ENTER(); |
| 13199 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13200 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 13201 | (0 == ssidlen)) |
| 13202 | { |
| 13203 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 13204 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 13205 | /*To keep GUI happy*/ |
| 13206 | return 0; |
| 13207 | } |
| 13208 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 13209 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 13210 | { |
| 13211 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13212 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 13213 | return 0; |
| 13214 | } |
| 13215 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13216 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13217 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13218 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13219 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13220 | } |
| 13221 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13222 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 13223 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 13224 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 13225 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 13226 | wlan_hdd_get_station_stats(pAdapter); |
| 13227 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
| 13228 | |
| 13229 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13230 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 13231 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13232 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13233 | { |
| 13234 | rate_flags = pAdapter->maxRateFlags; |
| 13235 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13236 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13237 | //convert to the UI units of 100kbps |
| 13238 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 13239 | |
| 13240 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13241 | 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] | 13242 | sinfo->signal, |
| 13243 | pCfg->reportMaxLinkSpeed, |
| 13244 | myRate, |
| 13245 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13246 | (int) pCfg->linkSpeedRssiMid, |
| 13247 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13248 | (int) rate_flags, |
| 13249 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13250 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13251 | |
| 13252 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 13253 | { |
| 13254 | // we do not want to necessarily report the current speed |
| 13255 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 13256 | { |
| 13257 | // report the max possible speed |
| 13258 | rssidx = 0; |
| 13259 | } |
| 13260 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 13261 | { |
| 13262 | // report the max possible speed with RSSI scaling |
| 13263 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 13264 | { |
| 13265 | // report the max possible speed |
| 13266 | rssidx = 0; |
| 13267 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13268 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13269 | { |
| 13270 | // report middle speed |
| 13271 | rssidx = 1; |
| 13272 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13273 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 13274 | { |
| 13275 | // report middle speed |
| 13276 | rssidx = 2; |
| 13277 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13278 | else |
| 13279 | { |
| 13280 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13281 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13282 | } |
| 13283 | } |
| 13284 | else |
| 13285 | { |
| 13286 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 13287 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13288 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 13289 | __func__, pCfg->reportMaxLinkSpeed); |
| 13290 | rssidx = 0; |
| 13291 | } |
| 13292 | |
| 13293 | maxRate = 0; |
| 13294 | |
| 13295 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13296 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 13297 | OperationalRates, &ORLeng)) |
| 13298 | { |
| 13299 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13300 | /*To keep GUI happy*/ |
| 13301 | return 0; |
| 13302 | } |
| 13303 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13304 | for (i = 0; i < ORLeng; i++) |
| 13305 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13306 | 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] | 13307 | { |
| 13308 | /* Validate Rate Set */ |
| 13309 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 13310 | { |
| 13311 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 13312 | break; |
| 13313 | } |
| 13314 | } |
| 13315 | /* Update MAX rate */ |
| 13316 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 13317 | } |
| 13318 | |
| 13319 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13320 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 13321 | ExtendedRates, &ERLeng)) |
| 13322 | { |
| 13323 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13324 | /*To keep GUI happy*/ |
| 13325 | return 0; |
| 13326 | } |
| 13327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13328 | for (i = 0; i < ERLeng; i++) |
| 13329 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13330 | 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] | 13331 | { |
| 13332 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 13333 | { |
| 13334 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 13335 | break; |
| 13336 | } |
| 13337 | } |
| 13338 | /* Update MAX rate */ |
| 13339 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 13340 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13341 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 13342 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 13343 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 13344 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13345 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13346 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13347 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13348 | mode = 2; |
| 13349 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 13350 | mode = 1; |
| 13351 | else |
| 13352 | mode = 0; |
| 13353 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13354 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 13355 | MCSRates, &MCSLeng)) |
| 13356 | { |
| 13357 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13358 | /*To keep GUI happy*/ |
| 13359 | return 0; |
| 13360 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13361 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13362 | #ifdef WLAN_FEATURE_11AC |
| 13363 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13364 | 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] | 13365 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13366 | 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] | 13367 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13368 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13369 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13370 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13371 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13372 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13373 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13374 | maxMCSIdx = 7; |
| 13375 | } |
| 13376 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 13377 | { |
| 13378 | maxMCSIdx = 8; |
| 13379 | } |
| 13380 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 13381 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13382 | //VHT20 is supporting 0~8 |
| 13383 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13384 | maxMCSIdx = 8; |
| 13385 | else |
| 13386 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13387 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13388 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13389 | if (0 != rssidx)/*check for scaled */ |
| 13390 | { |
| 13391 | //get middle rate MCS index if rssi=1/2 |
| 13392 | for (i=0; i <= maxMCSIdx; i++) |
| 13393 | { |
| 13394 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 13395 | { |
| 13396 | maxMCSIdx = i; |
| 13397 | break; |
| 13398 | } |
| 13399 | } |
| 13400 | } |
| 13401 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13402 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13403 | { |
| 13404 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 13405 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 13406 | } |
| 13407 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 13408 | { |
| 13409 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 13410 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 13411 | } |
| 13412 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13413 | { |
| 13414 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 13415 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 13416 | } |
| 13417 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13418 | maxSpeedMCS = 1; |
| 13419 | if (currentRate > maxRate) |
| 13420 | { |
| 13421 | maxRate = currentRate; |
| 13422 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13423 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13424 | } |
| 13425 | else |
| 13426 | #endif /* WLAN_FEATURE_11AC */ |
| 13427 | { |
| 13428 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13429 | { |
| 13430 | rateFlag |= 1; |
| 13431 | } |
| 13432 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13433 | { |
| 13434 | rateFlag |= 2; |
| 13435 | } |
| 13436 | |
Girish Gowli | 01abcee | 2014-07-31 20:18:55 +0530 | [diff] [blame] | 13437 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13438 | if (rssidx == 1 || rssidx == 2) |
| 13439 | { |
| 13440 | //get middle rate MCS index if rssi=1/2 |
| 13441 | for (i=0; i <= 7; i++) |
| 13442 | { |
| 13443 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 13444 | { |
| 13445 | temp = i+1; |
| 13446 | break; |
| 13447 | } |
| 13448 | } |
| 13449 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13450 | |
| 13451 | for (i = 0; i < MCSLeng; i++) |
| 13452 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13453 | for (j = 0; j < temp; j++) |
| 13454 | { |
| 13455 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 13456 | { |
| 13457 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
Hanumantha Reddy Pothula | fa62374 | 2015-06-16 14:08:24 +0530 | [diff] [blame] | 13458 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13459 | break; |
| 13460 | } |
| 13461 | } |
| 13462 | if ((j < temp) && (currentRate > maxRate)) |
| 13463 | { |
| 13464 | maxRate = currentRate; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13465 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13466 | } |
Hanumantha Reddy Pothula | fa62374 | 2015-06-16 14:08:24 +0530 | [diff] [blame] | 13467 | maxSpeedMCS = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13468 | } |
| 13469 | } |
| 13470 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13471 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 13472 | { |
| 13473 | maxRate = myRate; |
| 13474 | maxSpeedMCS = 1; |
| 13475 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 13476 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13477 | // 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] | 13478 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13479 | { |
| 13480 | maxRate = myRate; |
| 13481 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 13482 | { |
| 13483 | maxSpeedMCS = 0; |
| 13484 | } |
| 13485 | else |
| 13486 | { |
| 13487 | maxSpeedMCS = 1; |
| 13488 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 13489 | } |
| 13490 | } |
| 13491 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13492 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13493 | { |
| 13494 | sinfo->txrate.legacy = maxRate; |
| 13495 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13496 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 13497 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13498 | } |
| 13499 | else |
| 13500 | { |
| 13501 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13502 | #ifdef WLAN_FEATURE_11AC |
| 13503 | sinfo->txrate.nss = 1; |
| 13504 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13505 | { |
| 13506 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13507 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13508 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13509 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13510 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13511 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13512 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13513 | } |
| 13514 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13515 | { |
| 13516 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13517 | } |
| 13518 | #endif /* WLAN_FEATURE_11AC */ |
| 13519 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 13520 | { |
| 13521 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 13522 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13523 | { |
| 13524 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13525 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13526 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13527 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13528 | { |
| 13529 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 13530 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13531 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13532 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13533 | pr_info("Reporting MCS rate %d flags %x\n", |
| 13534 | sinfo->txrate.mcs, |
| 13535 | sinfo->txrate.flags ); |
| 13536 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13537 | } |
| 13538 | } |
| 13539 | else |
| 13540 | { |
| 13541 | // report current rate instead of max rate |
| 13542 | |
| 13543 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 13544 | { |
| 13545 | //provide to the UI in units of 100kbps |
| 13546 | sinfo->txrate.legacy = myRate; |
| 13547 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13548 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 13549 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13550 | } |
| 13551 | else |
| 13552 | { |
| 13553 | //must be MCS |
| 13554 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13555 | #ifdef WLAN_FEATURE_11AC |
| 13556 | sinfo->txrate.nss = 1; |
| 13557 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13558 | { |
| 13559 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13560 | } |
| 13561 | else |
| 13562 | #endif /* WLAN_FEATURE_11AC */ |
| 13563 | { |
| 13564 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 13565 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13566 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13567 | { |
| 13568 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 13569 | } |
| 13570 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13571 | { |
| 13572 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13573 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13574 | #ifdef WLAN_FEATURE_11AC |
| 13575 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13576 | { |
| 13577 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 13578 | } |
| 13579 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13580 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13581 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 13582 | sinfo->txrate.mcs, |
| 13583 | sinfo->txrate.flags ); |
| 13584 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13585 | } |
| 13586 | } |
| 13587 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 13588 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 13589 | sinfo->tx_packets = |
| 13590 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 13591 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 13592 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 13593 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 13594 | |
| 13595 | sinfo->tx_retries = |
| 13596 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 13597 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 13598 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 13599 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 13600 | |
| 13601 | sinfo->tx_failed = |
| 13602 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 13603 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 13604 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 13605 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 13606 | |
| 13607 | sinfo->filled |= |
| 13608 | STATION_INFO_TX_PACKETS | |
| 13609 | STATION_INFO_TX_RETRIES | |
| 13610 | STATION_INFO_TX_FAILED; |
| 13611 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13612 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13613 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 13614 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 13615 | EXIT(); |
| 13616 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13617 | } |
| 13618 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13619 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 13620 | u8* mac, struct station_info *sinfo) |
| 13621 | { |
| 13622 | int ret; |
| 13623 | |
| 13624 | vos_ssr_protect(__func__); |
| 13625 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 13626 | vos_ssr_unprotect(__func__); |
| 13627 | |
| 13628 | return ret; |
| 13629 | } |
| 13630 | |
| 13631 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 13632 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13633 | { |
| 13634 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13635 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13636 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13637 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13638 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13639 | ENTER(); |
| 13640 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13641 | if (NULL == pAdapter) |
| 13642 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13643 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13644 | return -ENODEV; |
| 13645 | } |
| 13646 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13647 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13648 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 13649 | pAdapter->sessionId, timeout)); |
| 13650 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13651 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13652 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13653 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13654 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13655 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13656 | } |
| 13657 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13658 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 13659 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 13660 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 13661 | (eConnectionState_Associated == |
| 13662 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 13663 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 13664 | |
| 13665 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13666 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 13667 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13668 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13669 | { |
| 13670 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13671 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13672 | __func__, vos_status); |
| 13673 | } |
| 13674 | } |
| 13675 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13676 | /**The get power cmd from the supplicant gets updated by the nl only |
| 13677 | *on successful execution of the function call |
| 13678 | *we are oppositely mapped w.r.t mode in the driver |
| 13679 | **/ |
| 13680 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 13681 | |
| 13682 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 13683 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13684 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13685 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13686 | return -EINVAL; |
| 13687 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13688 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13689 | return 0; |
| 13690 | } |
| 13691 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13692 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 13693 | struct net_device *dev, bool mode, int timeout) |
| 13694 | { |
| 13695 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13696 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13697 | vos_ssr_protect(__func__); |
| 13698 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 13699 | vos_ssr_unprotect(__func__); |
| 13700 | |
| 13701 | return ret; |
| 13702 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13703 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13704 | static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 13705 | struct net_device *netdev, |
| 13706 | u8 key_index) |
| 13707 | { |
| 13708 | ENTER(); |
| 13709 | return 0; |
| 13710 | } |
| 13711 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13712 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13713 | struct net_device *netdev, |
| 13714 | u8 key_index) |
| 13715 | { |
| 13716 | int ret; |
| 13717 | vos_ssr_protect(__func__); |
| 13718 | ret = __wlan_hdd_set_default_mgmt_key(wiphy, netdev, key_index); |
| 13719 | vos_ssr_unprotect(__func__); |
| 13720 | return ret; |
| 13721 | } |
| 13722 | #endif //LINUX_VERSION_CODE |
| 13723 | |
| 13724 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 13725 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13726 | struct net_device *dev, |
| 13727 | struct ieee80211_txq_params *params) |
| 13728 | { |
| 13729 | ENTER(); |
| 13730 | return 0; |
| 13731 | } |
| 13732 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13733 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13734 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13735 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13736 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13737 | return 0; |
| 13738 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13739 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13740 | |
| 13741 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 13742 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13743 | struct net_device *dev, |
| 13744 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13745 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13746 | int ret; |
| 13747 | |
| 13748 | vos_ssr_protect(__func__); |
| 13749 | ret = __wlan_hdd_set_txq_params(wiphy, dev, params); |
| 13750 | vos_ssr_unprotect(__func__); |
| 13751 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13752 | } |
| 13753 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13754 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13755 | struct ieee80211_txq_params *params) |
| 13756 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13757 | int ret; |
| 13758 | |
| 13759 | vos_ssr_protect(__func__); |
| 13760 | ret = __wlan_hdd_set_txq_params(wiphy, params); |
| 13761 | vos_ssr_unprotect(__func__); |
| 13762 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13763 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13764 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13765 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13766 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13767 | struct net_device *dev, |
| 13768 | struct tagCsrDelStaParams *pDelStaParams) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13769 | { |
| 13770 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13771 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13772 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13773 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13774 | v_U8_t staId; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13775 | v_CONTEXT_t pVosContext = NULL; |
| 13776 | ptSapContext pSapCtx = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13777 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13778 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13779 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13780 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13781 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13782 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13783 | return -EINVAL; |
| 13784 | } |
| 13785 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13786 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13787 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 13788 | pAdapter->sessionId, pAdapter->device_mode)); |
| 13789 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13790 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13791 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13792 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13793 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13794 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13795 | } |
| 13796 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13797 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13798 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13799 | ) |
| 13800 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13801 | pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 13802 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 13803 | if(pSapCtx == NULL){ |
| 13804 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13805 | FL("psapCtx is NULL")); |
| 13806 | return -ENOENT; |
| 13807 | } |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13808 | if (vos_is_macaddr_broadcast((v_MACADDR_t *)pDelStaParams->peerMacAddr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13809 | { |
| 13810 | v_U16_t i; |
| 13811 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 13812 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13813 | if ((pSapCtx->aStaInfo[i].isUsed) && |
| 13814 | (!pSapCtx->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13815 | { |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13816 | vos_mem_copy(pDelStaParams->peerMacAddr, |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13817 | pSapCtx->aStaInfo[i].macAddrSTA.bytes, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13818 | ETHER_ADDR_LEN); |
| 13819 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13820 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13821 | "%s: Delete STA with MAC::" |
| 13822 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13823 | __func__, |
| 13824 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
| 13825 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 13826 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13827 | pSapCtx->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13828 | } |
| 13829 | } |
| 13830 | } |
| 13831 | else |
| 13832 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13833 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13834 | vos_status = hdd_softap_GetStaId(pAdapter, |
| 13835 | (v_MACADDR_t *)pDelStaParams->peerMacAddr, &staId); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13836 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13837 | { |
| 13838 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13839 | "%s: Skip this DEL STA as this is not used::" |
| 13840 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13841 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13842 | return -ENOENT; |
| 13843 | } |
| 13844 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13845 | if( pSapCtx->aStaInfo[staId].isDeauthInProgress == TRUE) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13846 | { |
| 13847 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13848 | "%s: Skip this DEL STA as deauth is in progress::" |
| 13849 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13850 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13851 | return -ENOENT; |
| 13852 | } |
| 13853 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13854 | pSapCtx->aStaInfo[staId].isDeauthInProgress = TRUE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13855 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13856 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13857 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13858 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13859 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13860 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13861 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13862 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13863 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13864 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13865 | pSapCtx->aStaInfo[staId].isDeauthInProgress = FALSE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13866 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13867 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13868 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13869 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13870 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13871 | return -ENOENT; |
| 13872 | } |
| 13873 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13874 | } |
| 13875 | } |
| 13876 | |
| 13877 | EXIT(); |
| 13878 | |
| 13879 | return 0; |
| 13880 | } |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13881 | |
| 13882 | #ifdef CFG80211_DEL_STA_V2 |
| 13883 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 13884 | struct net_device *dev, |
| 13885 | struct station_del_parameters *param) |
| 13886 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13887 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 13888 | struct net_device *dev, u8 *mac) |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13889 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13890 | { |
| 13891 | int ret; |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13892 | struct tagCsrDelStaParams delStaParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13893 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13894 | vos_ssr_protect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13895 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13896 | #ifdef CFG80211_DEL_STA_V2 |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13897 | if (NULL == param) { |
| 13898 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid argumet passed", __func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13899 | vos_ssr_unprotect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13900 | return -EINVAL; |
| 13901 | } |
| 13902 | |
| 13903 | WLANSAP_PopulateDelStaParams(param->mac, param->reason_code, |
| 13904 | param->subtype, &delStaParams); |
| 13905 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13906 | #else |
Sushant Kaushik | 4cd28f6 | 2014-12-26 14:23:50 +0530 | [diff] [blame] | 13907 | WLANSAP_PopulateDelStaParams(mac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13908 | (SIR_MAC_MGMT_DEAUTH >> 4), &delStaParams); |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13909 | #endif |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13910 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, &delStaParams); |
| 13911 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13912 | vos_ssr_unprotect(__func__); |
| 13913 | |
| 13914 | return ret; |
| 13915 | } |
| 13916 | |
| 13917 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13918 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 13919 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13920 | hdd_adapter_t *pAdapter; |
| 13921 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13922 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13923 | #ifdef FEATURE_WLAN_TDLS |
| 13924 | u32 mask, set; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13925 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13926 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13927 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13928 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13929 | if (NULL == pAdapter) |
| 13930 | { |
| 13931 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13932 | "%s: Adapter is NULL",__func__); |
| 13933 | return -EINVAL; |
| 13934 | } |
| 13935 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13936 | status = wlan_hdd_validate_context(pHddCtx); |
| 13937 | if (0 != status) |
| 13938 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13939 | return status; |
| 13940 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13941 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13942 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13943 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 13944 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13945 | mask = params->sta_flags_mask; |
| 13946 | |
| 13947 | set = params->sta_flags_set; |
| 13948 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 13949 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13950 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 13951 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13952 | |
| 13953 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 13954 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13955 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13956 | } |
| 13957 | } |
| 13958 | #endif |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13959 | EXIT(); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13960 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13961 | } |
| 13962 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13963 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 13964 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 13965 | { |
| 13966 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13967 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13968 | vos_ssr_protect(__func__); |
| 13969 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 13970 | vos_ssr_unprotect(__func__); |
| 13971 | |
| 13972 | return ret; |
| 13973 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13974 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13975 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13976 | 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] | 13977 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13978 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13979 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13980 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13981 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13982 | int status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13983 | hdd_context_t *pHddCtx; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13984 | tPmkidCacheInfo pmk_id; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13985 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13986 | ENTER(); |
| 13987 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13988 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13989 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13990 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13991 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13992 | return -EINVAL; |
| 13993 | } |
| 13994 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13995 | if (!pmksa) { |
| 13996 | hddLog(LOGE, FL("pmksa is NULL")); |
| 13997 | return -EINVAL; |
| 13998 | } |
| 13999 | |
| 14000 | if (!pmksa->bssid || !pmksa->pmkid) { |
| 14001 | hddLog(LOGE, FL("pmksa->bssid(%p) or pmksa->pmkid(%p) is NULL"), |
| 14002 | pmksa->bssid, pmksa->pmkid); |
| 14003 | return -EINVAL; |
| 14004 | } |
| 14005 | |
| 14006 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 14007 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 14008 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14009 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14010 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14011 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14012 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14013 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14014 | } |
| 14015 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14016 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14017 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14018 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14019 | vos_mem_copy(pmk_id.BSSID, pmksa->bssid, ETHER_ADDR_LEN); |
| 14020 | vos_mem_copy(pmk_id.PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14021 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14022 | /* Add to the PMKSA ID Cache in CSR */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14023 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14024 | &pmk_id, 1, FALSE); |
| 14025 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14026 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14027 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 14028 | pAdapter->sessionId, result)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14029 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14030 | EXIT(); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14031 | return HAL_STATUS_SUCCESS(result) ? 0 : -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14032 | } |
| 14033 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 14034 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 14035 | struct cfg80211_pmksa *pmksa) |
| 14036 | { |
| 14037 | int ret; |
| 14038 | |
| 14039 | vos_ssr_protect(__func__); |
| 14040 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 14041 | vos_ssr_unprotect(__func__); |
| 14042 | |
| 14043 | return ret; |
| 14044 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14045 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14046 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 14047 | 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] | 14048 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14049 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14050 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14051 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14052 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 14053 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14054 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14055 | ENTER(); |
| 14056 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14057 | /* Validate pAdapter */ |
| 14058 | if (NULL == pAdapter) |
| 14059 | { |
| 14060 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 14061 | return -EINVAL; |
| 14062 | } |
| 14063 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14064 | if (!pmksa) { |
| 14065 | hddLog(LOGE, FL("pmksa is NULL")); |
| 14066 | return -EINVAL; |
| 14067 | } |
| 14068 | |
| 14069 | if (!pmksa->bssid) { |
| 14070 | hddLog(LOGE, FL("pmksa->bssid is NULL")); |
| 14071 | return -EINVAL; |
| 14072 | } |
| 14073 | |
Kiet Lam | 98c46a1 | 2014-10-31 15:34:57 -0700 | [diff] [blame] | 14074 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 14075 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 14076 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14077 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14078 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14079 | if (0 != status) |
| 14080 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14081 | return status; |
| 14082 | } |
| 14083 | |
| 14084 | /*Retrieve halHandle*/ |
| 14085 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14086 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 14087 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14088 | TRACE_CODE_HDD_CFG80211_DEL_PMKSA, |
| 14089 | pAdapter->sessionId, 0)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14090 | /* Delete the PMKID CSR cache */ |
| 14091 | if (eHAL_STATUS_SUCCESS != |
| 14092 | sme_RoamDelPMKIDfromCache(halHandle, |
| 14093 | pAdapter->sessionId, pmksa->bssid, FALSE)) { |
| 14094 | hddLog(LOGE, FL("Failed to delete PMKSA for "MAC_ADDRESS_STR), |
| 14095 | MAC_ADDR_ARRAY(pmksa->bssid)); |
| 14096 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14097 | } |
| 14098 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14099 | EXIT(); |
| 14100 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14101 | } |
| 14102 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14103 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 14104 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 14105 | struct cfg80211_pmksa *pmksa) |
| 14106 | { |
| 14107 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14108 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 14109 | vos_ssr_protect(__func__); |
| 14110 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 14111 | vos_ssr_unprotect(__func__); |
| 14112 | |
| 14113 | return ret; |
| 14114 | |
| 14115 | } |
| 14116 | |
| 14117 | 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] | 14118 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14119 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14120 | tHalHandle halHandle; |
| 14121 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 14122 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14123 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14124 | ENTER(); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14125 | |
| 14126 | /* Validate pAdapter */ |
| 14127 | if (NULL == pAdapter) |
| 14128 | { |
| 14129 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 14130 | "%s: Invalid Adapter" ,__func__); |
| 14131 | return -EINVAL; |
| 14132 | } |
| 14133 | |
| 14134 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14135 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14136 | if (0 != status) |
| 14137 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14138 | return status; |
| 14139 | } |
| 14140 | |
| 14141 | /*Retrieve halHandle*/ |
| 14142 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14143 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14144 | /* Flush the PMKID cache in CSR */ |
| 14145 | if (eHAL_STATUS_SUCCESS != |
| 14146 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, NULL, TRUE)) { |
| 14147 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Cannot flush PMKIDCache")); |
| 14148 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14149 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14150 | EXIT(); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 14151 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14152 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 14153 | |
| 14154 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 14155 | { |
| 14156 | int ret; |
| 14157 | |
| 14158 | vos_ssr_protect(__func__); |
| 14159 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 14160 | vos_ssr_unprotect(__func__); |
| 14161 | |
| 14162 | return ret; |
| 14163 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14164 | #endif |
| 14165 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14166 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14167 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 14168 | struct net_device *dev, |
| 14169 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14170 | { |
| 14171 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14172 | hdd_station_ctx_t *pHddStaCtx; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14173 | hdd_context_t *pHddCtx; |
| 14174 | int ret = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14175 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14176 | ENTER(); |
| 14177 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14178 | if (NULL == pAdapter) |
| 14179 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14180 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14181 | return -ENODEV; |
| 14182 | } |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14183 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14184 | ret = wlan_hdd_validate_context(pHddCtx); |
| 14185 | if (0 != ret) |
| 14186 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14187 | return ret; |
| 14188 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14189 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14190 | if (NULL == pHddStaCtx) |
| 14191 | { |
| 14192 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: STA Context is NULL", __func__); |
| 14193 | return -EINVAL; |
| 14194 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14195 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14196 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14197 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 14198 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14199 | // Added for debug on reception of Re-assoc Req. |
| 14200 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 14201 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14202 | 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] | 14203 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14204 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14205 | } |
| 14206 | |
| 14207 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14208 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14209 | ftie->ie_len); |
| 14210 | #endif |
| 14211 | |
| 14212 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 14213 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 14214 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14215 | ftie->ie_len); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14216 | |
| 14217 | EXIT(); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14218 | return 0; |
| 14219 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14220 | |
| 14221 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 14222 | struct net_device *dev, |
| 14223 | struct cfg80211_update_ft_ies_params *ftie) |
| 14224 | { |
| 14225 | int ret; |
| 14226 | |
| 14227 | vos_ssr_protect(__func__); |
| 14228 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 14229 | vos_ssr_unprotect(__func__); |
| 14230 | |
| 14231 | return ret; |
| 14232 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14233 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14234 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14235 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 14236 | |
| 14237 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 14238 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 14239 | { |
| 14240 | int ret; |
| 14241 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 14242 | hdd_context_t *pHddCtx; |
| 14243 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14244 | ENTER(); |
| 14245 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14246 | if (NULL == pAdapter) |
| 14247 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 14248 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14249 | "%s: HDD adapter is Null", __func__); |
| 14250 | return ; |
| 14251 | } |
| 14252 | |
| 14253 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14254 | if (NULL == pHddCtx) |
| 14255 | { |
| 14256 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14257 | "%s: HDD context is Null!!!", __func__); |
| 14258 | return ; |
| 14259 | } |
| 14260 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14261 | spin_lock(&pHddCtx->schedScan_lock); |
| 14262 | if (TRUE == pHddCtx->isWiphySuspended) |
| 14263 | { |
| 14264 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 14265 | spin_unlock(&pHddCtx->schedScan_lock); |
| 14266 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14267 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 14268 | return ; |
| 14269 | } |
| 14270 | spin_unlock(&pHddCtx->schedScan_lock); |
| 14271 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14272 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 14273 | |
| 14274 | if (0 > ret) |
| 14275 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 14276 | |
| 14277 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14278 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14279 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14280 | } |
| 14281 | |
| 14282 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14283 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14284 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14285 | */ |
| 14286 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 14287 | { |
| 14288 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 14289 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14290 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14291 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14292 | int status = 0; |
| 14293 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 14294 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14295 | /* The current firmware design does not allow PNO during any |
| 14296 | * active sessions. Hence, determine the active sessions |
| 14297 | * and return a failure. |
| 14298 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14299 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 14300 | { |
| 14301 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14302 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14303 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14304 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 14305 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 14306 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 14307 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 14308 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
Siddharth Bhal | 63a19a7 | 2014-11-07 14:31:56 +0530 | [diff] [blame] | 14309 | || (WLAN_HDD_TM_LEVEL_4 == pHddCtx->tmInfo.currentTmLevel) |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14310 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14311 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14312 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14313 | } |
| 14314 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 14315 | pAdapterNode = pNext; |
| 14316 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14317 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14318 | } |
| 14319 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14320 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 14321 | { |
| 14322 | hdd_adapter_t *pAdapter = callbackContext; |
| 14323 | hdd_context_t *pHddCtx; |
| 14324 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14325 | ENTER(); |
| 14326 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14327 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 14328 | { |
| 14329 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14330 | FL("Invalid adapter or adapter has invalid magic")); |
| 14331 | return; |
| 14332 | } |
| 14333 | |
| 14334 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14335 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 14336 | { |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14337 | return; |
| 14338 | } |
| 14339 | |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 14340 | if (VOS_STATUS_SUCCESS != status) |
| 14341 | { |
| 14342 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14343 | FL("PNO enable response status = %d"), status); |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 14344 | pHddCtx->isPnoEnable = FALSE; |
| 14345 | } |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14346 | |
| 14347 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 14348 | complete(&pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14349 | EXIT(); |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14350 | } |
| 14351 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14352 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14353 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 14354 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14355 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14356 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14357 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 14358 | { |
| 14359 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14360 | tSirPNOScanReq pnoRequest = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14361 | hdd_context_t *pHddCtx; |
| 14362 | tHalHandle hHal; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14363 | v_U32_t i, indx, num_ch, tempInterval, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 14364 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 14365 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14366 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 14367 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14368 | int ret = 0; |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14369 | hdd_config_t *pConfig = NULL; |
| 14370 | v_U32_t num_ignore_dfs_ch = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14371 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14372 | ENTER(); |
| 14373 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14374 | if (NULL == pAdapter) |
| 14375 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14376 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14377 | "%s: HDD adapter is Null", __func__); |
| 14378 | return -ENODEV; |
| 14379 | } |
| 14380 | |
| 14381 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14382 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14383 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14384 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14385 | { |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14386 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14387 | } |
| 14388 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14389 | pConfig = pHddCtx->cfg_ini; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14390 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14391 | if (NULL == hHal) |
| 14392 | { |
| 14393 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14394 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14395 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14396 | } |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 14397 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14398 | TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START, |
| 14399 | pAdapter->sessionId, pAdapter->device_mode)); |
Sushant Kaushik | 2fe8993 | 2014-09-03 10:58:09 +0530 | [diff] [blame] | 14400 | sme_ScanFlushResult(hHal, pAdapter->sessionId); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 14401 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 14402 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 14403 | { |
| 14404 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14405 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 14406 | return -EBUSY; |
| 14407 | } |
| 14408 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14409 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14410 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14411 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14412 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14413 | return -EBUSY; |
| 14414 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14415 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14416 | if (TRUE == pHddCtx->isPnoEnable) |
| 14417 | { |
| 14418 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 14419 | FL("already PNO is enabled")); |
| 14420 | return -EBUSY; |
| 14421 | } |
c_hpothu | 225aa7c | 2014-10-22 17:45:13 +0530 | [diff] [blame] | 14422 | |
| 14423 | if (VOS_STATUS_SUCCESS != wlan_hdd_cancel_remain_on_channel(pHddCtx)) |
| 14424 | { |
| 14425 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14426 | "%s: abort ROC failed ", __func__); |
| 14427 | return -EBUSY; |
| 14428 | } |
| 14429 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14430 | pHddCtx->isPnoEnable = TRUE; |
| 14431 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14432 | pnoRequest.enable = 1; /*Enable PNO */ |
| 14433 | pnoRequest.ucNetworksCount = request->n_match_sets; |
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 | if (( !pnoRequest.ucNetworksCount ) || |
| 14436 | ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14437 | { |
| 14438 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14439 | "%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] | 14440 | __func__, pnoRequest.ucNetworksCount, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14441 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14442 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14443 | goto error; |
| 14444 | } |
| 14445 | |
| 14446 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 14447 | { |
| 14448 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14449 | "%s: Incorrect number of channels %d", |
| 14450 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14451 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14452 | goto error; |
| 14453 | } |
| 14454 | |
| 14455 | /* Framework provides one set of channels(all) |
| 14456 | * common for all saved profile */ |
| 14457 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 14458 | channels_allowed, &num_channels_allowed)) |
| 14459 | { |
| 14460 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14461 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14462 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14463 | goto error; |
| 14464 | } |
| 14465 | /* Checking each channel against allowed channel list */ |
| 14466 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14467 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14468 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14469 | char chList [(request->n_channels*5)+1]; |
| 14470 | int len; |
| 14471 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14472 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14473 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14474 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14475 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 14476 | { |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14477 | if ((!pConfig->enableDFSPnoChnlScan) && |
| 14478 | (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channels_allowed[indx]))) |
| 14479 | { |
| 14480 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14481 | "%s : Dropping DFS channel : %d", |
| 14482 | __func__,channels_allowed[indx]); |
| 14483 | num_ignore_dfs_ch++; |
| 14484 | break; |
| 14485 | } |
| 14486 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14487 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 14488 | len += snprintf(chList+len, 5, "%d ", |
| 14489 | request->channels[i]->hw_value); |
| 14490 | break ; |
| 14491 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14492 | } |
| 14493 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14494 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14495 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14496 | /*If all channels are DFS and dropped, then ignore the PNO request*/ |
| 14497 | if (num_ignore_dfs_ch == request->n_channels) |
| 14498 | { |
| 14499 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14500 | "%s : All requested channels are DFS channels", __func__); |
| 14501 | ret = -EINVAL; |
| 14502 | goto error; |
| 14503 | } |
| 14504 | } |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14505 | |
| 14506 | pnoRequest.aNetworks = |
| 14507 | vos_mem_malloc(sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14508 | if (pnoRequest.aNetworks == NULL) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14509 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14510 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14511 | FL("failed to allocate memory aNetworks %u"), |
| 14512 | (uint32)sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14513 | goto error; |
| 14514 | } |
| 14515 | vos_mem_zero(pnoRequest.aNetworks, |
| 14516 | sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14517 | |
| 14518 | /* Filling per profile params */ |
| 14519 | for (i = 0; i < pnoRequest.ucNetworksCount; i++) |
| 14520 | { |
| 14521 | pnoRequest.aNetworks[i].ssId.length = |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14522 | request->match_sets[i].ssid.ssid_len; |
| 14523 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14524 | if (( 0 == pnoRequest.aNetworks[i].ssId.length ) || |
| 14525 | ( pnoRequest.aNetworks[i].ssId.length > 32 ) ) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14526 | { |
| 14527 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14528 | "%s: SSID Len %d is not correct for network %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14529 | __func__, pnoRequest.aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14530 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14531 | goto error; |
| 14532 | } |
| 14533 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14534 | memcpy(pnoRequest.aNetworks[i].ssId.ssId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14535 | request->match_sets[i].ssid.ssid, |
| 14536 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14537 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14538 | "%s: SSID of network %d is %s ", __func__, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14539 | i, pnoRequest.aNetworks[i].ssId.ssId); |
| 14540 | pnoRequest.aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 14541 | pnoRequest.aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 14542 | pnoRequest.aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14543 | |
| 14544 | /*Copying list of valid channel into request */ |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14545 | memcpy(pnoRequest.aNetworks[i].aChannels, valid_ch, num_ch); |
| 14546 | pnoRequest.aNetworks[i].ucChannelCount = num_ch; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14547 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14548 | pnoRequest.aNetworks[i].rssiThreshold = 0; //Default value |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14549 | } |
| 14550 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14551 | for (i = 0; i < request->n_ssids; i++) |
| 14552 | { |
| 14553 | j = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14554 | while (j < pnoRequest.ucNetworksCount) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14555 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14556 | if ((pnoRequest.aNetworks[j].ssId.length == |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14557 | request->ssids[i].ssid_len) && |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14558 | (0 == memcmp(pnoRequest.aNetworks[j].ssId.ssId, |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14559 | request->ssids[i].ssid, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14560 | pnoRequest.aNetworks[j].ssId.length))) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14561 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14562 | pnoRequest.aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14563 | break; |
| 14564 | } |
| 14565 | j++; |
| 14566 | } |
| 14567 | } |
| 14568 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14569 | "Number of hidden networks being Configured = %d", |
| 14570 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14571 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 14572 | "request->ie_len = %zu", request->ie_len); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14573 | |
| 14574 | pnoRequest.p24GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 14575 | if (pnoRequest.p24GProbeTemplate == NULL) |
| 14576 | { |
| 14577 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14578 | FL("failed to allocate memory p24GProbeTemplate %u"), |
| 14579 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 14580 | goto error; |
| 14581 | } |
| 14582 | |
| 14583 | pnoRequest.p5GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 14584 | if (pnoRequest.p5GProbeTemplate == NULL) |
| 14585 | { |
| 14586 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14587 | FL("failed to allocate memory p5GProbeTemplate %u"), |
| 14588 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 14589 | goto error; |
| 14590 | } |
| 14591 | |
| 14592 | vos_mem_zero(pnoRequest.p24GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 14593 | vos_mem_zero(pnoRequest.p5GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 14594 | |
Hanumantha Reddy Pothula | 06e87b2 | 2015-03-02 18:02:23 +0530 | [diff] [blame] | 14595 | if ((0 < request->ie_len) && (request->ie_len <= SIR_PNO_MAX_PB_REQ_SIZE) && |
| 14596 | (NULL != request->ie)) |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14597 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14598 | pnoRequest.us24GProbeTemplateLen = request->ie_len; |
| 14599 | memcpy(pnoRequest.p24GProbeTemplate, request->ie, |
| 14600 | pnoRequest.us24GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14601 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14602 | pnoRequest.us5GProbeTemplateLen = request->ie_len; |
| 14603 | memcpy(pnoRequest.p5GProbeTemplate, request->ie, |
| 14604 | pnoRequest.us5GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14605 | } |
| 14606 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14607 | /* Driver gets only one time interval which is hardcoded in |
| 14608 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 14609 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 14610 | * 80,160,320 secs. And number of scan cycle for each timer |
| 14611 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 14612 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 14613 | * will be repeated after each interval specified by supplicant |
| 14614 | * till PNO is disabled. |
| 14615 | */ |
| 14616 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14617 | pnoRequest.scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14618 | else |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14619 | pnoRequest.scanTimers.ucScanTimersCount = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14620 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 14621 | |
| 14622 | tempInterval = (request->interval)/1000; |
| 14623 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14624 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 14625 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14626 | for ( i = 0; i < pnoRequest.scanTimers.ucScanTimersCount; i++) |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14627 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14628 | pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14629 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14630 | pnoRequest.scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14631 | tempInterval *= 2; |
| 14632 | } |
| 14633 | //Repeat last timer until pno disabled. |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14634 | pnoRequest.scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14635 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14636 | pnoRequest.modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14637 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14638 | INIT_COMPLETION(pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14639 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 14640 | pnoRequest.callbackContext = pAdapter; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14641 | pAdapter->pno_req_status = 0; |
| 14642 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14643 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14644 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14645 | pAdapter->sessionId, pnoRequest.enable, pnoRequest.modePNO, |
| 14646 | pnoRequest.scanTimers.ucScanTimersCount); |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14647 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14648 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14649 | &pnoRequest, pAdapter->sessionId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14650 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 14651 | if (eHAL_STATUS_SUCCESS != status) |
| 14652 | { |
| 14653 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14654 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14655 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14656 | goto error; |
| 14657 | } |
| 14658 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14659 | ret = wait_for_completion_timeout( |
| 14660 | &pAdapter->pno_comp_var, |
| 14661 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 14662 | if (0 >= ret) |
| 14663 | { |
| 14664 | // Did not receive the response for PNO enable in time. |
| 14665 | // Assuming the PNO enable was success. |
| 14666 | // Returning error from here, because we timeout, results |
| 14667 | // in side effect of Wifi (Wifi Setting) not to work. |
| 14668 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14669 | FL("Timed out waiting for PNO to be Enabled")); |
| 14670 | ret = 0; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14671 | } |
| 14672 | |
| 14673 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14674 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14675 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14676 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14677 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14678 | FL("PNO scanRequest offloaded ret = %d"), ret); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14679 | pHddCtx->isPnoEnable = FALSE; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14680 | if (pnoRequest.aNetworks) |
| 14681 | vos_mem_free(pnoRequest.aNetworks); |
| 14682 | if (pnoRequest.p24GProbeTemplate) |
| 14683 | vos_mem_free(pnoRequest.p24GProbeTemplate); |
| 14684 | if (pnoRequest.p5GProbeTemplate) |
| 14685 | vos_mem_free(pnoRequest.p5GProbeTemplate); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14686 | |
| 14687 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14688 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14689 | } |
| 14690 | |
| 14691 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14692 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 14693 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14694 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14695 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 14696 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 14697 | { |
| 14698 | int ret; |
| 14699 | |
| 14700 | vos_ssr_protect(__func__); |
| 14701 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 14702 | vos_ssr_unprotect(__func__); |
| 14703 | |
| 14704 | return ret; |
| 14705 | } |
| 14706 | |
| 14707 | /* |
| 14708 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 14709 | * Function to disable PNO |
| 14710 | */ |
| 14711 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14712 | struct net_device *dev) |
| 14713 | { |
| 14714 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14715 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14716 | hdd_context_t *pHddCtx; |
| 14717 | tHalHandle hHal; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14718 | tSirPNOScanReq pnoRequest = {0}; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14719 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14720 | |
| 14721 | ENTER(); |
| 14722 | |
| 14723 | if (NULL == pAdapter) |
| 14724 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14725 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14726 | "%s: HDD adapter is Null", __func__); |
| 14727 | return -ENODEV; |
| 14728 | } |
| 14729 | |
| 14730 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14731 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14732 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14733 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14734 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14735 | "%s: HDD context is Null", __func__); |
| 14736 | return -ENODEV; |
| 14737 | } |
| 14738 | |
| 14739 | /* The return 0 is intentional when isLogpInProgress and |
| 14740 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 14741 | * failure in sched_scan_stop , especially for a case where the unload |
| 14742 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 14743 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 14744 | * success. If it returns a failure , then its next invocation due to the |
| 14745 | * clean up of the second interface will have the dev pointer corresponding |
| 14746 | * to the first one leading to a crash. |
| 14747 | */ |
| 14748 | if (pHddCtx->isLogpInProgress) |
| 14749 | { |
| 14750 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14751 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14752 | return ret; |
| 14753 | } |
| 14754 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 14755 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14756 | { |
| 14757 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14758 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14759 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14760 | } |
| 14761 | |
| 14762 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14763 | if (NULL == hHal) |
| 14764 | { |
| 14765 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14766 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14767 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14768 | } |
| 14769 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14770 | pnoRequest.enable = 0; /* Disable PNO */ |
| 14771 | pnoRequest.ucNetworksCount = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14772 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 14773 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14774 | TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP, |
| 14775 | pAdapter->sessionId, pAdapter->device_mode)); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14776 | status = sme_SetPreferredNetworkList(hHal, &pnoRequest, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14777 | pAdapter->sessionId, |
| 14778 | NULL, pAdapter); |
| 14779 | if (eHAL_STATUS_SUCCESS != status) |
| 14780 | { |
| 14781 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14782 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14783 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14784 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14785 | } |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14786 | pHddCtx->isPnoEnable = FALSE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14787 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14788 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14789 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14790 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14791 | |
| 14792 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14793 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14794 | } |
| 14795 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14796 | /* |
| 14797 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 14798 | * NL interface to disable PNO |
| 14799 | */ |
| 14800 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 14801 | struct net_device *dev) |
| 14802 | { |
| 14803 | int ret; |
| 14804 | |
| 14805 | vos_ssr_protect(__func__); |
| 14806 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 14807 | vos_ssr_unprotect(__func__); |
| 14808 | |
| 14809 | return ret; |
| 14810 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14811 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 14812 | |
| 14813 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14814 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14815 | #if TDLS_MGMT_VERSION2 |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14816 | 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] | 14817 | u8 *peer, u8 action_code, u8 dialog_token, |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14818 | u16 status_code, u32 peer_capability, const u8 *buf, size_t len) |
| 14819 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14820 | 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] | 14821 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14822 | u16 status_code, const u8 *buf, size_t len) |
| 14823 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14824 | { |
| 14825 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14826 | hdd_adapter_t *pAdapter; |
| 14827 | hdd_context_t *pHddCtx; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14828 | u8 peerMac[6]; |
| 14829 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14830 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14831 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14832 | long rc; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14833 | int ret; |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14834 | #if !(TDLS_MGMT_VERSION2) |
| 14835 | u32 peer_capability = 0; |
| 14836 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14837 | tANI_U16 numCurrTdlsPeers; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14838 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14839 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14840 | if (NULL == pAdapter) |
| 14841 | { |
| 14842 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14843 | "%s: Adapter is NULL",__func__); |
| 14844 | return -EINVAL; |
| 14845 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14846 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14847 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 14848 | pAdapter->sessionId, action_code)); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14849 | pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14850 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14851 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14852 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14853 | "Invalid arguments"); |
| 14854 | return -EINVAL; |
| 14855 | } |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14856 | if (pHddCtx->isLogpInProgress) |
| 14857 | { |
| 14858 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14859 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14860 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 14861 | peer, |
| 14862 | eTDLS_LINK_IDLE, |
| 14863 | eTDLS_LINK_UNSPECIFIED); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14864 | return -EBUSY; |
| 14865 | } |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14866 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
| 14867 | { |
| 14868 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14869 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14870 | return -EAGAIN; |
| 14871 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14872 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14873 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14874 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14875 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 14876 | MAC_ADDRESS_STR " action %d declined.", |
| 14877 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14878 | return -ENOTSUPP; |
| 14879 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14880 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14881 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 14882 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 14883 | { |
| 14884 | /* if tdls_mode is disabled to respond to peer's request */ |
| 14885 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 14886 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14887 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14888 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14889 | " TDLS mode is disabled. action %d declined.", |
| 14890 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14891 | |
| 14892 | return -ENOTSUPP; |
| 14893 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 14894 | |
| 14895 | if (vos_max_concurrent_connections_reached()) |
| 14896 | { |
| 14897 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 14898 | return -EINVAL; |
| 14899 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14900 | } |
| 14901 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14902 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 14903 | { |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 14904 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14905 | { |
| 14906 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14907 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14908 | " TDLS setup is ongoing. action %d declined.", |
| 14909 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 14910 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14911 | } |
| 14912 | } |
| 14913 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14914 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 14915 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14916 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14917 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 14918 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14919 | { |
| 14920 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 14921 | we return error code at 'add_station()'. Hence we have this |
| 14922 | check again in addtion to add_station(). |
| 14923 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14924 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14925 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14926 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14927 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14928 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 14929 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 14930 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 14931 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14932 | } |
| 14933 | else |
| 14934 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14935 | /* maximum reached. tweak to send error code to peer and return |
| 14936 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14937 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14938 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14939 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14940 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 14941 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 14942 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14943 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14944 | /* fall through to send setup resp with failure status |
| 14945 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14946 | } |
| 14947 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14948 | else |
| 14949 | { |
| 14950 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14951 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 14952 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14953 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14954 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14955 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 14956 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14957 | return -EPERM; |
| 14958 | } |
| 14959 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14960 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14961 | vos_mem_copy(peerMac, peer, 6); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14962 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14963 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 14964 | "%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] | 14965 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 14966 | action_code, dialog_token, status_code, len); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14967 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14968 | /*Except teardown responder will not be used so just make 0*/ |
| 14969 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14970 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14971 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14972 | |
| 14973 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14974 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14975 | |
| 14976 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 14977 | responder = pTdlsPeer->is_responder; |
| 14978 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14979 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14980 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 14981 | "%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] | 14982 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 14983 | dialog_token, status_code, len); |
| 14984 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14985 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14986 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14987 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14988 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 14989 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14990 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14991 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 14992 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14993 | { |
| 14994 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 14995 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14996 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14997 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14998 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 14999 | if (status != VOS_STATUS_SUCCESS) { |
| 15000 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
| 15001 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15002 | } |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15003 | if (SIR_MAC_TDLS_DIS_REQ != action_code) { |
| 15004 | if (0 != wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED)) { |
| 15005 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS capabilities")); |
| 15006 | } |
| 15007 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15008 | } |
| 15009 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15010 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 15011 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 15012 | { |
| 15013 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 15014 | "%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] | 15015 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 15016 | ret = -EBUSY; |
| 15017 | goto tx_failed; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15018 | } |
| 15019 | |
| 15020 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15021 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 15022 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15023 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 15024 | 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] | 15025 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15026 | if (VOS_STATUS_SUCCESS != status) |
| 15027 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15028 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15029 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15030 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 15031 | ret = -EINVAL; |
| 15032 | goto tx_failed; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15033 | } |
| 15034 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 15035 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 15036 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 15037 | |
| 15038 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15039 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 15040 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 15041 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 15042 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15043 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 15044 | |
| 15045 | if (pHddCtx->isLogpInProgress) |
| 15046 | { |
| 15047 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15048 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 15049 | return -EAGAIN; |
| 15050 | } |
| 15051 | |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 15052 | ret = -EINVAL; |
| 15053 | goto tx_failed; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15054 | } |
| 15055 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 15056 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15057 | { |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 15058 | ret = max_sta_failed; |
| 15059 | goto tx_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15060 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15061 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 15062 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 15063 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15064 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE)) { |
| 15065 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 15066 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 15067 | } |
| 15068 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 15069 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15070 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE)) { |
| 15071 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 15072 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 15073 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15074 | |
| 15075 | return 0; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 15076 | |
| 15077 | tx_failed: |
| 15078 | /* add_station will be called before sending TDLS_SETUP_REQ and |
| 15079 | * TDLS_SETUP_RSP and as part of add_station driver will enable |
| 15080 | * BMPS. NL80211_TDLS_DISABLE_LINK will be called if the tx of |
| 15081 | * TDLS_SETUP_REQ or TDLS_SETUP_RSP fails. BMPS will be enabled |
| 15082 | * as part of processing NL80211_TDLS_DISABLE_LINK. So need to |
| 15083 | * enable BMPS for TDLS_SETUP_REQ and TDLS_SETUP_RSP if tx fails. |
| 15084 | */ |
| 15085 | |
| 15086 | if ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 15087 | (SIR_MAC_TDLS_SETUP_RSP == action_code)) |
| 15088 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 15089 | return ret; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15090 | } |
| 15091 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15092 | #if TDLS_MGMT_VERSION2 |
| 15093 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 15094 | u8 *peer, u8 action_code, u8 dialog_token, |
| 15095 | u16 status_code, u32 peer_capability, |
| 15096 | const u8 *buf, size_t len) |
| 15097 | #else |
| 15098 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 15099 | u8 *peer, u8 action_code, u8 dialog_token, |
| 15100 | u16 status_code, const u8 *buf, size_t len) |
| 15101 | #endif |
| 15102 | { |
| 15103 | int ret; |
| 15104 | |
| 15105 | vos_ssr_protect(__func__); |
| 15106 | #if TDLS_MGMT_VERSION2 |
| 15107 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token, |
| 15108 | status_code, peer_capability, buf, len); |
| 15109 | #else |
| 15110 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token, |
| 15111 | status_code, buf, len); |
| 15112 | #endif |
| 15113 | vos_ssr_unprotect(__func__); |
| 15114 | |
| 15115 | return ret; |
| 15116 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15117 | |
| 15118 | int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter, |
| 15119 | u8 *peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15120 | tdls_req_params_t *tdls_peer_params, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15121 | cfg80211_exttdls_callback callback) |
| 15122 | { |
| 15123 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15124 | hddTdlsPeer_t *pTdlsPeer = NULL; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15125 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15126 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15127 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15128 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 15129 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15130 | |
| 15131 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 15132 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 15133 | |
| 15134 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15135 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 15136 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 15137 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15138 | return -ENOTSUPP; |
| 15139 | } |
| 15140 | |
| 15141 | /* To cater the requirement of establishing the TDLS link |
| 15142 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 15143 | */ |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 15144 | mutex_lock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15145 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 15146 | if (pTdlsPeer == NULL) { |
| 15147 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15148 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 15149 | __func__, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 15150 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15151 | return -EINVAL; |
| 15152 | } |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 15153 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15154 | |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 15155 | /* check FW TDLS Off Channel capability */ |
| 15156 | if ((TRUE == sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)) && |
Pradeep Reddy POTTETI | 0cb99bc | 2015-06-08 12:59:09 +0530 | [diff] [blame] | 15157 | (TRUE == pHddCtx->cfg_ini->fEnableTDLSOffChannel) && |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 15158 | (NULL != tdls_peer_params)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15159 | { |
| 15160 | pTdlsPeer->peerParams.channel = tdls_peer_params->channel; |
| 15161 | pTdlsPeer->peerParams.global_operating_class = |
| 15162 | tdls_peer_params->global_operating_class; |
| 15163 | pTdlsPeer->peerParams.max_latency_ms = tdls_peer_params->max_latency_ms; |
| 15164 | pTdlsPeer->peerParams.min_bandwidth_kbps = |
| 15165 | tdls_peer_params->min_bandwidth_kbps; |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15166 | /* check configured channel is valid, non dfs and |
| 15167 | * not current operating channel */ |
| 15168 | if ((sme_IsTdlsOffChannelValid(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15169 | tdls_peer_params->channel)) && |
| 15170 | (pHddStaCtx) && |
| 15171 | (tdls_peer_params->channel != |
| 15172 | pHddStaCtx->conn_info.operationChannel)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15173 | { |
| 15174 | pTdlsPeer->isOffChannelConfigured = TRUE; |
| 15175 | } |
| 15176 | else |
| 15177 | { |
| 15178 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 15179 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15180 | "%s: Configured Tdls Off Channel is not valid", __func__); |
| 15181 | |
| 15182 | } |
| 15183 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15184 | "%s: tdls_off_channel %d isOffChannelConfigured %d " |
| 15185 | "current operating channel %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15186 | __func__, pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15187 | pTdlsPeer->isOffChannelConfigured, |
| 15188 | (pHddStaCtx ? pHddStaCtx->conn_info.operationChannel : 0)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15189 | } |
| 15190 | else |
| 15191 | { |
| 15192 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pradeep Reddy POTTETI | 0cb99bc | 2015-06-08 12:59:09 +0530 | [diff] [blame] | 15193 | "%s: TDLS off channel FW capability %d, " |
| 15194 | "host capab %d or Invalid TDLS Peer Params", __func__, |
| 15195 | sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL), |
| 15196 | pHddCtx->cfg_ini->fEnableTDLSOffChannel); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15197 | } |
| 15198 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15199 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 15200 | |
| 15201 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15202 | " %s TDLS Add Force Peer Failed", |
| 15203 | __func__); |
| 15204 | return -EINVAL; |
| 15205 | } |
| 15206 | /*EXT TDLS*/ |
| 15207 | |
| 15208 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) { |
| 15209 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15210 | " %s TDLS set callback Failed", |
| 15211 | __func__); |
| 15212 | return -EINVAL; |
| 15213 | } |
| 15214 | |
| 15215 | return(0); |
| 15216 | |
| 15217 | } |
| 15218 | |
| 15219 | int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, u8 *peer) |
| 15220 | { |
| 15221 | |
| 15222 | hddTdlsPeer_t *pTdlsPeer; |
| 15223 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15224 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15225 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 15226 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15227 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 15228 | if (0 != wlan_hdd_validate_context(pHddCtx)) { |
| 15229 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is NULL")); |
| 15230 | return -EINVAL; |
| 15231 | } |
| 15232 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15233 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 15234 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 15235 | |
| 15236 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15237 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 15238 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 15239 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15240 | return -ENOTSUPP; |
| 15241 | } |
| 15242 | |
| 15243 | |
| 15244 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 15245 | |
| 15246 | if ( NULL == pTdlsPeer ) { |
| 15247 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15248 | " peer not existing", |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15249 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15250 | return -EINVAL; |
| 15251 | } |
| 15252 | else { |
| 15253 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 15254 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15255 | /* if channel switch is configured, reset |
| 15256 | the channel for this peer */ |
| 15257 | if (TRUE == pTdlsPeer->isOffChannelConfigured) |
| 15258 | { |
| 15259 | pTdlsPeer->peerParams.channel = 0; |
| 15260 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 15261 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15262 | } |
| 15263 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15264 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) { |
| 15265 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set force peer")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15266 | return -EINVAL; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15267 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15268 | |
| 15269 | /*EXT TDLS*/ |
| 15270 | |
| 15271 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) { |
| 15272 | |
| 15273 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15274 | " %s TDLS set callback Failed", |
| 15275 | __func__); |
| 15276 | return -EINVAL; |
| 15277 | } |
| 15278 | return(0); |
| 15279 | |
| 15280 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15281 | 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] | 15282 | u8 *peer, enum nl80211_tdls_operation oper) |
| 15283 | { |
| 15284 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15285 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15286 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15287 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15288 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15289 | ENTER(); |
| 15290 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 15291 | if (!pAdapter) { |
| 15292 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 15293 | return -EINVAL; |
| 15294 | } |
| 15295 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15296 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15297 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 15298 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15299 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15300 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15301 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 15302 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15303 | return -EINVAL; |
| 15304 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15305 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15306 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15307 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 15308 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15309 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 15310 | } |
| 15311 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15312 | |
| 15313 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15314 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15315 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15316 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15317 | "TDLS Disabled in INI (%d) OR not enabled in FW (%d) " |
| 15318 | "Cannot process TDLS commands", |
| 15319 | pHddCtx->cfg_ini->fEnableTDLSSupport, |
| 15320 | sme_IsFeatureSupportedByFW(TDLS)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15321 | return -ENOTSUPP; |
| 15322 | } |
| 15323 | |
| 15324 | switch (oper) { |
| 15325 | case NL80211_TDLS_ENABLE_LINK: |
| 15326 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15327 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15328 | long ret; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15329 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15330 | WLAN_STADescType staDesc; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15331 | tANI_U16 numCurrTdlsPeers = 0; |
| 15332 | hddTdlsPeer_t *connPeer = NULL; |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15333 | tANI_U8 suppChannelLen = 0; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15334 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15335 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15336 | " %s : NL80211_TDLS_ENABLE_LINK for " MAC_ADDRESS_STR, |
| 15337 | __func__, MAC_ADDR_ARRAY(peer)); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15338 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15339 | memset(&staDesc, 0, sizeof(staDesc)); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15340 | if ( NULL == pTdlsPeer ) { |
| 15341 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 15342 | " (oper %d) not exsting. ignored", |
| 15343 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 15344 | return -EINVAL; |
| 15345 | } |
| 15346 | |
| 15347 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15348 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 15349 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 15350 | "NL80211_TDLS_ENABLE_LINK"); |
| 15351 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 15352 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 15353 | { |
| 15354 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 15355 | MAC_ADDRESS_STR " failed", |
| 15356 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 15357 | return -EINVAL; |
| 15358 | } |
| 15359 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 15360 | /* before starting tdls connection, set tdls |
| 15361 | * off channel established status to default value */ |
| 15362 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15363 | /* TDLS Off Channel, Disable tdls channel switch, |
| 15364 | when there are more than one tdls link */ |
| 15365 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 15366 | if (numCurrTdlsPeers == 2) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15367 | { |
| 15368 | /* get connected peer and send disable tdls off chan */ |
| 15369 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15370 | if ((connPeer) && |
| 15371 | (connPeer->isOffChannelSupported == TRUE) && |
| 15372 | (connPeer->isOffChannelConfigured == TRUE)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15373 | { |
| 15374 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15375 | "%s: More then one peer connected, Disable " |
| 15376 | "TDLS channel switch", __func__); |
| 15377 | |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15378 | connPeer->isOffChannelEstablished = FALSE; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15379 | ret = sme_SendTdlsChanSwitchReq( |
| 15380 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15381 | pAdapter->sessionId, |
| 15382 | connPeer->peerMac, |
| 15383 | connPeer->peerParams.channel, |
| 15384 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15385 | TDLS_CHANNEL_SWITCH_DISABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15386 | if (ret != VOS_STATUS_SUCCESS) { |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15387 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15388 | FL("Failed to send TDLS switch channel request")); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15389 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15390 | } |
| 15391 | else |
| 15392 | { |
| 15393 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15394 | "%s: No TDLS Connected Peer or " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15395 | "isOffChannelSupported %d " |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15396 | "isOffChannelConfigured %d", |
| 15397 | __func__, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15398 | (connPeer ? (connPeer->isOffChannelSupported) |
| 15399 | : -1), |
| 15400 | (connPeer ? (connPeer->isOffChannelConfigured) |
| 15401 | : -1)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15402 | } |
| 15403 | } |
| 15404 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15405 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15406 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15407 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 15408 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15409 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 15410 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15411 | 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] | 15412 | return -EINVAL; |
| 15413 | } |
| 15414 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15415 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15416 | ret = sme_SendTdlsLinkEstablishParams( |
| 15417 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15418 | pAdapter->sessionId, peer, |
| 15419 | &tdlsLinkEstablishParams); |
| 15420 | if (ret != VOS_STATUS_SUCCESS) { |
| 15421 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send link establishment params")); |
| 15422 | } |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15423 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 15424 | * register with the TL on after the response for this operation |
| 15425 | * is received . |
| 15426 | */ |
| 15427 | ret = wait_for_completion_interruptible_timeout( |
| 15428 | &pAdapter->tdls_link_establish_req_comp, |
| 15429 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 15430 | if (ret <= 0) |
| 15431 | { |
| 15432 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15433 | FL("Link Establish Request Failed Status %ld"), |
| 15434 | ret); |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15435 | return -EINVAL; |
| 15436 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15437 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15438 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 15439 | eTDLS_LINK_CONNECTED, |
| 15440 | eTDLS_LINK_SUCCESS); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15441 | staDesc.ucSTAId = pTdlsPeer->staId; |
| 15442 | staDesc.ucQosEnabled = tdlsLinkEstablishParams.qos; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15443 | ret = WLANTL_UpdateTdlsSTAClient( |
| 15444 | pHddCtx->pvosContext, |
| 15445 | &staDesc); |
| 15446 | if (ret != VOS_STATUS_SUCCESS) { |
| 15447 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to update TDLS STA params")); |
| 15448 | } |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15449 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 15450 | /* Mark TDLS client Authenticated .*/ |
| 15451 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 15452 | pTdlsPeer->staId, |
| 15453 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 15454 | if (VOS_STATUS_SUCCESS == status) |
| 15455 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15456 | if (pTdlsPeer->is_responder == 0) |
| 15457 | { |
| 15458 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 15459 | |
| 15460 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 15461 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 15462 | WAIT_TIME_TDLS_INITIATOR); |
| 15463 | /* suspend initiator TX until it receives direct packet from the |
| 15464 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15465 | ret = WLANTL_SuspendDataTx( |
| 15466 | (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 15467 | &staId, NULL); |
| 15468 | if (ret != VOS_STATUS_SUCCESS) { |
| 15469 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to suspend data tx")); |
| 15470 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15471 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15472 | |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15473 | if ((TRUE == pTdlsPeer->isOffChannelSupported) && |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15474 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15475 | { |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15476 | suppChannelLen = |
| 15477 | tdlsLinkEstablishParams.supportedChannelsLen; |
| 15478 | |
| 15479 | if ((suppChannelLen > 0) && |
| 15480 | (suppChannelLen <= SIR_MAC_MAX_SUPP_CHANNELS)) |
| 15481 | { |
| 15482 | tANI_U8 suppPeerChannel = 0; |
| 15483 | int i = 0; |
| 15484 | for (i = 0U; i < suppChannelLen; i++) |
| 15485 | { |
| 15486 | suppPeerChannel = |
| 15487 | tdlsLinkEstablishParams.supportedChannels[i]; |
| 15488 | |
| 15489 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 15490 | if (suppPeerChannel == |
| 15491 | pTdlsPeer->peerParams.channel) |
| 15492 | { |
| 15493 | pTdlsPeer->isOffChannelSupported = TRUE; |
| 15494 | break; |
| 15495 | } |
| 15496 | } |
| 15497 | } |
| 15498 | else |
| 15499 | { |
| 15500 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 15501 | } |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15502 | } |
| 15503 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15504 | "%s: TDLS channel switch request for channel " |
| 15505 | "%d isOffChannelConfigured %d suppChannelLen " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15506 | "%d isOffChannelSupported %d", __func__, |
| 15507 | pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15508 | pTdlsPeer->isOffChannelConfigured, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15509 | suppChannelLen, |
| 15510 | pTdlsPeer->isOffChannelSupported); |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15511 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15512 | /* TDLS Off Channel, Enable tdls channel switch, |
| 15513 | when their is only one tdls link and it supports */ |
| 15514 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15515 | if ((numCurrTdlsPeers == 1) && |
| 15516 | (TRUE == pTdlsPeer->isOffChannelSupported) && |
| 15517 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
| 15518 | { |
| 15519 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15520 | "%s: Send TDLS channel switch request for channel %d", |
| 15521 | __func__, pTdlsPeer->peerParams.channel); |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15522 | |
| 15523 | pTdlsPeer->isOffChannelEstablished = TRUE; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15524 | ret = sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15525 | pAdapter->sessionId, |
| 15526 | pTdlsPeer->peerMac, |
| 15527 | pTdlsPeer->peerParams.channel, |
| 15528 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15529 | TDLS_CHANNEL_SWITCH_ENABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15530 | if (ret != VOS_STATUS_SUCCESS) { |
| 15531 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS offchannel: Failed to send TDLS switch channel req")); |
| 15532 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15533 | } |
| 15534 | else |
| 15535 | { |
| 15536 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15537 | "%s: TDLS channel switch request not sent" |
| 15538 | " numCurrTdlsPeers %d " |
| 15539 | "isOffChannelSupported %d " |
| 15540 | "isOffChannelConfigured %d", |
| 15541 | __func__, numCurrTdlsPeers, |
| 15542 | pTdlsPeer->isOffChannelSupported, |
| 15543 | pTdlsPeer->isOffChannelConfigured); |
| 15544 | } |
| 15545 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 15546 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15547 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15548 | |
| 15549 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15550 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 15551 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15552 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15553 | int ac; |
| 15554 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 15555 | WLANTL_AC_VI, |
| 15556 | WLANTL_AC_BK, |
| 15557 | WLANTL_AC_BE }; |
| 15558 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 15559 | for(ac=0; ac < 4; ac++) |
| 15560 | { |
| 15561 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 15562 | pTdlsPeer->staId, ucAc[ac], |
| 15563 | tlTid[ac], tlTid[ac], 0, 0, |
| 15564 | WLANTL_BI_DIR ); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15565 | if (status != VOS_STATUS_SUCCESS) { |
| 15566 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to enable UAPSD for AC")); |
| 15567 | } |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15568 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15569 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15570 | } |
| 15571 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15572 | } |
| 15573 | break; |
| 15574 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15575 | { |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15576 | tANI_U16 numCurrTdlsPeers = 0; |
| 15577 | hddTdlsPeer_t *connPeer = NULL; |
| 15578 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15579 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15580 | " %s : NL80211_TDLS_DISABLE_LINK for " MAC_ADDRESS_STR, |
| 15581 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15582 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15583 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 15584 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15585 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15586 | if ( NULL == pTdlsPeer ) { |
| 15587 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 15588 | " (oper %d) not exsting. ignored", |
| 15589 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 15590 | return -EINVAL; |
| 15591 | } |
| 15592 | |
| 15593 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15594 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 15595 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 15596 | "NL80211_TDLS_DISABLE_LINK"); |
| 15597 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15598 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15599 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15600 | long status; |
| 15601 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 15602 | /* set tdls off channel status to false for this peer */ |
| 15603 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 15604 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 15605 | eTDLS_LINK_TEARING, |
| 15606 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 15607 | eTDLS_LINK_UNSPECIFIED: |
| 15608 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15609 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 15610 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15611 | status = sme_DeleteTdlsPeerSta( |
| 15612 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15613 | pAdapter->sessionId, peer ); |
| 15614 | if (status != VOS_STATUS_SUCCESS) { |
| 15615 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 15616 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15617 | |
| 15618 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 15619 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 15620 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
Atul Mittal | 454664b | 2014-10-10 11:03:46 +0530 | [diff] [blame] | 15621 | eTDLS_LINK_IDLE, |
| 15622 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15623 | if (status <= 0) |
| 15624 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15625 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15626 | "%s: Del station failed status %ld", |
| 15627 | __func__, status); |
| 15628 | return -EPERM; |
| 15629 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15630 | |
| 15631 | /* TDLS Off Channel, Enable tdls channel switch, |
| 15632 | when their is only one tdls link and it supports */ |
| 15633 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15634 | if (numCurrTdlsPeers == 1) |
| 15635 | { |
| 15636 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
| 15637 | if ((connPeer) && |
| 15638 | (connPeer->isOffChannelSupported == TRUE) && |
| 15639 | (connPeer->isOffChannelConfigured == TRUE)) |
| 15640 | { |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15641 | connPeer->isOffChannelEstablished = TRUE; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15642 | status = sme_SendTdlsChanSwitchReq( |
| 15643 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15644 | pAdapter->sessionId, |
| 15645 | connPeer->peerMac, |
| 15646 | connPeer->peerParams.channel, |
| 15647 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15648 | TDLS_CHANNEL_SWITCH_ENABLE); |
| 15649 | if (status != VOS_STATUS_SUCCESS) { |
| 15650 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel req")); |
| 15651 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15652 | } |
| 15653 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15654 | "%s: TDLS channel switch " |
| 15655 | "isOffChannelSupported %d " |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15656 | "isOffChannelConfigured %d " |
| 15657 | "isOffChannelEstablished %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15658 | __func__, |
| 15659 | (connPeer ? connPeer->isOffChannelSupported : -1), |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15660 | (connPeer ? connPeer->isOffChannelConfigured : -1), |
| 15661 | (connPeer ? connPeer->isOffChannelEstablished : -1)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15662 | } |
| 15663 | else |
| 15664 | { |
| 15665 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15666 | "%s: TDLS channel switch request not sent " |
| 15667 | "numCurrTdlsPeers %d ", |
| 15668 | __func__, numCurrTdlsPeers); |
| 15669 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15670 | } |
| 15671 | else |
| 15672 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15673 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15674 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15675 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15676 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15677 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15678 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15679 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15680 | status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15681 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15682 | if (0 != status) |
| 15683 | { |
| 15684 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15685 | FL("Error in TDLS Teardown")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15686 | return status; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15687 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15688 | break; |
| 15689 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15690 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15691 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15692 | status = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 15693 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15694 | NULL, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15695 | NULL); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15696 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15697 | if (0 != status) |
| 15698 | { |
| 15699 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15700 | FL("Error in TDLS Setup")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15701 | return status; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 15702 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 15703 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15704 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15705 | case NL80211_TDLS_DISCOVERY_REQ: |
| 15706 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15707 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15708 | "%s: Driver doesn't support in-driver setup/teardown/discovery " |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15709 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15710 | return -ENOTSUPP; |
| 15711 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15712 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15713 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15714 | return -ENOTSUPP; |
| 15715 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15716 | |
| 15717 | EXIT(); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15718 | return 0; |
| 15719 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15720 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15721 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
| 15722 | u8 *peer, enum nl80211_tdls_operation oper) |
| 15723 | { |
| 15724 | int ret; |
| 15725 | |
| 15726 | vos_ssr_protect(__func__); |
| 15727 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 15728 | vos_ssr_unprotect(__func__); |
| 15729 | |
| 15730 | return ret; |
| 15731 | } |
| 15732 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15733 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 15734 | struct net_device *dev, u8 *peer) |
| 15735 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 15736 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 15737 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 15738 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15739 | |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15740 | #if TDLS_MGMT_VERSION2 |
| 15741 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 15742 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 15743 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15744 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 15745 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15746 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15747 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15748 | #endif |
| 15749 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15750 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 15751 | /* |
| 15752 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 15753 | * Callback rountine called upon receiving response for |
| 15754 | * get offload info |
| 15755 | */ |
| 15756 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 15757 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 15758 | { |
| 15759 | |
| 15760 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15761 | tANI_U8 tempReplayCounter[8]; |
| 15762 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15763 | |
| 15764 | ENTER(); |
| 15765 | |
| 15766 | if (NULL == pAdapter) |
| 15767 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 15768 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15769 | "%s: HDD adapter is Null", __func__); |
| 15770 | return ; |
| 15771 | } |
| 15772 | |
| 15773 | if (NULL == pGtkOffloadGetInfoRsp) |
| 15774 | { |
| 15775 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15776 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 15777 | return ; |
| 15778 | } |
| 15779 | |
| 15780 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 15781 | { |
| 15782 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15783 | "%s: wlan Failed to get replay counter value", |
| 15784 | __func__); |
| 15785 | return ; |
| 15786 | } |
| 15787 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15788 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15789 | /* Update replay counter */ |
| 15790 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 15791 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 15792 | |
| 15793 | { |
| 15794 | /* changing from little to big endian since supplicant |
| 15795 | * works on big endian format |
| 15796 | */ |
| 15797 | int i; |
| 15798 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 15799 | |
| 15800 | for (i = 0; i < 8; i++) |
| 15801 | { |
| 15802 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 15803 | } |
| 15804 | } |
| 15805 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15806 | /* Update replay counter to NL */ |
| 15807 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15808 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15809 | } |
| 15810 | |
| 15811 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15812 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15813 | * This function is used to offload GTK rekeying job to the firmware. |
| 15814 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15815 | 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] | 15816 | struct cfg80211_gtk_rekey_data *data) |
| 15817 | { |
| 15818 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15819 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 15820 | hdd_station_ctx_t *pHddStaCtx; |
| 15821 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15822 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15823 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15824 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 15825 | |
| 15826 | ENTER(); |
| 15827 | |
| 15828 | if (NULL == pAdapter) |
| 15829 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15830 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15831 | "%s: HDD adapter is Null", __func__); |
| 15832 | return -ENODEV; |
| 15833 | } |
| 15834 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15835 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15836 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 15837 | pAdapter->sessionId, pAdapter->device_mode)); |
| 15838 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15839 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15840 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15841 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15842 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15843 | } |
| 15844 | |
| 15845 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15846 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 15847 | if (NULL == hHal) |
| 15848 | { |
| 15849 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15850 | "%s: HAL context is Null!!!", __func__); |
| 15851 | return -EAGAIN; |
| 15852 | } |
| 15853 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15854 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 15855 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 15856 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 15857 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15858 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15859 | { |
| 15860 | /* changing from big to little endian since driver |
| 15861 | * works on little endian format |
| 15862 | */ |
| 15863 | tANI_U8 *p = |
| 15864 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 15865 | int i; |
| 15866 | |
| 15867 | for (i = 0; i < 8; i++) |
| 15868 | { |
| 15869 | p[7-i] = data->replay_ctr[i]; |
| 15870 | } |
| 15871 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15872 | |
| 15873 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 15874 | { |
| 15875 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15876 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 15877 | sizeof (tSirGtkOffloadParams)); |
| 15878 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15879 | pAdapter->sessionId); |
| 15880 | |
| 15881 | if (eHAL_STATUS_SUCCESS != status) |
| 15882 | { |
| 15883 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15884 | "%s: sme_SetGTKOffload failed, returned %d", |
| 15885 | __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 15886 | |
| 15887 | /* Need to clear any trace of key value in the memory. |
| 15888 | * Thus zero out the memory even though it is local |
| 15889 | * variable. |
| 15890 | */ |
| 15891 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 15892 | sizeof(hddGtkOffloadReqParams)); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15893 | return status; |
| 15894 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15895 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15896 | "%s: sme_SetGTKOffload successfull", __func__); |
| 15897 | } |
| 15898 | else |
| 15899 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15900 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15901 | "%s: wlan not suspended GTKOffload request is stored", |
| 15902 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15903 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15904 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 15905 | /* Need to clear any trace of key value in the memory. |
| 15906 | * Thus zero out the memory even though it is local |
| 15907 | * variable. |
| 15908 | */ |
| 15909 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 15910 | sizeof(hddGtkOffloadReqParams)); |
| 15911 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15912 | EXIT(); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15913 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15914 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15915 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15916 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 15917 | struct cfg80211_gtk_rekey_data *data) |
| 15918 | { |
| 15919 | int ret; |
| 15920 | |
| 15921 | vos_ssr_protect(__func__); |
| 15922 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 15923 | vos_ssr_unprotect(__func__); |
| 15924 | |
| 15925 | return ret; |
| 15926 | } |
| 15927 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15928 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15929 | * FUNCTION: __wlan_hdd_cfg80211_set_mac_acl |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15930 | * This function is used to set access control policy |
| 15931 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15932 | static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 15933 | struct net_device *dev, |
| 15934 | const struct cfg80211_acl_data *params) |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15935 | { |
| 15936 | int i; |
| 15937 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15938 | hdd_hostapd_state_t *pHostapdState; |
| 15939 | tsap_Config_t *pConfig; |
| 15940 | v_CONTEXT_t pVosContext = NULL; |
| 15941 | hdd_context_t *pHddCtx; |
| 15942 | int status; |
| 15943 | |
| 15944 | ENTER(); |
| 15945 | |
| 15946 | if (NULL == pAdapter) |
| 15947 | { |
| 15948 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15949 | "%s: HDD adapter is Null", __func__); |
| 15950 | return -ENODEV; |
| 15951 | } |
| 15952 | |
| 15953 | if (NULL == params) |
| 15954 | { |
| 15955 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15956 | "%s: params is Null", __func__); |
| 15957 | return -EINVAL; |
| 15958 | } |
| 15959 | |
| 15960 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15961 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15962 | if (0 != status) |
| 15963 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15964 | return status; |
| 15965 | } |
| 15966 | |
| 15967 | pVosContext = pHddCtx->pvosContext; |
| 15968 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 15969 | |
| 15970 | if (NULL == pHostapdState) |
| 15971 | { |
| 15972 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15973 | "%s: pHostapdState is Null", __func__); |
| 15974 | return -EINVAL; |
| 15975 | } |
| 15976 | |
| 15977 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 15978 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 15979 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15980 | TRACE_CODE_HDD_CFG80211_SET_MAC_ACL, |
| 15981 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15982 | |
| 15983 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 15984 | { |
| 15985 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 15986 | |
| 15987 | /* default value */ |
| 15988 | pConfig->num_accept_mac = 0; |
| 15989 | pConfig->num_deny_mac = 0; |
| 15990 | |
| 15991 | /** |
| 15992 | * access control policy |
| 15993 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 15994 | * listed in hostapd.deny file. |
| 15995 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 15996 | * listed in hostapd.accept file. |
| 15997 | */ |
| 15998 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 15999 | { |
| 16000 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 16001 | } |
| 16002 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 16003 | { |
| 16004 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 16005 | } |
| 16006 | else |
| 16007 | { |
| 16008 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16009 | "%s:Acl Policy : %d is not supported", |
| 16010 | __func__, params->acl_policy); |
| 16011 | return -ENOTSUPP; |
| 16012 | } |
| 16013 | |
| 16014 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 16015 | { |
| 16016 | pConfig->num_accept_mac = params->n_acl_entries; |
| 16017 | for (i = 0; i < params->n_acl_entries; i++) |
| 16018 | { |
| 16019 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16020 | "** Add ACL MAC entry %i in WhiletList :" |
| 16021 | MAC_ADDRESS_STR, i, |
| 16022 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 16023 | |
| 16024 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 16025 | sizeof(qcmacaddr)); |
| 16026 | } |
| 16027 | } |
| 16028 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 16029 | { |
| 16030 | pConfig->num_deny_mac = params->n_acl_entries; |
| 16031 | for (i = 0; i < params->n_acl_entries; i++) |
| 16032 | { |
| 16033 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16034 | "** Add ACL MAC entry %i in BlackList :" |
| 16035 | MAC_ADDRESS_STR, i, |
| 16036 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 16037 | |
| 16038 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 16039 | sizeof(qcmacaddr)); |
| 16040 | } |
| 16041 | } |
| 16042 | |
| 16043 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 16044 | { |
| 16045 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16046 | "%s: SAP Set Mac Acl fail", __func__); |
| 16047 | return -EINVAL; |
| 16048 | } |
| 16049 | } |
| 16050 | else |
| 16051 | { |
| 16052 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 16053 | "%s: Invalid device_mode = %s (%d)", |
| 16054 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 16055 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16056 | return -EINVAL; |
| 16057 | } |
| 16058 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16059 | EXIT(); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16060 | return 0; |
| 16061 | } |
| 16062 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16063 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 16064 | struct net_device *dev, |
| 16065 | const struct cfg80211_acl_data *params) |
| 16066 | { |
| 16067 | int ret; |
| 16068 | vos_ssr_protect(__func__); |
| 16069 | ret = __wlan_hdd_cfg80211_set_mac_acl(wiphy, dev, params); |
| 16070 | vos_ssr_unprotect(__func__); |
| 16071 | |
| 16072 | return ret; |
| 16073 | } |
| 16074 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16075 | #ifdef WLAN_NL80211_TESTMODE |
| 16076 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16077 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16078 | ( |
| 16079 | void *pAdapter, |
| 16080 | void *indCont |
| 16081 | ) |
| 16082 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16083 | tSirLPHBInd *lphbInd; |
| 16084 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 16085 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16086 | |
| 16087 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16088 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16089 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 16090 | if (pAdapter == NULL) |
| 16091 | { |
| 16092 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16093 | "%s: pAdapter is NULL\n",__func__); |
| 16094 | return; |
| 16095 | } |
| 16096 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16097 | if (NULL == indCont) |
| 16098 | { |
| 16099 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16100 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16101 | return; |
| 16102 | } |
| 16103 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 16104 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16105 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16106 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 16107 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16108 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16109 | GFP_ATOMIC); |
| 16110 | if (!skb) |
| 16111 | { |
| 16112 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16113 | "LPHB timeout, NL buffer alloc fail"); |
| 16114 | return; |
| 16115 | } |
| 16116 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 16117 | 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] | 16118 | { |
| 16119 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16120 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 16121 | goto nla_put_failure; |
| 16122 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 16123 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16124 | { |
| 16125 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16126 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 16127 | goto nla_put_failure; |
| 16128 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 16129 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16130 | sizeof(tSirLPHBInd), lphbInd)) |
| 16131 | { |
| 16132 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16133 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 16134 | goto nla_put_failure; |
| 16135 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16136 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 16137 | return; |
| 16138 | |
| 16139 | nla_put_failure: |
| 16140 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16141 | "NLA Put fail"); |
| 16142 | kfree_skb(skb); |
| 16143 | |
| 16144 | return; |
| 16145 | } |
| 16146 | #endif /* FEATURE_WLAN_LPHB */ |
| 16147 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16148 | 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] | 16149 | { |
| 16150 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 16151 | int err = 0; |
| 16152 | #ifdef FEATURE_WLAN_LPHB |
| 16153 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16154 | eHalStatus smeStatus; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16155 | |
| 16156 | ENTER(); |
| 16157 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16158 | err = wlan_hdd_validate_context(pHddCtx); |
| 16159 | if (0 != err) |
| 16160 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16161 | return err; |
| 16162 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16163 | #endif /* FEATURE_WLAN_LPHB */ |
| 16164 | |
| 16165 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 16166 | if (err) |
| 16167 | { |
| 16168 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16169 | "%s Testmode INV ATTR", __func__); |
| 16170 | return err; |
| 16171 | } |
| 16172 | |
| 16173 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 16174 | { |
| 16175 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16176 | "%s Testmode INV CMD", __func__); |
| 16177 | return -EINVAL; |
| 16178 | } |
| 16179 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 16180 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16181 | TRACE_CODE_HDD_CFG80211_TESTMODE, |
| 16182 | NO_SESSION, nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD]))); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16183 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 16184 | { |
| 16185 | #ifdef FEATURE_WLAN_LPHB |
| 16186 | /* Low Power Heartbeat configuration request */ |
| 16187 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 16188 | { |
| 16189 | int buf_len; |
| 16190 | void *buf; |
| 16191 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 16192 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16193 | |
| 16194 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 16195 | { |
| 16196 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16197 | "%s Testmode INV DATA", __func__); |
| 16198 | return -EINVAL; |
| 16199 | } |
| 16200 | |
| 16201 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 16202 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 16203 | |
| 16204 | hb_params_temp =(tSirLPHBReq *)buf; |
| 16205 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 16206 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 16207 | return -EINVAL; |
| 16208 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16209 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 16210 | if (NULL == hb_params) |
| 16211 | { |
| 16212 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16213 | "%s Request Buffer Alloc Fail", __func__); |
| 16214 | return -EINVAL; |
| 16215 | } |
| 16216 | |
| 16217 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16218 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 16219 | hb_params, |
| 16220 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 16221 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16222 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16223 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16224 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16225 | vos_mem_free(hb_params); |
| 16226 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16227 | return 0; |
| 16228 | } |
| 16229 | #endif /* FEATURE_WLAN_LPHB */ |
| 16230 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 16231 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16232 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16233 | return -EOPNOTSUPP; |
| 16234 | } |
| 16235 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16236 | EXIT(); |
| 16237 | return err; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16238 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16239 | |
| 16240 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) |
| 16241 | { |
| 16242 | int ret; |
| 16243 | |
| 16244 | vos_ssr_protect(__func__); |
| 16245 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 16246 | vos_ssr_unprotect(__func__); |
| 16247 | |
| 16248 | return ret; |
| 16249 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16250 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 16251 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16252 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16253 | struct net_device *dev, |
| 16254 | int idx, struct survey_info *survey) |
| 16255 | { |
| 16256 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16257 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16258 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16259 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16260 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16261 | v_S7_t snr,rssi; |
| 16262 | int status, i, j, filled = 0; |
| 16263 | |
| 16264 | ENTER(); |
| 16265 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16266 | if (NULL == pAdapter) |
| 16267 | { |
| 16268 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 16269 | "%s: HDD adapter is Null", __func__); |
| 16270 | return -ENODEV; |
| 16271 | } |
| 16272 | |
| 16273 | if (NULL == wiphy) |
| 16274 | { |
| 16275 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 16276 | "%s: wiphy is Null", __func__); |
| 16277 | return -ENODEV; |
| 16278 | } |
| 16279 | |
| 16280 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16281 | status = wlan_hdd_validate_context(pHddCtx); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16282 | if (0 != status) |
| 16283 | { |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16284 | return status; |
| 16285 | } |
| 16286 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16287 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 16288 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16289 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16290 | 0 != pAdapter->survey_idx || |
| 16291 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16292 | { |
| 16293 | /* The survey dump ops when implemented completely is expected to |
| 16294 | * return a survey of all channels and the ops is called by the |
| 16295 | * kernel with incremental values of the argument 'idx' till it |
| 16296 | * returns -ENONET. But we can only support the survey for the |
| 16297 | * operating channel for now. survey_idx is used to track |
| 16298 | * that the ops is called only once and then return -ENONET for |
| 16299 | * the next iteration |
| 16300 | */ |
| 16301 | pAdapter->survey_idx = 0; |
| 16302 | return -ENONET; |
| 16303 | } |
| 16304 | |
Mukul Sharma | 9d5233b | 2015-06-11 20:28:20 +0530 | [diff] [blame] | 16305 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 16306 | { |
| 16307 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16308 | "%s: Roaming in progress, hence return ", __func__); |
| 16309 | return -ENONET; |
| 16310 | } |
| 16311 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16312 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16313 | |
| 16314 | wlan_hdd_get_snr(pAdapter, &snr); |
| 16315 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 16316 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 16317 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16318 | TRACE_CODE_HDD_CFG80211_DUMP_SURVEY, |
| 16319 | pAdapter->sessionId, pAdapter->device_mode)); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16320 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 16321 | hdd_wlan_get_freq(channel, &freq); |
| 16322 | |
| 16323 | |
| 16324 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 16325 | { |
| 16326 | if (NULL == wiphy->bands[i]) |
| 16327 | { |
| 16328 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 16329 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 16330 | continue; |
| 16331 | } |
| 16332 | |
| 16333 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 16334 | { |
| 16335 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 16336 | |
| 16337 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 16338 | { |
| 16339 | survey->channel = &band->channels[j]; |
| 16340 | /* The Rx BDs contain SNR values in dB for the received frames |
| 16341 | * while the supplicant expects noise. So we calculate and |
| 16342 | * return the value of noise (dBm) |
| 16343 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 16344 | */ |
| 16345 | survey->noise = rssi - snr; |
| 16346 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 16347 | filled = 1; |
| 16348 | } |
| 16349 | } |
| 16350 | } |
| 16351 | |
| 16352 | if (filled) |
| 16353 | pAdapter->survey_idx = 1; |
| 16354 | else |
| 16355 | { |
| 16356 | pAdapter->survey_idx = 0; |
| 16357 | return -ENONET; |
| 16358 | } |
| 16359 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16360 | EXIT(); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16361 | return 0; |
| 16362 | } |
| 16363 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16364 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 16365 | struct net_device *dev, |
| 16366 | int idx, struct survey_info *survey) |
| 16367 | { |
| 16368 | int ret; |
| 16369 | |
| 16370 | vos_ssr_protect(__func__); |
| 16371 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 16372 | vos_ssr_unprotect(__func__); |
| 16373 | |
| 16374 | return ret; |
| 16375 | } |
| 16376 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16377 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16378 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16379 | * this is called when cfg80211 driver resume |
| 16380 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 16381 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16382 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16383 | { |
| 16384 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 16385 | hdd_adapter_t *pAdapter; |
| 16386 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 16387 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 16388 | |
| 16389 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16390 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16391 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16392 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16393 | return 0; |
| 16394 | } |
| 16395 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 16396 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_CFG80211_RESUME_WLAN, |
| 16397 | NO_SESSION, pHddCtx->isWiphySuspended)); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16398 | spin_lock(&pHddCtx->schedScan_lock); |
| 16399 | pHddCtx->isWiphySuspended = FALSE; |
| 16400 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 16401 | { |
| 16402 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16403 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16404 | "%s: Return resume is not due to PNO indication", __func__); |
| 16405 | return 0; |
| 16406 | } |
| 16407 | // Reset flag to avoid updatating cfg80211 data old results again |
| 16408 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 16409 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16410 | |
| 16411 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 16412 | |
| 16413 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 16414 | { |
| 16415 | pAdapter = pAdapterNode->pAdapter; |
| 16416 | if ( (NULL != pAdapter) && |
| 16417 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 16418 | { |
| 16419 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16420 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16421 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 16422 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16423 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16424 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16425 | { |
| 16426 | /* Acquire wakelock to handle the case where APP's tries to |
| 16427 | * suspend immediately after updating the scan results. Whis |
| 16428 | * results in app's is in suspended state and not able to |
| 16429 | * process the connect request to AP |
| 16430 | */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 16431 | hdd_prevent_suspend_timeout(2000, |
| 16432 | WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16433 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16434 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16435 | |
| 16436 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16437 | "%s : cfg80211 scan result database updated", __func__); |
| 16438 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16439 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16440 | return 0; |
| 16441 | |
| 16442 | } |
| 16443 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 16444 | pAdapterNode = pNext; |
| 16445 | } |
| 16446 | |
| 16447 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16448 | "%s: Failed to find Adapter", __func__); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16449 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16450 | return 0; |
| 16451 | } |
| 16452 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16453 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 16454 | { |
| 16455 | int ret; |
| 16456 | |
| 16457 | vos_ssr_protect(__func__); |
| 16458 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 16459 | vos_ssr_unprotect(__func__); |
| 16460 | |
| 16461 | return ret; |
| 16462 | } |
| 16463 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16464 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16465 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16466 | * this is called when cfg80211 driver suspends |
| 16467 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16468 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16469 | struct cfg80211_wowlan *wow) |
| 16470 | { |
| 16471 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16472 | int ret = 0; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16473 | |
| 16474 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16475 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16476 | ret = wlan_hdd_validate_context(pHddCtx); |
| 16477 | if (0 != ret) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16478 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16479 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16480 | } |
| 16481 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16482 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 16483 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16484 | TRACE_CODE_HDD_CFG80211_SUSPEND_WLAN, |
| 16485 | NO_SESSION, pHddCtx->isWiphySuspended)); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16486 | pHddCtx->isWiphySuspended = TRUE; |
| 16487 | |
| 16488 | EXIT(); |
| 16489 | |
| 16490 | return 0; |
| 16491 | } |
| 16492 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16493 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 16494 | struct cfg80211_wowlan *wow) |
| 16495 | { |
| 16496 | int ret; |
| 16497 | |
| 16498 | vos_ssr_protect(__func__); |
| 16499 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 16500 | vos_ssr_unprotect(__func__); |
| 16501 | |
| 16502 | return ret; |
| 16503 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16504 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16505 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16506 | { |
| 16507 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 16508 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 16509 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 16510 | .change_station = wlan_hdd_change_station, |
| 16511 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 16512 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 16513 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 16514 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16515 | #else |
| 16516 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 16517 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 16518 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16519 | #endif |
| 16520 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 16521 | .add_key = wlan_hdd_cfg80211_add_key, |
| 16522 | .get_key = wlan_hdd_cfg80211_get_key, |
| 16523 | .del_key = wlan_hdd_cfg80211_del_key, |
| 16524 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 16525 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16526 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 16527 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16528 | .scan = wlan_hdd_cfg80211_scan, |
| 16529 | .connect = wlan_hdd_cfg80211_connect, |
| 16530 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 16531 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 16532 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 16533 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 16534 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 16535 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16536 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 16537 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 16538 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16539 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 16540 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 16541 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 16542 | .set_txq_params = wlan_hdd_set_txq_params, |
| 16543 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16544 | .get_station = wlan_hdd_cfg80211_get_station, |
| 16545 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 16546 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16547 | .add_station = wlan_hdd_cfg80211_add_station, |
| 16548 | #ifdef FEATURE_WLAN_LFR |
| 16549 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 16550 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 16551 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 16552 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16553 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 16554 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 16555 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16556 | #ifdef FEATURE_WLAN_TDLS |
| 16557 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 16558 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 16559 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16560 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 16561 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 16562 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16563 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 16564 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 16565 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 16566 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16567 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 16568 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16569 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16570 | #ifdef WLAN_NL80211_TESTMODE |
| 16571 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 16572 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16573 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16574 | }; |
| 16575 | |