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, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 622 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 623 | NULL, |
| 624 | #endif |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 625 | sizeof(tHddAvoidFreqList), |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 626 | QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 627 | GFP_KERNEL); |
| 628 | if (!vendor_event) |
| 629 | { |
| 630 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 631 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 632 | return -1; |
| 633 | } |
| 634 | |
| 635 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 636 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 637 | |
| 638 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 639 | |
| 640 | EXIT(); |
| 641 | return 0; |
| 642 | } |
| 643 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 644 | |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 645 | /* |
| 646 | * FUNCTION: __wlan_hdd_cfg80211_nan_request |
| 647 | * This is called when wlan driver needs to send vendor specific |
| 648 | * nan request event. |
| 649 | */ |
| 650 | static int __wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 651 | struct wireless_dev *wdev, |
| 652 | const void *data, int data_len) |
| 653 | { |
| 654 | tNanRequestReq nan_req; |
| 655 | VOS_STATUS status; |
| 656 | int ret_val = -1; |
Srinivas Dasari | a3f11c0 | 2015-03-20 13:15:20 +0530 | [diff] [blame] | 657 | struct net_device *dev = wdev->netdev; |
| 658 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 659 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 660 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 661 | |
| 662 | if (0 == data_len) |
| 663 | { |
| 664 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 665 | FL("NAN - Invalid Request, length = 0")); |
| 666 | return ret_val; |
| 667 | } |
| 668 | |
| 669 | if (NULL == data) |
| 670 | { |
| 671 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 672 | FL("NAN - Invalid Request, data is NULL")); |
| 673 | return ret_val; |
| 674 | } |
| 675 | |
| 676 | status = wlan_hdd_validate_context(pHddCtx); |
| 677 | if (0 != status) |
| 678 | { |
| 679 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 680 | FL("HDD context is not valid")); |
| 681 | return -EINVAL; |
| 682 | } |
| 683 | |
| 684 | hddLog(LOG1, FL("Received NAN command")); |
| 685 | vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 686 | (tANI_U8 *)data, data_len); |
| 687 | |
| 688 | /* check the NAN Capability */ |
| 689 | if (TRUE != sme_IsFeatureSupportedByFW(NAN)) |
| 690 | { |
| 691 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 692 | FL("NAN is not supported by Firmware")); |
| 693 | return -EINVAL; |
| 694 | } |
| 695 | |
| 696 | nan_req.request_data_len = data_len; |
| 697 | nan_req.request_data = data; |
| 698 | |
Srinivas Dasari | a3f11c0 | 2015-03-20 13:15:20 +0530 | [diff] [blame] | 699 | status = sme_NanRequest(hHal, &nan_req, pAdapter->sessionId); |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 700 | if (VOS_STATUS_SUCCESS == status) |
| 701 | { |
| 702 | ret_val = 0; |
| 703 | } |
| 704 | return ret_val; |
| 705 | } |
| 706 | |
| 707 | /* |
| 708 | * FUNCTION: wlan_hdd_cfg80211_nan_request |
| 709 | * Wrapper to protect the nan vendor command from ssr |
| 710 | */ |
| 711 | static int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 712 | struct wireless_dev *wdev, |
| 713 | const void *data, int data_len) |
| 714 | { |
| 715 | int ret; |
| 716 | |
| 717 | vos_ssr_protect(__func__); |
| 718 | ret = __wlan_hdd_cfg80211_nan_request(wiphy, wdev, data, data_len); |
| 719 | vos_ssr_unprotect(__func__); |
| 720 | |
| 721 | return ret; |
| 722 | } |
| 723 | |
| 724 | /* |
| 725 | * FUNCTION: wlan_hdd_cfg80211_nan_callback |
| 726 | * This is a callback function and it gets called |
| 727 | * when we need to report nan response event to |
| 728 | * upper layers. |
| 729 | */ |
| 730 | static void wlan_hdd_cfg80211_nan_callback(void* ctx, tSirNanEvent* msg) |
| 731 | { |
| 732 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 733 | struct sk_buff *vendor_event; |
| 734 | int status; |
| 735 | tSirNanEvent *data; |
| 736 | |
| 737 | ENTER(); |
| 738 | if (NULL == msg) |
| 739 | { |
| 740 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 741 | FL(" msg received here is null")); |
| 742 | return; |
| 743 | } |
| 744 | data = msg; |
| 745 | |
| 746 | status = wlan_hdd_validate_context(pHddCtx); |
| 747 | |
| 748 | if (0 != status) |
| 749 | { |
| 750 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 751 | FL("HDD context is not valid")); |
| 752 | return; |
| 753 | } |
| 754 | |
| 755 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 756 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 757 | NULL, |
| 758 | #endif |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 759 | data->event_data_len + |
| 760 | NLMSG_HDRLEN, |
| 761 | QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX, |
| 762 | GFP_KERNEL); |
| 763 | |
| 764 | if (!vendor_event) |
| 765 | { |
| 766 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 767 | FL("cfg80211_vendor_event_alloc failed")); |
| 768 | return; |
| 769 | } |
| 770 | if (nla_put(vendor_event, QCA_WLAN_VENDOR_ATTR_NAN, |
| 771 | data->event_data_len, data->event_data)) |
| 772 | { |
| 773 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 774 | FL("QCA_WLAN_VENDOR_ATTR_NAN put fail")); |
| 775 | kfree_skb(vendor_event); |
| 776 | return; |
| 777 | } |
| 778 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 779 | EXIT(); |
| 780 | } |
| 781 | |
| 782 | /* |
| 783 | * FUNCTION: wlan_hdd_cfg80211_nan_init |
| 784 | * This function is called to register the callback to sme layer |
| 785 | */ |
| 786 | inline void wlan_hdd_cfg80211_nan_init(hdd_context_t *pHddCtx) |
| 787 | { |
| 788 | sme_NanRegisterCallback(pHddCtx->hHal, wlan_hdd_cfg80211_nan_callback); |
| 789 | } |
| 790 | |
| 791 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 792 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 793 | |
| 794 | static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats, |
| 795 | struct sk_buff *vendor_event) |
| 796 | { |
| 797 | if (nla_put_u8(vendor_event, |
| 798 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_PREAMBLE, |
| 799 | stats->rate.preamble) || |
| 800 | nla_put_u8(vendor_event, |
| 801 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_NSS, |
| 802 | stats->rate.nss) || |
| 803 | nla_put_u8(vendor_event, |
| 804 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BW, |
| 805 | stats->rate.bw) || |
| 806 | nla_put_u8(vendor_event, |
| 807 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX, |
| 808 | stats->rate.rateMcsIdx) || |
| 809 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE, |
| 810 | stats->rate.bitrate ) || |
| 811 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU, |
| 812 | stats->txMpdu ) || |
| 813 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU, |
| 814 | stats->rxMpdu ) || |
| 815 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST, |
| 816 | stats->mpduLost ) || |
| 817 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES, |
| 818 | stats->retries) || |
| 819 | nla_put_u32(vendor_event, |
| 820 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT, |
| 821 | stats->retriesShort ) || |
| 822 | nla_put_u32(vendor_event, |
| 823 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG, |
| 824 | stats->retriesLong)) |
| 825 | { |
| 826 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 827 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 828 | return FALSE; |
| 829 | } |
| 830 | return TRUE; |
| 831 | } |
| 832 | |
| 833 | static v_BOOL_t put_wifi_peer_info( tpSirWifiPeerInfo stats, |
| 834 | struct sk_buff *vendor_event) |
| 835 | { |
| 836 | u32 i = 0; |
| 837 | struct nlattr *rateInfo; |
| 838 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE, |
| 839 | stats->type) || |
| 840 | nla_put(vendor_event, |
| 841 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS, |
| 842 | VOS_MAC_ADDR_SIZE, &stats->peerMacAddress[0]) || |
| 843 | nla_put_u32(vendor_event, |
| 844 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES, |
| 845 | stats->capabilities) || |
| 846 | nla_put_u32(vendor_event, |
| 847 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES, |
| 848 | stats->numRate)) |
| 849 | { |
| 850 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 851 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 852 | goto error; |
| 853 | } |
| 854 | |
| 855 | rateInfo = nla_nest_start(vendor_event, |
| 856 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 857 | if(!rateInfo) |
| 858 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 859 | for (i = 0; i < stats->numRate; i++) |
| 860 | { |
| 861 | struct nlattr *rates; |
| 862 | tpSirWifiRateStat pRateStats = (tpSirWifiRateStat )((uint8 *) |
| 863 | stats->rateStats + |
| 864 | (i * sizeof(tSirWifiRateStat))); |
| 865 | rates = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 866 | if(!rates) |
| 867 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 868 | |
| 869 | if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event)) |
| 870 | { |
| 871 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 872 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 873 | return FALSE; |
| 874 | } |
| 875 | nla_nest_end(vendor_event, rates); |
| 876 | } |
| 877 | nla_nest_end(vendor_event, rateInfo); |
| 878 | |
| 879 | return TRUE; |
| 880 | error: |
| 881 | return FALSE; |
| 882 | } |
| 883 | |
| 884 | static v_BOOL_t put_wifi_wmm_ac_stat( tpSirWifiWmmAcStat stats, |
| 885 | struct sk_buff *vendor_event) |
| 886 | { |
| 887 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_AC, |
| 888 | stats->ac ) || |
| 889 | nla_put_u32(vendor_event, |
| 890 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MPDU, |
| 891 | stats->txMpdu ) || |
| 892 | nla_put_u32(vendor_event, |
| 893 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MPDU, |
| 894 | stats->rxMpdu ) || |
| 895 | nla_put_u32(vendor_event, |
| 896 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MCAST, |
| 897 | stats->txMcast ) || |
| 898 | nla_put_u32(vendor_event, |
| 899 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MCAST, |
| 900 | stats->rxMcast ) || |
| 901 | nla_put_u32(vendor_event, |
| 902 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_AMPDU, |
| 903 | stats->rxAmpdu ) || |
| 904 | nla_put_u32(vendor_event, |
| 905 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_AMPDU, |
| 906 | stats->txAmpdu ) || |
| 907 | nla_put_u32(vendor_event, |
| 908 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_MPDU_LOST, |
| 909 | stats->mpduLost )|| |
| 910 | nla_put_u32(vendor_event, |
| 911 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES, |
| 912 | stats->retries ) || |
| 913 | nla_put_u32(vendor_event, |
| 914 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_SHORT, |
| 915 | stats->retriesShort ) || |
| 916 | nla_put_u32(vendor_event, |
| 917 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_LONG, |
| 918 | stats->retriesLong ) || |
| 919 | nla_put_u32(vendor_event, |
| 920 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MIN, |
| 921 | stats->contentionTimeMin ) || |
| 922 | nla_put_u32(vendor_event, |
| 923 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MAX, |
| 924 | stats->contentionTimeMax ) || |
| 925 | nla_put_u32(vendor_event, |
| 926 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_AVG, |
| 927 | stats->contentionTimeAvg ) || |
| 928 | nla_put_u32(vendor_event, |
| 929 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_NUM_SAMPLES, |
| 930 | stats->contentionNumSamples )) |
| 931 | { |
| 932 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 933 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 934 | return FALSE; |
| 935 | } |
| 936 | return TRUE; |
| 937 | } |
| 938 | |
| 939 | static v_BOOL_t put_wifi_interface_info(tpSirWifiInterfaceInfo stats, |
| 940 | struct sk_buff *vendor_event) |
| 941 | { |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 942 | if (nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 943 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE, stats->mode ) || |
| 944 | nla_put(vendor_event, |
| 945 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MAC_ADDR, |
| 946 | VOS_MAC_ADDR_SIZE, stats->macAddr) || |
| 947 | nla_put_u32(vendor_event, |
| 948 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_STATE, |
| 949 | stats->state ) || |
| 950 | nla_put_u32(vendor_event, |
| 951 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_ROAMING, |
| 952 | stats->roaming ) || |
| 953 | nla_put_u32(vendor_event, |
| 954 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_CAPABILITIES, |
| 955 | stats->capabilities ) || |
| 956 | nla_put(vendor_event, |
| 957 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_SSID, |
| 958 | strlen(stats->ssid), stats->ssid) || |
| 959 | nla_put(vendor_event, |
| 960 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_BSSID, |
| 961 | WNI_CFG_BSSID_LEN, stats->bssid) || |
| 962 | nla_put(vendor_event, |
| 963 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_AP_COUNTRY_STR, |
| 964 | WNI_CFG_COUNTRY_CODE_LEN, stats->apCountryStr) || |
| 965 | nla_put(vendor_event, |
| 966 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_COUNTRY_STR, |
| 967 | WNI_CFG_COUNTRY_CODE_LEN, stats->countryStr) |
| 968 | ) |
| 969 | { |
| 970 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 971 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 972 | return FALSE; |
| 973 | } |
| 974 | return TRUE; |
| 975 | } |
| 976 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 977 | static v_BOOL_t put_wifi_iface_stats(hdd_adapter_t *pAdapter, |
| 978 | tpSirWifiIfaceStat pWifiIfaceStat, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 979 | struct sk_buff *vendor_event) |
| 980 | { |
| 981 | int i = 0; |
| 982 | struct nlattr *wmmInfo; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 983 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 984 | WLANTL_InterfaceStatsType *pWifiIfaceStatTL = NULL; |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 985 | tSirWifiWmmAcStat accessclassStats; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 986 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 987 | if (FALSE == put_wifi_interface_info( |
| 988 | &pWifiIfaceStat->info, |
| 989 | vendor_event)) |
| 990 | { |
| 991 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 992 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 993 | return FALSE; |
| 994 | |
| 995 | } |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 996 | pWifiIfaceStatTL = (WLANTL_InterfaceStatsType *) |
| 997 | vos_mem_malloc(sizeof(WLANTL_InterfaceStatsType)); |
| 998 | if (NULL == pWifiIfaceStatTL) |
| 999 | { |
| 1000 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 1001 | return FALSE; |
| 1002 | } |
| 1003 | |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 1004 | accessclassStats = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK]; |
| 1005 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK] = |
| 1006 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE]; |
| 1007 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE] = accessclassStats; |
| 1008 | |
| 1009 | accessclassStats.ac = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac; |
| 1010 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac = |
| 1011 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac; |
| 1012 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac = accessclassStats.ac; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1013 | |
| 1014 | if ( pWifiIfaceStat->info.state == WIFI_ASSOCIATED) |
| 1015 | { |
| 1016 | if (VOS_STATUS_SUCCESS == |
| 1017 | WLANTL_CollectInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1018 | pHddStaCtx->conn_info.staId[0], pWifiIfaceStatTL)) |
| 1019 | { |
| 1020 | /* mgmtRx, MgmtActionRx, rxMcast, rxMpdu, rxAmpdu, rssiData are |
| 1021 | * obtained from TL structure |
| 1022 | */ |
| 1023 | |
| 1024 | pWifiIfaceStat->mgmtRx = pWifiIfaceStat->beaconRx + |
| 1025 | pWifiIfaceStatTL->mgmtRx; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1026 | pWifiIfaceStat->rssiData = pWifiIfaceStatTL->rssiData; |
| 1027 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1028 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMcast |
| 1029 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMcast; |
| 1030 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMcast |
| 1031 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMcast; |
| 1032 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMcast |
| 1033 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMcast; |
| 1034 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMcast |
| 1035 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMcast; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1036 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1037 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMpdu |
| 1038 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMpdu; |
| 1039 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMpdu |
| 1040 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMpdu; |
| 1041 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMpdu |
| 1042 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMpdu; |
| 1043 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMpdu |
| 1044 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1045 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1046 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxAmpdu |
| 1047 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxAmpdu; |
| 1048 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxAmpdu |
| 1049 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxAmpdu; |
| 1050 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxAmpdu |
| 1051 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxAmpdu; |
| 1052 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxAmpdu |
| 1053 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxAmpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1054 | } |
| 1055 | else |
| 1056 | { |
| 1057 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in getting stats from TL")); |
| 1058 | } |
| 1059 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1060 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].txMcast = |
| 1061 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO]; |
| 1062 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].txMcast = |
| 1063 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI]; |
| 1064 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].txMcast = |
| 1065 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE]; |
| 1066 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].txMcast = |
| 1067 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK]; |
| 1068 | } |
| 1069 | else |
| 1070 | { |
| 1071 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Interface not Associated")); |
| 1072 | } |
| 1073 | |
| 1074 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1075 | |
| 1076 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1077 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 1078 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_IFACE) || |
| 1079 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1080 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX, |
| 1081 | pWifiIfaceStat->beaconRx) || |
| 1082 | nla_put_u32(vendor_event, |
| 1083 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_RX, |
| 1084 | pWifiIfaceStat->mgmtRx) || |
| 1085 | nla_put_u32(vendor_event, |
| 1086 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_RX, |
| 1087 | pWifiIfaceStat->mgmtActionRx) || |
| 1088 | nla_put_u32(vendor_event, |
| 1089 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_TX, |
| 1090 | pWifiIfaceStat->mgmtActionTx) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1091 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1092 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_MGMT, |
| 1093 | pWifiIfaceStat->rssiMgmt) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1094 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1095 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_DATA, |
| 1096 | pWifiIfaceStat->rssiData) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1097 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1098 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_ACK, |
| 1099 | pWifiIfaceStat->rssiAck)) |
| 1100 | { |
| 1101 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1102 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1103 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1104 | return FALSE; |
| 1105 | } |
| 1106 | |
| 1107 | wmmInfo = nla_nest_start(vendor_event, |
| 1108 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1109 | if(!wmmInfo) |
| 1110 | { |
| 1111 | vos_mem_free(pWifiIfaceStatTL); |
| 1112 | return FALSE; |
| 1113 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1114 | for (i = 0; i < WIFI_AC_MAX; i++) |
| 1115 | { |
| 1116 | struct nlattr *wmmStats; |
| 1117 | wmmStats = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1118 | if(!wmmStats) |
| 1119 | { |
| 1120 | vos_mem_free(pWifiIfaceStatTL); |
| 1121 | return FALSE; |
| 1122 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1123 | if (FALSE == put_wifi_wmm_ac_stat( |
| 1124 | &pWifiIfaceStat->AccessclassStats[i], |
| 1125 | vendor_event)) |
| 1126 | { |
| 1127 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1128 | FL("QCA_WLAN_VENDOR_ATTR put Fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1129 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1130 | return FALSE; |
| 1131 | } |
| 1132 | |
| 1133 | nla_nest_end(vendor_event, wmmStats); |
| 1134 | } |
| 1135 | nla_nest_end(vendor_event, wmmInfo); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1136 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1137 | return TRUE; |
| 1138 | } |
| 1139 | |
| 1140 | static tSirWifiInterfaceMode |
| 1141 | hdd_map_device_to_ll_iface_mode ( int deviceMode ) |
| 1142 | { |
| 1143 | switch (deviceMode) |
| 1144 | { |
| 1145 | case WLAN_HDD_INFRA_STATION: |
| 1146 | return WIFI_INTERFACE_STA; |
| 1147 | case WLAN_HDD_SOFTAP: |
| 1148 | return WIFI_INTERFACE_SOFTAP; |
| 1149 | case WLAN_HDD_P2P_CLIENT: |
| 1150 | return WIFI_INTERFACE_P2P_CLIENT; |
| 1151 | case WLAN_HDD_P2P_GO: |
| 1152 | return WIFI_INTERFACE_P2P_GO; |
| 1153 | case WLAN_HDD_IBSS: |
| 1154 | return WIFI_INTERFACE_IBSS; |
| 1155 | default: |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 1156 | return WIFI_INTERFACE_UNKNOWN; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1157 | } |
| 1158 | } |
| 1159 | |
| 1160 | static v_BOOL_t hdd_get_interface_info(hdd_adapter_t *pAdapter, |
| 1161 | tpSirWifiInterfaceInfo pInfo) |
| 1162 | { |
| 1163 | v_U8_t *staMac = NULL; |
| 1164 | hdd_station_ctx_t *pHddStaCtx; |
| 1165 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1166 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1167 | |
| 1168 | pInfo->mode = hdd_map_device_to_ll_iface_mode(pAdapter->device_mode); |
| 1169 | |
| 1170 | vos_mem_copy(pInfo->macAddr, |
| 1171 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 1172 | |
| 1173 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1174 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 1175 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))) |
| 1176 | { |
| 1177 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1178 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) |
| 1179 | { |
| 1180 | pInfo->state = WIFI_DISCONNECTED; |
| 1181 | } |
| 1182 | if (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) |
| 1183 | { |
| 1184 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1185 | "%s: Session ID %d, Connection is in progress", __func__, |
| 1186 | pAdapter->sessionId); |
| 1187 | pInfo->state = WIFI_ASSOCIATING; |
| 1188 | } |
| 1189 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 1190 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 1191 | { |
| 1192 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 1193 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1194 | "%s: client " MAC_ADDRESS_STR |
| 1195 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 1196 | MAC_ADDR_ARRAY(staMac)); |
| 1197 | pInfo->state = WIFI_AUTHENTICATING; |
| 1198 | } |
| 1199 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 1200 | { |
| 1201 | pInfo->state = WIFI_ASSOCIATED; |
| 1202 | vos_mem_copy(pInfo->bssid, |
| 1203 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 1204 | vos_mem_copy(pInfo->ssid, |
| 1205 | pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 1206 | pHddStaCtx->conn_info.SSID.SSID.length); |
| 1207 | //NULL Terminate the string. |
| 1208 | pInfo->ssid[pHddStaCtx->conn_info.SSID.SSID.length] = 0; |
| 1209 | } |
| 1210 | } |
| 1211 | vos_mem_copy(pInfo->countryStr, |
| 1212 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1213 | |
| 1214 | vos_mem_copy(pInfo->apCountryStr, |
| 1215 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1216 | |
| 1217 | return TRUE; |
| 1218 | } |
| 1219 | |
| 1220 | /* |
| 1221 | * hdd_link_layer_process_peer_stats () - This function is called after |
| 1222 | * receiving Link Layer Peer statistics from FW.This function converts |
| 1223 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1224 | * layers. |
| 1225 | */ |
| 1226 | static v_VOID_t hdd_link_layer_process_peer_stats(hdd_adapter_t *pAdapter, |
| 1227 | v_VOID_t *pData) |
| 1228 | { |
| 1229 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1230 | tpSirWifiRateStat pWifiRateStat; |
| 1231 | tpSirWifiPeerStat pWifiPeerStat; |
| 1232 | tpSirWifiPeerInfo pWifiPeerInfo; |
| 1233 | struct nlattr *peerInfo; |
| 1234 | struct sk_buff *vendor_event; |
| 1235 | int status, i; |
| 1236 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1237 | ENTER(); |
| 1238 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1239 | status = wlan_hdd_validate_context(pHddCtx); |
| 1240 | if (0 != status) |
| 1241 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1242 | return; |
| 1243 | } |
| 1244 | |
| 1245 | pWifiPeerStat = (tpSirWifiPeerStat) pData; |
| 1246 | |
| 1247 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1248 | "LL_STATS_PEER_ALL : numPeers %u", |
| 1249 | pWifiPeerStat->numPeers); |
| 1250 | { |
| 1251 | for (i = 0; i < pWifiPeerStat->numPeers; i++) |
| 1252 | { |
| 1253 | pWifiPeerInfo = (tpSirWifiPeerInfo) |
| 1254 | ((uint8 *)pWifiPeerStat->peerInfo + |
| 1255 | ( i * sizeof(tSirWifiPeerInfo))); |
| 1256 | |
Dasari Srinivas | 1be0c4e | 2014-10-19 13:03:41 +0530 | [diff] [blame] | 1257 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) { |
| 1258 | pWifiPeerInfo->type = WIFI_PEER_AP; |
| 1259 | } |
| 1260 | if (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) { |
| 1261 | pWifiPeerInfo->type = WIFI_PEER_P2P_GO; |
| 1262 | } |
| 1263 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1264 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1265 | " %d) LL_STATS Channel Stats " |
| 1266 | " Peer Type %u " |
| 1267 | " peerMacAddress %pM " |
| 1268 | " capabilities 0x%x " |
| 1269 | " numRate %u ", |
| 1270 | i, |
| 1271 | pWifiPeerInfo->type, |
| 1272 | pWifiPeerInfo->peerMacAddress, |
| 1273 | pWifiPeerInfo->capabilities, |
| 1274 | pWifiPeerInfo->numRate); |
| 1275 | { |
| 1276 | int j; |
| 1277 | for (j = 0; j < pWifiPeerInfo->numRate; j++) |
| 1278 | { |
| 1279 | pWifiRateStat = (tpSirWifiRateStat) |
| 1280 | ((tANI_U8 *) pWifiPeerInfo->rateStats + |
| 1281 | ( j * sizeof(tSirWifiRateStat))); |
| 1282 | |
| 1283 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1284 | " peer Rate Stats " |
| 1285 | " preamble %u " |
| 1286 | " nss %u " |
| 1287 | " bw %u " |
| 1288 | " rateMcsIdx %u " |
| 1289 | " reserved %u " |
| 1290 | " bitrate %u " |
| 1291 | " txMpdu %u " |
| 1292 | " rxMpdu %u " |
| 1293 | " mpduLost %u " |
| 1294 | " retries %u " |
| 1295 | " retriesShort %u " |
| 1296 | " retriesLong %u", |
| 1297 | pWifiRateStat->rate.preamble, |
| 1298 | pWifiRateStat->rate.nss, |
| 1299 | pWifiRateStat->rate.bw, |
| 1300 | pWifiRateStat->rate.rateMcsIdx, |
| 1301 | pWifiRateStat->rate.reserved, |
| 1302 | pWifiRateStat->rate.bitrate, |
| 1303 | pWifiRateStat->txMpdu, |
| 1304 | pWifiRateStat->rxMpdu, |
| 1305 | pWifiRateStat->mpduLost, |
| 1306 | pWifiRateStat->retries, |
| 1307 | pWifiRateStat->retriesShort, |
| 1308 | pWifiRateStat->retriesLong); |
| 1309 | } |
| 1310 | } |
| 1311 | } |
| 1312 | } |
| 1313 | |
| 1314 | /* |
| 1315 | * Allocate a size of 4096 for the peer stats comprising |
| 1316 | * each of size = sizeof (tSirWifiPeerInfo) + numRate * |
| 1317 | * sizeof (tSirWifiRateStat).Each field is put with an |
| 1318 | * NL attribute.The size of 4096 is considered assuming |
| 1319 | * that number of rates shall not exceed beyond 50 with |
| 1320 | * the sizeof (tSirWifiRateStat) being 32. |
| 1321 | */ |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1322 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 1323 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1324 | if (!vendor_event) |
| 1325 | { |
| 1326 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1327 | "%s: cfg80211_vendor_cmd_alloc_reply_skb failed", |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1328 | __func__); |
| 1329 | return; |
| 1330 | } |
| 1331 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1332 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 1333 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_PEER) || |
| 1334 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1335 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS, |
| 1336 | pWifiPeerStat->numPeers)) |
| 1337 | { |
| 1338 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1339 | "%s: QCA_WLAN_VENDOR_ATTR put fail", __func__); |
| 1340 | kfree_skb(vendor_event); |
| 1341 | return; |
| 1342 | } |
| 1343 | |
| 1344 | peerInfo = nla_nest_start(vendor_event, |
| 1345 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1346 | if(!peerInfo) |
| 1347 | { |
| 1348 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1349 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO put fail", |
| 1350 | __func__); |
| 1351 | kfree_skb(vendor_event); |
| 1352 | return; |
| 1353 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1354 | |
| 1355 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1356 | pWifiPeerStat->peerInfo); |
| 1357 | |
| 1358 | for (i = 1; i <= pWifiPeerStat->numPeers; i++) |
| 1359 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1360 | int numRate = pWifiPeerInfo->numRate; |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1361 | struct nlattr *peers = nla_nest_start(vendor_event, i); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1362 | |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1363 | if(!peers) |
| 1364 | { |
| 1365 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1366 | "%s: peer stats put fail", |
| 1367 | __func__); |
| 1368 | kfree_skb(vendor_event); |
| 1369 | return; |
| 1370 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1371 | if (FALSE == put_wifi_peer_info( |
| 1372 | pWifiPeerInfo, vendor_event)) |
| 1373 | { |
| 1374 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1375 | "%s: put_wifi_peer_info put fail", __func__); |
| 1376 | kfree_skb(vendor_event); |
| 1377 | return; |
| 1378 | } |
| 1379 | |
| 1380 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1381 | pWifiPeerStat->peerInfo + |
| 1382 | (i * sizeof(tSirWifiPeerInfo)) + |
| 1383 | (numRate * sizeof (tSirWifiRateStat))); |
| 1384 | nla_nest_end(vendor_event, peers); |
| 1385 | } |
| 1386 | nla_nest_end(vendor_event, peerInfo); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1387 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1388 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1389 | } |
| 1390 | |
| 1391 | /* |
| 1392 | * hdd_link_layer_process_iface_stats () - This function is called after |
| 1393 | * receiving Link Layer Interface statistics from FW.This function converts |
| 1394 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1395 | * layers. |
| 1396 | */ |
| 1397 | static v_VOID_t hdd_link_layer_process_iface_stats(hdd_adapter_t *pAdapter, |
| 1398 | v_VOID_t *pData) |
| 1399 | { |
| 1400 | tpSirWifiIfaceStat pWifiIfaceStat; |
| 1401 | struct sk_buff *vendor_event; |
| 1402 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1403 | int status; |
| 1404 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1405 | ENTER(); |
| 1406 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1407 | status = wlan_hdd_validate_context(pHddCtx); |
| 1408 | if (0 != status) |
| 1409 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1410 | return; |
| 1411 | } |
| 1412 | /* |
| 1413 | * Allocate a size of 4096 for the interface stats comprising |
| 1414 | * sizeof (tpSirWifiIfaceStat).The size of 4096 is considered |
| 1415 | * assuming that all these fit with in the limit.Please take |
| 1416 | * a call on the limit based on the data requirements on |
| 1417 | * interface statistics. |
| 1418 | */ |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1419 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 1420 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1421 | if (!vendor_event) |
| 1422 | { |
| 1423 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1424 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed") ); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1425 | return; |
| 1426 | } |
| 1427 | |
| 1428 | pWifiIfaceStat = (tpSirWifiIfaceStat) pData; |
| 1429 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1430 | |
| 1431 | if (FALSE == hdd_get_interface_info( pAdapter, |
| 1432 | &pWifiIfaceStat->info)) |
| 1433 | { |
| 1434 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1435 | FL("hdd_get_interface_info get fail") ); |
| 1436 | kfree_skb(vendor_event); |
| 1437 | return; |
| 1438 | } |
| 1439 | |
| 1440 | if (FALSE == put_wifi_iface_stats( pAdapter, pWifiIfaceStat, |
| 1441 | vendor_event)) |
| 1442 | { |
| 1443 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1444 | FL("put_wifi_iface_stats fail") ); |
| 1445 | kfree_skb(vendor_event); |
| 1446 | return; |
| 1447 | } |
| 1448 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1449 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1450 | "WMI_LINK_STATS_IFACE Data"); |
| 1451 | |
| 1452 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1453 | "LL_STATS_IFACE: " |
| 1454 | " Mode %u " |
| 1455 | " MAC %pM " |
| 1456 | " State %u " |
| 1457 | " Roaming %u " |
| 1458 | " capabilities 0x%x " |
| 1459 | " SSID %s " |
| 1460 | " BSSID %pM", |
| 1461 | pWifiIfaceStat->info.mode, |
| 1462 | pWifiIfaceStat->info.macAddr, |
| 1463 | pWifiIfaceStat->info.state, |
| 1464 | pWifiIfaceStat->info.roaming, |
| 1465 | pWifiIfaceStat->info.capabilities, |
| 1466 | pWifiIfaceStat->info.ssid, |
| 1467 | pWifiIfaceStat->info.bssid); |
| 1468 | |
| 1469 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1470 | " AP country str: %c%c%c", |
| 1471 | pWifiIfaceStat->info.apCountryStr[0], |
| 1472 | pWifiIfaceStat->info.apCountryStr[1], |
| 1473 | pWifiIfaceStat->info.apCountryStr[2]); |
| 1474 | |
| 1475 | |
| 1476 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1477 | " Country Str Association: %c%c%c", |
| 1478 | pWifiIfaceStat->info.countryStr[0], |
| 1479 | pWifiIfaceStat->info.countryStr[1], |
| 1480 | pWifiIfaceStat->info.countryStr[2]); |
| 1481 | |
| 1482 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1483 | " beaconRx %u " |
| 1484 | " mgmtRx %u " |
| 1485 | " mgmtActionRx %u " |
| 1486 | " mgmtActionTx %u " |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1487 | " rssiMgmt %d " |
| 1488 | " rssiData %d " |
| 1489 | " rssiAck %d", |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1490 | pWifiIfaceStat->beaconRx, |
| 1491 | pWifiIfaceStat->mgmtRx, |
| 1492 | pWifiIfaceStat->mgmtActionRx, |
| 1493 | pWifiIfaceStat->mgmtActionTx, |
| 1494 | pWifiIfaceStat->rssiMgmt, |
| 1495 | pWifiIfaceStat->rssiData, |
| 1496 | pWifiIfaceStat->rssiAck ); |
| 1497 | |
| 1498 | |
| 1499 | { |
| 1500 | int i; |
| 1501 | for (i = 0 ; i < WIFI_AC_MAX; i ++) |
| 1502 | { |
| 1503 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1504 | |
| 1505 | " %d) LL_STATS IFACE: " |
| 1506 | " ac: %u txMpdu: %u " |
| 1507 | " rxMpdu: %u txMcast: %u " |
| 1508 | " rxMcast: %u rxAmpdu: %u " |
| 1509 | " txAmpdu: %u mpduLost: %u " |
| 1510 | " retries: %u retriesShort: %u " |
| 1511 | " retriesLong: %u contentionTimeMin: %u " |
| 1512 | " contentionTimeMax: %u contentionTimeAvg: %u " |
| 1513 | " contentionNumSamples: %u", |
| 1514 | i, |
| 1515 | pWifiIfaceStat->AccessclassStats[i].ac, |
| 1516 | pWifiIfaceStat->AccessclassStats[i].txMpdu, |
| 1517 | pWifiIfaceStat->AccessclassStats[i].rxMpdu, |
| 1518 | pWifiIfaceStat->AccessclassStats[i].txMcast, |
| 1519 | pWifiIfaceStat->AccessclassStats[i].rxMcast, |
| 1520 | pWifiIfaceStat->AccessclassStats[i].rxAmpdu, |
| 1521 | pWifiIfaceStat->AccessclassStats[i].txAmpdu, |
| 1522 | pWifiIfaceStat->AccessclassStats[i].mpduLost, |
| 1523 | pWifiIfaceStat->AccessclassStats[i].retries, |
| 1524 | pWifiIfaceStat-> |
| 1525 | AccessclassStats[i].retriesShort, |
| 1526 | pWifiIfaceStat->AccessclassStats[i].retriesLong, |
| 1527 | pWifiIfaceStat-> |
| 1528 | AccessclassStats[i].contentionTimeMin, |
| 1529 | pWifiIfaceStat-> |
| 1530 | AccessclassStats[i].contentionTimeMax, |
| 1531 | pWifiIfaceStat-> |
| 1532 | AccessclassStats[i].contentionTimeAvg, |
| 1533 | pWifiIfaceStat-> |
| 1534 | AccessclassStats[i].contentionNumSamples); |
| 1535 | |
| 1536 | } |
| 1537 | } |
| 1538 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1539 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1540 | |
| 1541 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1542 | } |
| 1543 | |
| 1544 | /* |
| 1545 | * hdd_link_layer_process_radio_stats () - This function is called after |
| 1546 | * receiving Link Layer Radio statistics from FW.This function converts |
| 1547 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1548 | * layers. |
| 1549 | */ |
| 1550 | static v_VOID_t hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, |
| 1551 | v_VOID_t *pData) |
| 1552 | { |
| 1553 | int status, i; |
| 1554 | tpSirWifiRadioStat pWifiRadioStat; |
| 1555 | tpSirWifiChannelStats pWifiChannelStats; |
| 1556 | struct sk_buff *vendor_event; |
| 1557 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1558 | struct nlattr *chList; |
| 1559 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1560 | ENTER(); |
| 1561 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1562 | status = wlan_hdd_validate_context(pHddCtx); |
| 1563 | if (0 != status) |
| 1564 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1565 | return; |
| 1566 | } |
| 1567 | pWifiRadioStat = (tpSirWifiRadioStat) pData; |
| 1568 | |
| 1569 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1570 | "LL_STATS_RADIO" |
| 1571 | " radio is %d onTime is %u " |
| 1572 | " txTime is %u rxTime is %u " |
| 1573 | " onTimeScan is %u onTimeNbd is %u " |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1574 | " onTimeEXTScan is %u onTimeRoamScan is %u " |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1575 | " onTimePnoScan is %u onTimeHs20 is %u " |
| 1576 | " numChannels is %u", |
| 1577 | pWifiRadioStat->radio, pWifiRadioStat->onTime, |
| 1578 | pWifiRadioStat->txTime, pWifiRadioStat->rxTime, |
| 1579 | pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1580 | pWifiRadioStat->onTimeEXTScan, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1581 | pWifiRadioStat->onTimeRoamScan, |
| 1582 | pWifiRadioStat->onTimePnoScan, |
| 1583 | pWifiRadioStat->onTimeHs20, |
| 1584 | pWifiRadioStat->numChannels); |
| 1585 | /* |
| 1586 | * Allocate a size of 4096 for the Radio stats comprising |
| 1587 | * sizeof (tSirWifiRadioStat) + numChannels * sizeof |
| 1588 | * (tSirWifiChannelStats).Each channel data is put with an |
| 1589 | * NL attribute.The size of 4096 is considered assuming that |
| 1590 | * number of channels shall not exceed beyond 60 with the |
| 1591 | * sizeof (tSirWifiChannelStats) being 24 bytes. |
| 1592 | */ |
| 1593 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1594 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 1595 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1596 | if (!vendor_event) |
| 1597 | { |
| 1598 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1599 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed") ); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1600 | return; |
| 1601 | } |
| 1602 | |
| 1603 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1604 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 1605 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_RADIO) || |
| 1606 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1607 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID, |
| 1608 | pWifiRadioStat->radio) || |
| 1609 | nla_put_u32(vendor_event, |
| 1610 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME, |
| 1611 | pWifiRadioStat->onTime) || |
| 1612 | nla_put_u32(vendor_event, |
| 1613 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME, |
| 1614 | pWifiRadioStat->txTime) || |
| 1615 | nla_put_u32(vendor_event, |
| 1616 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME, |
| 1617 | pWifiRadioStat->rxTime) || |
| 1618 | nla_put_u32(vendor_event, |
| 1619 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN, |
| 1620 | pWifiRadioStat->onTimeScan) || |
| 1621 | nla_put_u32(vendor_event, |
| 1622 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD, |
| 1623 | pWifiRadioStat->onTimeNbd) || |
| 1624 | nla_put_u32(vendor_event, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1625 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_EXTSCAN, |
| 1626 | pWifiRadioStat->onTimeEXTScan)|| |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1627 | nla_put_u32(vendor_event, |
| 1628 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN, |
| 1629 | pWifiRadioStat->onTimeRoamScan) || |
| 1630 | nla_put_u32(vendor_event, |
| 1631 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN, |
| 1632 | pWifiRadioStat->onTimePnoScan) || |
| 1633 | nla_put_u32(vendor_event, |
| 1634 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20, |
| 1635 | pWifiRadioStat->onTimeHs20) || |
| 1636 | nla_put_u32(vendor_event, |
| 1637 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS, |
| 1638 | pWifiRadioStat->numChannels)) |
| 1639 | { |
| 1640 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1641 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1642 | kfree_skb(vendor_event); |
| 1643 | return ; |
| 1644 | } |
| 1645 | |
| 1646 | chList = nla_nest_start(vendor_event, |
| 1647 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1648 | if(!chList) |
| 1649 | { |
| 1650 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1651 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO put fail", |
| 1652 | __func__); |
| 1653 | kfree_skb(vendor_event); |
| 1654 | return; |
| 1655 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1656 | for (i = 0; i < pWifiRadioStat->numChannels; i++) |
| 1657 | { |
| 1658 | struct nlattr *chInfo; |
| 1659 | |
| 1660 | pWifiChannelStats = (tpSirWifiChannelStats) ((uint8*) |
| 1661 | pWifiRadioStat->channels + |
| 1662 | (i * sizeof(tSirWifiChannelStats))); |
| 1663 | |
| 1664 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1665 | " %d) Channel Info" |
| 1666 | " width is %u " |
| 1667 | " CenterFreq %u " |
| 1668 | " CenterFreq0 %u " |
| 1669 | " CenterFreq1 %u " |
| 1670 | " onTime %u " |
| 1671 | " ccaBusyTime %u", |
| 1672 | i, |
| 1673 | pWifiChannelStats->channel.width, |
| 1674 | pWifiChannelStats->channel.centerFreq, |
| 1675 | pWifiChannelStats->channel.centerFreq0, |
| 1676 | pWifiChannelStats->channel.centerFreq1, |
| 1677 | pWifiChannelStats->onTime, |
| 1678 | pWifiChannelStats->ccaBusyTime); |
| 1679 | |
| 1680 | |
| 1681 | chInfo = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1682 | if(!chInfo) |
| 1683 | { |
| 1684 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1685 | "%s: failed to put chInfo", |
| 1686 | __func__); |
| 1687 | kfree_skb(vendor_event); |
| 1688 | return; |
| 1689 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1690 | |
| 1691 | if (nla_put_u32(vendor_event, |
| 1692 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH, |
| 1693 | pWifiChannelStats->channel.width) || |
| 1694 | nla_put_u32(vendor_event, |
| 1695 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ, |
| 1696 | pWifiChannelStats->channel.centerFreq) || |
| 1697 | nla_put_u32(vendor_event, |
| 1698 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ0, |
| 1699 | pWifiChannelStats->channel.centerFreq0) || |
| 1700 | nla_put_u32(vendor_event, |
| 1701 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ1, |
| 1702 | pWifiChannelStats->channel.centerFreq1) || |
| 1703 | nla_put_u32(vendor_event, |
| 1704 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME, |
| 1705 | pWifiChannelStats->onTime) || |
| 1706 | nla_put_u32(vendor_event, |
| 1707 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME, |
| 1708 | pWifiChannelStats->ccaBusyTime)) |
| 1709 | { |
| 1710 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1711 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1712 | kfree_skb(vendor_event); |
| 1713 | return ; |
| 1714 | } |
| 1715 | nla_nest_end(vendor_event, chInfo); |
| 1716 | } |
| 1717 | nla_nest_end(vendor_event, chList); |
| 1718 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1719 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1720 | |
| 1721 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1722 | return; |
| 1723 | } |
| 1724 | |
| 1725 | /* |
| 1726 | * hdd_link_layer_stats_ind_callback () - This function is called after |
| 1727 | * receiving Link Layer indications from FW.This callback converts the firmware |
| 1728 | * data to the NL data and send the same to the kernel/upper layers. |
| 1729 | */ |
| 1730 | static void hdd_link_layer_stats_ind_callback ( void *pCtx, |
| 1731 | int indType, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1732 | void *pRsp, u8 *macAddr) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1733 | { |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1734 | hdd_context_t *pHddCtx = (hdd_context_t *)pCtx; |
| 1735 | hdd_adapter_t *pAdapter = NULL; |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1736 | struct hdd_ll_stats_context *context; |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1737 | tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults)pRsp; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1738 | int status; |
| 1739 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1740 | ENTER(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1741 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1742 | status = wlan_hdd_validate_context(pHddCtx); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1743 | if (0 != status) |
| 1744 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1745 | return; |
| 1746 | } |
| 1747 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1748 | pAdapter = hdd_get_adapter_by_macaddr(pHddCtx, macAddr); |
| 1749 | if (NULL == pAdapter) |
| 1750 | { |
| 1751 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1752 | FL(" MAC address %pM does not exist with host"), |
| 1753 | macAddr); |
| 1754 | return; |
| 1755 | } |
| 1756 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1757 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1758 | "%s: Interface: %s LLStats indType: %d", __func__, |
| 1759 | pAdapter->dev->name, indType); |
| 1760 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1761 | switch (indType) |
| 1762 | { |
| 1763 | case SIR_HAL_LL_STATS_RESULTS_RSP: |
| 1764 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1765 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1766 | FL("RESPONSE SIR_HAL_LL_STATS_RESULTS_RSP") ); |
| 1767 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1768 | "LL_STATS RESULTS RESPONSE paramID = 0x%x", |
| 1769 | linkLayerStatsResults->paramId); |
| 1770 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1771 | "LL_STATS RESULTS RESPONSE ifaceId = %u MAC: %pM", |
| 1772 | linkLayerStatsResults->ifaceId, macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1773 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1774 | "LL_STATS RESULTS RESPONSE respId = %u", |
| 1775 | linkLayerStatsResults->respId); |
| 1776 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1777 | "LL_STATS RESULTS RESPONSE moreResultToFollow = %u", |
| 1778 | linkLayerStatsResults->moreResultToFollow); |
| 1779 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1780 | "LL_STATS RESULTS RESPONSE result = %p", |
| 1781 | linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1782 | spin_lock(&hdd_context_lock); |
| 1783 | context = &pHddCtx->ll_stats_context; |
| 1784 | /* validate response received from target */ |
| 1785 | if ((context->request_id != linkLayerStatsResults->respId) || |
| 1786 | !(context->request_bitmap & linkLayerStatsResults->paramId)) |
| 1787 | { |
| 1788 | spin_unlock(&hdd_context_lock); |
| 1789 | hddLog(LOGE, |
| 1790 | FL("Error : Request id %d response id %d request bitmap 0x%x" |
| 1791 | "response bitmap 0x%x"), |
| 1792 | context->request_id, linkLayerStatsResults->respId, |
| 1793 | context->request_bitmap, linkLayerStatsResults->paramId); |
| 1794 | return; |
| 1795 | } |
| 1796 | spin_unlock(&hdd_context_lock); |
| 1797 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1798 | if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO ) |
| 1799 | { |
| 1800 | hdd_link_layer_process_radio_stats(pAdapter, |
| 1801 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1802 | spin_lock(&hdd_context_lock); |
| 1803 | context->request_bitmap &= ~(WMI_LINK_STATS_RADIO); |
| 1804 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1805 | } |
| 1806 | else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE ) |
| 1807 | { |
| 1808 | hdd_link_layer_process_iface_stats(pAdapter, |
| 1809 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1810 | spin_lock(&hdd_context_lock); |
| 1811 | context->request_bitmap &= ~(WMI_LINK_STATS_IFACE); |
| 1812 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1813 | } |
| 1814 | else if ( linkLayerStatsResults->paramId & |
| 1815 | WMI_LINK_STATS_ALL_PEER ) |
| 1816 | { |
| 1817 | hdd_link_layer_process_peer_stats(pAdapter, |
| 1818 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1819 | spin_lock(&hdd_context_lock); |
| 1820 | context->request_bitmap &= ~(WMI_LINK_STATS_ALL_PEER); |
| 1821 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1822 | } /* WMI_LINK_STATS_ALL_PEER */ |
| 1823 | else |
| 1824 | { |
| 1825 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1826 | FL("INVALID LL_STATS_NOTIFY RESPONSE ***********")); |
| 1827 | } |
| 1828 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1829 | spin_lock(&hdd_context_lock); |
| 1830 | /* complete response event if all requests are completed */ |
| 1831 | if (0 == context->request_bitmap) |
| 1832 | complete(&context->response_event); |
| 1833 | spin_unlock(&hdd_context_lock); |
| 1834 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1835 | break; |
| 1836 | } |
| 1837 | default: |
| 1838 | hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType); |
| 1839 | break; |
| 1840 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1841 | |
| 1842 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1843 | return; |
| 1844 | } |
| 1845 | |
| 1846 | const struct |
| 1847 | nla_policy |
| 1848 | qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX +1] = |
| 1849 | { |
| 1850 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = |
| 1851 | { .type = NLA_U32 }, |
| 1852 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = |
| 1853 | { .type = NLA_U32 }, |
| 1854 | }; |
| 1855 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1856 | static int __wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1857 | struct wireless_dev *wdev, |
| 1858 | const void *data, |
| 1859 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1860 | { |
| 1861 | int status; |
| 1862 | 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] | 1863 | tSirLLStatsSetReq linkLayerStatsSetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1864 | struct net_device *dev = wdev->netdev; |
| 1865 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1866 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1867 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1868 | ENTER(); |
| 1869 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1870 | status = wlan_hdd_validate_context(pHddCtx); |
| 1871 | if (0 != status) |
| 1872 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1873 | return -EINVAL; |
| 1874 | } |
| 1875 | |
| 1876 | if (NULL == pAdapter) |
| 1877 | { |
| 1878 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1879 | FL("HDD adapter is Null")); |
| 1880 | return -ENODEV; |
| 1881 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1882 | /* check the LLStats Capability */ |
| 1883 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1884 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1885 | { |
| 1886 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1887 | FL("Link Layer Statistics not supported by Firmware")); |
| 1888 | return -EINVAL; |
| 1889 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1890 | |
| 1891 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, |
| 1892 | (struct nlattr *)data, |
| 1893 | data_len, qca_wlan_vendor_ll_set_policy)) |
| 1894 | { |
| 1895 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1896 | return -EINVAL; |
| 1897 | } |
| 1898 | if (!tb_vendor |
| 1899 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]) |
| 1900 | { |
| 1901 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MPDU size Not present")); |
| 1902 | return -EINVAL; |
| 1903 | } |
| 1904 | if (!tb_vendor[ |
| 1905 | QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]) |
| 1906 | { |
| 1907 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Stats Gathering Not Present")); |
| 1908 | return -EINVAL; |
| 1909 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1910 | // 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] | 1911 | linkLayerStatsSetReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1912 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1913 | linkLayerStatsSetReq.mpduSizeThreshold = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1914 | nla_get_u32( |
| 1915 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]); |
| 1916 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1917 | linkLayerStatsSetReq.aggressiveStatisticsGathering = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1918 | nla_get_u32( |
| 1919 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]); |
| 1920 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1921 | vos_mem_copy(linkLayerStatsSetReq.macAddr, |
| 1922 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1923 | |
| 1924 | |
| 1925 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1926 | "LL_STATS_SET reqId = %d", linkLayerStatsSetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1927 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1928 | "LL_STATS_SET MAC = %pM", linkLayerStatsSetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1929 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1930 | "LL_STATS_SET mpduSizeThreshold = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1931 | linkLayerStatsSetReq.mpduSizeThreshold); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1932 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1933 | "LL_STATS_SET aggressive Statistics Gathering = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1934 | linkLayerStatsSetReq.aggressiveStatisticsGathering); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1935 | |
| 1936 | if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB( |
| 1937 | pHddCtx->hHal, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1938 | hdd_link_layer_stats_ind_callback)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1939 | { |
| 1940 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1941 | "sme_SetLinkLayerStatsIndCB Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1942 | return -EINVAL; |
| 1943 | |
| 1944 | } |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1945 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1946 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1947 | &linkLayerStatsSetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1948 | { |
| 1949 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1950 | "sme_LLStatsSetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1951 | return -EINVAL; |
| 1952 | } |
| 1953 | |
| 1954 | pAdapter->isLinkLayerStatsSet = 1; |
| 1955 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1956 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1957 | return 0; |
| 1958 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1959 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1960 | struct wireless_dev *wdev, |
| 1961 | const void *data, |
| 1962 | int data_len) |
| 1963 | { |
| 1964 | int ret = 0; |
| 1965 | |
| 1966 | vos_ssr_protect(__func__); |
| 1967 | ret = __wlan_hdd_cfg80211_ll_stats_set(wiphy, wdev, data, data_len); |
| 1968 | vos_ssr_unprotect(__func__); |
| 1969 | |
| 1970 | return ret; |
| 1971 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1972 | |
| 1973 | const struct |
| 1974 | nla_policy |
| 1975 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 1976 | { |
| 1977 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 1978 | * command. When reporting |
| 1979 | * the stats results, the driver uses the same value to indicate |
| 1980 | * which GET request the results |
| 1981 | * correspond to. |
| 1982 | */ |
| 1983 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 1984 | |
| 1985 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 1986 | requested for retrieval */ |
| 1987 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 1988 | }; |
| 1989 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1990 | static int __wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1991 | struct wireless_dev *wdev, |
| 1992 | const void *data, |
| 1993 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1994 | { |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1995 | unsigned long rc; |
| 1996 | struct hdd_ll_stats_context *context; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1997 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1998 | 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] | 1999 | tSirLLStatsGetReq linkLayerStatsGetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2000 | struct net_device *dev = wdev->netdev; |
| 2001 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 2002 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2003 | int status; |
| 2004 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2005 | ENTER(); |
| 2006 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2007 | status = wlan_hdd_validate_context(pHddCtx); |
| 2008 | if (0 != status) |
| 2009 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2010 | return -EINVAL ; |
| 2011 | } |
| 2012 | |
| 2013 | if (NULL == pAdapter) |
| 2014 | { |
| 2015 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2016 | "%s: HDD adapter is Null", __func__); |
| 2017 | return -ENODEV; |
| 2018 | } |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 2019 | |
| 2020 | if (pHddStaCtx == NULL) |
| 2021 | { |
| 2022 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2023 | "%s: HddStaCtx is Null", __func__); |
| 2024 | return -ENODEV; |
| 2025 | } |
| 2026 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2027 | /* check the LLStats Capability */ |
| 2028 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 2029 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 2030 | { |
| 2031 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2032 | FL("Link Layer Statistics not supported by Firmware")); |
| 2033 | return -EINVAL; |
| 2034 | } |
| 2035 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2036 | |
| 2037 | if (!pAdapter->isLinkLayerStatsSet) |
| 2038 | { |
| 2039 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2040 | "%s: isLinkLayerStatsSet : %d", |
| 2041 | __func__, pAdapter->isLinkLayerStatsSet); |
| 2042 | return -EINVAL; |
| 2043 | } |
| 2044 | |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 2045 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 2046 | { |
| 2047 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2048 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 2049 | return -EBUSY; |
| 2050 | } |
| 2051 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2052 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 2053 | (struct nlattr *)data, |
| 2054 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 2055 | { |
| 2056 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 2057 | return -EINVAL; |
| 2058 | } |
| 2059 | |
| 2060 | if (!tb_vendor |
| 2061 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 2062 | { |
| 2063 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 2064 | return -EINVAL; |
| 2065 | } |
| 2066 | |
| 2067 | if (!tb_vendor |
| 2068 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 2069 | { |
| 2070 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 2071 | return -EINVAL; |
| 2072 | } |
| 2073 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2074 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2075 | linkLayerStatsGetReq.reqId = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2076 | nla_get_u32( tb_vendor[ |
| 2077 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2078 | linkLayerStatsGetReq.paramIdMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2079 | nla_get_u32( tb_vendor[ |
| 2080 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 2081 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2082 | vos_mem_copy(linkLayerStatsGetReq.macAddr, |
| 2083 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2084 | |
| 2085 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2086 | "LL_STATS_GET reqId = %d", linkLayerStatsGetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2087 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2088 | "LL_STATS_GET MAC = %pM", linkLayerStatsGetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2089 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2090 | "LL_STATS_GET paramIdMask = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2091 | linkLayerStatsGetReq.paramIdMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2092 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2093 | spin_lock(&hdd_context_lock); |
| 2094 | context = &pHddCtx->ll_stats_context; |
| 2095 | context->request_id = linkLayerStatsGetReq.reqId; |
| 2096 | context->request_bitmap = linkLayerStatsGetReq.paramIdMask; |
| 2097 | INIT_COMPLETION(context->response_event); |
| 2098 | spin_unlock(&hdd_context_lock); |
| 2099 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2100 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2101 | &linkLayerStatsGetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2102 | { |
| 2103 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2104 | "sme_LLStatsGetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2105 | return -EINVAL; |
| 2106 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2107 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2108 | rc = wait_for_completion_timeout(&context->response_event, |
| 2109 | msecs_to_jiffies(WLAN_WAIT_TIME_LL_STATS)); |
| 2110 | if (!rc) |
| 2111 | { |
| 2112 | hddLog(LOGE, |
| 2113 | FL("Target response timed out request id %d request bitmap 0x%x"), |
| 2114 | context->request_id, context->request_bitmap); |
| 2115 | return -ETIMEDOUT; |
| 2116 | } |
| 2117 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2118 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2119 | return 0; |
| 2120 | } |
| 2121 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2122 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 2123 | struct wireless_dev *wdev, |
| 2124 | const void *data, |
| 2125 | int data_len) |
| 2126 | { |
| 2127 | int ret = 0; |
| 2128 | |
| 2129 | vos_ssr_protect(__func__); |
| 2130 | ret = __wlan_hdd_cfg80211_ll_stats_get(wiphy, wdev, data, data_len); |
| 2131 | vos_ssr_unprotect(__func__); |
| 2132 | |
| 2133 | return ret; |
| 2134 | } |
| 2135 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2136 | const struct |
| 2137 | nla_policy |
| 2138 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 2139 | { |
| 2140 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 2141 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 2142 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 2143 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 2144 | }; |
| 2145 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2146 | static int __wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 2147 | struct wireless_dev *wdev, |
| 2148 | const void *data, |
| 2149 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2150 | { |
| 2151 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 2152 | 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] | 2153 | tSirLLStatsClearReq linkLayerStatsClearReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2154 | struct net_device *dev = wdev->netdev; |
| 2155 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2156 | u32 statsClearReqMask; |
| 2157 | u8 stopReq; |
| 2158 | int status; |
| 2159 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2160 | ENTER(); |
| 2161 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2162 | status = wlan_hdd_validate_context(pHddCtx); |
| 2163 | if (0 != status) |
| 2164 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2165 | return -EINVAL; |
| 2166 | } |
| 2167 | |
| 2168 | if (NULL == pAdapter) |
| 2169 | { |
| 2170 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2171 | "%s: HDD adapter is Null", __func__); |
| 2172 | return -ENODEV; |
| 2173 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2174 | /* check the LLStats Capability */ |
| 2175 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 2176 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 2177 | { |
| 2178 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2179 | FL("Enable LLStats Capability")); |
| 2180 | return -EINVAL; |
| 2181 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2182 | |
| 2183 | if (!pAdapter->isLinkLayerStatsSet) |
| 2184 | { |
| 2185 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2186 | "%s: isLinkLayerStatsSet : %d", |
| 2187 | __func__, pAdapter->isLinkLayerStatsSet); |
| 2188 | return -EINVAL; |
| 2189 | } |
| 2190 | |
| 2191 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 2192 | (struct nlattr *)data, |
| 2193 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 2194 | { |
| 2195 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 2196 | return -EINVAL; |
| 2197 | } |
| 2198 | |
| 2199 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 2200 | |
| 2201 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 2202 | { |
| 2203 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 2204 | return -EINVAL; |
| 2205 | |
| 2206 | } |
| 2207 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2208 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2209 | statsClearReqMask = linkLayerStatsClearReq.statsClearReqMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2210 | nla_get_u32( |
| 2211 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 2212 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2213 | stopReq = linkLayerStatsClearReq.stopReq = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2214 | nla_get_u8( |
| 2215 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 2216 | |
| 2217 | // 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] | 2218 | linkLayerStatsClearReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2219 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2220 | vos_mem_copy(linkLayerStatsClearReq.macAddr, |
| 2221 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2222 | |
| 2223 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2224 | "LL_STATS_CLEAR reqId = %d", linkLayerStatsClearReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2225 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2226 | "LL_STATS_CLEAR MAC = %pM", linkLayerStatsClearReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2227 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2228 | "LL_STATS_CLEAR statsClearReqMask = 0x%X", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2229 | linkLayerStatsClearReq.statsClearReqMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2230 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2231 | "LL_STATS_CLEAR stopReq = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2232 | linkLayerStatsClearReq.stopReq); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2233 | |
| 2234 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2235 | &linkLayerStatsClearReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2236 | { |
| 2237 | struct sk_buff *temp_skbuff; |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 2238 | hdd_station_ctx_t *pHddStaCtx; |
| 2239 | |
| 2240 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2241 | if (VOS_STATUS_SUCCESS != |
| 2242 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 2243 | pHddStaCtx->conn_info.staId[0], statsClearReqMask)) |
| 2244 | { |
| 2245 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2246 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 2247 | return -EINVAL; |
| 2248 | } |
| 2249 | if ((statsClearReqMask & WIFI_STATS_IFACE_AC) || |
| 2250 | (statsClearReqMask & WIFI_STATS_IFACE)) { |
| 2251 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 2252 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 2253 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 2254 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 2255 | } |
| 2256 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2257 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 2258 | 2 * sizeof(u32) + |
| 2259 | NLMSG_HDRLEN); |
| 2260 | |
| 2261 | if (temp_skbuff != NULL) |
| 2262 | { |
| 2263 | |
| 2264 | if (nla_put_u32(temp_skbuff, |
| 2265 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 2266 | statsClearReqMask) || |
| 2267 | nla_put_u32(temp_skbuff, |
| 2268 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 2269 | stopReq)) |
| 2270 | { |
| 2271 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 2272 | kfree_skb(temp_skbuff); |
| 2273 | return -EINVAL; |
| 2274 | } |
| 2275 | /* If the ask is to stop the stats collection as part of clear |
| 2276 | * (stopReq = 1) , ensure that no further requests of get |
| 2277 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 2278 | * However it the stopReq as part of the clear request is 0 , |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2279 | * the request to get the statistics are honoured as in this |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2280 | * case the firmware is just asked to clear the statistics. |
| 2281 | */ |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2282 | if (linkLayerStatsClearReq.stopReq == 1) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2283 | pAdapter->isLinkLayerStatsSet = 0; |
| 2284 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 2285 | } |
| 2286 | return -ENOMEM; |
| 2287 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2288 | |
| 2289 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2290 | return -EINVAL; |
| 2291 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2292 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 2293 | struct wireless_dev *wdev, |
| 2294 | const void *data, |
| 2295 | int data_len) |
| 2296 | { |
| 2297 | int ret = 0; |
| 2298 | |
| 2299 | vos_ssr_protect(__func__); |
| 2300 | ret = __wlan_hdd_cfg80211_ll_stats_clear(wiphy, wdev, data, data_len); |
| 2301 | vos_ssr_unprotect(__func__); |
| 2302 | |
| 2303 | return ret; |
| 2304 | |
| 2305 | |
| 2306 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2307 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 2308 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2309 | #ifdef WLAN_FEATURE_EXTSCAN |
| 2310 | static const struct nla_policy |
| 2311 | wlan_hdd_extscan_config_policy |
| 2312 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = |
| 2313 | { |
| 2314 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = |
| 2315 | { .type = NLA_U32 }, |
| 2316 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = |
| 2317 | { .type = NLA_U32 }, |
| 2318 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 }, |
| 2319 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = |
| 2320 | { .type = NLA_U32 }, |
| 2321 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = { .type = NLA_U8 }, |
| 2322 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = { .type = NLA_U8 }, |
| 2323 | |
| 2324 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = { .type = NLA_U8 }, |
| 2325 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = { .type = NLA_U8 }, |
| 2326 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 }, |
| 2327 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = |
| 2328 | { .type = NLA_U8 }, |
| 2329 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = |
| 2330 | { .type = NLA_U32 }, |
| 2331 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = |
| 2332 | { .type = NLA_U32 }, |
| 2333 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = |
| 2334 | { .type = NLA_U32 }, |
| 2335 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD] = |
| 2336 | { .type = NLA_U8 }, |
| 2337 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = |
| 2338 | { .type = NLA_U8 }, |
| 2339 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = |
| 2340 | { .type = NLA_U8 }, |
| 2341 | |
| 2342 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = |
| 2343 | { .type = NLA_U32 }, |
| 2344 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = |
| 2345 | { .type = NLA_UNSPEC }, |
| 2346 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = |
| 2347 | { .type = NLA_S32 }, |
| 2348 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = |
| 2349 | { .type = NLA_S32 }, |
| 2350 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = |
| 2351 | { .type = NLA_U32 }, |
| 2352 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = |
| 2353 | { .type = NLA_U32 }, |
| 2354 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE] = |
| 2355 | { .type = NLA_U32 }, |
| 2356 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE] |
| 2357 | = { .type = NLA_U32 }, |
| 2358 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING] = |
| 2359 | { .type = NLA_U32 }, |
| 2360 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP] = { .type = |
| 2361 | NLA_U32 }, |
| 2362 | }; |
| 2363 | |
| 2364 | static void wlan_hdd_cfg80211_extscan_get_capabilities_ind(void *ctx, void *pMsg) |
| 2365 | { |
| 2366 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2367 | struct sk_buff *skb = NULL; |
| 2368 | tpSirEXTScanCapabilitiesEvent pData = |
| 2369 | (tpSirEXTScanCapabilitiesEvent) pMsg; |
| 2370 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2371 | ENTER(); |
| 2372 | |
| 2373 | if (wlan_hdd_validate_context(pHddCtx)) |
| 2374 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2375 | return; |
| 2376 | } |
| 2377 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2378 | if (!pMsg) |
| 2379 | { |
| 2380 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2381 | return; |
| 2382 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2383 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 2384 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 2385 | NULL, |
| 2386 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2387 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2388 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES_INDEX, |
| 2389 | GFP_KERNEL); |
| 2390 | |
| 2391 | if (!skb) { |
| 2392 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2393 | FL("cfg80211_vendor_event_alloc failed")); |
| 2394 | return; |
| 2395 | } |
| 2396 | |
| 2397 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2398 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan cache size (%u)", pData->scanCacheSize); |
| 2399 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan buckets (%u)", pData->scanBuckets); |
| 2400 | hddLog(VOS_TRACE_LEVEL_INFO, "Max AP per scan (%u)", pData->maxApPerScan); |
| 2401 | hddLog(VOS_TRACE_LEVEL_INFO, "maxRssiSampleSize (%u)", |
| 2402 | pData->maxRssiSampleSize); |
| 2403 | hddLog(VOS_TRACE_LEVEL_INFO, "maxScanReportingThreshold (%u)", |
| 2404 | pData->maxScanReportingThreshold); |
| 2405 | hddLog(VOS_TRACE_LEVEL_INFO, "maxHotlistAPs (%u)", pData->maxHotlistAPs); |
| 2406 | hddLog(VOS_TRACE_LEVEL_INFO, "maxSignificantWifiChangeAPs (%u)", |
| 2407 | pData->maxSignificantWifiChangeAPs); |
| 2408 | hddLog(VOS_TRACE_LEVEL_INFO, "maxBsidHistoryEntries (%u)", |
| 2409 | pData->maxBsidHistoryEntries); |
| 2410 | |
| 2411 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2412 | pData->requestId) || |
| 2413 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status) || |
| 2414 | nla_put_u32(skb, |
| 2415 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE, |
| 2416 | pData->scanCacheSize) || |
| 2417 | nla_put_u32(skb, |
| 2418 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS, |
| 2419 | pData->scanBuckets) || |
| 2420 | nla_put_u32(skb, |
| 2421 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN, |
| 2422 | pData->maxApPerScan) || |
| 2423 | nla_put_u32(skb, |
| 2424 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE, |
| 2425 | pData->maxRssiSampleSize) || |
| 2426 | nla_put_u32(skb, |
| 2427 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD, |
| 2428 | pData->maxScanReportingThreshold) || |
| 2429 | nla_put_u32(skb, |
| 2430 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_APS, |
| 2431 | pData->maxHotlistAPs) || |
| 2432 | nla_put_u32(skb, |
| 2433 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS, |
| 2434 | pData->maxSignificantWifiChangeAPs) || |
| 2435 | nla_put_u32(skb, |
| 2436 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES, |
| 2437 | pData->maxBsidHistoryEntries)) { |
| 2438 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2439 | goto nla_put_failure; |
| 2440 | } |
| 2441 | |
| 2442 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2443 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2444 | return; |
| 2445 | |
| 2446 | nla_put_failure: |
| 2447 | kfree_skb(skb); |
| 2448 | return; |
| 2449 | } |
| 2450 | |
| 2451 | |
| 2452 | static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg) |
| 2453 | { |
| 2454 | tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg; |
| 2455 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2456 | struct sk_buff *skb = NULL; |
| 2457 | tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal ); |
| 2458 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2459 | ENTER(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2460 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2461 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2462 | return; |
| 2463 | } |
| 2464 | if (!pMsg) |
| 2465 | { |
| 2466 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2467 | return; |
| 2468 | } |
| 2469 | |
| 2470 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 2471 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 2472 | NULL, |
| 2473 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2474 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2475 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START_INDEX, |
| 2476 | GFP_KERNEL); |
| 2477 | |
| 2478 | if (!skb) { |
| 2479 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2480 | FL("cfg80211_vendor_event_alloc failed")); |
| 2481 | return; |
| 2482 | } |
| 2483 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2484 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2485 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2486 | |
| 2487 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2488 | pData->requestId) || |
| 2489 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2490 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2491 | goto nla_put_failure; |
| 2492 | } |
| 2493 | |
| 2494 | /* |
| 2495 | * Store the Request ID for comparing with the requestID obtained |
| 2496 | * in other requests.HDD shall return a failure is the extscan_stop |
| 2497 | * request is issued with a different requestId as that of the |
| 2498 | * extscan_start request. Also, This requestId shall be used while |
| 2499 | * indicating the full scan results to the upper layers. |
| 2500 | * The requestId is stored with the assumption that the firmware |
| 2501 | * shall return the ext scan start request's requestId in ext scan |
| 2502 | * start response. |
| 2503 | */ |
| 2504 | if (pData->status == 0) |
| 2505 | pMac->sme.extScanStartReqId = pData->requestId; |
| 2506 | |
| 2507 | |
| 2508 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2509 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2510 | return; |
| 2511 | |
| 2512 | nla_put_failure: |
| 2513 | kfree_skb(skb); |
| 2514 | return; |
| 2515 | } |
| 2516 | |
| 2517 | |
| 2518 | static void wlan_hdd_cfg80211_extscan_stop_rsp(void *ctx, void *pMsg) |
| 2519 | { |
| 2520 | tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg; |
| 2521 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2522 | struct sk_buff *skb = NULL; |
| 2523 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2524 | ENTER(); |
| 2525 | |
| 2526 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2527 | return; |
| 2528 | } |
| 2529 | if (!pMsg) |
| 2530 | { |
| 2531 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2532 | return; |
| 2533 | } |
| 2534 | |
| 2535 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 2536 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 2537 | NULL, |
| 2538 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2539 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2540 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP_INDEX, |
| 2541 | GFP_KERNEL); |
| 2542 | |
| 2543 | if (!skb) { |
| 2544 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2545 | FL("cfg80211_vendor_event_alloc failed")); |
| 2546 | return; |
| 2547 | } |
| 2548 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2549 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2550 | |
| 2551 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2552 | pData->requestId) || |
| 2553 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2554 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2555 | goto nla_put_failure; |
| 2556 | } |
| 2557 | |
| 2558 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2559 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2560 | return; |
| 2561 | |
| 2562 | nla_put_failure: |
| 2563 | kfree_skb(skb); |
| 2564 | return; |
| 2565 | } |
| 2566 | |
| 2567 | |
| 2568 | static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx, |
| 2569 | void *pMsg) |
| 2570 | { |
| 2571 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2572 | struct sk_buff *skb = NULL; |
| 2573 | tpSirEXTScanSetBssidHotListRspParams pData = |
| 2574 | (tpSirEXTScanSetBssidHotListRspParams) pMsg; |
| 2575 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2576 | ENTER(); |
| 2577 | |
| 2578 | if (wlan_hdd_validate_context(pHddCtx)){ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2579 | return; |
| 2580 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2581 | if (!pMsg) |
| 2582 | { |
| 2583 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2584 | return; |
| 2585 | } |
| 2586 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2587 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 2588 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 2589 | NULL, |
| 2590 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2591 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2592 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST_INDEX, |
| 2593 | GFP_KERNEL); |
| 2594 | |
| 2595 | if (!skb) { |
| 2596 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2597 | FL("cfg80211_vendor_event_alloc failed")); |
| 2598 | return; |
| 2599 | } |
| 2600 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2601 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2602 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2603 | |
| 2604 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2605 | pData->requestId) || |
| 2606 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2607 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2608 | goto nla_put_failure; |
| 2609 | } |
| 2610 | |
| 2611 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2612 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2613 | return; |
| 2614 | |
| 2615 | nla_put_failure: |
| 2616 | kfree_skb(skb); |
| 2617 | return; |
| 2618 | } |
| 2619 | |
| 2620 | static void wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(void *ctx, |
| 2621 | void *pMsg) |
| 2622 | { |
| 2623 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2624 | struct sk_buff *skb = NULL; |
| 2625 | tpSirEXTScanResetBssidHotlistRspParams pData = |
| 2626 | (tpSirEXTScanResetBssidHotlistRspParams) pMsg; |
| 2627 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2628 | ENTER(); |
| 2629 | |
| 2630 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2631 | return; |
| 2632 | } |
| 2633 | if (!pMsg) |
| 2634 | { |
| 2635 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2636 | return; |
| 2637 | } |
| 2638 | |
| 2639 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 2640 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 2641 | NULL, |
| 2642 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2643 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2644 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST_INDEX, |
| 2645 | GFP_KERNEL); |
| 2646 | |
| 2647 | if (!skb) { |
| 2648 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2649 | FL("cfg80211_vendor_event_alloc failed")); |
| 2650 | return; |
| 2651 | } |
| 2652 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2653 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2654 | |
| 2655 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2656 | pData->requestId) || |
| 2657 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2658 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2659 | goto nla_put_failure; |
| 2660 | } |
| 2661 | |
| 2662 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2663 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2664 | return; |
| 2665 | |
| 2666 | nla_put_failure: |
| 2667 | kfree_skb(skb); |
| 2668 | return; |
| 2669 | } |
| 2670 | |
| 2671 | |
| 2672 | static void wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(void *ctx, |
| 2673 | void *pMsg) |
| 2674 | { |
| 2675 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2676 | struct sk_buff *skb = NULL; |
| 2677 | tpSirEXTScanSetSignificantChangeRspParams pData = |
| 2678 | (tpSirEXTScanSetSignificantChangeRspParams) pMsg; |
| 2679 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2680 | ENTER(); |
| 2681 | |
| 2682 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2683 | return; |
| 2684 | } |
| 2685 | if (!pMsg) |
| 2686 | { |
| 2687 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2688 | return; |
| 2689 | } |
| 2690 | |
| 2691 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 2692 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 2693 | NULL, |
| 2694 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2695 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2696 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE_INDEX, |
| 2697 | GFP_KERNEL); |
| 2698 | |
| 2699 | if (!skb) { |
| 2700 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2701 | FL("cfg80211_vendor_event_alloc failed")); |
| 2702 | return; |
| 2703 | } |
| 2704 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2705 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2706 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2707 | |
| 2708 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2709 | pData->requestId) || |
| 2710 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2711 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2712 | goto nla_put_failure; |
| 2713 | } |
| 2714 | |
| 2715 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2716 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2717 | return; |
| 2718 | |
| 2719 | nla_put_failure: |
| 2720 | kfree_skb(skb); |
| 2721 | return; |
| 2722 | } |
| 2723 | |
| 2724 | |
| 2725 | static void wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(void *ctx, |
| 2726 | void *pMsg) |
| 2727 | { |
| 2728 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2729 | struct sk_buff *skb = NULL; |
| 2730 | tpSirEXTScanResetSignificantChangeRspParams pData = |
| 2731 | (tpSirEXTScanResetSignificantChangeRspParams) pMsg; |
| 2732 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2733 | ENTER(); |
| 2734 | |
| 2735 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2736 | return; |
| 2737 | } |
| 2738 | if (!pMsg) |
| 2739 | { |
| 2740 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2741 | return; |
| 2742 | } |
| 2743 | |
| 2744 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 2745 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 2746 | NULL, |
| 2747 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2748 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2749 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE_INDEX, |
| 2750 | GFP_KERNEL); |
| 2751 | |
| 2752 | if (!skb) { |
| 2753 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2754 | FL("cfg80211_vendor_event_alloc failed")); |
| 2755 | return; |
| 2756 | } |
| 2757 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2758 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2759 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2760 | |
| 2761 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2762 | pData->requestId) || |
| 2763 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2764 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2765 | goto nla_put_failure; |
| 2766 | } |
| 2767 | |
| 2768 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2769 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2770 | return; |
| 2771 | |
| 2772 | nla_put_failure: |
| 2773 | kfree_skb(skb); |
| 2774 | return; |
| 2775 | } |
| 2776 | |
| 2777 | static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx, |
| 2778 | void *pMsg) |
| 2779 | { |
| 2780 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2781 | struct sk_buff *skb = NULL; |
| 2782 | tANI_U32 i = 0, j, resultsPerEvent; |
| 2783 | tANI_S32 totalResults; |
| 2784 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2785 | tpSirWifiScanResult pSirWifiScanResult; |
| 2786 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2787 | ENTER(); |
| 2788 | |
| 2789 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2790 | return; |
| 2791 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2792 | if (!pMsg) |
| 2793 | { |
| 2794 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2795 | return; |
| 2796 | } |
| 2797 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2798 | totalResults = pData->numOfAps; |
| 2799 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2800 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2801 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2802 | |
| 2803 | do{ |
| 2804 | resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ? |
| 2805 | EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults); |
| 2806 | totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND; |
| 2807 | |
| 2808 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 2809 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 2810 | NULL, |
| 2811 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2812 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2813 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS_INDEX, |
| 2814 | GFP_KERNEL); |
| 2815 | |
| 2816 | if (!skb) { |
| 2817 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2818 | FL("cfg80211_vendor_event_alloc failed")); |
| 2819 | return; |
| 2820 | } |
| 2821 | |
| 2822 | hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent); |
| 2823 | |
| 2824 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2825 | pData->requestId) || |
| 2826 | nla_put_u32(skb, |
| 2827 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2828 | resultsPerEvent)) { |
| 2829 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2830 | goto fail; |
| 2831 | } |
| 2832 | if (nla_put_u8(skb, |
| 2833 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2834 | pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 ))) |
| 2835 | { |
| 2836 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2837 | goto fail; |
| 2838 | } |
| 2839 | |
| 2840 | if (resultsPerEvent) { |
| 2841 | struct nlattr *aps; |
| 2842 | |
| 2843 | aps = nla_nest_start(skb, |
| 2844 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2845 | if (!aps) |
| 2846 | { |
| 2847 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2848 | goto fail; |
| 2849 | } |
| 2850 | |
| 2851 | for (j = 0; j < resultsPerEvent; j++, i++) { |
| 2852 | struct nlattr *ap; |
| 2853 | pSirWifiScanResult = (tpSirWifiScanResult) ((tANI_U8 *) |
| 2854 | pData->ap + ( i* sizeof(tSirWifiScanResult))); |
| 2855 | |
| 2856 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) " |
| 2857 | "Ssid (%s)" |
| 2858 | "Bssid: %pM " |
| 2859 | "Channel (%u)" |
| 2860 | "Rssi (%d)" |
| 2861 | "RTT (%u)" |
| 2862 | "RTT_SD (%u)", |
| 2863 | i, |
| 2864 | pSirWifiScanResult->ts, |
| 2865 | pSirWifiScanResult->ssid, |
| 2866 | pSirWifiScanResult->bssid, |
| 2867 | pSirWifiScanResult->channel, |
| 2868 | pSirWifiScanResult->rssi, |
| 2869 | pSirWifiScanResult->rtt, |
| 2870 | pSirWifiScanResult->rtt_sd); |
| 2871 | |
| 2872 | ap = nla_nest_start(skb, j + 1); |
| 2873 | if (!ap) |
| 2874 | { |
| 2875 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2876 | goto fail; |
| 2877 | } |
| 2878 | |
| 2879 | if (nla_put_u64(skb, |
| 2880 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2881 | pSirWifiScanResult->ts) ) |
| 2882 | { |
| 2883 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2884 | goto fail; |
| 2885 | } |
| 2886 | if (nla_put(skb, |
| 2887 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2888 | sizeof(pSirWifiScanResult->ssid), |
| 2889 | pSirWifiScanResult->ssid) ) |
| 2890 | { |
| 2891 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2892 | goto fail; |
| 2893 | } |
| 2894 | if (nla_put(skb, |
| 2895 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2896 | sizeof(pSirWifiScanResult->bssid), |
| 2897 | pSirWifiScanResult->bssid) ) |
| 2898 | { |
| 2899 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2900 | goto fail; |
| 2901 | } |
| 2902 | if (nla_put_u32(skb, |
| 2903 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2904 | pSirWifiScanResult->channel) ) |
| 2905 | { |
| 2906 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2907 | goto fail; |
| 2908 | } |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 2909 | if (nla_put_s32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2910 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2911 | pSirWifiScanResult->rssi) ) |
| 2912 | { |
| 2913 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2914 | goto fail; |
| 2915 | } |
| 2916 | if (nla_put_u32(skb, |
| 2917 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2918 | pSirWifiScanResult->rtt) ) |
| 2919 | { |
| 2920 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2921 | goto fail; |
| 2922 | } |
| 2923 | if (nla_put_u32(skb, |
| 2924 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2925 | pSirWifiScanResult->rtt_sd)) |
| 2926 | { |
| 2927 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2928 | goto fail; |
| 2929 | } |
| 2930 | |
| 2931 | nla_nest_end(skb, ap); |
| 2932 | } |
| 2933 | nla_nest_end(skb, aps); |
| 2934 | |
| 2935 | } |
| 2936 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2937 | } while (totalResults > 0); |
| 2938 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2939 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2940 | return; |
| 2941 | fail: |
| 2942 | kfree_skb(skb); |
| 2943 | return; |
| 2944 | } |
| 2945 | |
| 2946 | static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx, |
| 2947 | void *pMsg) |
| 2948 | { |
| 2949 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2950 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2951 | struct sk_buff *skb = NULL; |
| 2952 | tANI_U32 i; |
| 2953 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2954 | ENTER(); |
| 2955 | |
| 2956 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2957 | return; |
| 2958 | } |
| 2959 | if (!pMsg) |
| 2960 | { |
| 2961 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2962 | return; |
| 2963 | } |
| 2964 | |
| 2965 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 2966 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 2967 | NULL, |
| 2968 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2969 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2970 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX, |
| 2971 | GFP_KERNEL); |
| 2972 | |
| 2973 | if (!skb) { |
| 2974 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2975 | FL("cfg80211_vendor_event_alloc failed")); |
| 2976 | return; |
| 2977 | } |
| 2978 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2979 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2980 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2981 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2982 | |
| 2983 | for (i = 0; i < pData->numOfAps; i++) { |
| 2984 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) " |
| 2985 | "Ssid (%s) " |
| 2986 | "Bssid (" MAC_ADDRESS_STR ") " |
| 2987 | "Channel (%u) " |
| 2988 | "Rssi (%d) " |
| 2989 | "RTT (%u) " |
| 2990 | "RTT_SD (%u) ", |
| 2991 | i, |
| 2992 | pData->ap[i].ts, |
| 2993 | pData->ap[i].ssid, |
| 2994 | MAC_ADDR_ARRAY(pData->ap[i].bssid), |
| 2995 | pData->ap[i].channel, |
| 2996 | pData->ap[i].rssi, |
| 2997 | pData->ap[i].rtt, |
| 2998 | pData->ap[i].rtt_sd); |
| 2999 | } |
| 3000 | |
| 3001 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3002 | pData->requestId) || |
| 3003 | nla_put_u32(skb, |
| 3004 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3005 | pData->numOfAps)) { |
| 3006 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3007 | goto fail; |
| 3008 | } |
| 3009 | if (pData->numOfAps) { |
| 3010 | struct nlattr *aps; |
| 3011 | |
| 3012 | aps = nla_nest_start(skb, |
| 3013 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 3014 | if (!aps) |
| 3015 | goto fail; |
| 3016 | |
| 3017 | for (i = 0; i < pData->numOfAps; i++) { |
| 3018 | struct nlattr *ap; |
| 3019 | |
| 3020 | ap = nla_nest_start(skb, i + 1); |
| 3021 | if (!ap) |
| 3022 | goto fail; |
| 3023 | |
| 3024 | if (nla_put_u64(skb, |
| 3025 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 3026 | pData->ap[i].ts) || |
| 3027 | nla_put(skb, |
| 3028 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 3029 | sizeof(pData->ap[i].ssid), |
| 3030 | pData->ap[i].ssid) || |
| 3031 | nla_put(skb, |
| 3032 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 3033 | sizeof(pData->ap[i].bssid), |
| 3034 | pData->ap[i].bssid) || |
| 3035 | nla_put_u32(skb, |
| 3036 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 3037 | pData->ap[i].channel) || |
| 3038 | nla_put_s32(skb, |
| 3039 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 3040 | pData->ap[i].rssi) || |
| 3041 | nla_put_u32(skb, |
| 3042 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 3043 | pData->ap[i].rtt) || |
| 3044 | nla_put_u32(skb, |
| 3045 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 3046 | pData->ap[i].rtt_sd)) |
| 3047 | goto fail; |
| 3048 | |
| 3049 | nla_nest_end(skb, ap); |
| 3050 | } |
| 3051 | nla_nest_end(skb, aps); |
| 3052 | |
| 3053 | if (nla_put_u8(skb, |
| 3054 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 3055 | pData->moreData)) |
| 3056 | goto fail; |
| 3057 | } |
| 3058 | |
| 3059 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3060 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3061 | return; |
| 3062 | |
| 3063 | fail: |
| 3064 | kfree_skb(skb); |
| 3065 | return; |
| 3066 | |
| 3067 | } |
| 3068 | static void wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(void *ctx, |
| 3069 | void *pMsg) |
| 3070 | { |
| 3071 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3072 | struct sk_buff *skb = NULL; |
| 3073 | tANI_U32 i, j; |
| 3074 | tpSirWifiSignificantChangeEvent pData = |
| 3075 | (tpSirWifiSignificantChangeEvent) pMsg; |
| 3076 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3077 | ENTER(); |
| 3078 | |
| 3079 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3080 | return; |
| 3081 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3082 | if (!pMsg) |
| 3083 | { |
| 3084 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 3085 | return; |
| 3086 | } |
| 3087 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3088 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 3089 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3090 | NULL, |
| 3091 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3092 | EXTSCAN_EVENT_BUF_SIZE, |
| 3093 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE_INDEX, |
| 3094 | GFP_KERNEL); |
| 3095 | |
| 3096 | if (!skb) { |
| 3097 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3098 | FL("cfg80211_vendor_event_alloc failed")); |
| 3099 | return; |
| 3100 | } |
| 3101 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3102 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 3103 | hddLog(VOS_TRACE_LEVEL_INFO, "total List Size %u ", pData->numSigRssiBss); |
| 3104 | hddLog(VOS_TRACE_LEVEL_INFO, " CUrrent List size (%u)", |
| 3105 | pData->numSigRssiBss); |
| 3106 | hddLog(VOS_TRACE_LEVEL_INFO, "moreData (%u)", pData->moreData); |
| 3107 | |
| 3108 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 3109 | hddLog(VOS_TRACE_LEVEL_INFO , "Rssi List [%d] BSSID: (%pM) Channel %u " |
| 3110 | " num RSSI %u ", |
| 3111 | i, pData->sigRssiResult[i].bssid, |
| 3112 | pData->sigRssiResult[i].channel, |
| 3113 | pData->sigRssiResult[i].numRssi); |
| 3114 | |
| 3115 | for (j = 0; j < pData->sigRssiResult[i].numRssi; j++){ |
| 3116 | |
| 3117 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3118 | " [%d]", |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 3119 | pData->sigRssiResult[i].rssi[j]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3120 | |
| 3121 | } |
| 3122 | } |
| 3123 | |
| 3124 | |
| 3125 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3126 | pData->requestId) || |
| 3127 | nla_put_u32(skb, |
| 3128 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3129 | pData->numSigRssiBss)) { |
| 3130 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3131 | goto fail; |
| 3132 | } |
| 3133 | |
| 3134 | if (pData->numSigRssiBss) { |
| 3135 | struct nlattr *aps; |
| 3136 | aps = nla_nest_start(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 3137 | if (!aps) |
| 3138 | goto fail; |
| 3139 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 3140 | struct nlattr *ap; |
| 3141 | |
| 3142 | ap = nla_nest_start(skb, i); |
| 3143 | if (!ap) |
| 3144 | goto fail; |
| 3145 | if (nla_put(skb, |
| 3146 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_BSSID, |
| 3147 | sizeof(tSirMacAddr), pData->sigRssiResult[i].bssid) || |
| 3148 | nla_put_u32(skb, |
| 3149 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_CHANNEL, |
| 3150 | pData->sigRssiResult[i].channel) || |
| 3151 | nla_put_u32(skb, |
| 3152 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_NUM_RSSI, |
| 3153 | pData->sigRssiResult[i].numRssi) || |
| 3154 | nla_put(skb, |
| 3155 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_RSSI_LIST, |
| 3156 | sizeof(s32) * pData->sigRssiResult[i].numRssi, |
| 3157 | pData->sigRssiResult[i].rssi)) |
| 3158 | goto fail; |
| 3159 | nla_nest_end(skb, ap); |
| 3160 | } |
| 3161 | nla_nest_end(skb, aps); |
| 3162 | if (nla_put_u8(skb, |
| 3163 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 3164 | pData->moreData)) |
| 3165 | goto fail; |
| 3166 | } |
| 3167 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3168 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3169 | return; |
| 3170 | fail: |
| 3171 | kfree_skb(skb); |
| 3172 | return; |
| 3173 | } |
| 3174 | |
| 3175 | static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx, |
| 3176 | void *pMsg) |
| 3177 | { |
| 3178 | struct sk_buff *skb; |
| 3179 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3180 | tpSirWifiFullScanResultEvent pData = |
| 3181 | (tpSirWifiFullScanResultEvent) (pMsg); |
| 3182 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3183 | ENTER(); |
| 3184 | |
| 3185 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 3186 | return; |
| 3187 | } |
| 3188 | if (!pMsg) |
| 3189 | { |
| 3190 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3191 | return; |
| 3192 | } |
| 3193 | |
| 3194 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 3195 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3196 | NULL, |
| 3197 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3198 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3199 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX, |
| 3200 | GFP_KERNEL); |
| 3201 | |
| 3202 | if (!skb) { |
| 3203 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3204 | FL("cfg80211_vendor_event_alloc failed")); |
| 3205 | return; |
| 3206 | } |
| 3207 | |
| 3208 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3209 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId); |
| 3210 | hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData); |
| 3211 | hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) " |
| 3212 | "Ssid (%s)" |
| 3213 | "Bssid (" MAC_ADDRESS_STR ")" |
| 3214 | "Channel (%u)" |
| 3215 | "Rssi (%d)" |
| 3216 | "RTT (%u)" |
| 3217 | "RTT_SD (%u)"), |
| 3218 | pData->ap.ts, |
| 3219 | pData->ap.ssid, |
| 3220 | MAC_ADDR_ARRAY(pData->ap.bssid), |
| 3221 | pData->ap.channel, |
| 3222 | pData->ap.rssi, |
| 3223 | pData->ap.rtt, |
| 3224 | pData->ap.rtt_sd); |
| 3225 | hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength); |
| 3226 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3227 | pData->requestId) || |
| 3228 | nla_put_u64(skb, |
| 3229 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 3230 | pData->ap.ts) || |
| 3231 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 3232 | sizeof(pData->ap.ssid), |
| 3233 | pData->ap.ssid) || |
| 3234 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 3235 | WNI_CFG_BSSID_LEN, |
| 3236 | pData->ap.bssid) || |
| 3237 | nla_put_u32(skb, |
| 3238 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 3239 | pData->ap.channel) || |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 3240 | 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] | 3241 | pData->ap.rssi) || |
| 3242 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 3243 | pData->ap.rtt) || |
| 3244 | nla_put_u32(skb, |
| 3245 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 3246 | pData->ap.rtt_sd) || |
| 3247 | nla_put_u16(skb, |
| 3248 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 3249 | pData->ap.beaconPeriod) || |
| 3250 | nla_put_u16(skb, |
| 3251 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 3252 | pData->ap.capability) || |
| 3253 | nla_put_u32(skb, |
| 3254 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
| 3255 | pData->ieLength)) |
| 3256 | { |
| 3257 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3258 | goto nla_put_failure; |
| 3259 | } |
| 3260 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 3261 | pData->ieLength, |
| 3262 | pData->ie)) |
| 3263 | { |
| 3264 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3265 | goto nla_put_failure; |
| 3266 | } |
| 3267 | |
| 3268 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3269 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3270 | return; |
| 3271 | |
| 3272 | nla_put_failure: |
| 3273 | kfree_skb(skb); |
| 3274 | return; |
| 3275 | } |
| 3276 | |
| 3277 | static void wlan_hdd_cfg80211_extscan_scan_res_available_event(void *ctx, |
| 3278 | void *pMsg) |
| 3279 | { |
| 3280 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3281 | struct sk_buff *skb = NULL; |
| 3282 | tpSirEXTScanResultsAvailableIndParams pData = |
| 3283 | (tpSirEXTScanResultsAvailableIndParams) pMsg; |
| 3284 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3285 | ENTER(); |
| 3286 | |
| 3287 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 3288 | return; |
| 3289 | } |
| 3290 | if (!pMsg) |
| 3291 | { |
| 3292 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3293 | return; |
| 3294 | } |
| 3295 | |
| 3296 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 3297 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3298 | NULL, |
| 3299 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3300 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3301 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX, |
| 3302 | GFP_KERNEL); |
| 3303 | |
| 3304 | if (!skb) { |
| 3305 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3306 | FL("cfg80211_vendor_event_alloc failed")); |
| 3307 | return; |
| 3308 | } |
| 3309 | |
| 3310 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3311 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 3312 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", |
| 3313 | pData->numResultsAvailable); |
| 3314 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3315 | pData->requestId) || |
| 3316 | nla_put_u32(skb, |
| 3317 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3318 | pData->numResultsAvailable)) { |
| 3319 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3320 | goto nla_put_failure; |
| 3321 | } |
| 3322 | |
| 3323 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3324 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3325 | return; |
| 3326 | |
| 3327 | nla_put_failure: |
| 3328 | kfree_skb(skb); |
| 3329 | return; |
| 3330 | } |
| 3331 | |
| 3332 | static void wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx, void *pMsg) |
| 3333 | { |
| 3334 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3335 | struct sk_buff *skb = NULL; |
| 3336 | tpSirEXTScanProgressIndParams pData = |
| 3337 | (tpSirEXTScanProgressIndParams) pMsg; |
| 3338 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3339 | ENTER(); |
| 3340 | |
| 3341 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 3342 | return; |
| 3343 | } |
| 3344 | if (!pMsg) |
| 3345 | { |
| 3346 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3347 | return; |
| 3348 | } |
| 3349 | |
| 3350 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 3351 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3352 | NULL, |
| 3353 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3354 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3355 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX, |
| 3356 | GFP_KERNEL); |
| 3357 | |
| 3358 | if (!skb) { |
| 3359 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3360 | FL("cfg80211_vendor_event_alloc failed")); |
| 3361 | return; |
| 3362 | } |
| 3363 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3364 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)", |
| 3365 | pData->extScanEventType); |
| 3366 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)", |
| 3367 | pData->status); |
| 3368 | |
| 3369 | if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE, |
| 3370 | pData->extScanEventType) || |
| 3371 | nla_put_u32(skb, |
Dasari Srinivas | 5a28865 | 2014-06-30 17:13:22 +0530 | [diff] [blame] | 3372 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3373 | pData->requestId) || |
| 3374 | nla_put_u32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3375 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS, |
| 3376 | pData->status)) { |
| 3377 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3378 | goto nla_put_failure; |
| 3379 | } |
| 3380 | |
| 3381 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3382 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3383 | return; |
| 3384 | |
| 3385 | nla_put_failure: |
| 3386 | kfree_skb(skb); |
| 3387 | return; |
| 3388 | } |
| 3389 | |
| 3390 | void wlan_hdd_cfg80211_extscan_callback(void *ctx, const tANI_U16 evType, |
| 3391 | void *pMsg) |
| 3392 | { |
| 3393 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3394 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3395 | ENTER(); |
| 3396 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3397 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3398 | return; |
| 3399 | } |
| 3400 | |
| 3401 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 3402 | |
| 3403 | |
| 3404 | switch(evType) { |
| 3405 | case SIR_HAL_EXTSCAN_START_RSP: |
| 3406 | wlan_hdd_cfg80211_extscan_start_rsp(ctx, pMsg); |
| 3407 | break; |
| 3408 | |
| 3409 | case SIR_HAL_EXTSCAN_STOP_RSP: |
| 3410 | wlan_hdd_cfg80211_extscan_stop_rsp(ctx, pMsg); |
| 3411 | break; |
| 3412 | case SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP: |
| 3413 | /* There is no need to send this response to upper layer |
| 3414 | Just log the message */ |
| 3415 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3416 | FL("Rcvd SIR_HAL_EXTSCAN_CACHED_RESULTS_RSP")); |
| 3417 | break; |
| 3418 | case SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP: |
| 3419 | wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(ctx, pMsg); |
| 3420 | break; |
| 3421 | |
| 3422 | case SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP: |
| 3423 | wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg); |
| 3424 | break; |
| 3425 | |
| 3426 | case SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP: |
| 3427 | wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(ctx, pMsg); |
| 3428 | break; |
| 3429 | |
| 3430 | case SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP: |
| 3431 | wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(ctx, pMsg); |
| 3432 | break; |
| 3433 | case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP: |
| 3434 | wlan_hdd_cfg80211_extscan_get_capabilities_ind(ctx, pMsg); |
| 3435 | break; |
| 3436 | case SIR_HAL_EXTSCAN_PROGRESS_IND: |
| 3437 | wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg); |
| 3438 | break; |
| 3439 | case SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND: |
| 3440 | wlan_hdd_cfg80211_extscan_scan_res_available_event(ctx, pMsg); |
| 3441 | break; |
| 3442 | case SIR_HAL_EXTSCAN_SCAN_RESULT_IND: |
| 3443 | wlan_hdd_cfg80211_extscan_cached_results_ind(ctx, pMsg); |
| 3444 | break; |
| 3445 | case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND: |
| 3446 | wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg); |
| 3447 | break; |
| 3448 | case SIR_HAL_EXTSCAN_SIGNF_WIFI_CHANGE_IND: |
| 3449 | wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(ctx, pMsg); |
| 3450 | break; |
| 3451 | case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 3452 | wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg); |
| 3453 | break; |
| 3454 | default: |
| 3455 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 3456 | break; |
| 3457 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3458 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3459 | } |
| 3460 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3461 | static int __wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3462 | struct wireless_dev *wdev, |
| 3463 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3464 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3465 | tSirGetEXTScanCapabilitiesReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3466 | struct net_device *dev = wdev->netdev; |
| 3467 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3468 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3469 | struct nlattr |
| 3470 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3471 | eHalStatus status; |
| 3472 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3473 | ENTER(); |
| 3474 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3475 | status = wlan_hdd_validate_context(pHddCtx); |
| 3476 | if (0 != status) |
| 3477 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3478 | return -EINVAL; |
| 3479 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3480 | /* check the EXTScan Capability */ |
| 3481 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3482 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3483 | { |
| 3484 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3485 | FL("EXTScan not enabled/supported by Firmware")); |
| 3486 | return -EINVAL; |
| 3487 | } |
| 3488 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3489 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3490 | data, dataLen, |
| 3491 | wlan_hdd_extscan_config_policy)) { |
| 3492 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3493 | return -EINVAL; |
| 3494 | } |
| 3495 | |
| 3496 | /* Parse and fetch request Id */ |
| 3497 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3498 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3499 | return -EINVAL; |
| 3500 | } |
| 3501 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3502 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3503 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3504 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3505 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3506 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3507 | reqMsg.sessionId = pAdapter->sessionId; |
| 3508 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3509 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3510 | status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3511 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3512 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3513 | FL("sme_EXTScanGetCapabilities failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3514 | return -EINVAL; |
| 3515 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3516 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3517 | return 0; |
| 3518 | } |
| 3519 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3520 | static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3521 | struct wireless_dev *wdev, |
| 3522 | const void *data, int dataLen) |
| 3523 | { |
| 3524 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3525 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3526 | vos_ssr_protect(__func__); |
| 3527 | ret = __wlan_hdd_cfg80211_extscan_get_capabilities(wiphy, wdev, data, dataLen); |
| 3528 | vos_ssr_unprotect(__func__); |
| 3529 | |
| 3530 | return ret; |
| 3531 | } |
| 3532 | |
| 3533 | static int __wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3534 | struct wireless_dev *wdev, |
| 3535 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3536 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3537 | tSirEXTScanGetCachedResultsReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3538 | struct net_device *dev = wdev->netdev; |
| 3539 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3540 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3541 | struct nlattr |
| 3542 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3543 | eHalStatus status; |
| 3544 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3545 | ENTER(); |
| 3546 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3547 | status = wlan_hdd_validate_context(pHddCtx); |
| 3548 | if (0 != status) |
| 3549 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3550 | return -EINVAL; |
| 3551 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3552 | /* check the EXTScan Capability */ |
| 3553 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3554 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3555 | { |
| 3556 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3557 | FL("EXTScan not enabled/supported by Firmware")); |
| 3558 | return -EINVAL; |
| 3559 | } |
| 3560 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3561 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3562 | data, dataLen, |
| 3563 | wlan_hdd_extscan_config_policy)) { |
| 3564 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3565 | return -EINVAL; |
| 3566 | } |
| 3567 | /* Parse and fetch request Id */ |
| 3568 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3569 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3570 | return -EINVAL; |
| 3571 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3572 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3573 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3574 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3575 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3576 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3577 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3578 | reqMsg.sessionId = pAdapter->sessionId; |
| 3579 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3580 | |
| 3581 | /* Parse and fetch flush parameter */ |
| 3582 | if (!tb |
| 3583 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]) |
| 3584 | { |
| 3585 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed")); |
| 3586 | goto failed; |
| 3587 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3588 | reqMsg.flush = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3589 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]); |
| 3590 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3591 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3592 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3593 | status = sme_getCachedResults(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3594 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3595 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3596 | FL("sme_getCachedResults failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3597 | return -EINVAL; |
| 3598 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3599 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3600 | return 0; |
| 3601 | |
| 3602 | failed: |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3603 | return -EINVAL; |
| 3604 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3605 | static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3606 | struct wireless_dev *wdev, |
| 3607 | const void *data, int dataLen) |
| 3608 | { |
| 3609 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3610 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3611 | vos_ssr_protect(__func__); |
| 3612 | ret = __wlan_hdd_cfg80211_extscan_get_cached_results(wiphy, wdev, data, dataLen); |
| 3613 | vos_ssr_unprotect(__func__); |
| 3614 | |
| 3615 | return ret; |
| 3616 | } |
| 3617 | |
| 3618 | static int __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3619 | struct wireless_dev *wdev, |
Edhar, Mahesh Kumar | ed8631f | 2015-01-20 14:31:47 +0530 | [diff] [blame] | 3620 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3621 | { |
| 3622 | tpSirEXTScanSetBssidHotListReqParams pReqMsg = NULL; |
| 3623 | struct net_device *dev = wdev->netdev; |
| 3624 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3625 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3626 | struct nlattr |
| 3627 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3628 | struct nlattr |
| 3629 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3630 | struct nlattr *apTh; |
| 3631 | eHalStatus status; |
| 3632 | tANI_U8 i = 0; |
| 3633 | int rem; |
| 3634 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3635 | ENTER(); |
| 3636 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3637 | status = wlan_hdd_validate_context(pHddCtx); |
| 3638 | if (0 != status) |
| 3639 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3640 | return -EINVAL; |
| 3641 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3642 | /* check the EXTScan Capability */ |
| 3643 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3644 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3645 | { |
| 3646 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3647 | FL("EXTScan not enabled/supported by Firmware")); |
| 3648 | return -EINVAL; |
| 3649 | } |
| 3650 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3651 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3652 | data, dataLen, |
| 3653 | wlan_hdd_extscan_config_policy)) { |
| 3654 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3655 | return -EINVAL; |
| 3656 | } |
| 3657 | |
| 3658 | /* Parse and fetch request Id */ |
| 3659 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3660 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3661 | return -EINVAL; |
| 3662 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3663 | pReqMsg = (tpSirEXTScanSetBssidHotListReqParams) |
| 3664 | vos_mem_malloc(sizeof(*pReqMsg)); |
| 3665 | if (!pReqMsg) { |
| 3666 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3667 | return -ENOMEM; |
| 3668 | } |
| 3669 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3670 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3671 | pReqMsg->requestId = nla_get_u32( |
| 3672 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3673 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3674 | |
| 3675 | /* Parse and fetch number of APs */ |
| 3676 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]) { |
| 3677 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3678 | goto fail; |
| 3679 | } |
| 3680 | |
| 3681 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3682 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3683 | |
| 3684 | pReqMsg->numAp = nla_get_u32( |
| 3685 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]); |
| 3686 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3687 | |
| 3688 | nla_for_each_nested(apTh, |
| 3689 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3690 | if(nla_parse(tb2, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3691 | nla_data(apTh), nla_len(apTh), |
| 3692 | NULL)) { |
| 3693 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3694 | goto fail; |
| 3695 | } |
| 3696 | |
| 3697 | /* Parse and fetch MAC address */ |
| 3698 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3699 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3700 | goto fail; |
| 3701 | } |
| 3702 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3703 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3704 | sizeof(tSirMacAddr)); |
| 3705 | hddLog(VOS_TRACE_LEVEL_INFO, FL("BSSID: %pM "), pReqMsg->ap[i].bssid); |
| 3706 | |
| 3707 | /* Parse and fetch low RSSI */ |
| 3708 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3709 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3710 | goto fail; |
| 3711 | } |
| 3712 | pReqMsg->ap[i].low = nla_get_s32( |
| 3713 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3714 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3715 | |
| 3716 | /* Parse and fetch high RSSI */ |
| 3717 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3718 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3719 | goto fail; |
| 3720 | } |
| 3721 | pReqMsg->ap[i].high = nla_get_s32( |
| 3722 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3723 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"), |
| 3724 | pReqMsg->ap[i].high); |
| 3725 | |
| 3726 | /* Parse and fetch channel */ |
| 3727 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3728 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3729 | goto fail; |
| 3730 | } |
| 3731 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3732 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3733 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3734 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3735 | i++; |
| 3736 | } |
| 3737 | status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg); |
| 3738 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3739 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3740 | FL("sme_SetBssHotlist failed(err=%d)"), status); |
| 3741 | vos_mem_free(pReqMsg); |
| 3742 | return -EINVAL; |
| 3743 | } |
| 3744 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3745 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3746 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3747 | return 0; |
| 3748 | |
| 3749 | fail: |
| 3750 | vos_mem_free(pReqMsg); |
| 3751 | return -EINVAL; |
| 3752 | } |
| 3753 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3754 | static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
| 3755 | struct wireless_dev *wdev, |
| 3756 | const void *data, int dataLen) |
| 3757 | { |
| 3758 | int ret = 0; |
| 3759 | |
| 3760 | vos_ssr_protect(__func__); |
| 3761 | ret = __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(wiphy, wdev, data, |
| 3762 | dataLen); |
| 3763 | vos_ssr_unprotect(__func__); |
| 3764 | |
| 3765 | return ret; |
| 3766 | } |
| 3767 | |
| 3768 | static int __wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3769 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3770 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3771 | { |
| 3772 | tpSirEXTScanSetSignificantChangeReqParams pReqMsg = NULL; |
| 3773 | struct net_device *dev = wdev->netdev; |
| 3774 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3775 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3776 | struct nlattr |
| 3777 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3778 | struct nlattr |
| 3779 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3780 | struct nlattr *apTh; |
| 3781 | eHalStatus status; |
| 3782 | int i = 0; |
| 3783 | int rem; |
| 3784 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3785 | ENTER(); |
| 3786 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3787 | status = wlan_hdd_validate_context(pHddCtx); |
| 3788 | if (0 != status) |
| 3789 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3790 | return -EINVAL; |
| 3791 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3792 | /* check the EXTScan Capability */ |
| 3793 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3794 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3795 | { |
| 3796 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3797 | FL("EXTScan not enabled/supported by Firmware")); |
| 3798 | return -EINVAL; |
| 3799 | } |
| 3800 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3801 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3802 | data, dataLen, |
| 3803 | wlan_hdd_extscan_config_policy)) { |
| 3804 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3805 | return -EINVAL; |
| 3806 | } |
| 3807 | |
| 3808 | /* Parse and fetch request Id */ |
| 3809 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3810 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3811 | return -EINVAL; |
| 3812 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3813 | pReqMsg = (tpSirEXTScanSetSignificantChangeReqParams) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3814 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3815 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3816 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3817 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3818 | } |
| 3819 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3820 | |
| 3821 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3822 | pReqMsg->requestId = nla_get_u32( |
| 3823 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3824 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3825 | |
| 3826 | /* Parse and fetch RSSI sample size */ |
| 3827 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]) |
| 3828 | { |
| 3829 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr RSSI sample size failed")); |
| 3830 | goto fail; |
| 3831 | } |
| 3832 | pReqMsg->rssiSampleSize = nla_get_u32( |
| 3833 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]); |
| 3834 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3835 | FL("RSSI sample size (%u)"), pReqMsg->rssiSampleSize); |
| 3836 | |
| 3837 | /* Parse and fetch lost AP sample size */ |
| 3838 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]) |
| 3839 | { |
| 3840 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr lost AP sample size failed")); |
| 3841 | goto fail; |
| 3842 | } |
| 3843 | pReqMsg->lostApSampleSize = nla_get_u32( |
| 3844 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]); |
| 3845 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3846 | FL("Lost AP sample size (%u)"), pReqMsg->lostApSampleSize); |
| 3847 | /* Parse and fetch minimum Breaching */ |
| 3848 | if (!tb |
| 3849 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]) { |
| 3850 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr minBreaching failed")); |
| 3851 | goto fail; |
| 3852 | } |
| 3853 | pReqMsg->minBreaching = nla_get_u32( |
| 3854 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]); |
| 3855 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Breaching (%d)"), pReqMsg->minBreaching); |
| 3856 | |
| 3857 | /* Parse and fetch number of APs */ |
| 3858 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]) { |
| 3859 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3860 | goto fail; |
| 3861 | } |
| 3862 | pReqMsg->numAp = nla_get_u32( |
| 3863 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]); |
| 3864 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3865 | |
| 3866 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3867 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3868 | |
| 3869 | nla_for_each_nested(apTh, |
| 3870 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3871 | if(nla_parse(tb2, |
| 3872 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3873 | nla_data(apTh), nla_len(apTh), |
| 3874 | NULL)) { |
| 3875 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3876 | goto fail; |
| 3877 | } |
| 3878 | |
| 3879 | /* Parse and fetch MAC address */ |
| 3880 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3881 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3882 | goto fail; |
| 3883 | } |
| 3884 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3885 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3886 | sizeof(tSirMacAddr)); |
| 3887 | |
| 3888 | /* Parse and fetch low RSSI */ |
| 3889 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3890 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3891 | goto fail; |
| 3892 | } |
| 3893 | pReqMsg->ap[i].low = nla_get_s32( |
| 3894 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3895 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3896 | |
| 3897 | /* Parse and fetch high RSSI */ |
| 3898 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3899 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3900 | goto fail; |
| 3901 | } |
| 3902 | pReqMsg->ap[i].high = nla_get_s32( |
| 3903 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3904 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3905 | FL("RSSI High (%d)"), pReqMsg->ap[i].high); |
| 3906 | |
| 3907 | /* Parse and fetch channel */ |
| 3908 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3909 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3910 | goto fail; |
| 3911 | } |
| 3912 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3913 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3914 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3915 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3916 | i++; |
| 3917 | } |
| 3918 | |
| 3919 | status = sme_SetSignificantChange(pHddCtx->hHal, pReqMsg); |
| 3920 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3921 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3922 | FL("sme_SetSignificantChange failed(err=%d)"), status); |
| 3923 | vos_mem_free(pReqMsg); |
| 3924 | return -EINVAL; |
| 3925 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3926 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3927 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3928 | return 0; |
| 3929 | |
| 3930 | fail: |
| 3931 | vos_mem_free(pReqMsg); |
| 3932 | return -EINVAL; |
| 3933 | } |
| 3934 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3935 | static int wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
| 3936 | struct wireless_dev *wdev, |
| 3937 | const void *data, int dataLen) |
| 3938 | { |
| 3939 | int ret = 0; |
| 3940 | |
| 3941 | vos_ssr_protect(__func__); |
| 3942 | ret = __wlan_hdd_cfg80211_extscan_set_significant_change(wiphy, wdev, data, |
| 3943 | dataLen); |
| 3944 | vos_ssr_unprotect(__func__); |
| 3945 | |
| 3946 | return ret; |
| 3947 | } |
| 3948 | |
| 3949 | static int __wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3950 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3951 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3952 | { |
| 3953 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3954 | tANI_U32 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 3955 | tANI_U8 numChannels = 0; |
| 3956 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3957 | tANI_U32 requestId; |
| 3958 | tWifiBand wifiBand; |
| 3959 | eHalStatus status; |
| 3960 | struct sk_buff *replySkb; |
| 3961 | tANI_U8 i; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3962 | int ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3963 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3964 | ENTER(); |
| 3965 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3966 | status = wlan_hdd_validate_context(pHddCtx); |
| 3967 | if (0 != status) |
| 3968 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3969 | return -EINVAL; |
| 3970 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3971 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3972 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3973 | data, dataLen, |
| 3974 | wlan_hdd_extscan_config_policy)) { |
| 3975 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3976 | return -EINVAL; |
| 3977 | } |
| 3978 | |
| 3979 | /* Parse and fetch request Id */ |
| 3980 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3981 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3982 | return -EINVAL; |
| 3983 | } |
| 3984 | requestId = nla_get_u32( |
| 3985 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3986 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); |
| 3987 | |
| 3988 | /* Parse and fetch wifi band */ |
| 3989 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) |
| 3990 | { |
| 3991 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3992 | return -EINVAL; |
| 3993 | } |
| 3994 | wifiBand = nla_get_u32( |
| 3995 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); |
| 3996 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); |
| 3997 | |
| 3998 | status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), |
| 3999 | wifiBand, ChannelList, |
| 4000 | &numChannels); |
| 4001 | if (eHAL_STATUS_SUCCESS != status) { |
| 4002 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4003 | FL("sme_GetValidChannelsByBand failed (err=%d)"), status); |
| 4004 | return -EINVAL; |
| 4005 | } |
| 4006 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of channels (%d)"), numChannels); |
| 4007 | for (i = 0; i < numChannels; i++) |
| 4008 | hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %u ", ChannelList[i]); |
| 4009 | |
| 4010 | replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 4011 | sizeof(u32) * numChannels + |
| 4012 | NLMSG_HDRLEN); |
| 4013 | |
| 4014 | if (!replySkb) { |
| 4015 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4016 | FL("valid channels: buffer alloc fail")); |
| 4017 | return -EINVAL; |
| 4018 | } |
| 4019 | if (nla_put_u32(replySkb, |
| 4020 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS, |
| 4021 | numChannels) || |
| 4022 | nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS, |
| 4023 | sizeof(u32) * numChannels, ChannelList)) { |
| 4024 | |
| 4025 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4026 | kfree_skb(replySkb); |
| 4027 | return -EINVAL; |
| 4028 | } |
| 4029 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4030 | ret = cfg80211_vendor_cmd_reply(replySkb); |
| 4031 | |
| 4032 | EXIT(); |
| 4033 | return ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4034 | } |
| 4035 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4036 | static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
| 4037 | struct wireless_dev *wdev, |
| 4038 | const void *data, int dataLen) |
| 4039 | { |
| 4040 | int ret = 0; |
| 4041 | |
| 4042 | vos_ssr_protect(__func__); |
| 4043 | ret = __wlan_hdd_cfg80211_extscan_get_valid_channels(wiphy, wdev, data, |
| 4044 | dataLen); |
| 4045 | vos_ssr_unprotect(__func__); |
| 4046 | |
| 4047 | return ret; |
| 4048 | } |
| 4049 | |
| 4050 | static int __wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4051 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4052 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4053 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4054 | tpSirEXTScanStartReqParams pReqMsg = NULL; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4055 | struct net_device *dev = wdev->netdev; |
| 4056 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4057 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4058 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4059 | struct nlattr *bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4060 | struct nlattr *channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4061 | struct nlattr *buckets; |
| 4062 | struct nlattr *channels; |
| 4063 | int rem1; |
| 4064 | int rem2; |
| 4065 | eHalStatus status; |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4066 | tANI_U32 j = 0, index = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4067 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4068 | ENTER(); |
| 4069 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4070 | status = wlan_hdd_validate_context(pHddCtx); |
| 4071 | if (0 != status) |
| 4072 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4073 | return -EINVAL; |
| 4074 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4075 | /* check the EXTScan Capability */ |
| 4076 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4077 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4078 | { |
| 4079 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4080 | FL("EXTScan not enabled/supported by Firmware")); |
| 4081 | return -EINVAL; |
| 4082 | } |
| 4083 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4084 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4085 | data, dataLen, |
| 4086 | wlan_hdd_extscan_config_policy)) { |
| 4087 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4088 | return -EINVAL; |
| 4089 | } |
| 4090 | |
| 4091 | /* Parse and fetch request Id */ |
| 4092 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4093 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4094 | return -EINVAL; |
| 4095 | } |
| 4096 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4097 | pReqMsg = (tpSirEXTScanStartReqParams) |
| 4098 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4099 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4100 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 4101 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4102 | } |
| 4103 | |
| 4104 | pReqMsg->requestId = nla_get_u32( |
| 4105 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 4106 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 4107 | |
| 4108 | pReqMsg->sessionId = pAdapter->sessionId; |
| 4109 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 4110 | |
| 4111 | /* Parse and fetch base period */ |
| 4112 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]) { |
| 4113 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed")); |
| 4114 | goto fail; |
| 4115 | } |
| 4116 | pReqMsg->basePeriod = nla_get_u32( |
| 4117 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]); |
| 4118 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"), |
| 4119 | pReqMsg->basePeriod); |
| 4120 | |
| 4121 | /* Parse and fetch max AP per scan */ |
| 4122 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]) { |
| 4123 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed")); |
| 4124 | goto fail; |
| 4125 | } |
| 4126 | pReqMsg->maxAPperScan = nla_get_u32( |
| 4127 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]); |
| 4128 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"), |
| 4129 | pReqMsg->maxAPperScan); |
| 4130 | |
| 4131 | /* Parse and fetch report threshold */ |
| 4132 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]) { |
| 4133 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed")); |
| 4134 | goto fail; |
| 4135 | } |
| 4136 | pReqMsg->reportThreshold = nla_get_u8( |
| 4137 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]); |
| 4138 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"), |
| 4139 | pReqMsg->reportThreshold); |
| 4140 | |
| 4141 | /* Parse and fetch number of buckets */ |
| 4142 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]) { |
| 4143 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed")); |
| 4144 | goto fail; |
| 4145 | } |
| 4146 | pReqMsg->numBuckets = nla_get_u8( |
| 4147 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]); |
| 4148 | if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) { |
| 4149 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets " |
| 4150 | "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS); |
| 4151 | pReqMsg->numBuckets = WLAN_EXTSCAN_MAX_BUCKETS; |
| 4152 | } |
| 4153 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"), |
| 4154 | pReqMsg->numBuckets); |
| 4155 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) { |
| 4156 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed")); |
| 4157 | goto fail; |
| 4158 | } |
| 4159 | |
| 4160 | nla_for_each_nested(buckets, |
| 4161 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) { |
| 4162 | if(nla_parse(bucket, |
| 4163 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4164 | nla_data(buckets), nla_len(buckets), NULL)) { //policy |
| 4165 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 4166 | goto fail; |
| 4167 | } |
| 4168 | |
| 4169 | /* Parse and fetch bucket spec */ |
| 4170 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) { |
| 4171 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket index failed")); |
| 4172 | goto fail; |
| 4173 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4174 | |
| 4175 | pReqMsg->buckets[index].bucket = nla_get_u8( |
| 4176 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]); |
| 4177 | |
| 4178 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bucket spec Index (%d)"), |
| 4179 | pReqMsg->buckets[index].bucket); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4180 | |
| 4181 | /* Parse and fetch wifi band */ |
| 4182 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) { |
| 4183 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 4184 | goto fail; |
| 4185 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4186 | pReqMsg->buckets[index].band = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4187 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]); |
| 4188 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4189 | pReqMsg->buckets[index].band); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4190 | |
| 4191 | /* Parse and fetch period */ |
| 4192 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) { |
| 4193 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr period failed")); |
| 4194 | goto fail; |
| 4195 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4196 | pReqMsg->buckets[index].period = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4197 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]); |
| 4198 | hddLog(VOS_TRACE_LEVEL_INFO, FL("period (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4199 | pReqMsg->buckets[index].period); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4200 | |
| 4201 | /* Parse and fetch report events */ |
| 4202 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) { |
| 4203 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report events failed")); |
| 4204 | goto fail; |
| 4205 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4206 | pReqMsg->buckets[index].reportEvents = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4207 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]); |
| 4208 | hddLog(VOS_TRACE_LEVEL_INFO, FL("report events (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4209 | pReqMsg->buckets[index].reportEvents); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4210 | |
| 4211 | /* Parse and fetch number of channels */ |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4212 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) |
| 4213 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4214 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr num channels failed")); |
| 4215 | goto fail; |
| 4216 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4217 | pReqMsg->buckets[index].numChannels = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4218 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]); |
| 4219 | hddLog(VOS_TRACE_LEVEL_INFO, FL("num channels (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4220 | pReqMsg->buckets[index].numChannels); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4221 | |
| 4222 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) { |
| 4223 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel spec failed")); |
| 4224 | goto fail; |
| 4225 | } |
| 4226 | |
| 4227 | j = 0; |
| 4228 | nla_for_each_nested(channels, |
| 4229 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) { |
| 4230 | if(nla_parse(channel, |
| 4231 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4232 | nla_data(channels), nla_len(channels), |
| 4233 | NULL)) { //wlan_hdd_extscan_config_policy here |
| 4234 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 4235 | goto fail; |
| 4236 | } |
| 4237 | |
| 4238 | /* Parse and fetch channel */ |
| 4239 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) { |
| 4240 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 4241 | goto fail; |
| 4242 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4243 | pReqMsg->buckets[index].channels[j].channel = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4244 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]); |
| 4245 | hddLog(VOS_TRACE_LEVEL_INFO, FL("channel (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4246 | pReqMsg->buckets[index].channels[j].channel); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4247 | |
| 4248 | /* Parse and fetch dwell time */ |
| 4249 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) { |
| 4250 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dwelltime failed")); |
| 4251 | goto fail; |
| 4252 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4253 | pReqMsg->buckets[index].channels[j].dwellTimeMs = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4254 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]); |
| 4255 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Dwell time (%u ms)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4256 | pReqMsg->buckets[index].channels[j].dwellTimeMs); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4257 | |
| 4258 | /* Parse and fetch channel spec passive */ |
| 4259 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) { |
| 4260 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4261 | FL("attr channel spec passive failed")); |
| 4262 | goto fail; |
| 4263 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4264 | pReqMsg->buckets[index].channels[j].passive = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4265 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]); |
| 4266 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Chnl spec passive (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4267 | pReqMsg->buckets[index].channels[j].passive); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4268 | j++; |
| 4269 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4270 | index++; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4271 | } |
| 4272 | status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg); |
| 4273 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4274 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4275 | FL("sme_EXTScanStart failed(err=%d)"), status); |
| 4276 | vos_mem_free(pReqMsg); |
| 4277 | return -EINVAL; |
| 4278 | } |
| 4279 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4280 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4281 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4282 | return 0; |
| 4283 | |
| 4284 | fail: |
| 4285 | vos_mem_free(pReqMsg); |
| 4286 | return -EINVAL; |
| 4287 | } |
| 4288 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4289 | static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
| 4290 | struct wireless_dev *wdev, |
| 4291 | const void *data, int dataLen) |
| 4292 | { |
| 4293 | int ret = 0; |
| 4294 | |
| 4295 | vos_ssr_protect(__func__); |
| 4296 | ret = __wlan_hdd_cfg80211_extscan_start(wiphy, wdev, data, dataLen); |
| 4297 | vos_ssr_unprotect(__func__); |
| 4298 | |
| 4299 | return ret; |
| 4300 | } |
| 4301 | |
| 4302 | static int __wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4303 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4304 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4305 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4306 | tSirEXTScanStopReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4307 | struct net_device *dev = wdev->netdev; |
| 4308 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4309 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4310 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4311 | eHalStatus status; |
| 4312 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4313 | ENTER(); |
| 4314 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4315 | status = wlan_hdd_validate_context(pHddCtx); |
| 4316 | if (0 != status) |
| 4317 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4318 | return -EINVAL; |
| 4319 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4320 | /* check the EXTScan Capability */ |
| 4321 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4322 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4323 | { |
| 4324 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4325 | FL("EXTScan not enabled/supported by Firmware")); |
| 4326 | return -EINVAL; |
| 4327 | } |
| 4328 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4329 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4330 | data, dataLen, |
| 4331 | wlan_hdd_extscan_config_policy)) { |
| 4332 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4333 | return -EINVAL; |
| 4334 | } |
| 4335 | |
| 4336 | /* Parse and fetch request Id */ |
| 4337 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4338 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4339 | return -EINVAL; |
| 4340 | } |
| 4341 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4342 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4343 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4344 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
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 | reqMsg.sessionId = pAdapter->sessionId; |
| 4347 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4348 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4349 | status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4350 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4351 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4352 | FL("sme_EXTScanStop failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4353 | return -EINVAL; |
| 4354 | } |
| 4355 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4356 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4357 | return 0; |
| 4358 | } |
| 4359 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4360 | static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
| 4361 | struct wireless_dev *wdev, |
| 4362 | const void *data, int dataLen) |
| 4363 | { |
| 4364 | int ret = 0; |
| 4365 | |
| 4366 | vos_ssr_protect(__func__); |
| 4367 | ret = __wlan_hdd_cfg80211_extscan_stop(wiphy, wdev, data, dataLen); |
| 4368 | vos_ssr_unprotect(__func__); |
| 4369 | |
| 4370 | return ret; |
| 4371 | } |
| 4372 | |
| 4373 | static int __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4374 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4375 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4376 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4377 | tSirEXTScanResetBssidHotlistReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4378 | struct net_device *dev = wdev->netdev; |
| 4379 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4380 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4381 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4382 | eHalStatus status; |
| 4383 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4384 | ENTER(); |
| 4385 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4386 | status = wlan_hdd_validate_context(pHddCtx); |
| 4387 | if (0 != status) |
| 4388 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4389 | return -EINVAL; |
| 4390 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4391 | /* check the EXTScan Capability */ |
| 4392 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4393 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4394 | { |
| 4395 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4396 | FL("EXTScan not enabled/supported by Firmware")); |
| 4397 | return -EINVAL; |
| 4398 | } |
| 4399 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4400 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4401 | data, dataLen, |
| 4402 | wlan_hdd_extscan_config_policy)) { |
| 4403 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4404 | return -EINVAL; |
| 4405 | } |
| 4406 | |
| 4407 | /* Parse and fetch request Id */ |
| 4408 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4409 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4410 | return -EINVAL; |
| 4411 | } |
| 4412 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4413 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4414 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4415 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4416 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4417 | reqMsg.sessionId = pAdapter->sessionId; |
| 4418 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4419 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4420 | status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4421 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4422 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4423 | FL("sme_ResetBssHotlist failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4424 | return -EINVAL; |
| 4425 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4426 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4427 | return 0; |
| 4428 | } |
| 4429 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4430 | static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
| 4431 | struct wireless_dev *wdev, |
| 4432 | const void *data, int dataLen) |
| 4433 | { |
| 4434 | int ret = 0; |
| 4435 | |
| 4436 | vos_ssr_protect(__func__); |
| 4437 | ret = __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(wiphy, wdev, data, dataLen); |
| 4438 | vos_ssr_unprotect(__func__); |
| 4439 | |
| 4440 | return ret; |
| 4441 | } |
| 4442 | |
| 4443 | static int __wlan_hdd_cfg80211_extscan_reset_significant_change( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4444 | struct wiphy *wiphy, |
| 4445 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4446 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4447 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4448 | tSirEXTScanResetSignificantChangeReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4449 | struct net_device *dev = wdev->netdev; |
| 4450 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4451 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4452 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4453 | eHalStatus status; |
| 4454 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4455 | ENTER(); |
| 4456 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4457 | status = wlan_hdd_validate_context(pHddCtx); |
| 4458 | if (0 != status) |
| 4459 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4460 | return -EINVAL; |
| 4461 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4462 | /* check the EXTScan Capability */ |
| 4463 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4464 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4465 | { |
| 4466 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4467 | FL("EXTScan not enabled/supported by Firmware")); |
| 4468 | return -EINVAL; |
| 4469 | } |
| 4470 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4471 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4472 | data, dataLen, |
| 4473 | wlan_hdd_extscan_config_policy)) { |
| 4474 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4475 | return -EINVAL; |
| 4476 | } |
| 4477 | |
| 4478 | /* Parse and fetch request Id */ |
| 4479 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4480 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4481 | return -EINVAL; |
| 4482 | } |
| 4483 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4484 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4485 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4486 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4487 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4488 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4489 | reqMsg.sessionId = pAdapter->sessionId; |
| 4490 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4491 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4492 | status = sme_ResetSignificantChange(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4493 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4494 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4495 | FL("sme_ResetSignificantChange failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4496 | return -EINVAL; |
| 4497 | } |
| 4498 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4499 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4500 | return 0; |
| 4501 | } |
| 4502 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4503 | static int wlan_hdd_cfg80211_extscan_reset_significant_change( |
| 4504 | struct wiphy *wiphy, |
| 4505 | struct wireless_dev *wdev, |
| 4506 | const void *data, int dataLen) |
| 4507 | { |
| 4508 | int ret = 0; |
| 4509 | |
| 4510 | vos_ssr_protect(__func__); |
| 4511 | ret = __wlan_hdd_cfg80211_extscan_reset_significant_change(wiphy, |
| 4512 | wdev, data, |
| 4513 | dataLen); |
| 4514 | vos_ssr_unprotect(__func__); |
| 4515 | |
| 4516 | return ret; |
| 4517 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4518 | #endif /* WLAN_FEATURE_EXTSCAN */ |
| 4519 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4520 | /*EXT TDLS*/ |
| 4521 | static const struct nla_policy |
| 4522 | wlan_hdd_tdls_config_enable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX +1] = |
| 4523 | { |
| 4524 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4525 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL] = {.type = NLA_S32 }, |
| 4526 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS] = |
| 4527 | {.type = NLA_S32 }, |
| 4528 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS] = {.type = NLA_S32 }, |
| 4529 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS] = {.type = NLA_S32 }, |
| 4530 | |
| 4531 | }; |
| 4532 | |
| 4533 | static const struct nla_policy |
| 4534 | wlan_hdd_tdls_config_disable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX +1] = |
| 4535 | { |
| 4536 | [QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4537 | |
| 4538 | }; |
| 4539 | |
| 4540 | static const struct nla_policy |
| 4541 | wlan_hdd_tdls_config_state_change_policy[ |
| 4542 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAX +1] = |
| 4543 | { |
| 4544 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4545 | [QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE] = {.type = NLA_S32 }, |
| 4546 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4547 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL] = {.type = NLA_S32 }, |
| 4548 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS] = |
| 4549 | {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4550 | |
| 4551 | }; |
| 4552 | |
| 4553 | static const struct nla_policy |
| 4554 | wlan_hdd_tdls_config_get_status_policy[ |
| 4555 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX +1] = |
| 4556 | { |
| 4557 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4558 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE] = {.type = NLA_S32 }, |
| 4559 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4560 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL] = {.type = NLA_S32 }, |
| 4561 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS] |
| 4562 | = {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4563 | |
| 4564 | }; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4565 | |
| 4566 | static const struct nla_policy |
| 4567 | wlan_hdd_mac_config[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX+1] = |
| 4568 | { |
| 4569 | [QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI] = {.type = NLA_UNSPEC }, |
| 4570 | }; |
| 4571 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4572 | static int __wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4573 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4574 | const void *data, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4575 | int data_len) |
| 4576 | { |
| 4577 | |
| 4578 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4579 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX + 1]; |
| 4580 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4581 | ENTER(); |
| 4582 | |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4583 | if (0 != wlan_hdd_validate_context(pHddCtx)){ |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4584 | return -EINVAL; |
| 4585 | } |
| 4586 | if (FALSE == pHddCtx->cfg_ini->enableMacSpoofing) { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 4587 | hddLog(VOS_TRACE_LEVEL_INFO, FL("MAC_SPOOFED_SCAN disabled in ini")); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4588 | return -ENOTSUPP; |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4589 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4590 | if (TRUE != sme_IsFeatureSupportedByFW(MAC_SPOOFED_SCAN)){ |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 4591 | hddLog(VOS_TRACE_LEVEL_INFO, FL("MAC_SPOOFED_SCAN not supported by FW")); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4592 | return -ENOTSUPP; |
| 4593 | } |
| 4594 | |
| 4595 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX, |
| 4596 | data, data_len, wlan_hdd_mac_config)) { |
| 4597 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4598 | return -EINVAL; |
| 4599 | } |
| 4600 | |
| 4601 | /* Parse and fetch mac address */ |
| 4602 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]) { |
| 4603 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4604 | return -EINVAL; |
| 4605 | } |
| 4606 | |
| 4607 | memcpy(pHddCtx->spoofMacAddr.randomMacAddr.bytes, nla_data( |
| 4608 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4609 | VOS_MAC_ADDR_LAST_3_BYTES); |
| 4610 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4611 | pHddCtx->spoofMacAddr.isEnabled = TRUE; |
| 4612 | |
| 4613 | 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] | 4614 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4615 | VOS_MAC_ADDR_FIRST_3_BYTES); |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4616 | if ((pHddCtx->spoofMacAddr.randomMacAddr.bytes[0] == 0) && |
| 4617 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[1] == 0) && |
| 4618 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[2] == 0)) |
| 4619 | { |
| 4620 | hddLog(LOG1, FL("ZERO MAC OUI Recieved. Disabling Spoofing")); |
| 4621 | vos_mem_zero(pHddCtx->spoofMacAddr.randomMacAddr.bytes, |
| 4622 | VOS_MAC_ADDRESS_LEN); |
| 4623 | pHddCtx->spoofMacAddr.isEnabled = FALSE; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4624 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4625 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4626 | if (VOS_STATUS_SUCCESS != hdd_processSpoofMacAddrRequest(pHddCtx)) |
| 4627 | { |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4628 | hddLog(LOGE, FL("Failed to send Spoof Mac Addr to FW")); |
| 4629 | } |
| 4630 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4631 | EXIT(); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4632 | return 0; |
| 4633 | } |
| 4634 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4635 | static int wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
| 4636 | struct wireless_dev *wdev, |
| 4637 | const void *data, |
| 4638 | int data_len) |
| 4639 | { |
| 4640 | int ret = 0; |
| 4641 | |
| 4642 | vos_ssr_protect(__func__); |
| 4643 | ret = __wlan_hdd_cfg80211_set_spoofed_mac_oui(wiphy, wdev, data, data_len); |
| 4644 | vos_ssr_unprotect(__func__); |
| 4645 | |
| 4646 | return ret; |
| 4647 | } |
| 4648 | |
| 4649 | static int __wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4650 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4651 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4652 | int data_len) |
| 4653 | { |
| 4654 | u8 peer[6] = {0}; |
| 4655 | struct net_device *dev = wdev->netdev; |
| 4656 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4657 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4658 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; |
| 4659 | eHalStatus ret; |
| 4660 | tANI_S32 state; |
| 4661 | tANI_S32 reason; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4662 | tANI_S32 global_operating_class = 0; |
| 4663 | tANI_S32 channel = 0; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4664 | struct sk_buff *skb = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4665 | int retVal; |
| 4666 | |
| 4667 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 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 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4674 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4675 | if (0 != ret) { |
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 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4680 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4681 | return -ENOTSUPP; |
| 4682 | } |
| 4683 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, |
| 4684 | data, data_len, |
| 4685 | wlan_hdd_tdls_config_get_status_policy)) { |
| 4686 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4687 | return -EINVAL; |
| 4688 | } |
| 4689 | |
| 4690 | /* Parse and fetch mac address */ |
| 4691 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]) { |
| 4692 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4693 | return -EINVAL; |
| 4694 | } |
| 4695 | |
| 4696 | memcpy(peer, nla_data( |
| 4697 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]), |
| 4698 | sizeof(peer)); |
| 4699 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4700 | |
Konamki, Sreelakshmi | abb59ed | 2015-06-12 12:13:23 +0530 | [diff] [blame] | 4701 | wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4702 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4703 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4704 | 4 * sizeof(s32) + |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4705 | NLMSG_HDRLEN); |
| 4706 | |
| 4707 | if (!skb) { |
| 4708 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4709 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 4710 | return -EINVAL; |
| 4711 | } |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4712 | 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] | 4713 | reason, |
| 4714 | state, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4715 | global_operating_class, |
| 4716 | channel, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4717 | MAC_ADDR_ARRAY(peer)); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4718 | if (nla_put_s32(skb, |
| 4719 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE, |
| 4720 | state) || |
| 4721 | nla_put_s32(skb, |
| 4722 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON, |
| 4723 | reason) || |
| 4724 | nla_put_s32(skb, |
| 4725 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS, |
| 4726 | global_operating_class) || |
| 4727 | nla_put_s32(skb, |
| 4728 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL, |
| 4729 | channel)) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4730 | |
| 4731 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4732 | goto nla_put_failure; |
| 4733 | } |
| 4734 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4735 | retVal = cfg80211_vendor_cmd_reply(skb); |
| 4736 | EXIT(); |
| 4737 | return retVal; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4738 | |
| 4739 | nla_put_failure: |
| 4740 | kfree_skb(skb); |
| 4741 | return -EINVAL; |
| 4742 | } |
| 4743 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4744 | static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
| 4745 | struct wireless_dev *wdev, |
| 4746 | const void *data, |
| 4747 | int data_len) |
| 4748 | { |
| 4749 | int ret = 0; |
| 4750 | |
| 4751 | vos_ssr_protect(__func__); |
| 4752 | ret = __wlan_hdd_cfg80211_exttdls_get_status(wiphy, wdev, data, data_len); |
| 4753 | vos_ssr_unprotect(__func__); |
| 4754 | |
| 4755 | return ret; |
| 4756 | } |
| 4757 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 4758 | static int wlan_hdd_cfg80211_exttdls_callback( |
| 4759 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 4760 | const tANI_U8* mac, |
| 4761 | #else |
| 4762 | tANI_U8* mac, |
| 4763 | #endif |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4764 | tANI_S32 state, |
| 4765 | tANI_S32 reason, |
| 4766 | void *ctx) |
| 4767 | { |
| 4768 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)ctx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4769 | struct sk_buff *skb = NULL; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4770 | tANI_S32 global_operating_class = 0; |
| 4771 | tANI_S32 channel = 0; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4772 | hdd_context_t *pHddCtx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4773 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4774 | ENTER(); |
| 4775 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4776 | if (!pAdapter) { |
| 4777 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 4778 | return -EINVAL; |
| 4779 | } |
| 4780 | |
| 4781 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4782 | if (wlan_hdd_validate_context(pHddCtx)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4783 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4784 | return -EINVAL; |
| 4785 | } |
| 4786 | |
| 4787 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4788 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4789 | return -ENOTSUPP; |
| 4790 | } |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 4791 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 4792 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 4793 | NULL, |
| 4794 | #endif |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4795 | EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 4796 | QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX, |
| 4797 | GFP_KERNEL); |
| 4798 | |
| 4799 | if (!skb) { |
| 4800 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4801 | FL("cfg80211_vendor_event_alloc failed")); |
| 4802 | return -EINVAL; |
| 4803 | } |
| 4804 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4805 | hddLog(VOS_TRACE_LEVEL_INFO, "Reason: (%d) Status: (%d) Class: (%d) Channel: (%d)", |
| 4806 | reason, |
| 4807 | state, |
| 4808 | global_operating_class, |
| 4809 | channel); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4810 | hddLog(VOS_TRACE_LEVEL_WARN, "tdls peer " MAC_ADDRESS_STR, |
| 4811 | MAC_ADDR_ARRAY(mac)); |
| 4812 | |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4813 | if (nla_put(skb, |
| 4814 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR, |
| 4815 | VOS_MAC_ADDR_SIZE, mac) || |
| 4816 | nla_put_s32(skb, |
| 4817 | QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE, |
| 4818 | state) || |
| 4819 | nla_put_s32(skb, |
| 4820 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON, |
| 4821 | reason) || |
| 4822 | nla_put_s32(skb, |
| 4823 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL, |
| 4824 | channel) || |
| 4825 | nla_put_s32(skb, |
| 4826 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS, |
| 4827 | global_operating_class) |
| 4828 | ) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4829 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4830 | goto nla_put_failure; |
| 4831 | } |
| 4832 | |
| 4833 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4834 | EXIT(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4835 | return (0); |
| 4836 | |
| 4837 | nla_put_failure: |
| 4838 | kfree_skb(skb); |
| 4839 | return -EINVAL; |
| 4840 | } |
| 4841 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4842 | static int __wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4843 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4844 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4845 | int data_len) |
| 4846 | { |
| 4847 | u8 peer[6] = {0}; |
| 4848 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4849 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4850 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1]; |
| 4851 | eHalStatus status; |
| 4852 | tdls_req_params_t pReqMsg = {0}; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4853 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4854 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4855 | |
| 4856 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4857 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4858 | if (!dev) { |
| 4859 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 4860 | return -EINVAL; |
| 4861 | } |
| 4862 | |
| 4863 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4864 | if (!pAdapter) { |
| 4865 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 4866 | return -EINVAL; |
| 4867 | } |
| 4868 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4869 | status = wlan_hdd_validate_context(pHddCtx); |
| 4870 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4871 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4872 | return -EINVAL; |
| 4873 | } |
| 4874 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4875 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4876 | return -ENOTSUPP; |
| 4877 | } |
| 4878 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX, |
| 4879 | data, data_len, |
| 4880 | wlan_hdd_tdls_config_enable_policy)) { |
| 4881 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4882 | return -EINVAL; |
| 4883 | } |
| 4884 | |
| 4885 | /* Parse and fetch mac address */ |
| 4886 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]) { |
| 4887 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4888 | return -EINVAL; |
| 4889 | } |
| 4890 | |
| 4891 | memcpy(peer, nla_data( |
| 4892 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]), |
| 4893 | sizeof(peer)); |
| 4894 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4895 | |
| 4896 | /* Parse and fetch channel */ |
| 4897 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]) { |
| 4898 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 4899 | return -EINVAL; |
| 4900 | } |
| 4901 | pReqMsg.channel = nla_get_s32( |
| 4902 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]); |
| 4903 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Channel Num (%d)"), pReqMsg.channel); |
| 4904 | |
| 4905 | /* Parse and fetch global operating class */ |
| 4906 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]) { |
| 4907 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr operating class failed")); |
| 4908 | return -EINVAL; |
| 4909 | } |
| 4910 | pReqMsg.global_operating_class = nla_get_s32( |
| 4911 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]); |
| 4912 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Operating class (%d)"), |
| 4913 | pReqMsg.global_operating_class); |
| 4914 | |
| 4915 | /* Parse and fetch latency ms */ |
| 4916 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]) { |
| 4917 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr latency failed")); |
| 4918 | return -EINVAL; |
| 4919 | } |
| 4920 | pReqMsg.max_latency_ms = nla_get_s32( |
| 4921 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]); |
| 4922 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Latency (%d)"), |
| 4923 | pReqMsg.max_latency_ms); |
| 4924 | |
| 4925 | /* Parse and fetch required bandwidth kbps */ |
| 4926 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]) { |
| 4927 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bandwidth failed")); |
| 4928 | return -EINVAL; |
| 4929 | } |
| 4930 | |
| 4931 | pReqMsg.min_bandwidth_kbps = nla_get_s32( |
| 4932 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]); |
| 4933 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bandwidth (%d)"), |
| 4934 | pReqMsg.min_bandwidth_kbps); |
| 4935 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4936 | ret = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4937 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 4938 | &pReqMsg, |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4939 | wlan_hdd_cfg80211_exttdls_callback); |
| 4940 | |
| 4941 | EXIT(); |
| 4942 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4943 | } |
| 4944 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4945 | static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
| 4946 | struct wireless_dev *wdev, |
| 4947 | const void *data, |
| 4948 | int data_len) |
| 4949 | { |
| 4950 | int ret = 0; |
| 4951 | |
| 4952 | vos_ssr_protect(__func__); |
| 4953 | ret = __wlan_hdd_cfg80211_exttdls_enable(wiphy, wdev, data, data_len); |
| 4954 | vos_ssr_unprotect(__func__); |
| 4955 | |
| 4956 | return ret; |
| 4957 | } |
| 4958 | |
| 4959 | static int __wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4960 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4961 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4962 | int data_len) |
| 4963 | { |
| 4964 | u8 peer[6] = {0}; |
| 4965 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4966 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4967 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1]; |
| 4968 | eHalStatus status; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4969 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4970 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4971 | |
| 4972 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4973 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4974 | if (!dev) { |
| 4975 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 4976 | return -EINVAL; |
| 4977 | } |
| 4978 | |
| 4979 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4980 | if (!pAdapter) { |
| 4981 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 4982 | return -EINVAL; |
| 4983 | } |
| 4984 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4985 | status = wlan_hdd_validate_context(pHddCtx); |
| 4986 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4987 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4988 | return -EINVAL; |
| 4989 | } |
| 4990 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4991 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4992 | return -ENOTSUPP; |
| 4993 | } |
| 4994 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX, |
| 4995 | data, data_len, |
| 4996 | wlan_hdd_tdls_config_disable_policy)) { |
| 4997 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4998 | return -EINVAL; |
| 4999 | } |
| 5000 | /* Parse and fetch mac address */ |
| 5001 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]) { |
| 5002 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5003 | return -EINVAL; |
| 5004 | } |
| 5005 | |
| 5006 | memcpy(peer, nla_data( |
| 5007 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]), |
| 5008 | sizeof(peer)); |
| 5009 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 5010 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5011 | ret = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
| 5012 | |
| 5013 | EXIT(); |
| 5014 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5015 | } |
| 5016 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5017 | static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
| 5018 | struct wireless_dev *wdev, |
| 5019 | const void *data, |
| 5020 | int data_len) |
| 5021 | { |
| 5022 | int ret = 0; |
| 5023 | |
| 5024 | vos_ssr_protect(__func__); |
| 5025 | ret = __wlan_hdd_cfg80211_exttdls_disable(wiphy, wdev, data, data_len); |
| 5026 | vos_ssr_unprotect(__func__); |
| 5027 | |
| 5028 | return ret; |
| 5029 | } |
| 5030 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5031 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5032 | __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5033 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5034 | const void *data, int data_len) |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5035 | { |
| 5036 | struct net_device *dev = wdev->netdev; |
| 5037 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5038 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5039 | struct sk_buff *skb = NULL; |
| 5040 | tANI_U32 fset = 0; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5041 | int ret = 0; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5042 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5043 | ENTER(); |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5044 | |
| 5045 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5046 | if (0 != ret) |
| 5047 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5048 | return ret; |
| 5049 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5050 | if (wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { |
| 5051 | hddLog(LOG1, FL("Infra Station mode is supported by driver")); |
| 5052 | fset |= WIFI_FEATURE_INFRA; |
| 5053 | } |
| 5054 | |
| 5055 | if (TRUE == hdd_is_5g_supported(pHddCtx)) { |
| 5056 | hddLog(LOG1, FL("INFRA_5G is supported by firmware")); |
| 5057 | fset |= WIFI_FEATURE_INFRA_5G; |
| 5058 | } |
| 5059 | |
| 5060 | #ifdef WLAN_FEATURE_P2P |
| 5061 | if ((wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) && |
| 5062 | (wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_GO))) { |
| 5063 | hddLog(LOG1, FL("WiFi-Direct is supported by driver")); |
| 5064 | fset |= WIFI_FEATURE_P2P; |
| 5065 | } |
| 5066 | #endif |
| 5067 | |
| 5068 | /* Soft-AP is supported currently by default */ |
| 5069 | fset |= WIFI_FEATURE_SOFT_AP; |
| 5070 | |
Kanchanapally, Vidyullatha | 683aed0 | 2015-03-24 16:58:38 +0530 | [diff] [blame] | 5071 | /* HOTSPOT is a supplicant feature, enable it by default */ |
| 5072 | fset |= WIFI_FEATURE_HOTSPOT; |
| 5073 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5074 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5075 | if ((TRUE == pHddCtx->cfg_ini->fEnableEXTScan) && |
| 5076 | sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) { |
| 5077 | hddLog(LOG1, FL("EXTScan is supported by firmware")); |
| 5078 | fset |= WIFI_FEATURE_EXTSCAN; |
| 5079 | } |
| 5080 | #endif |
| 5081 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5082 | if (sme_IsFeatureSupportedByFW(NAN)) { |
| 5083 | hddLog(LOG1, FL("NAN is supported by firmware")); |
| 5084 | fset |= WIFI_FEATURE_NAN; |
| 5085 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5086 | |
| 5087 | /* D2D RTT is not supported currently by default */ |
| 5088 | if (sme_IsFeatureSupportedByFW(RTT)) { |
| 5089 | hddLog(LOG1, FL("RTT is supported by firmware")); |
| 5090 | fset |= WIFI_FEATURE_D2AP_RTT; |
| 5091 | } |
| 5092 | |
| 5093 | #ifdef FEATURE_WLAN_BATCH_SCAN |
| 5094 | if (fset & WIFI_FEATURE_EXTSCAN) { |
| 5095 | hddLog(LOG1, FL("Batch scan is supported as extscan is supported")); |
| 5096 | fset &= ~WIFI_FEATURE_BATCH_SCAN; |
| 5097 | } else if (sme_IsFeatureSupportedByFW(BATCH_SCAN)) { |
| 5098 | hddLog(LOG1, FL("Batch scan is supported by firmware")); |
| 5099 | fset |= WIFI_FEATURE_BATCH_SCAN; |
| 5100 | } |
| 5101 | #endif |
| 5102 | |
| 5103 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 5104 | if (pHddCtx->cfg_ini->configPNOScanSupport && |
| 5105 | (eHAL_STATUS_SUCCESS == wlan_hdd_is_pno_allowed(pAdapter))) { |
| 5106 | hddLog(LOG1, FL("PNO is supported by firmware")); |
| 5107 | fset |= WIFI_FEATURE_PNO; |
| 5108 | } |
| 5109 | #endif |
| 5110 | |
| 5111 | /* STA+STA is supported currently by default */ |
| 5112 | fset |= WIFI_FEATURE_ADDITIONAL_STA; |
| 5113 | |
| 5114 | #ifdef FEATURE_WLAN_TDLS |
| 5115 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSSupport) && |
| 5116 | sme_IsFeatureSupportedByFW(TDLS)) { |
| 5117 | hddLog(LOG1, FL("TDLS is supported by firmware")); |
| 5118 | fset |= WIFI_FEATURE_TDLS; |
| 5119 | } |
| 5120 | |
| 5121 | /* TDLS_OFFCHANNEL is not supported currently by default */ |
| 5122 | #endif |
| 5123 | |
| 5124 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 5125 | /* AP+STA concurrency is supported currently by default */ |
| 5126 | fset |= WIFI_FEATURE_AP_STA; |
| 5127 | #endif |
| 5128 | |
Mukul Sharma | 5add053 | 2015-08-17 15:57:47 +0530 | [diff] [blame] | 5129 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5130 | fset |= WIFI_FEATURE_LINK_LAYER_STATS; |
| 5131 | hddLog(LOG1, FL("Link layer stats is supported by driver")); |
| 5132 | #endif |
| 5133 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5134 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) + |
| 5135 | NLMSG_HDRLEN); |
| 5136 | |
| 5137 | if (!skb) { |
| 5138 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 5139 | return -EINVAL; |
| 5140 | } |
| 5141 | hddLog(LOG1, FL("Supported Features : 0x%x"), fset); |
| 5142 | |
| 5143 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_FEATURE_SET, fset)) { |
| 5144 | hddLog(LOGE, FL("nla put fail")); |
| 5145 | goto nla_put_failure; |
| 5146 | } |
| 5147 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5148 | ret = cfg80211_vendor_cmd_reply(skb); |
| 5149 | EXIT(); |
| 5150 | return ret; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5151 | |
| 5152 | nla_put_failure: |
| 5153 | kfree_skb(skb); |
| 5154 | return -EINVAL; |
| 5155 | } |
| 5156 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5157 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5158 | wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
| 5159 | struct wireless_dev *wdev, |
| 5160 | const void *data, int data_len) |
| 5161 | { |
| 5162 | int ret = 0; |
| 5163 | |
| 5164 | vos_ssr_protect(__func__); |
| 5165 | ret = __wlan_hdd_cfg80211_get_supported_features(wiphy, wdev, data, data_len); |
| 5166 | vos_ssr_unprotect(__func__); |
| 5167 | |
| 5168 | return ret; |
| 5169 | } |
| 5170 | |
| 5171 | static int |
| 5172 | __wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5173 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5174 | const void *data, int data_len) |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5175 | { |
| 5176 | uint32_t feature_set_matrix[WLAN_HDD_MAX_FEATURE_SET] = {0}; |
| 5177 | uint8_t i, feature_sets, max_feature_sets; |
| 5178 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX + 1]; |
| 5179 | struct sk_buff *reply_skb; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5180 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5181 | int ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5182 | |
| 5183 | ENTER(); |
| 5184 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5185 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5186 | if (0 != ret) |
| 5187 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5188 | return ret; |
| 5189 | } |
| 5190 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5191 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX, |
| 5192 | data, data_len, NULL)) { |
| 5193 | hddLog(LOGE, FL("Invalid ATTR")); |
| 5194 | return -EINVAL; |
| 5195 | } |
| 5196 | |
| 5197 | /* Parse and fetch max feature set */ |
| 5198 | if (!tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]) { |
| 5199 | hddLog(LOGE, FL("Attr max feature set size failed")); |
| 5200 | return -EINVAL; |
| 5201 | } |
| 5202 | max_feature_sets = nla_get_u32( |
| 5203 | tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]); |
| 5204 | hddLog(LOG1, FL("Max feature set size (%d)"), max_feature_sets); |
| 5205 | |
| 5206 | /* Fill feature combination matrix */ |
| 5207 | feature_sets = 0; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5208 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5209 | WIFI_FEATURE_P2P; |
| 5210 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5211 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5212 | WIFI_FEATURE_SOFT_AP; |
| 5213 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5214 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_P2P | |
| 5215 | WIFI_FEATURE_SOFT_AP; |
| 5216 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5217 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5218 | WIFI_FEATURE_SOFT_AP | |
| 5219 | WIFI_FEATURE_P2P; |
| 5220 | |
| 5221 | /* Add more feature combinations here */ |
| 5222 | |
| 5223 | feature_sets = VOS_MIN(feature_sets, max_feature_sets); |
| 5224 | hddLog(LOG1, FL("Number of feature sets (%d)"), feature_sets); |
| 5225 | hddLog(LOG1, "Feature set matrix"); |
| 5226 | for (i = 0; i < feature_sets; i++) |
| 5227 | hddLog(LOG1, "[%d] 0x%02X", i, feature_set_matrix[i]); |
| 5228 | |
| 5229 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 5230 | sizeof(u32) * feature_sets + |
| 5231 | NLMSG_HDRLEN); |
| 5232 | |
| 5233 | if (reply_skb) { |
| 5234 | if (nla_put_u32(reply_skb, |
| 5235 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET_SIZE, |
| 5236 | feature_sets) || |
| 5237 | nla_put(reply_skb, |
| 5238 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET, |
| 5239 | sizeof(u32) * feature_sets, feature_set_matrix)) { |
| 5240 | hddLog(LOGE, FL("nla put fail")); |
| 5241 | kfree_skb(reply_skb); |
| 5242 | return -EINVAL; |
| 5243 | } |
| 5244 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5245 | ret = cfg80211_vendor_cmd_reply(reply_skb); |
| 5246 | EXIT(); |
| 5247 | return ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5248 | } |
| 5249 | hddLog(LOGE, FL("Feature set matrix: buffer alloc fail")); |
| 5250 | return -ENOMEM; |
| 5251 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5252 | } |
| 5253 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5254 | static int |
| 5255 | wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
| 5256 | struct wireless_dev *wdev, |
| 5257 | const void *data, int data_len) |
| 5258 | { |
| 5259 | int ret = 0; |
| 5260 | |
| 5261 | vos_ssr_protect(__func__); |
| 5262 | ret = __wlan_hdd_cfg80211_get_concurrency_matrix(wiphy, wdev, data, |
| 5263 | data_len); |
| 5264 | vos_ssr_unprotect(__func__); |
| 5265 | |
| 5266 | return ret; |
| 5267 | } |
| 5268 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5269 | static const struct nla_policy |
| 5270 | wlan_hdd_set_no_dfs_flag_config_policy[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX |
| 5271 | +1] = |
| 5272 | { |
| 5273 | [QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG] = {.type = NLA_U32 }, |
| 5274 | }; |
| 5275 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5276 | static int __wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5277 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5278 | const void *data, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5279 | int data_len) |
| 5280 | { |
| 5281 | struct net_device *dev = wdev->netdev; |
| 5282 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5283 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5284 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5285 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX + 1]; |
| 5286 | eHalStatus status; |
| 5287 | u32 dfsFlag = 0; |
| 5288 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5289 | ENTER(); |
| 5290 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5291 | status = wlan_hdd_validate_context(pHddCtx); |
| 5292 | if (0 != status) { |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5293 | return -EINVAL; |
| 5294 | } |
| 5295 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX, |
| 5296 | data, data_len, |
| 5297 | wlan_hdd_set_no_dfs_flag_config_policy)) { |
| 5298 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5299 | return -EINVAL; |
| 5300 | } |
| 5301 | |
| 5302 | /* Parse and fetch required bandwidth kbps */ |
| 5303 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]) { |
| 5304 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dfs flag failed")); |
| 5305 | return -EINVAL; |
| 5306 | } |
| 5307 | |
| 5308 | dfsFlag = nla_get_u32( |
| 5309 | tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]); |
| 5310 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" DFS flag (%d)"), |
| 5311 | dfsFlag); |
| 5312 | |
| 5313 | pHddCtx->disable_dfs_flag = dfsFlag; |
| 5314 | |
| 5315 | sme_disable_dfs_channel(hHal, dfsFlag); |
| 5316 | sme_FilterScanResults(hHal, pAdapter->sessionId); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5317 | |
| 5318 | EXIT(); |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5319 | return 0; |
| 5320 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5321 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5322 | static int wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
| 5323 | struct wireless_dev *wdev, |
| 5324 | const void *data, |
| 5325 | int data_len) |
| 5326 | { |
| 5327 | int ret = 0; |
| 5328 | |
| 5329 | vos_ssr_protect(__func__); |
| 5330 | ret = __wlan_hdd_cfg80211_disable_dfs_channels(wiphy, wdev, data, data_len); |
| 5331 | vos_ssr_unprotect(__func__); |
| 5332 | |
| 5333 | return ret; |
| 5334 | |
| 5335 | } |
| 5336 | |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5337 | const struct |
| 5338 | nla_policy qca_wlan_vendor_attr[QCA_WLAN_VENDOR_ATTR_MAX+1] = |
| 5339 | { |
| 5340 | [QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY] = { .type = NLA_U32 }, |
| 5341 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { .type = NLA_UNSPEC }, |
| 5342 | }; |
| 5343 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5344 | static int __wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5345 | struct wireless_dev *wdev, const void *data, int data_len) |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5346 | { |
| 5347 | |
| 5348 | u8 bssid[6] = {0}; |
| 5349 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5350 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 5351 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5352 | v_U32_t isFwrRoamEnabled = FALSE; |
| 5353 | int ret; |
| 5354 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5355 | ENTER(); |
| 5356 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5357 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5358 | if (0 != ret) { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5359 | return ret; |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5360 | } |
| 5361 | |
| 5362 | ret = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, |
| 5363 | data, data_len, |
| 5364 | qca_wlan_vendor_attr); |
| 5365 | if (ret){ |
| 5366 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5367 | return -EINVAL; |
| 5368 | } |
| 5369 | |
| 5370 | /* Parse and fetch Enable flag */ |
| 5371 | if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]) { |
| 5372 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr enable failed")); |
| 5373 | return -EINVAL; |
| 5374 | } |
| 5375 | |
| 5376 | isFwrRoamEnabled = nla_get_u32( |
| 5377 | tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]); |
| 5378 | |
| 5379 | hddLog(VOS_TRACE_LEVEL_INFO, FL("isFwrRoamEnabled (%d)"), isFwrRoamEnabled); |
| 5380 | |
| 5381 | /* Parse and fetch bssid */ |
| 5382 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 5383 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bss id failed")); |
| 5384 | return -EINVAL; |
| 5385 | } |
| 5386 | |
| 5387 | memcpy(bssid, nla_data( |
| 5388 | tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 5389 | sizeof(bssid)); |
| 5390 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(bssid)); |
| 5391 | |
| 5392 | //Update roaming |
| 5393 | status = sme_ConfigFwrRoaming((tHalHandle)(pHddCtx->hHal), isFwrRoamEnabled); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5394 | EXIT(); |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5395 | return status; |
| 5396 | } |
| 5397 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5398 | static int wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
| 5399 | struct wireless_dev *wdev, const void *data, int data_len) |
| 5400 | { |
| 5401 | int ret = 0; |
| 5402 | |
| 5403 | vos_ssr_protect(__func__); |
| 5404 | ret = __wlan_hdd_cfg80211_firmware_roaming(wiphy, wdev, data, data_len); |
| 5405 | vos_ssr_unprotect(__func__); |
| 5406 | |
| 5407 | return ret; |
| 5408 | } |
| 5409 | |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 5410 | /** |
| 5411 | * __wlan_hdd_cfg80211_setband() - set band |
| 5412 | * @wiphy: Pointer to wireless phy |
| 5413 | * @wdev: Pointer to wireless device |
| 5414 | * @data: Pointer to data |
| 5415 | * @data_len: Data length |
| 5416 | * |
| 5417 | * Return: 0 on success, negative errno on failure |
| 5418 | */ |
| 5419 | static int |
| 5420 | __wlan_hdd_cfg80211_setband(struct wiphy *wiphy, |
| 5421 | struct wireless_dev *wdev, |
| 5422 | const void *data, |
| 5423 | int data_len) |
| 5424 | { |
| 5425 | struct net_device *dev = wdev->netdev; |
| 5426 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 5427 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 5428 | int ret; |
| 5429 | static const struct nla_policy policy[QCA_WLAN_VENDOR_ATTR_MAX + 1] |
| 5430 | = {[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE] = { .type = NLA_U32 }}; |
| 5431 | |
| 5432 | ENTER(); |
| 5433 | |
| 5434 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5435 | if (0 != ret) { |
| 5436 | hddLog(LOGE, FL("HDD context is not valid")); |
| 5437 | return ret; |
| 5438 | } |
| 5439 | |
| 5440 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len, |
| 5441 | policy)) { |
| 5442 | hddLog(LOGE, FL("Invalid ATTR")); |
| 5443 | return -EINVAL; |
| 5444 | } |
| 5445 | |
| 5446 | if (!tb[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE]) { |
| 5447 | hddLog(LOGE, FL("attr QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE failed")); |
| 5448 | return -EINVAL; |
| 5449 | } |
| 5450 | |
Hanumantha Reddy Pothula | 1347e43 | 2015-08-05 09:53:44 +0530 | [diff] [blame] | 5451 | hdd_ctx->isSetBandByNL = TRUE; |
| 5452 | ret = hdd_setBand(dev, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 5453 | nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE])); |
Hanumantha Reddy Pothula | 1347e43 | 2015-08-05 09:53:44 +0530 | [diff] [blame] | 5454 | hdd_ctx->isSetBandByNL = FALSE; |
| 5455 | |
| 5456 | EXIT(); |
| 5457 | return ret; |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 5458 | } |
| 5459 | |
| 5460 | /** |
| 5461 | * wlan_hdd_cfg80211_setband() - Wrapper to offload packets |
| 5462 | * @wiphy: wiphy structure pointer |
| 5463 | * @wdev: Wireless device structure pointer |
| 5464 | * @data: Pointer to the data received |
| 5465 | * @data_len: Length of @data |
| 5466 | * |
| 5467 | * Return: 0 on success; errno on failure |
| 5468 | */ |
| 5469 | static int wlan_hdd_cfg80211_setband(struct wiphy *wiphy, |
| 5470 | struct wireless_dev *wdev, |
| 5471 | const void *data, |
| 5472 | int data_len) |
| 5473 | { |
| 5474 | int ret = 0; |
| 5475 | |
| 5476 | vos_ssr_protect(__func__); |
| 5477 | ret = __wlan_hdd_cfg80211_setband(wiphy, |
| 5478 | wdev, data, data_len); |
| 5479 | vos_ssr_unprotect(__func__); |
| 5480 | |
| 5481 | return ret; |
| 5482 | } |
| 5483 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5484 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 5485 | { |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5486 | { |
| 5487 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5488 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAMING, |
| 5489 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5490 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5491 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5492 | .doit = wlan_hdd_cfg80211_firmware_roaming |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5493 | }, |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 5494 | |
| 5495 | { |
| 5496 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5497 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN, |
| 5498 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5499 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5500 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 5501 | .doit = wlan_hdd_cfg80211_nan_request |
| 5502 | }, |
| 5503 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5504 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5505 | { |
| 5506 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5507 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 5508 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5509 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5510 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5511 | .doit = wlan_hdd_cfg80211_ll_stats_clear |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5512 | }, |
| 5513 | |
| 5514 | { |
| 5515 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5516 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 5517 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5518 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5519 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5520 | .doit = wlan_hdd_cfg80211_ll_stats_set |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5521 | }, |
| 5522 | |
| 5523 | { |
| 5524 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5525 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 5526 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5527 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5528 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5529 | .doit = wlan_hdd_cfg80211_ll_stats_get |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5530 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5531 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5532 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5533 | { |
| 5534 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5535 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START, |
| 5536 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5537 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5538 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5539 | .doit = wlan_hdd_cfg80211_extscan_start |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5540 | }, |
| 5541 | { |
| 5542 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5543 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP, |
| 5544 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5545 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5546 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5547 | .doit = wlan_hdd_cfg80211_extscan_stop |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5548 | }, |
| 5549 | { |
| 5550 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5551 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS, |
| 5552 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5553 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5554 | .doit = wlan_hdd_cfg80211_extscan_get_valid_channels |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5555 | }, |
| 5556 | { |
| 5557 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5558 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES, |
| 5559 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5560 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5561 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5562 | .doit = wlan_hdd_cfg80211_extscan_get_capabilities |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5563 | }, |
| 5564 | { |
| 5565 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5566 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS, |
| 5567 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5568 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5569 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5570 | .doit = wlan_hdd_cfg80211_extscan_get_cached_results |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5571 | }, |
| 5572 | { |
| 5573 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5574 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST, |
| 5575 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5576 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5577 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5578 | .doit = wlan_hdd_cfg80211_extscan_set_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5579 | }, |
| 5580 | { |
| 5581 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5582 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST, |
| 5583 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5584 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5585 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5586 | .doit = wlan_hdd_cfg80211_extscan_reset_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5587 | }, |
| 5588 | { |
| 5589 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5590 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE, |
| 5591 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5592 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5593 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5594 | .doit = wlan_hdd_cfg80211_extscan_set_significant_change |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5595 | }, |
| 5596 | { |
| 5597 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5598 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE, |
| 5599 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5600 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5601 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5602 | .doit = wlan_hdd_cfg80211_extscan_reset_significant_change |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5603 | }, |
| 5604 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5605 | /*EXT TDLS*/ |
| 5606 | { |
| 5607 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5608 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE, |
| 5609 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5610 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5611 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5612 | .doit = wlan_hdd_cfg80211_exttdls_enable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5613 | }, |
| 5614 | { |
| 5615 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5616 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE, |
| 5617 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5618 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5619 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5620 | .doit = wlan_hdd_cfg80211_exttdls_disable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5621 | }, |
| 5622 | { |
| 5623 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5624 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS, |
| 5625 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5626 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5627 | .doit = wlan_hdd_cfg80211_exttdls_get_status |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5628 | }, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5629 | { |
| 5630 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5631 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES, |
| 5632 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5633 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5634 | .doit = wlan_hdd_cfg80211_get_supported_features |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5635 | }, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5636 | { |
| 5637 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5638 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG, |
| 5639 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5640 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5641 | .doit = wlan_hdd_cfg80211_disable_dfs_channels |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5642 | }, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5643 | { |
| 5644 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5645 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MAC_OUI, |
| 5646 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5647 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5648 | .doit = wlan_hdd_cfg80211_set_spoofed_mac_oui |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5649 | }, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5650 | { |
| 5651 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5652 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX, |
| 5653 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5654 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5655 | .doit = wlan_hdd_cfg80211_get_concurrency_matrix |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5656 | }, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 5657 | { |
| 5658 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5659 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SETBAND, |
| 5660 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5661 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5662 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 5663 | .doit = wlan_hdd_cfg80211_setband |
| 5664 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5665 | }; |
| 5666 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5667 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5668 | static const |
| 5669 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5670 | { |
| 5671 | #ifdef FEATURE_WLAN_CH_AVOID |
| 5672 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5673 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5674 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5675 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5676 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 5677 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5678 | { |
| 5679 | /* Index = 1*/ |
| 5680 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5681 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 5682 | }, |
| 5683 | { |
| 5684 | /* Index = 2*/ |
| 5685 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5686 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 5687 | }, |
| 5688 | { |
| 5689 | /* Index = 3*/ |
| 5690 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5691 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 5692 | }, |
| 5693 | { |
| 5694 | /* Index = 4*/ |
| 5695 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5696 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 5697 | }, |
| 5698 | { |
| 5699 | /* Index = 5*/ |
| 5700 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5701 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 5702 | }, |
| 5703 | { |
| 5704 | /* Index = 6*/ |
| 5705 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5706 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 5707 | }, |
| 5708 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5709 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5710 | { |
| 5711 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5712 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START |
| 5713 | }, |
| 5714 | { |
| 5715 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5716 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP |
| 5717 | }, |
| 5718 | { |
| 5719 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5720 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES |
| 5721 | }, |
| 5722 | { |
| 5723 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5724 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS |
| 5725 | }, |
| 5726 | { |
| 5727 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5728 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE |
| 5729 | }, |
| 5730 | { |
| 5731 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5732 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT |
| 5733 | }, |
| 5734 | { |
| 5735 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5736 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT |
| 5737 | }, |
| 5738 | { |
| 5739 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5740 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND |
| 5741 | }, |
| 5742 | { |
| 5743 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5744 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST |
| 5745 | }, |
| 5746 | { |
| 5747 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5748 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST |
| 5749 | }, |
| 5750 | { |
| 5751 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5752 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE |
| 5753 | }, |
| 5754 | { |
| 5755 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5756 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE |
| 5757 | }, |
| 5758 | { |
| 5759 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5760 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE |
| 5761 | }, |
| 5762 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5763 | /*EXT TDLS*/ |
| 5764 | { |
| 5765 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5766 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE |
| 5767 | }, |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 5768 | |
| 5769 | { |
| 5770 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5771 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN |
| 5772 | }, |
| 5773 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5774 | }; |
| 5775 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5776 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5777 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5778 | * This function is called by hdd_wlan_startup() |
| 5779 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5780 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5781 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5782 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5783 | { |
| 5784 | struct wiphy *wiphy; |
| 5785 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5786 | /* |
| 5787 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5788 | */ |
| 5789 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 5790 | |
| 5791 | if (!wiphy) |
| 5792 | { |
| 5793 | /* Print error and jump into err label and free the memory */ |
| 5794 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 5795 | return NULL; |
| 5796 | } |
| 5797 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5798 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5799 | return wiphy; |
| 5800 | } |
| 5801 | |
| 5802 | /* |
| 5803 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5804 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5805 | * private ioctl to change the band value |
| 5806 | */ |
| 5807 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 5808 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5809 | int i, j; |
| 5810 | eNVChannelEnabledType channelEnabledState; |
| 5811 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5812 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5813 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5814 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5815 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5816 | |
| 5817 | if (NULL == wiphy->bands[i]) |
| 5818 | { |
| 5819 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 5820 | __func__, i); |
| 5821 | continue; |
| 5822 | } |
| 5823 | |
| 5824 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 5825 | { |
| 5826 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 5827 | |
| 5828 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 5829 | band->channels[j].hw_value); |
| 5830 | |
| 5831 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 5832 | { |
Abhishek Singh | 678227a | 2014-11-04 10:52:38 +0530 | [diff] [blame] | 5833 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5834 | continue; |
| 5835 | } |
| 5836 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 5837 | { |
| 5838 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5839 | continue; |
| 5840 | } |
| 5841 | |
| 5842 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 5843 | NV_CHANNEL_INVALID == channelEnabledState) |
| 5844 | { |
| 5845 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5846 | } |
| 5847 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 5848 | { |
| 5849 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 5850 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 5851 | } |
| 5852 | else |
| 5853 | { |
| 5854 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 5855 | |IEEE80211_CHAN_RADAR); |
| 5856 | } |
| 5857 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5858 | } |
| 5859 | return 0; |
| 5860 | } |
| 5861 | /* |
| 5862 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5863 | * This function is called by hdd_wlan_startup() |
| 5864 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5865 | * This function is used to initialize and register wiphy structure. |
| 5866 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5867 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5868 | struct wiphy *wiphy, |
| 5869 | hdd_config_t *pCfg |
| 5870 | ) |
| 5871 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5872 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 5873 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5874 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5875 | ENTER(); |
| 5876 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5877 | /* Now bind the underlying wlan device with wiphy */ |
| 5878 | set_wiphy_dev(wiphy, dev); |
| 5879 | |
| 5880 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5881 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5882 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 5883 | /* the flag for the other case would be initialzed in |
| 5884 | vos_init_wiphy_from_nv_bin */ |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 5885 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5886 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5887 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5888 | /* This will disable updating of NL channels from passive to |
| 5889 | * active if a beacon is received on passive channel. */ |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 5890 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 5891 | wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS; |
| 5892 | #else |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5893 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 5894 | #endif |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5895 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5896 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5897 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 5898 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 5899 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 5900 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5901 | | WIPHY_FLAG_OFFCHAN_TX; |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 5902 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 5903 | wiphy->regulatory_flags = REGULATORY_COUNTRY_IE_IGNORE; |
| 5904 | #else |
| 5905 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
| 5906 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5907 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5908 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5909 | #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] | 5910 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 5911 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 5912 | || pCfg->isFastRoamIniFeatureEnabled |
| 5913 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5914 | #ifdef FEATURE_WLAN_ESE |
| 5915 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 5916 | #endif |
| 5917 | ) |
| 5918 | { |
| 5919 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 5920 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 5921 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5922 | #ifdef FEATURE_WLAN_TDLS |
| 5923 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 5924 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 5925 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 5926 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 5927 | if (pCfg->configPNOScanSupport) |
| 5928 | { |
| 5929 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 5930 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 5931 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 5932 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 5933 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 5934 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5935 | |
Abhishek Singh | 10d8597 | 2015-04-17 10:27:23 +0530 | [diff] [blame] | 5936 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 5937 | wiphy->features |= NL80211_FEATURE_HT_IBSS; |
| 5938 | #endif |
| 5939 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5940 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 5941 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 5942 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5943 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 5944 | driver need to determine what to do with both |
| 5945 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5946 | |
| 5947 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5948 | #else |
| 5949 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5950 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5951 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5952 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 5953 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 5954 | wiphy->max_scan_ie_len = SIR_MAC_MAX_ADD_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5955 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 5956 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 5957 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5958 | /* Supports STATION & AD-HOC modes right now */ |
Bhargav Shah | 0d2e3e5 | 2015-07-24 16:51:01 +0530 | [diff] [blame] | 5959 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
| 5960 | | BIT(NL80211_IFTYPE_ADHOC) |
| 5961 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 5962 | | BIT(NL80211_IFTYPE_P2P_GO) |
| 5963 | | BIT(NL80211_IFTYPE_AP); |
| 5964 | |
| 5965 | if (VOS_MONITOR_MODE == hdd_get_conparam()) |
| 5966 | { |
| 5967 | wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); |
| 5968 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5969 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5970 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5971 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5972 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 5973 | if( pCfg->enableMCC ) |
| 5974 | { |
| 5975 | /* Currently, supports up to two channels */ |
| 5976 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5977 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5978 | if( !pCfg->allowMCCGODiffBI ) |
| 5979 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5980 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5981 | } |
| 5982 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 5983 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5984 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5985 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5986 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5987 | /* Before registering we need to update the ht capabilitied based |
| 5988 | * on ini values*/ |
| 5989 | if( !pCfg->ShortGI20MhzEnable ) |
| 5990 | { |
| 5991 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5992 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5993 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5994 | } |
| 5995 | |
| 5996 | if( !pCfg->ShortGI40MhzEnable ) |
| 5997 | { |
| 5998 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 5999 | } |
| 6000 | |
| 6001 | if( !pCfg->nChannelBondingMode5GHz ) |
| 6002 | { |
| 6003 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 6004 | } |
| 6005 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 6006 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 6007 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 6008 | { |
| 6009 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 6010 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 6011 | |
| 6012 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 6013 | { |
| 6014 | |
| 6015 | if (NULL == wiphy->bands[i]) |
| 6016 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 6017 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: wiphy->bands[i] is NULL, i = %d", |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 6018 | __func__, i); |
| 6019 | continue; |
| 6020 | } |
| 6021 | |
| 6022 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 6023 | { |
| 6024 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 6025 | |
| 6026 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 6027 | { |
| 6028 | // Enable social channels for P2P |
| 6029 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 6030 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 6031 | else |
| 6032 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 6033 | continue; |
| 6034 | } |
| 6035 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 6036 | { |
| 6037 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 6038 | continue; |
| 6039 | } |
| 6040 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6041 | } |
| 6042 | /*Initialise the supported cipher suite details*/ |
| 6043 | wiphy->cipher_suites = hdd_cipher_suites; |
| 6044 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 6045 | |
| 6046 | /*signal strength in mBm (100*dBm) */ |
| 6047 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 6048 | |
| 6049 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 6050 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6051 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6052 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 6053 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 6054 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 6055 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 6056 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 6057 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 6058 | EXIT(); |
| 6059 | return 0; |
| 6060 | } |
| 6061 | |
| 6062 | /* In this function we are registering wiphy. */ |
| 6063 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 6064 | { |
| 6065 | ENTER(); |
| 6066 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6067 | if (0 > wiphy_register(wiphy)) |
| 6068 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 6069 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6070 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 6071 | return -EIO; |
| 6072 | } |
| 6073 | |
| 6074 | EXIT(); |
| 6075 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6076 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6077 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 6078 | /* In this function we are updating channel list when, |
| 6079 | regulatory domain is FCC and country code is US. |
| 6080 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 6081 | As per FCC smart phone is not a indoor device. |
| 6082 | GO should not opeate on indoor channels */ |
| 6083 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 6084 | { |
| 6085 | int j; |
| 6086 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6087 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 6088 | //Default counrtycode from NV at the time of wiphy initialization. |
| 6089 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 6090 | &defaultCountryCode[0])) |
| 6091 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 6092 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 6093 | } |
| 6094 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 6095 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 6096 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 6097 | { |
| 6098 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 6099 | return; |
| 6100 | } |
| 6101 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 6102 | { |
| 6103 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 6104 | // Mark UNII -1 band channel as passive |
| 6105 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 6106 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 6107 | } |
| 6108 | } |
| 6109 | } |
| 6110 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 6111 | /* This function registers for all frame which supplicant is interested in */ |
| 6112 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6113 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6114 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6115 | /* Register for all P2P action, public action etc frames */ |
| 6116 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 6117 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6118 | ENTER(); |
| 6119 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6120 | /* Right now we are registering these frame when driver is getting |
| 6121 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 6122 | frame register ops, we will move this code as a part of that */ |
| 6123 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6124 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6125 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 6126 | |
| 6127 | /* GAS Initial Response */ |
| 6128 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6129 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6130 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6131 | /* GAS Comeback Request */ |
| 6132 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6133 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 6134 | |
| 6135 | /* GAS Comeback Response */ |
| 6136 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6137 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 6138 | |
| 6139 | /* P2P Public Action */ |
| 6140 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6141 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6142 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 6143 | |
| 6144 | /* P2P Action */ |
| 6145 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6146 | (v_U8_t*)P2P_ACTION_FRAME, |
| 6147 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6148 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 6149 | /* WNM BSS Transition Request frame */ |
| 6150 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6151 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 6152 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 6153 | |
| 6154 | /* WNM-Notification */ |
| 6155 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6156 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 6157 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6158 | } |
| 6159 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 6160 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6161 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6162 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6163 | /* Register for all P2P action, public action etc frames */ |
| 6164 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 6165 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6166 | ENTER(); |
| 6167 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6168 | /* Right now we are registering these frame when driver is getting |
| 6169 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 6170 | frame register ops, we will move this code as a part of that */ |
| 6171 | /* GAS Initial Request */ |
| 6172 | |
| 6173 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6174 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 6175 | |
| 6176 | /* GAS Initial Response */ |
| 6177 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6178 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6179 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6180 | /* GAS Comeback Request */ |
| 6181 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6182 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 6183 | |
| 6184 | /* GAS Comeback Response */ |
| 6185 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6186 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 6187 | |
| 6188 | /* P2P Public Action */ |
| 6189 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6190 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6191 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 6192 | |
| 6193 | /* P2P Action */ |
| 6194 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6195 | (v_U8_t*)P2P_ACTION_FRAME, |
| 6196 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 6197 | /* WNM-Notification */ |
| 6198 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 6199 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 6200 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6201 | } |
| 6202 | |
| 6203 | #ifdef FEATURE_WLAN_WAPI |
| 6204 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 6205 | const u8 *mac_addr, const u8 *key , int key_Len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6206 | { |
| 6207 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6208 | tCsrRoamSetKey setKey; |
| 6209 | v_BOOL_t isConnected = TRUE; |
| 6210 | int status = 0; |
| 6211 | v_U32_t roamId= 0xFF; |
| 6212 | tANI_U8 *pKeyPtr = NULL; |
| 6213 | int n = 0; |
| 6214 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6215 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 6216 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6217 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6218 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 6219 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6220 | setKey.keyId = key_index; // Store Key ID |
| 6221 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 6222 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 6223 | setKey.paeRole = 0 ; // the PAE role |
| 6224 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 6225 | { |
| 6226 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 6227 | } |
| 6228 | else |
| 6229 | { |
| 6230 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 6231 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 6232 | } |
| 6233 | setKey.keyLength = key_Len; |
| 6234 | pKeyPtr = setKey.Key; |
| 6235 | memcpy( pKeyPtr, key, key_Len); |
| 6236 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6237 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6238 | __func__, key_Len); |
| 6239 | for (n = 0 ; n < key_Len; n++) |
| 6240 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 6241 | __func__,n,setKey.Key[n]); |
| 6242 | |
| 6243 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 6244 | if ( isConnected ) |
| 6245 | { |
| 6246 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6247 | pAdapter->sessionId, &setKey, &roamId ); |
| 6248 | } |
| 6249 | if ( status != 0 ) |
| 6250 | { |
| 6251 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6252 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 6253 | __LINE__, status ); |
| 6254 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 6255 | } |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 6256 | /* Need to clear any trace of key value in the memory. |
| 6257 | * Thus zero out the memory even though it is local |
| 6258 | * variable. |
| 6259 | */ |
| 6260 | vos_mem_zero(&setKey, sizeof(setKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6261 | } |
| 6262 | #endif /* FEATURE_WLAN_WAPI*/ |
| 6263 | |
| 6264 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6265 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6266 | beacon_data_t **ppBeacon, |
| 6267 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6268 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6269 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6270 | beacon_data_t **ppBeacon, |
| 6271 | struct cfg80211_beacon_data *params, |
| 6272 | int dtim_period) |
| 6273 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6274 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6275 | int size; |
| 6276 | beacon_data_t *beacon = NULL; |
| 6277 | beacon_data_t *old = NULL; |
| 6278 | int head_len,tail_len; |
| 6279 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6280 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6281 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6282 | { |
| 6283 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6284 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6285 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6286 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6287 | |
| 6288 | old = pAdapter->sessionCtx.ap.beacon; |
| 6289 | |
| 6290 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6291 | { |
| 6292 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6293 | FL("session(%d) old and new heads points to NULL"), |
| 6294 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6295 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6296 | } |
| 6297 | |
| 6298 | if (params->tail && !params->tail_len) |
| 6299 | { |
| 6300 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6301 | FL("tail_len is zero but tail is not NULL")); |
| 6302 | return -EINVAL; |
| 6303 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6304 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6305 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 6306 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 6307 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6308 | { |
| 6309 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6310 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6311 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6312 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6313 | #endif |
| 6314 | |
| 6315 | if(params->head) |
| 6316 | head_len = params->head_len; |
| 6317 | else |
| 6318 | head_len = old->head_len; |
| 6319 | |
| 6320 | if(params->tail || !old) |
| 6321 | tail_len = params->tail_len; |
| 6322 | else |
| 6323 | tail_len = old->tail_len; |
| 6324 | |
| 6325 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 6326 | |
| 6327 | beacon = kzalloc(size, GFP_KERNEL); |
| 6328 | |
| 6329 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6330 | { |
| 6331 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6332 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6333 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6334 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6335 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6336 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6337 | if(params->dtim_period || !old ) |
| 6338 | beacon->dtim_period = params->dtim_period; |
| 6339 | else |
| 6340 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6341 | #else |
| 6342 | if(dtim_period || !old ) |
| 6343 | beacon->dtim_period = dtim_period; |
| 6344 | else |
| 6345 | beacon->dtim_period = old->dtim_period; |
| 6346 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6347 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6348 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 6349 | beacon->tail = beacon->head + head_len; |
| 6350 | beacon->head_len = head_len; |
| 6351 | beacon->tail_len = tail_len; |
| 6352 | |
| 6353 | if(params->head) { |
| 6354 | memcpy (beacon->head,params->head,beacon->head_len); |
| 6355 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6356 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6357 | if(old) |
| 6358 | memcpy (beacon->head,old->head,beacon->head_len); |
| 6359 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6360 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6361 | if(params->tail) { |
| 6362 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 6363 | } |
| 6364 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6365 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6366 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 6367 | } |
| 6368 | |
| 6369 | *ppBeacon = beacon; |
| 6370 | |
| 6371 | kfree(old); |
| 6372 | |
| 6373 | return 0; |
| 6374 | |
| 6375 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6376 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 6377 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr( |
| 6378 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 6379 | const v_U8_t *pIes, |
| 6380 | #else |
| 6381 | v_U8_t *pIes, |
| 6382 | #endif |
| 6383 | int length, v_U8_t eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6384 | { |
| 6385 | int left = length; |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 6386 | v_U8_t *ptr = (v_U8_t *)pIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6387 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6388 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6389 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6390 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6391 | elem_id = ptr[0]; |
| 6392 | elem_len = ptr[1]; |
| 6393 | left -= 2; |
| 6394 | if(elem_len > left) |
| 6395 | { |
| 6396 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 6397 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6398 | eid,elem_len,left); |
| 6399 | return NULL; |
| 6400 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6401 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6402 | { |
| 6403 | return ptr; |
| 6404 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6405 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6406 | left -= elem_len; |
| 6407 | ptr += (elem_len + 2); |
| 6408 | } |
| 6409 | return NULL; |
| 6410 | } |
| 6411 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6412 | /* Check if rate is 11g rate or not */ |
| 6413 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 6414 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 6415 | 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] | 6416 | u8 i; |
| 6417 | for (i = 0; i < 8; i++) |
| 6418 | { |
| 6419 | if(rate == gRateArray[i]) |
| 6420 | return TRUE; |
| 6421 | } |
| 6422 | return FALSE; |
| 6423 | } |
| 6424 | |
| 6425 | /* Check for 11g rate and set proper 11g only mode */ |
| 6426 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 6427 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 6428 | { |
| 6429 | u8 i, num_rates = pIe[0]; |
| 6430 | |
| 6431 | pIe += 1; |
| 6432 | for ( i = 0; i < num_rates; i++) |
| 6433 | { |
| 6434 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 6435 | { |
| 6436 | /* If rate set have 11g rate than change the mode to 11G */ |
| 6437 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 6438 | if (pIe[i] & BASIC_RATE_MASK) |
| 6439 | { |
| 6440 | /* If we have 11g rate as basic rate, it means mode |
| 6441 | is 11g only mode. |
| 6442 | */ |
| 6443 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 6444 | *pCheckRatesfor11g = FALSE; |
| 6445 | } |
| 6446 | } |
| 6447 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 6448 | { |
| 6449 | *require_ht = TRUE; |
| 6450 | } |
| 6451 | } |
| 6452 | return; |
| 6453 | } |
| 6454 | |
| 6455 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 6456 | { |
| 6457 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 6458 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6459 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 6460 | u8 checkRatesfor11g = TRUE; |
| 6461 | u8 require_ht = FALSE; |
| 6462 | u8 *pIe=NULL; |
| 6463 | |
| 6464 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 6465 | |
| 6466 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 6467 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 6468 | if (pIe != NULL) |
| 6469 | { |
| 6470 | pIe += 1; |
| 6471 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 6472 | &pConfig->SapHw_mode); |
| 6473 | } |
| 6474 | |
| 6475 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 6476 | WLAN_EID_EXT_SUPP_RATES); |
| 6477 | if (pIe != NULL) |
| 6478 | { |
| 6479 | |
| 6480 | pIe += 1; |
| 6481 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 6482 | &pConfig->SapHw_mode); |
| 6483 | } |
| 6484 | |
| 6485 | if( pConfig->channel > 14 ) |
| 6486 | { |
| 6487 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 6488 | } |
| 6489 | |
| 6490 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 6491 | WLAN_EID_HT_CAPABILITY); |
| 6492 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6493 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6494 | { |
| 6495 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 6496 | if(require_ht) |
| 6497 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 6498 | } |
| 6499 | } |
| 6500 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6501 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 6502 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 6503 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6504 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6505 | v_U8_t *pIe = NULL; |
| 6506 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6507 | |
| 6508 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 6509 | pBeacon->tail, pBeacon->tail_len); |
| 6510 | |
| 6511 | if (pIe) |
| 6512 | { |
| 6513 | ielen = pIe[1] + 2; |
| 6514 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 6515 | { |
| 6516 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 6517 | } |
| 6518 | else |
| 6519 | { |
| 6520 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 6521 | return -EINVAL; |
| 6522 | } |
| 6523 | *total_ielen += ielen; |
| 6524 | } |
| 6525 | return 0; |
| 6526 | } |
| 6527 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6528 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 6529 | v_U8_t *genie, v_U8_t *total_ielen) |
| 6530 | { |
| 6531 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6532 | int left = pBeacon->tail_len; |
| 6533 | v_U8_t *ptr = pBeacon->tail; |
| 6534 | v_U8_t elem_id, elem_len; |
| 6535 | v_U16_t ielen = 0; |
| 6536 | |
| 6537 | if ( NULL == ptr || 0 == left ) |
| 6538 | return; |
| 6539 | |
| 6540 | while (left >= 2) |
| 6541 | { |
| 6542 | elem_id = ptr[0]; |
| 6543 | elem_len = ptr[1]; |
| 6544 | left -= 2; |
| 6545 | if (elem_len > left) |
| 6546 | { |
| 6547 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 6548 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 6549 | elem_id, elem_len, left); |
| 6550 | return; |
| 6551 | } |
| 6552 | if (IE_EID_VENDOR == elem_id) |
| 6553 | { |
| 6554 | /* skipping the VSIE's which we don't want to include or |
| 6555 | * it will be included by existing code |
| 6556 | */ |
| 6557 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 6558 | #ifdef WLAN_FEATURE_WFD |
| 6559 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 6560 | #endif |
| 6561 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6562 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6563 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 6564 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6565 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 6566 | { |
| 6567 | ielen = ptr[1] + 2; |
| 6568 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 6569 | { |
| 6570 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 6571 | *total_ielen += ielen; |
| 6572 | } |
| 6573 | else |
| 6574 | { |
| 6575 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 6576 | "IE Length is too big " |
| 6577 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 6578 | elem_id, elem_len, *total_ielen); |
| 6579 | } |
| 6580 | } |
| 6581 | } |
| 6582 | |
| 6583 | left -= elem_len; |
| 6584 | ptr += (elem_len + 2); |
| 6585 | } |
| 6586 | return; |
| 6587 | } |
| 6588 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6589 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6590 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 6591 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6592 | #else |
| 6593 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 6594 | struct cfg80211_beacon_data *params) |
| 6595 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6596 | { |
| 6597 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6598 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6599 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6600 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6601 | |
| 6602 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 6603 | |
| 6604 | if(genie == NULL) { |
| 6605 | |
| 6606 | return -ENOMEM; |
| 6607 | } |
| 6608 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6609 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6610 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6611 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6612 | hddLog(LOGE, |
| 6613 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6614 | ret = -EINVAL; |
| 6615 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6616 | } |
| 6617 | |
| 6618 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6619 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6620 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 6621 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6622 | hddLog(LOGE, |
| 6623 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6624 | ret = -EINVAL; |
| 6625 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6626 | } |
| 6627 | #endif |
| 6628 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6629 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6630 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6631 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6632 | hddLog(LOGE, |
| 6633 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6634 | ret = -EINVAL; |
| 6635 | goto done; |
| 6636 | } |
| 6637 | |
| 6638 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 6639 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6640 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6641 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6642 | |
| 6643 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6644 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 6645 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 6646 | { |
| 6647 | hddLog(LOGE, |
| 6648 | "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] | 6649 | ret = -EINVAL; |
| 6650 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6651 | } |
| 6652 | |
| 6653 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6654 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 6655 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6656 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6657 | ==eHAL_STATUS_FAILURE) |
| 6658 | { |
| 6659 | hddLog(LOGE, |
| 6660 | "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] | 6661 | ret = -EINVAL; |
| 6662 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6663 | } |
| 6664 | |
| 6665 | // Added for ProResp IE |
| 6666 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 6667 | { |
| 6668 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 6669 | u8 probe_rsp_ie_len[3] = {0}; |
| 6670 | u8 counter = 0; |
| 6671 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 6672 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 6673 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 6674 | Store More then 255 bytes into One Variable. |
| 6675 | */ |
| 6676 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 6677 | { |
| 6678 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 6679 | { |
| 6680 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 6681 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 6682 | } |
| 6683 | else |
| 6684 | { |
| 6685 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 6686 | rem_probe_resp_ie_len = 0; |
| 6687 | } |
| 6688 | } |
| 6689 | |
| 6690 | rem_probe_resp_ie_len = 0; |
| 6691 | |
| 6692 | if (probe_rsp_ie_len[0] > 0) |
| 6693 | { |
| 6694 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6695 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 6696 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6697 | probe_rsp_ie_len[0], NULL, |
| 6698 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6699 | { |
| 6700 | hddLog(LOGE, |
| 6701 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6702 | ret = -EINVAL; |
| 6703 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6704 | } |
| 6705 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 6706 | } |
| 6707 | |
| 6708 | if (probe_rsp_ie_len[1] > 0) |
| 6709 | { |
| 6710 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6711 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 6712 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6713 | probe_rsp_ie_len[1], NULL, |
| 6714 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6715 | { |
| 6716 | hddLog(LOGE, |
| 6717 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6718 | ret = -EINVAL; |
| 6719 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6720 | } |
| 6721 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 6722 | } |
| 6723 | |
| 6724 | if (probe_rsp_ie_len[2] > 0) |
| 6725 | { |
| 6726 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6727 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 6728 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6729 | probe_rsp_ie_len[2], NULL, |
| 6730 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6731 | { |
| 6732 | hddLog(LOGE, |
| 6733 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6734 | ret = -EINVAL; |
| 6735 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6736 | } |
| 6737 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 6738 | } |
| 6739 | |
| 6740 | if (probe_rsp_ie_len[1] == 0 ) |
| 6741 | { |
| 6742 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6743 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 6744 | eANI_BOOLEAN_FALSE) ) |
| 6745 | { |
| 6746 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6747 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6748 | } |
| 6749 | } |
| 6750 | |
| 6751 | if (probe_rsp_ie_len[2] == 0 ) |
| 6752 | { |
| 6753 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6754 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 6755 | eANI_BOOLEAN_FALSE) ) |
| 6756 | { |
| 6757 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6758 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6759 | } |
| 6760 | } |
| 6761 | |
| 6762 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6763 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 6764 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6765 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6766 | == eHAL_STATUS_FAILURE) |
| 6767 | { |
| 6768 | hddLog(LOGE, |
| 6769 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6770 | ret = -EINVAL; |
| 6771 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6772 | } |
| 6773 | } |
| 6774 | else |
| 6775 | { |
| 6776 | // Reset WNI_CFG_PROBE_RSP Flags |
| 6777 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 6778 | |
| 6779 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6780 | "%s: No Probe Response IE received in set beacon", |
| 6781 | __func__); |
| 6782 | } |
| 6783 | |
| 6784 | // Added for AssocResp IE |
| 6785 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 6786 | { |
| 6787 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6788 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 6789 | params->assocresp_ies_len, NULL, |
| 6790 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6791 | { |
| 6792 | hddLog(LOGE, |
| 6793 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6794 | ret = -EINVAL; |
| 6795 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6796 | } |
| 6797 | |
| 6798 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6799 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 6800 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6801 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6802 | == eHAL_STATUS_FAILURE) |
| 6803 | { |
| 6804 | hddLog(LOGE, |
| 6805 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6806 | ret = -EINVAL; |
| 6807 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6808 | } |
| 6809 | } |
| 6810 | else |
| 6811 | { |
| 6812 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6813 | "%s: No Assoc Response IE received in set beacon", |
| 6814 | __func__); |
| 6815 | |
| 6816 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6817 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 6818 | eANI_BOOLEAN_FALSE) ) |
| 6819 | { |
| 6820 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6821 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6822 | } |
| 6823 | } |
| 6824 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6825 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6826 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6827 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6828 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6829 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6830 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6831 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 6832 | * called by wlan_hdd_cfg80211_start_bss() and |
| 6833 | * wlan_hdd_cfg80211_set_channel() |
| 6834 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6835 | * channel list. |
| 6836 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 6837 | 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] | 6838 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6839 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6840 | v_U32_t num_ch = 0; |
| 6841 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 6842 | u32 indx = 0; |
| 6843 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6844 | v_U8_t fValidChannel = FALSE, count = 0; |
| 6845 | 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] | 6846 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6847 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6848 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6849 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6850 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6851 | /* Validate the channel */ |
| 6852 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6853 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6854 | if ( channel == rfChannels[count].channelNum ) |
| 6855 | { |
| 6856 | fValidChannel = TRUE; |
| 6857 | break; |
| 6858 | } |
| 6859 | } |
| 6860 | if (fValidChannel != TRUE) |
| 6861 | { |
| 6862 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6863 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6864 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6865 | } |
| 6866 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6867 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6868 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6869 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 6870 | valid_ch, &num_ch)) |
| 6871 | { |
| 6872 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6873 | "%s: failed to get valid channel list", __func__); |
| 6874 | return VOS_STATUS_E_FAILURE; |
| 6875 | } |
| 6876 | for (indx = 0; indx < num_ch; indx++) |
| 6877 | { |
| 6878 | if (channel == valid_ch[indx]) |
| 6879 | { |
| 6880 | break; |
| 6881 | } |
| 6882 | } |
| 6883 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6884 | if (indx >= num_ch) |
| 6885 | { |
| 6886 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6887 | { |
| 6888 | eCsrBand band; |
| 6889 | unsigned int freq; |
| 6890 | |
| 6891 | sme_GetFreqBand(hHal, &band); |
| 6892 | |
| 6893 | if (eCSR_BAND_5G == band) |
| 6894 | { |
| 6895 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 6896 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 6897 | { |
| 6898 | freq = ieee80211_channel_to_frequency(channel, |
| 6899 | IEEE80211_BAND_2GHZ); |
| 6900 | } |
| 6901 | else |
| 6902 | { |
| 6903 | freq = ieee80211_channel_to_frequency(channel, |
| 6904 | IEEE80211_BAND_5GHZ); |
| 6905 | } |
| 6906 | #else |
| 6907 | freq = ieee80211_channel_to_frequency(channel); |
| 6908 | #endif |
| 6909 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 6910 | return VOS_STATUS_SUCCESS; |
| 6911 | } |
| 6912 | } |
| 6913 | |
| 6914 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6915 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6916 | return VOS_STATUS_E_FAILURE; |
| 6917 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6918 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6919 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6920 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6921 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6922 | } |
| 6923 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6924 | /** |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6925 | * FUNCTION: __wlan_hdd_cfg80211_set_channel |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6926 | * This function is used to set the channel number |
| 6927 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6928 | 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] | 6929 | struct ieee80211_channel *chan, |
| 6930 | enum nl80211_channel_type channel_type |
| 6931 | ) |
| 6932 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6933 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6934 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6935 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6936 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6937 | hdd_context_t *pHddCtx; |
| 6938 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6939 | |
| 6940 | ENTER(); |
| 6941 | |
| 6942 | if( NULL == dev ) |
| 6943 | { |
| 6944 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6945 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6946 | return -ENODEV; |
| 6947 | } |
| 6948 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6949 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6950 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6951 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 6952 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6953 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6954 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 6955 | hdd_device_modetoString(pAdapter->device_mode), |
| 6956 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6957 | |
| 6958 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6959 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6960 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6961 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6962 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6963 | } |
| 6964 | |
| 6965 | /* |
| 6966 | * Do freq to chan conversion |
| 6967 | * TODO: for 11a |
| 6968 | */ |
| 6969 | |
| 6970 | channel = ieee80211_frequency_to_channel(freq); |
| 6971 | |
| 6972 | /* Check freq range */ |
| 6973 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 6974 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 6975 | { |
| 6976 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6977 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6978 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 6979 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 6980 | return -EINVAL; |
| 6981 | } |
| 6982 | |
| 6983 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6984 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 6985 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 6986 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6987 | { |
| 6988 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6989 | { |
| 6990 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6991 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6992 | return -EINVAL; |
| 6993 | } |
| 6994 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 6995 | "%s: set channel to [%d] for device mode =%d", |
| 6996 | __func__, channel,pAdapter->device_mode); |
| 6997 | } |
| 6998 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6999 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7000 | ) |
| 7001 | { |
| 7002 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7003 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 7004 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7005 | |
| 7006 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 7007 | { |
| 7008 | /* Link is up then return cant set channel*/ |
| 7009 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7010 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7011 | return -EINVAL; |
| 7012 | } |
| 7013 | |
| 7014 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 7015 | pHddStaCtx->conn_info.operationChannel = channel; |
| 7016 | pRoamProfile->ChannelInfo.ChannelList = |
| 7017 | &pHddStaCtx->conn_info.operationChannel; |
| 7018 | } |
| 7019 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7020 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7021 | ) |
| 7022 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 7023 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 7024 | { |
| 7025 | if(VOS_STATUS_SUCCESS != |
| 7026 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 7027 | { |
| 7028 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7029 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 7030 | return -EINVAL; |
| 7031 | } |
| 7032 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 7033 | } |
| 7034 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7035 | { |
| 7036 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 7037 | |
| 7038 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 7039 | channel set by supplicant |
| 7040 | */ |
| 7041 | if ( cfg_param->apAutoChannelSelection ) |
| 7042 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 7043 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 7044 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7045 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7046 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 7047 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7048 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7049 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 7050 | else |
| 7051 | { |
| 7052 | if(VOS_STATUS_SUCCESS != |
| 7053 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 7054 | { |
| 7055 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7056 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 7057 | return -EINVAL; |
| 7058 | } |
| 7059 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 7060 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7061 | } |
| 7062 | } |
| 7063 | else |
| 7064 | { |
| 7065 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 7066 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 7067 | return -EINVAL; |
| 7068 | } |
| 7069 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7070 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7071 | } |
| 7072 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 7073 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, |
| 7074 | struct net_device *dev, |
| 7075 | struct ieee80211_channel *chan, |
| 7076 | enum nl80211_channel_type channel_type |
| 7077 | ) |
| 7078 | { |
| 7079 | int ret; |
| 7080 | |
| 7081 | vos_ssr_protect(__func__); |
| 7082 | ret = __wlan_hdd_cfg80211_set_channel(wiphy, dev, chan, channel_type); |
| 7083 | vos_ssr_unprotect(__func__); |
| 7084 | |
| 7085 | return ret; |
| 7086 | } |
| 7087 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7088 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7089 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 7090 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7091 | #else |
| 7092 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 7093 | struct cfg80211_beacon_data *params, |
| 7094 | const u8 *ssid, size_t ssid_len, |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 7095 | enum nl80211_hidden_ssid hidden_ssid, |
| 7096 | v_U8_t auth_type) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7097 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7098 | { |
| 7099 | tsap_Config_t *pConfig; |
| 7100 | beacon_data_t *pBeacon = NULL; |
| 7101 | struct ieee80211_mgmt *pMgmt_frame; |
| 7102 | v_U8_t *pIe=NULL; |
| 7103 | v_U16_t capab_info; |
| 7104 | eCsrAuthType RSNAuthType; |
| 7105 | eCsrEncryptionType RSNEncryptType; |
| 7106 | eCsrEncryptionType mcRSNEncryptType; |
| 7107 | int status = VOS_STATUS_SUCCESS; |
| 7108 | tpWLAN_SAPEventCB pSapEventCallback; |
| 7109 | hdd_hostapd_state_t *pHostapdState; |
| 7110 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 7111 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 7112 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7113 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 7114 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7115 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 7116 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7117 | tSmeConfigParams *psmeConfig; |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 7118 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 7119 | v_BOOL_t MFPRequired = VOS_FALSE; |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 7120 | v_BOOL_t sapEnable11AC = |
| 7121 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapEnable11AC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7122 | ENTER(); |
| 7123 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 7124 | iniConfig = pHddCtx->cfg_ini; |
| 7125 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7126 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 7127 | |
| 7128 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 7129 | |
| 7130 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 7131 | |
| 7132 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 7133 | |
| 7134 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 7135 | |
| 7136 | //channel is already set in the set_channel Call back |
| 7137 | //pConfig->channel = pCommitConfig->channel; |
| 7138 | |
| 7139 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7140 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7141 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 7142 | |
| 7143 | pConfig->dtim_period = pBeacon->dtim_period; |
| 7144 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7145 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7146 | pConfig->dtim_period); |
| 7147 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 7148 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7149 | { |
| 7150 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7151 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 7152 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 7153 | { |
| 7154 | tANI_BOOLEAN restartNeeded; |
| 7155 | pConfig->ieee80211d = 1; |
| 7156 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 7157 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 7158 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 7159 | } |
| 7160 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7161 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7162 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7163 | pConfig->ieee80211d = 1; |
| 7164 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 7165 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 7166 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7167 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7168 | else |
| 7169 | { |
| 7170 | pConfig->ieee80211d = 0; |
| 7171 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 7172 | /* |
| 7173 | * If auto channel is configured i.e. channel is 0, |
| 7174 | * so skip channel validation. |
| 7175 | */ |
| 7176 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 7177 | { |
| 7178 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 7179 | { |
| 7180 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7181 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 7182 | return -EINVAL; |
| 7183 | } |
| 7184 | } |
| 7185 | else |
| 7186 | { |
| 7187 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 7188 | { |
| 7189 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 7190 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 7191 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 7192 | } |
| 7193 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 7194 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7195 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7196 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7197 | { |
| 7198 | pConfig->ieee80211d = 0; |
| 7199 | } |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 7200 | |
| 7201 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7202 | if (params->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
| 7203 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 7204 | else if (params->auth_type == NL80211_AUTHTYPE_SHARED_KEY) |
| 7205 | pConfig->authType = eSAP_SHARED_KEY; |
| 7206 | else |
| 7207 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 7208 | #else |
| 7209 | if (auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
| 7210 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 7211 | else if (auth_type == NL80211_AUTHTYPE_SHARED_KEY) |
| 7212 | pConfig->authType = eSAP_SHARED_KEY; |
| 7213 | else |
| 7214 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 7215 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7216 | |
| 7217 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7218 | |
| 7219 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7220 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 7221 | |
| 7222 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 7223 | |
| 7224 | /*Set wps station to configured*/ |
| 7225 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 7226 | |
| 7227 | if(pIe) |
| 7228 | { |
| 7229 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 7230 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7231 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7232 | return -EINVAL; |
| 7233 | } |
| 7234 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 7235 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 7236 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7237 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 7238 | * WPS state |
| 7239 | */ |
| 7240 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 7241 | { |
| 7242 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 7243 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 7244 | { |
| 7245 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 7246 | } |
| 7247 | } |
| 7248 | } |
| 7249 | else |
| 7250 | { |
| 7251 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 7252 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7253 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7254 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 7255 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 7256 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 7257 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 7258 | eCSR_ENCRYPT_TYPE_NONE; |
| 7259 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7260 | pConfig->RSNWPAReqIELength = 0; |
| 7261 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7262 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7263 | WLAN_EID_RSN); |
| 7264 | if(pIe && pIe[1]) |
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 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 7267 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 7268 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7269 | /* The actual processing may eventually be more extensive than |
| 7270 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7271 | * by the app. |
| 7272 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7273 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7274 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 7275 | &RSNEncryptType, |
| 7276 | &mcRSNEncryptType, |
| 7277 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7278 | &MFPCapable, |
| 7279 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7280 | pConfig->pRSNWPAReqIE[1]+2, |
| 7281 | pConfig->pRSNWPAReqIE ); |
| 7282 | |
| 7283 | if( VOS_STATUS_SUCCESS == status ) |
| 7284 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7285 | /* Now copy over all the security attributes you have |
| 7286 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7287 | * */ |
| 7288 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 7289 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 7290 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 7291 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 7292 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7293 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7294 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 7295 | } |
| 7296 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7297 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7298 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7299 | pBeacon->tail, pBeacon->tail_len); |
| 7300 | |
| 7301 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 7302 | { |
| 7303 | if (pConfig->pRSNWPAReqIE) |
| 7304 | { |
| 7305 | /*Mixed mode WPA/WPA2*/ |
| 7306 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 7307 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 7308 | } |
| 7309 | else |
| 7310 | { |
| 7311 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 7312 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 7313 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7314 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7315 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 7316 | &RSNEncryptType, |
| 7317 | &mcRSNEncryptType, |
| 7318 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7319 | &MFPCapable, |
| 7320 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7321 | pConfig->pRSNWPAReqIE[1]+2, |
| 7322 | pConfig->pRSNWPAReqIE ); |
| 7323 | |
| 7324 | if( VOS_STATUS_SUCCESS == status ) |
| 7325 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7326 | /* Now copy over all the security attributes you have |
| 7327 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7328 | * */ |
| 7329 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 7330 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 7331 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 7332 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 7333 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7334 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7335 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 7336 | } |
| 7337 | } |
| 7338 | } |
| 7339 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7340 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 7341 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 7342 | return -EINVAL; |
| 7343 | } |
| 7344 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7345 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 7346 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7347 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7348 | if (params->ssid != NULL) |
| 7349 | { |
| 7350 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 7351 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 7352 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 7353 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 7354 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7355 | #else |
| 7356 | if (ssid != NULL) |
| 7357 | { |
| 7358 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 7359 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 7360 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 7361 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 7362 | } |
| 7363 | #endif |
| 7364 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7365 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7366 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7367 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7368 | /* default value */ |
| 7369 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 7370 | pConfig->num_accept_mac = 0; |
| 7371 | pConfig->num_deny_mac = 0; |
| 7372 | |
| 7373 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7374 | pBeacon->tail, pBeacon->tail_len); |
| 7375 | |
| 7376 | /* pIe for black list is following form: |
| 7377 | type : 1 byte |
| 7378 | length : 1 byte |
| 7379 | OUI : 4 bytes |
| 7380 | acl type : 1 byte |
| 7381 | no of mac addr in black list: 1 byte |
| 7382 | 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] | 7383 | */ |
| 7384 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7385 | { |
| 7386 | pConfig->SapMacaddr_acl = pIe[6]; |
| 7387 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7388 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7389 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7390 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 7391 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7392 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 7393 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 7394 | { |
| 7395 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 7396 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7397 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7398 | } |
| 7399 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7400 | pBeacon->tail, pBeacon->tail_len); |
| 7401 | |
| 7402 | /* pIe for white list is following form: |
| 7403 | type : 1 byte |
| 7404 | length : 1 byte |
| 7405 | OUI : 4 bytes |
| 7406 | acl type : 1 byte |
| 7407 | no of mac addr in white list: 1 byte |
| 7408 | 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] | 7409 | */ |
| 7410 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7411 | { |
| 7412 | pConfig->SapMacaddr_acl = pIe[6]; |
| 7413 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7414 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7415 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7416 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 7417 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7418 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 7419 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 7420 | { |
| 7421 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 7422 | acl_entry++; |
| 7423 | } |
| 7424 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7425 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7426 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 7427 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7428 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 7429 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 7430 | * This is valid only if mode is set to 11n in hostapd, sapEnable11AC |
| 7431 | * 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] | 7432 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 7433 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 7434 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 7435 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 7436 | (sapEnable11AC) && (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 7437 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7438 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7439 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7440 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7441 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7442 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 7443 | /* If ACS disable and selected channel <= 14 |
| 7444 | * OR |
| 7445 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 7446 | * AND |
| 7447 | * VHT in 2.4G Disabled |
| 7448 | * THEN |
| 7449 | * Fallback to 11N mode |
| 7450 | */ |
| 7451 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 7452 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 7453 | operatingBand == eSAP_RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 7454 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7455 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7456 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 7457 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7458 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 7459 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7460 | } |
| 7461 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7462 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7463 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 7464 | pConfig->ht_capab = |
| 7465 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 7466 | |
| 7467 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 7468 | { |
| 7469 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 7470 | return -EINVAL; |
| 7471 | } |
| 7472 | |
| 7473 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7474 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7475 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 7476 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7477 | pConfig->obssProtEnabled = |
| 7478 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7479 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7480 | #ifdef WLAN_FEATURE_11W |
| 7481 | pConfig->mfpCapable = MFPCapable; |
| 7482 | pConfig->mfpRequired = MFPRequired; |
| 7483 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 7484 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 7485 | #endif |
| 7486 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7487 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7488 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7489 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 7490 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 7491 | (int)pConfig->channel); |
| 7492 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 7493 | pConfig->SapHw_mode, pConfig->privacy, |
| 7494 | pConfig->authType); |
| 7495 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 7496 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 7497 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 7498 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7499 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7500 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7501 | { |
| 7502 | //Bss already started. just return. |
| 7503 | //TODO Probably it should update some beacon params. |
| 7504 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 7505 | EXIT(); |
| 7506 | return 0; |
| 7507 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7508 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7509 | if (vos_max_concurrent_connections_reached()) { |
| 7510 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7511 | return -EINVAL; |
| 7512 | } |
| 7513 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7514 | pConfig->persona = pHostapdAdapter->device_mode; |
| 7515 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7516 | psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams)); |
| 7517 | if ( NULL != psmeConfig) |
| 7518 | { |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 7519 | vos_mem_zero(psmeConfig, sizeof (tSmeConfigParams)); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7520 | sme_GetConfigParam(hHal, psmeConfig); |
| 7521 | pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference; |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 7522 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 7523 | if (((pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 7524 | || (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 7525 | && pHddCtx->cfg_ini->apHT40_24GEnabled) |
| 7526 | { |
| 7527 | psmeConfig->csrConfig.apHT40_24GEnabled = 1; |
| 7528 | sme_UpdateConfig (hHal, psmeConfig); |
| 7529 | } |
| 7530 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7531 | vos_mem_free(psmeConfig); |
| 7532 | } |
Peng Xu | afc34e3 | 2014-09-25 13:23:55 +0530 | [diff] [blame] | 7533 | pConfig->acsBandSwitchThreshold = iniConfig->acsBandSwitchThreshold; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7534 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7535 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 7536 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 7537 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 7538 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7539 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7540 | return -EINVAL; |
| 7541 | } |
| 7542 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7543 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7544 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 7545 | |
| 7546 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7547 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7548 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7549 | { |
| 7550 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7551 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 7552 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7553 | VOS_ASSERT(0); |
| 7554 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7555 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7556 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Kaushik, Sushant | f607080 | 2014-10-15 15:09:23 +0530 | [diff] [blame] | 7557 | /* Initialize WMM configuation */ |
| 7558 | hdd_wmm_init(pHostapdAdapter); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7559 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7560 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7561 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7562 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 7563 | { |
| 7564 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 7565 | { |
| 7566 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 7567 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 7568 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7569 | } |
| 7570 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 7571 | { |
| 7572 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 7573 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 7574 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7575 | } |
| 7576 | } |
| 7577 | #endif |
| 7578 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7579 | pHostapdState->bCommit = TRUE; |
| 7580 | EXIT(); |
| 7581 | |
| 7582 | return 0; |
| 7583 | } |
| 7584 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7585 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7586 | static int __wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7587 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7588 | struct beacon_parameters *params) |
| 7589 | { |
| 7590 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7591 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7592 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7593 | |
| 7594 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7595 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7596 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7597 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 7598 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7599 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 7600 | hdd_device_modetoString(pAdapter->device_mode), |
| 7601 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7602 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7603 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7604 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7605 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7606 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7607 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7608 | } |
| 7609 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7610 | if (vos_max_concurrent_connections_reached()) { |
| 7611 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7612 | return -EINVAL; |
| 7613 | } |
| 7614 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7615 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7616 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7617 | ) |
| 7618 | { |
| 7619 | beacon_data_t *old,*new; |
| 7620 | |
| 7621 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7622 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7623 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7624 | { |
| 7625 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 7626 | FL("already beacon info added to session(%d)"), |
| 7627 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7628 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7629 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7630 | |
| 7631 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 7632 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7633 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7634 | { |
| 7635 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7636 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7637 | return -EINVAL; |
| 7638 | } |
| 7639 | |
| 7640 | pAdapter->sessionCtx.ap.beacon = new; |
| 7641 | |
| 7642 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 7643 | } |
| 7644 | |
| 7645 | EXIT(); |
| 7646 | return status; |
| 7647 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7648 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7649 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 7650 | struct net_device *dev, |
| 7651 | struct beacon_parameters *params) |
| 7652 | { |
| 7653 | int ret; |
| 7654 | |
| 7655 | vos_ssr_protect(__func__); |
| 7656 | ret = __wlan_hdd_cfg80211_add_beacon(wiphy, dev, params); |
| 7657 | vos_ssr_unprotect(__func__); |
| 7658 | |
| 7659 | return ret; |
| 7660 | } |
| 7661 | |
| 7662 | static int __wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7663 | struct net_device *dev, |
| 7664 | struct beacon_parameters *params) |
| 7665 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7666 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7667 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7668 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7669 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7670 | |
| 7671 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 7672 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7673 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7674 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 7675 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 7676 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7677 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7678 | pAdapter->device_mode); |
| 7679 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7680 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7681 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7682 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7683 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7684 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7685 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7686 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7687 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7688 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7689 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7690 | { |
| 7691 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7692 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7693 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7694 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7695 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7696 | { |
| 7697 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7698 | FL("session(%d) old and new heads points to NULL"), |
| 7699 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7700 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7701 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7702 | |
| 7703 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 7704 | |
| 7705 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7706 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7707 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7708 | return -EINVAL; |
| 7709 | } |
| 7710 | |
| 7711 | pAdapter->sessionCtx.ap.beacon = new; |
| 7712 | |
| 7713 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 7714 | } |
| 7715 | |
| 7716 | EXIT(); |
| 7717 | return status; |
| 7718 | } |
| 7719 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7720 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
| 7721 | struct net_device *dev, |
| 7722 | struct beacon_parameters *params) |
| 7723 | { |
| 7724 | int ret; |
| 7725 | |
| 7726 | vos_ssr_protect(__func__); |
| 7727 | ret = __wlan_hdd_cfg80211_set_beacon(wiphy, dev, params); |
| 7728 | vos_ssr_unprotect(__func__); |
| 7729 | |
| 7730 | return ret; |
| 7731 | } |
| 7732 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7733 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7734 | |
| 7735 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7736 | static int __wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7737 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7738 | #else |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7739 | static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7740 | struct net_device *dev) |
| 7741 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7742 | { |
| 7743 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7744 | hdd_context_t *pHddCtx = NULL; |
| 7745 | hdd_scaninfo_t *pScanInfo = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7746 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7747 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7748 | |
| 7749 | ENTER(); |
| 7750 | |
| 7751 | if (NULL == pAdapter) |
| 7752 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7753 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7754 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7755 | return -ENODEV; |
| 7756 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7757 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7758 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7759 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 7760 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7761 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7762 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7763 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7764 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7765 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7766 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7767 | |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7768 | pScanInfo = &pHddCtx->scan_info; |
| 7769 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7770 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7771 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7772 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7773 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7774 | ret = wlan_hdd_scan_abort(pAdapter); |
| 7775 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 7776 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7777 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7778 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7779 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7780 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7781 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7782 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7783 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7784 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 7785 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7786 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7787 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7788 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7789 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7790 | } |
| 7791 | |
Rashmi Ramanna | 1f0948d | 2014-08-28 15:33:48 +0530 | [diff] [blame] | 7792 | /* Delete all associated STAs before stopping AP/P2P GO */ |
| 7793 | hdd_del_all_sta(pAdapter); |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 7794 | hdd_hostapd_stop(dev); |
| 7795 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7796 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7797 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7798 | ) |
| 7799 | { |
| 7800 | beacon_data_t *old; |
| 7801 | |
| 7802 | old = pAdapter->sessionCtx.ap.beacon; |
| 7803 | |
| 7804 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7805 | { |
| 7806 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7807 | FL("session(%d) beacon data points to NULL"), |
| 7808 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7809 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7810 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7811 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7812 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7813 | |
| 7814 | mutex_lock(&pHddCtx->sap_lock); |
| 7815 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 7816 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7817 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7818 | { |
| 7819 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 7820 | |
| 7821 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 7822 | |
| 7823 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 7824 | { |
| 7825 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7826 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7827 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7828 | } |
| 7829 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7830 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7831 | /* BSS stopped, clear the active sessions for this device mode */ |
| 7832 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7833 | } |
| 7834 | mutex_unlock(&pHddCtx->sap_lock); |
| 7835 | |
| 7836 | if(status != VOS_STATUS_SUCCESS) |
| 7837 | { |
| 7838 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7839 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7840 | return -EINVAL; |
| 7841 | } |
| 7842 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7843 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7844 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 7845 | ==eHAL_STATUS_FAILURE) |
| 7846 | { |
| 7847 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7848 | "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] | 7849 | } |
| 7850 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7851 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7852 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 7853 | eANI_BOOLEAN_FALSE) ) |
| 7854 | { |
| 7855 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7856 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7857 | } |
| 7858 | |
| 7859 | // Reset WNI_CFG_PROBE_RSP Flags |
| 7860 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 7861 | |
| 7862 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 7863 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7864 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7865 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 7866 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 7867 | { |
| 7868 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 7869 | "GO got removed"); |
| 7870 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 7871 | } |
| 7872 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7873 | } |
| 7874 | EXIT(); |
| 7875 | return status; |
| 7876 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7877 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7878 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7879 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 7880 | struct net_device *dev) |
| 7881 | { |
| 7882 | int ret; |
| 7883 | |
| 7884 | vos_ssr_protect(__func__); |
| 7885 | ret = __wlan_hdd_cfg80211_del_beacon(wiphy, dev); |
| 7886 | vos_ssr_unprotect(__func__); |
| 7887 | |
| 7888 | return ret; |
| 7889 | } |
| 7890 | #else |
| 7891 | static int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, |
| 7892 | struct net_device *dev) |
| 7893 | { |
| 7894 | int ret; |
| 7895 | |
| 7896 | vos_ssr_protect(__func__); |
| 7897 | ret = __wlan_hdd_cfg80211_stop_ap(wiphy, dev); |
| 7898 | vos_ssr_unprotect(__func__); |
| 7899 | |
| 7900 | return ret; |
| 7901 | } |
| 7902 | #endif |
| 7903 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7904 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 7905 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7906 | static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7907 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7908 | struct cfg80211_ap_settings *params) |
| 7909 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7910 | hdd_adapter_t *pAdapter; |
| 7911 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7912 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7913 | |
| 7914 | ENTER(); |
| 7915 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7916 | if (NULL == dev || NULL == params) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7917 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7918 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7919 | "%s: Device or params is Null", __func__); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7920 | return -ENODEV; |
| 7921 | } |
| 7922 | |
| 7923 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7924 | if (NULL == pAdapter) |
| 7925 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7926 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7927 | "%s: HDD adapter is Null", __func__); |
| 7928 | return -ENODEV; |
| 7929 | } |
| 7930 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7931 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7932 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 7933 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7934 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 7935 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7936 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7937 | "%s: HDD adapter magic is invalid", __func__); |
| 7938 | return -ENODEV; |
| 7939 | } |
| 7940 | |
| 7941 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7942 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7943 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7944 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7945 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7946 | } |
| 7947 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7948 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 7949 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7950 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7951 | |
| 7952 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7953 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7954 | ) |
| 7955 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7956 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7957 | |
| 7958 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7959 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7960 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7961 | { |
| 7962 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 7963 | FL("already beacon info added to session(%d)"), |
| 7964 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7965 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7966 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7967 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7968 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7969 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 7970 | &new, |
| 7971 | ¶ms->beacon); |
| 7972 | #else |
| 7973 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 7974 | &new, |
| 7975 | ¶ms->beacon, |
| 7976 | params->dtim_period); |
| 7977 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7978 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7979 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7980 | { |
| 7981 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7982 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7983 | return -EINVAL; |
| 7984 | } |
| 7985 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7986 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 7987 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 7988 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 7989 | params->channel, params->channel_type); |
| 7990 | #else |
| 7991 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 7992 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7993 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7994 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 7995 | params->ssid_len, params->hidden_ssid, |
| 7996 | params->auth_type); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7997 | } |
| 7998 | |
| 7999 | EXIT(); |
| 8000 | return status; |
| 8001 | } |
| 8002 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 8003 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 8004 | struct net_device *dev, |
| 8005 | struct cfg80211_ap_settings *params) |
| 8006 | { |
| 8007 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8008 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 8009 | vos_ssr_protect(__func__); |
| 8010 | ret = __wlan_hdd_cfg80211_start_ap(wiphy, dev, params); |
| 8011 | vos_ssr_unprotect(__func__); |
| 8012 | |
| 8013 | return ret; |
| 8014 | } |
| 8015 | |
| 8016 | static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8017 | struct net_device *dev, |
| 8018 | struct cfg80211_beacon_data *params) |
| 8019 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8020 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8021 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8022 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8023 | |
| 8024 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8025 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8026 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8027 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 8028 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8029 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8030 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8031 | |
| 8032 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8033 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8034 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 8035 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8036 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 8037 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8038 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8039 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8040 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8041 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8042 | { |
| 8043 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8044 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8045 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8046 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8047 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8048 | { |
| 8049 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8050 | FL("session(%d) beacon data points to NULL"), |
| 8051 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8052 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8053 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8054 | |
| 8055 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 8056 | |
| 8057 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8058 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8059 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8060 | return -EINVAL; |
| 8061 | } |
| 8062 | |
| 8063 | pAdapter->sessionCtx.ap.beacon = new; |
| 8064 | |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 8065 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0, |
| 8066 | pAdapter->sessionCtx.ap.sapConfig.authType); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8067 | } |
| 8068 | |
| 8069 | EXIT(); |
| 8070 | return status; |
| 8071 | } |
| 8072 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 8073 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
| 8074 | struct net_device *dev, |
| 8075 | struct cfg80211_beacon_data *params) |
| 8076 | { |
| 8077 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8078 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 8079 | vos_ssr_protect(__func__); |
| 8080 | ret = __wlan_hdd_cfg80211_change_beacon(wiphy, dev, params); |
| 8081 | vos_ssr_unprotect(__func__); |
| 8082 | |
| 8083 | return ret; |
| 8084 | } |
| 8085 | |
| 8086 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8087 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 8088 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8089 | struct net_device *dev, |
| 8090 | struct bss_parameters *params) |
| 8091 | { |
| 8092 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8093 | hdd_context_t *pHddCtx; |
| 8094 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8095 | |
| 8096 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8097 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8098 | if (NULL == pAdapter) |
| 8099 | { |
| 8100 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8101 | "%s: HDD adapter is Null", __func__); |
| 8102 | return -ENODEV; |
| 8103 | } |
| 8104 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8105 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8106 | if (0 != ret) |
| 8107 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8108 | return ret; |
| 8109 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8110 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8111 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 8112 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8113 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8114 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8115 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8116 | |
| 8117 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8118 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8119 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8120 | { |
| 8121 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 8122 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8123 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8124 | { |
| 8125 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8126 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8127 | } |
| 8128 | |
| 8129 | EXIT(); |
| 8130 | return 0; |
| 8131 | } |
| 8132 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 8133 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 8134 | struct net_device *dev, |
| 8135 | struct bss_parameters *params) |
| 8136 | { |
| 8137 | int ret; |
| 8138 | |
| 8139 | vos_ssr_protect(__func__); |
| 8140 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 8141 | vos_ssr_unprotect(__func__); |
| 8142 | |
| 8143 | return ret; |
| 8144 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8145 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 8146 | * to wait for contry code completion |
| 8147 | */ |
| 8148 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 8149 | { |
| 8150 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 8151 | complete(&call_back_pAdapter->change_country_code); |
| 8152 | return NULL; |
| 8153 | } |
| 8154 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8155 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 8156 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8157 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 8158 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 8159 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8160 | struct net_device *ndev, |
| 8161 | enum nl80211_iftype type, |
| 8162 | u32 *flags, |
| 8163 | struct vif_params *params |
| 8164 | ) |
| 8165 | { |
| 8166 | struct wireless_dev *wdev; |
| 8167 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 8168 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8169 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8170 | tCsrRoamProfile *pRoamProfile = NULL; |
| 8171 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8172 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8173 | eMib_dot11DesiredBssType connectedBssType; |
| 8174 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8175 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8176 | |
| 8177 | ENTER(); |
| 8178 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8179 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 8180 | { |
| 8181 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8182 | "%s: Adapter context is null", __func__); |
| 8183 | return VOS_STATUS_E_FAILURE; |
| 8184 | } |
| 8185 | |
| 8186 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8187 | if (!pHddCtx) |
| 8188 | { |
| 8189 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8190 | "%s: HDD context is null", __func__); |
| 8191 | return VOS_STATUS_E_FAILURE; |
| 8192 | } |
| 8193 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8194 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8195 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 8196 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8197 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8198 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8199 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8200 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8201 | } |
| 8202 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8203 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8204 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8205 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8206 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 8207 | if (vos_max_concurrent_connections_reached()) { |
| 8208 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 8209 | return -EINVAL; |
| 8210 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8211 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8212 | wdev = ndev->ieee80211_ptr; |
| 8213 | |
| 8214 | #ifdef WLAN_BTAMP_FEATURE |
| 8215 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 8216 | (NL80211_IFTYPE_ADHOC == type)|| |
| 8217 | (NL80211_IFTYPE_AP == type)|| |
| 8218 | (NL80211_IFTYPE_P2P_GO == type)) |
| 8219 | { |
| 8220 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 8221 | // stop AMP traffic |
| 8222 | status = WLANBAP_StopAmp(); |
| 8223 | if(VOS_STATUS_SUCCESS != status ) |
| 8224 | { |
| 8225 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 8226 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 8227 | "%s: Failed to stop AMP", __func__); |
| 8228 | return -EINVAL; |
| 8229 | } |
| 8230 | } |
| 8231 | #endif //WLAN_BTAMP_FEATURE |
| 8232 | /* Reset the current device mode bit mask*/ |
| 8233 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 8234 | |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 8235 | if ((pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) && |
| 8236 | ((type == NL80211_IFTYPE_P2P_CLIENT) || |
| 8237 | (type == NL80211_IFTYPE_P2P_GO))) |
| 8238 | { |
| 8239 | /* Notify Mode change in case of concurrency. |
| 8240 | * Below function invokes TDLS teardown Functionality Since TDLS is |
| 8241 | * not Supported in case of concurrency i.e Once P2P session |
| 8242 | * is detected disable offchannel and teardown TDLS links |
| 8243 | */ |
| 8244 | hddLog(LOG1, |
| 8245 | FL("Device mode = %d Interface type = %d"), |
| 8246 | pAdapter->device_mode, type); |
| 8247 | hdd_tdls_notify_mode_change(pAdapter, pHddCtx); |
| 8248 | } |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 8249 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8250 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8251 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8252 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8253 | ) |
| 8254 | { |
| 8255 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 8256 | if (!pWextState) |
| 8257 | { |
| 8258 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8259 | "%s: pWextState is null", __func__); |
| 8260 | return VOS_STATUS_E_FAILURE; |
| 8261 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8262 | pRoamProfile = &pWextState->roamProfile; |
| 8263 | LastBSSType = pRoamProfile->BSSType; |
| 8264 | |
| 8265 | switch (type) |
| 8266 | { |
| 8267 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8268 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8269 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8270 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 8271 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8272 | #ifdef WLAN_FEATURE_11AC |
| 8273 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 8274 | { |
| 8275 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 8276 | } |
| 8277 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8278 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8279 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8280 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8281 | //Check for sub-string p2p to confirm its a p2p interface |
| 8282 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8283 | { |
Mahesh A Saptasagar | c48ae8a | 2015-08-09 00:04:35 +0530 | [diff] [blame] | 8284 | #ifdef FEATURE_WLAN_TDLS |
| 8285 | mutex_lock(&pHddCtx->tdls_lock); |
| 8286 | wlan_hdd_tdls_exit(pAdapter, TRUE); |
| 8287 | mutex_unlock(&pHddCtx->tdls_lock); |
| 8288 | #endif |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8289 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 8290 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 8291 | } |
| 8292 | else |
| 8293 | { |
| 8294 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8295 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8296 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8297 | break; |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 8298 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8299 | case NL80211_IFTYPE_ADHOC: |
| 8300 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8301 | "%s: setting interface Type to ADHOC", __func__); |
| 8302 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 8303 | pRoamProfile->phyMode = |
| 8304 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 8305 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8306 | wdev->iftype = type; |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 8307 | hdd_set_ibss_ops( pAdapter ); |
| 8308 | hdd_ibss_init_tx_rx( pAdapter ); |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 8309 | |
| 8310 | status = hdd_sta_id_hash_attach(pAdapter); |
| 8311 | if (VOS_STATUS_SUCCESS != status) { |
| 8312 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8313 | FL("Failed to initialize hash for IBSS")); |
| 8314 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8315 | break; |
| 8316 | |
| 8317 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8318 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8319 | { |
| 8320 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 8321 | "%s: setting interface Type to %s", __func__, |
| 8322 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 8323 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8324 | //Cancel any remain on channel for GO mode |
| 8325 | if (NL80211_IFTYPE_P2P_GO == type) |
| 8326 | { |
| 8327 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 8328 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8329 | if (NL80211_IFTYPE_AP == type) |
| 8330 | { |
| 8331 | /* As Loading WLAN Driver one interface being created for p2p device |
| 8332 | * address. This will take one HW STA and the max number of clients |
| 8333 | * that can connect to softAP will be reduced by one. so while changing |
| 8334 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 8335 | * interface as it is not required in SoftAP mode. |
| 8336 | */ |
| 8337 | |
| 8338 | // Get P2P Adapter |
| 8339 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 8340 | |
| 8341 | if (pP2pAdapter) |
| 8342 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 8343 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8344 | hdd_deinit_adapter(pHddCtx, pP2pAdapter, TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8345 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 8346 | } |
| 8347 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 8348 | //Disable IMPS & BMPS for SAP/GO |
| 8349 | if(VOS_STATUS_E_FAILURE == |
| 8350 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 8351 | { |
| 8352 | //Fail to Exit BMPS |
| 8353 | VOS_ASSERT(0); |
| 8354 | } |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 8355 | |
| 8356 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
| 8357 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8358 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 8359 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8360 | /* A Mutex Lock is introduced while changing the mode to |
| 8361 | * protect the concurrent access for the Adapters by TDLS |
| 8362 | * module. |
| 8363 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8364 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8365 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8366 | //De-init the adapter. |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8367 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8368 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8369 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 8370 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8371 | #ifdef FEATURE_WLAN_TDLS |
| 8372 | mutex_unlock(&pHddCtx->tdls_lock); |
| 8373 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 8374 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 8375 | (pConfig->apRandomBssidEnabled)) |
| 8376 | { |
| 8377 | /* To meet Android requirements create a randomized |
| 8378 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 8379 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 8380 | ndev->dev_addr[0] = 0x02; |
| 8381 | ndev->dev_addr[1] = 0x1A; |
| 8382 | ndev->dev_addr[2] = 0x11; |
| 8383 | ndev->dev_addr[3] |= 0xF0; |
| 8384 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 8385 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 8386 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 8387 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 8388 | } |
| 8389 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8390 | hdd_set_ap_ops( pAdapter->dev ); |
| 8391 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8392 | /* This is for only SAP mode where users can |
| 8393 | * control country through ini. |
| 8394 | * P2P GO follows station country code |
| 8395 | * acquired during the STA scanning. */ |
| 8396 | if((NL80211_IFTYPE_AP == type) && |
| 8397 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 8398 | { |
| 8399 | int status = 0; |
| 8400 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 8401 | "%s: setting country code from INI ", __func__); |
| 8402 | init_completion(&pAdapter->change_country_code); |
| 8403 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 8404 | (void *)(tSmeChangeCountryCallback) |
| 8405 | wlan_hdd_change_country_code_cb, |
| 8406 | pConfig->apCntryCode, pAdapter, |
| 8407 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 8408 | eSIR_FALSE, |
| 8409 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8410 | if (eHAL_STATUS_SUCCESS == status) |
| 8411 | { |
| 8412 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8413 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8414 | &pAdapter->change_country_code, |
| 8415 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8416 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8417 | { |
| 8418 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8419 | FL("SME Timed out while setting country code %ld"), |
| 8420 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 8421 | |
| 8422 | if (pHddCtx->isLogpInProgress) |
| 8423 | { |
| 8424 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8425 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 8426 | return -EAGAIN; |
| 8427 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8428 | } |
| 8429 | } |
| 8430 | else |
| 8431 | { |
| 8432 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8433 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8434 | return -EINVAL; |
| 8435 | } |
| 8436 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8437 | status = hdd_init_ap_mode(pAdapter); |
| 8438 | if(status != VOS_STATUS_SUCCESS) |
| 8439 | { |
| 8440 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 8441 | "%s: Error initializing the ap mode", __func__); |
| 8442 | return -EINVAL; |
| 8443 | } |
| 8444 | hdd_set_conparam(1); |
| 8445 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 8446 | status = hdd_sta_id_hash_attach(pAdapter); |
| 8447 | if (VOS_STATUS_SUCCESS != status) |
| 8448 | { |
| 8449 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8450 | FL("Failed to initialize hash for AP")); |
| 8451 | return -EINVAL; |
| 8452 | } |
| 8453 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8454 | /*interface type changed update in wiphy structure*/ |
| 8455 | if(wdev) |
| 8456 | { |
| 8457 | wdev->iftype = type; |
| 8458 | pHddCtx->change_iface = type; |
| 8459 | } |
| 8460 | else |
| 8461 | { |
| 8462 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8463 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 8464 | return -EINVAL; |
| 8465 | } |
| 8466 | goto done; |
| 8467 | } |
| 8468 | |
| 8469 | default: |
| 8470 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 8471 | __func__); |
| 8472 | return -EOPNOTSUPP; |
| 8473 | } |
| 8474 | } |
| 8475 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8476 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8477 | ) |
| 8478 | { |
| 8479 | switch(type) |
| 8480 | { |
| 8481 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8482 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8483 | case NL80211_IFTYPE_ADHOC: |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 8484 | |
| 8485 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8486 | #ifdef FEATURE_WLAN_TDLS |
| 8487 | |
| 8488 | /* A Mutex Lock is introduced while changing the mode to |
| 8489 | * protect the concurrent access for the Adapters by TDLS |
| 8490 | * module. |
| 8491 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8492 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8493 | #endif |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8494 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8495 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8496 | //Check for sub-string p2p to confirm its a p2p interface |
| 8497 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8498 | { |
| 8499 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 8500 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 8501 | } |
| 8502 | else |
| 8503 | { |
| 8504 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8505 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8506 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8507 | hdd_set_conparam(0); |
| 8508 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8509 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 8510 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8511 | #ifdef FEATURE_WLAN_TDLS |
| 8512 | mutex_unlock(&pHddCtx->tdls_lock); |
| 8513 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 8514 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8515 | if( VOS_STATUS_SUCCESS != status ) |
| 8516 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8517 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 8518 | * This is the right place to enable back bmps_imps() |
| 8519 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 8520 | if (pHddCtx->hdd_wlan_suspended) |
| 8521 | { |
| 8522 | hdd_set_pwrparams(pHddCtx); |
| 8523 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8524 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8525 | goto done; |
| 8526 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8527 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8528 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8529 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 8530 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8531 | goto done; |
| 8532 | default: |
| 8533 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 8534 | __func__); |
| 8535 | return -EOPNOTSUPP; |
| 8536 | |
| 8537 | } |
| 8538 | |
| 8539 | } |
| 8540 | else |
| 8541 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8542 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 8543 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8544 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8545 | return -EOPNOTSUPP; |
| 8546 | } |
| 8547 | |
| 8548 | |
| 8549 | if(pRoamProfile) |
| 8550 | { |
| 8551 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 8552 | { |
| 8553 | /*interface type changed update in wiphy structure*/ |
| 8554 | wdev->iftype = type; |
| 8555 | |
| 8556 | /*the BSS mode changed, We need to issue disconnect |
| 8557 | if connected or in IBSS disconnect state*/ |
| 8558 | if ( hdd_connGetConnectedBssType( |
| 8559 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 8560 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 8561 | { |
| 8562 | /*need to issue a disconnect to CSR.*/ |
| 8563 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 8564 | if( eHAL_STATUS_SUCCESS == |
| 8565 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8566 | pAdapter->sessionId, |
| 8567 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 8568 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8569 | ret = wait_for_completion_interruptible_timeout( |
| 8570 | &pAdapter->disconnect_comp_var, |
| 8571 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 8572 | if (ret <= 0) |
| 8573 | { |
| 8574 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8575 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 8576 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8577 | } |
| 8578 | } |
| 8579 | } |
| 8580 | } |
| 8581 | |
| 8582 | done: |
| 8583 | /*set bitmask based on updated value*/ |
| 8584 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 8585 | |
| 8586 | /* Only STA mode support TM now |
| 8587 | * all other mode, TM feature should be disabled */ |
| 8588 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 8589 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 8590 | { |
| 8591 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 8592 | } |
| 8593 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8594 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8595 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 8596 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8597 | { |
| 8598 | //we are ok to do AMP |
| 8599 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 8600 | } |
| 8601 | #endif //WLAN_BTAMP_FEATURE |
| 8602 | EXIT(); |
| 8603 | return 0; |
| 8604 | } |
| 8605 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 8606 | /* |
| 8607 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 8608 | * wrapper function to protect the actual implementation from SSR. |
| 8609 | */ |
| 8610 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 8611 | struct net_device *ndev, |
| 8612 | enum nl80211_iftype type, |
| 8613 | u32 *flags, |
| 8614 | struct vif_params *params |
| 8615 | ) |
| 8616 | { |
| 8617 | int ret; |
| 8618 | |
| 8619 | vos_ssr_protect(__func__); |
| 8620 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 8621 | vos_ssr_unprotect(__func__); |
| 8622 | |
| 8623 | return ret; |
| 8624 | } |
| 8625 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8626 | #ifdef FEATURE_WLAN_TDLS |
| 8627 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 8628 | struct net_device *dev, |
| 8629 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 8630 | const u8 *mac, |
| 8631 | #else |
| 8632 | u8 *mac, |
| 8633 | #endif |
| 8634 | bool update, tCsrStaParams *StaParams) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8635 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8636 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8637 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8638 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8639 | tANI_U16 numCurrTdlsPeers; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 8640 | hdd_adapter_t *pAdapter; |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 8641 | VOS_STATUS status; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8642 | |
| 8643 | ENTER(); |
| 8644 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 8645 | if (!dev) { |
| 8646 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 8647 | return -EINVAL; |
| 8648 | } |
| 8649 | |
| 8650 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8651 | if (!pAdapter) { |
| 8652 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 8653 | return -EINVAL; |
| 8654 | } |
| 8655 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8656 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8657 | { |
| 8658 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8659 | "Invalid arguments"); |
| 8660 | return -EINVAL; |
| 8661 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8662 | |
| 8663 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 8664 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 8665 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8666 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8667 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 8668 | MAC_ADDRESS_STR " Request declined.", |
| 8669 | __func__, MAC_ADDR_ARRAY(mac)); |
| 8670 | return -ENOTSUPP; |
| 8671 | } |
| 8672 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8673 | if (pHddCtx->isLogpInProgress) |
| 8674 | { |
| 8675 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8676 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8677 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8678 | mac, |
| 8679 | eTDLS_LINK_IDLE, |
| 8680 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8681 | return -EBUSY; |
| 8682 | } |
| 8683 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 8684 | mutex_lock(&pHddCtx->tdls_lock); |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 8685 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8686 | |
| 8687 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8688 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8689 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 8690 | __func__, MAC_ADDR_ARRAY(mac), update); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 8691 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8692 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8693 | } |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 8694 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8695 | |
| 8696 | /* in add station, we accept existing valid staId if there is */ |
| 8697 | if ((0 == update) && |
| 8698 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 8699 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8700 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8701 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8702 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8703 | " link_status %d. staId %d. add station ignored.", |
| 8704 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 8705 | return 0; |
| 8706 | } |
| 8707 | /* in change station, we accept only when staId is valid */ |
| 8708 | if ((1 == update) && |
| 8709 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 8710 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 8711 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8712 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8713 | "%s: " MAC_ADDRESS_STR |
| 8714 | " link status %d. staId %d. change station %s.", |
| 8715 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 8716 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 8717 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8718 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8719 | |
| 8720 | /* 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] | 8721 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8722 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8723 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8724 | "%s: " MAC_ADDRESS_STR |
| 8725 | " TDLS setup is ongoing. Request declined.", |
| 8726 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8727 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8728 | } |
| 8729 | |
| 8730 | /* first to check if we reached to maximum supported TDLS peer. |
| 8731 | TODO: for now, return -EPERM looks working fine, |
| 8732 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8733 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 8734 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8735 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8736 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8737 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8738 | " TDLS Max peer already connected. Request declined." |
| 8739 | " Num of peers (%d), Max allowed (%d).", |
| 8740 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 8741 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8742 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8743 | } |
| 8744 | else |
| 8745 | { |
| 8746 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8747 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8748 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8749 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8750 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8751 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 8752 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8753 | return -EPERM; |
| 8754 | } |
| 8755 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8756 | if (0 == update) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8757 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8758 | mac, |
| 8759 | eTDLS_LINK_CONNECTING, |
| 8760 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8761 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 8762 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8763 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8764 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8765 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8766 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8767 | if(StaParams->htcap_present) |
| 8768 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8769 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8770 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8771 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8772 | "ht_capa->extended_capabilities: %0x", |
| 8773 | StaParams->HTCap.extendedHtCapInfo); |
| 8774 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8775 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8776 | "params->capability: %0x",StaParams->capability); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8777 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8778 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8779 | if(StaParams->vhtcap_present) |
| 8780 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8781 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8782 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 8783 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 8784 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 8785 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8786 | { |
| 8787 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8788 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8789 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8790 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8791 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 8792 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 8793 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8794 | else if ((1 == update) && (NULL == StaParams)) |
| 8795 | { |
| 8796 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8797 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 8798 | return -EPERM; |
| 8799 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8800 | |
| 8801 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 8802 | |
| 8803 | if (!update) |
| 8804 | { |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 8805 | /*Before adding sta make sure that device exited from BMPS*/ |
| 8806 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 8807 | { |
| 8808 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8809 | "%s: Adding tdls peer sta. Disable BMPS", __func__); |
| 8810 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 8811 | if (status != VOS_STATUS_SUCCESS) { |
| 8812 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
| 8813 | } |
| 8814 | } |
| 8815 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8816 | ret = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8817 | pAdapter->sessionId, mac); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8818 | if (ret != eHAL_STATUS_SUCCESS) { |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 8819 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8820 | FL("Failed to add TDLS peer STA. Enable Bmps")); |
| 8821 | wlan_hdd_tdls_check_bmps(pAdapter); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8822 | return -EPERM; |
| 8823 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8824 | } |
| 8825 | else |
| 8826 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8827 | ret = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8828 | pAdapter->sessionId, mac, StaParams); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8829 | if (ret != eHAL_STATUS_SUCCESS) { |
| 8830 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to change TDLS peer STA params")); |
| 8831 | return -EPERM; |
| 8832 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8833 | } |
| 8834 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8835 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8836 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 8837 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8838 | if (ret <= 0) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8839 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8840 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8841 | "%s: timeout waiting for tdls add station indication %ld", |
| 8842 | __func__, ret); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8843 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8844 | } |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8845 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8846 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 8847 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8848 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8849 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8850 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8851 | } |
| 8852 | |
| 8853 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8854 | |
| 8855 | error: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8856 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8857 | mac, |
| 8858 | eTDLS_LINK_IDLE, |
| 8859 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8860 | return -EPERM; |
| 8861 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8862 | } |
| 8863 | #endif |
| 8864 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8865 | static int __wlan_hdd_change_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8866 | struct net_device *dev, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 8867 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 8868 | const u8 *mac, |
| 8869 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8870 | u8 *mac, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 8871 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8872 | struct station_parameters *params) |
| 8873 | { |
| 8874 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8875 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8876 | hdd_context_t *pHddCtx; |
| 8877 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8878 | v_MACADDR_t STAMacAddress; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8879 | int ret = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8880 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8881 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8882 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8883 | tANI_U8 isOffChannelSupported = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8884 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8885 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8886 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8887 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8888 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8889 | if ((NULL == pAdapter)) |
| 8890 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8891 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8892 | "invalid adapter "); |
| 8893 | return -EINVAL; |
| 8894 | } |
| 8895 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8896 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8897 | TRACE_CODE_HDD_CHANGE_STATION, |
| 8898 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8899 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8900 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8901 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8902 | if (0 != ret) |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8903 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8904 | return ret; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8905 | } |
| 8906 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8907 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8908 | |
| 8909 | if (NULL == pHddStaCtx) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8910 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8911 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8912 | "invalid HDD station context"); |
| 8913 | return -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8914 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8915 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 8916 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8917 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 8918 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8919 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8920 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8921 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8922 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8923 | WLANTL_STA_AUTHENTICATED); |
| 8924 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8925 | if (status != VOS_STATUS_SUCCESS) |
| 8926 | { |
| 8927 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8928 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 8929 | return -EINVAL; |
| 8930 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8931 | } |
| 8932 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 8933 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 8934 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8935 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8936 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 8937 | StaParams.capability = params->capability; |
| 8938 | StaParams.uapsd_queues = params->uapsd_queues; |
| 8939 | StaParams.max_sp = params->max_sp; |
| 8940 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8941 | /* Convert (first channel , number of channels) tuple to |
| 8942 | * the total list of channels. This goes with the assumption |
| 8943 | * that if the first channel is < 14, then the next channels |
| 8944 | * are an incremental of 1 else an incremental of 4 till the number |
| 8945 | * of channels. |
| 8946 | */ |
| 8947 | if (0 != params->supported_channels_len) { |
| 8948 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 8949 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 8950 | { |
| 8951 | int wifi_chan_index; |
| 8952 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 8953 | wifi_chan_index = |
| 8954 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 8955 | no_of_channels = params->supported_channels[i+1]; |
| 8956 | for(k=1; k <= no_of_channels; k++) |
| 8957 | { |
| 8958 | StaParams.supported_channels[j+1] = |
| 8959 | StaParams.supported_channels[j] + wifi_chan_index; |
| 8960 | j+=1; |
| 8961 | } |
| 8962 | } |
| 8963 | StaParams.supported_channels_len = j; |
| 8964 | } |
| 8965 | vos_mem_copy(StaParams.supported_oper_classes, |
| 8966 | params->supported_oper_classes, |
| 8967 | params->supported_oper_classes_len); |
| 8968 | StaParams.supported_oper_classes_len = |
| 8969 | params->supported_oper_classes_len; |
| 8970 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8971 | if (0 != params->ext_capab_len) |
| 8972 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 8973 | sizeof(StaParams.extn_capability)); |
| 8974 | |
| 8975 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8976 | { |
| 8977 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8978 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8979 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8980 | |
| 8981 | StaParams.supported_rates_len = params->supported_rates_len; |
| 8982 | |
| 8983 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 8984 | * The supported_rates array , for all the structures propogating till Add Sta |
| 8985 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 8986 | * modified to send more rates. |
| 8987 | */ |
| 8988 | |
| 8989 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 8990 | */ |
| 8991 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 8992 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 8993 | |
| 8994 | if (0 != StaParams.supported_rates_len) { |
| 8995 | int i = 0; |
| 8996 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 8997 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8998 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8999 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 9000 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 9001 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 9002 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 9003 | } |
| 9004 | |
| 9005 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 9006 | { |
| 9007 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 9008 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 9009 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 9010 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9011 | if (0 != params->ext_capab_len ) { |
| 9012 | /*Define A Macro : TODO Sunil*/ |
| 9013 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 9014 | isBufSta = 1; |
| 9015 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 9016 | /* TDLS Channel Switching Support */ |
| 9017 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 9018 | isOffChannelSupported = 1; |
| 9019 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9020 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 9021 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 9022 | &StaParams, isBufSta, |
| 9023 | isOffChannelSupported); |
| 9024 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 9025 | if (VOS_STATUS_SUCCESS != status) { |
| 9026 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9027 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 9028 | return -EINVAL; |
| 9029 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 9030 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 9031 | |
| 9032 | if (VOS_STATUS_SUCCESS != status) { |
| 9033 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9034 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 9035 | return -EINVAL; |
| 9036 | } |
| 9037 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 9038 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 9039 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9040 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9041 | return status; |
| 9042 | } |
| 9043 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 9044 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 9045 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 9046 | struct net_device *dev, |
| 9047 | const u8 *mac, |
| 9048 | struct station_parameters *params) |
| 9049 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9050 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 9051 | struct net_device *dev, |
| 9052 | u8 *mac, |
| 9053 | struct station_parameters *params) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 9054 | #endif |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9055 | { |
| 9056 | int ret; |
| 9057 | |
| 9058 | vos_ssr_protect(__func__); |
| 9059 | ret = __wlan_hdd_change_station(wiphy, dev, mac, params); |
| 9060 | vos_ssr_unprotect(__func__); |
| 9061 | |
| 9062 | return ret; |
| 9063 | } |
| 9064 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9065 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9066 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9067 | * This function is used to initialize the key information |
| 9068 | */ |
| 9069 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9070 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9071 | struct net_device *ndev, |
| 9072 | u8 key_index, bool pairwise, |
| 9073 | const u8 *mac_addr, |
| 9074 | struct key_params *params |
| 9075 | ) |
| 9076 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9077 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9078 | struct net_device *ndev, |
| 9079 | u8 key_index, const u8 *mac_addr, |
| 9080 | struct key_params *params |
| 9081 | ) |
| 9082 | #endif |
| 9083 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9084 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9085 | tCsrRoamSetKey setKey; |
| 9086 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9087 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9088 | v_U32_t roamId= 0xFF; |
| 9089 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9090 | hdd_hostapd_state_t *pHostapdState; |
| 9091 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9092 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9093 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9094 | |
| 9095 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9096 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9097 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9098 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 9099 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9100 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9101 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9102 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9103 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9104 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9105 | } |
| 9106 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9107 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 9108 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9109 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9110 | |
| 9111 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9112 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9113 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9114 | key_index); |
| 9115 | |
| 9116 | return -EINVAL; |
| 9117 | } |
| 9118 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9119 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 9120 | { |
| 9121 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 9122 | params->key_len); |
| 9123 | |
| 9124 | return -EINVAL; |
| 9125 | } |
| 9126 | |
| 9127 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9128 | "%s: called with key index = %d & key length %d", |
| 9129 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9130 | |
| 9131 | /*extract key idx, key len and key*/ |
| 9132 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9133 | setKey.keyId = key_index; |
| 9134 | setKey.keyLength = params->key_len; |
| 9135 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 9136 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9137 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9138 | { |
| 9139 | case WLAN_CIPHER_SUITE_WEP40: |
| 9140 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 9141 | break; |
| 9142 | |
| 9143 | case WLAN_CIPHER_SUITE_WEP104: |
| 9144 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 9145 | break; |
| 9146 | |
| 9147 | case WLAN_CIPHER_SUITE_TKIP: |
| 9148 | { |
| 9149 | u8 *pKey = &setKey.Key[0]; |
| 9150 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 9151 | |
| 9152 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 9153 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9154 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9155 | |
| 9156 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9157 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9158 | |--------------|----------|----------| |
| 9159 | <---16bytes---><--8bytes--><--8bytes--> |
| 9160 | |
| 9161 | */ |
| 9162 | /*Sme expects the 32 bytes key to be in the below order |
| 9163 | |
| 9164 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9165 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9166 | |--------------|----------|----------| |
| 9167 | <---16bytes---><--8bytes--><--8bytes--> |
| 9168 | */ |
| 9169 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9170 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9171 | |
| 9172 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9173 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9174 | |
| 9175 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9176 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9177 | |
| 9178 | |
| 9179 | break; |
| 9180 | } |
| 9181 | |
| 9182 | case WLAN_CIPHER_SUITE_CCMP: |
| 9183 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 9184 | break; |
| 9185 | |
| 9186 | #ifdef FEATURE_WLAN_WAPI |
| 9187 | case WLAN_CIPHER_SUITE_SMS4: |
| 9188 | { |
| 9189 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9190 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 9191 | params->key, params->key_len); |
| 9192 | return 0; |
| 9193 | } |
| 9194 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 9195 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9196 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9197 | case WLAN_CIPHER_SUITE_KRK: |
| 9198 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 9199 | break; |
| 9200 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 9201 | |
| 9202 | #ifdef WLAN_FEATURE_11W |
| 9203 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 9204 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 9205 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 9206 | #endif |
| 9207 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9208 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 9209 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9210 | __func__, params->cipher); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9211 | status = -EOPNOTSUPP; |
| 9212 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9213 | } |
| 9214 | |
| 9215 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 9216 | __func__, setKey.encType); |
| 9217 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9218 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9219 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9220 | (!pairwise) |
| 9221 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9222 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9223 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9224 | ) |
| 9225 | { |
| 9226 | /* set group key*/ |
| 9227 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9228 | "%s- %d: setting Broadcast key", |
| 9229 | __func__, __LINE__); |
| 9230 | setKey.keyDirection = eSIR_RX_ONLY; |
| 9231 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 9232 | } |
| 9233 | else |
| 9234 | { |
| 9235 | /* set pairwise key*/ |
| 9236 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9237 | "%s- %d: setting pairwise key", |
| 9238 | __func__, __LINE__); |
| 9239 | setKey.keyDirection = eSIR_TX_RX; |
| 9240 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 9241 | } |
| 9242 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 9243 | { |
| 9244 | setKey.keyDirection = eSIR_TX_RX; |
| 9245 | /*Set the group key*/ |
| 9246 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9247 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9248 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9249 | if ( 0 != status ) |
| 9250 | { |
| 9251 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9252 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9253 | status = -EINVAL; |
| 9254 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9255 | } |
| 9256 | /*Save the keys here and call sme_RoamSetKey for setting |
| 9257 | the PTK after peer joins the IBSS network*/ |
| 9258 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 9259 | &setKey, sizeof(tCsrRoamSetKey)); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9260 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9261 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9262 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 9263 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 9264 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9265 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9266 | if( pHostapdState->bssState == BSS_START ) |
| 9267 | { |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9268 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9269 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 9270 | |
| 9271 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 9272 | { |
| 9273 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9274 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 9275 | __LINE__, vos_status ); |
| 9276 | |
| 9277 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 9278 | |
| 9279 | status = -EINVAL; |
| 9280 | goto end; |
| 9281 | } |
| 9282 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9283 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 9284 | |
| 9285 | if ( status != eHAL_STATUS_SUCCESS ) |
| 9286 | { |
| 9287 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9288 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 9289 | __LINE__, status ); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9290 | status = -EINVAL; |
| 9291 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9292 | } |
| 9293 | } |
| 9294 | |
| 9295 | /* Saving WEP keys */ |
| 9296 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 9297 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 9298 | { |
| 9299 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 9300 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 9301 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 9302 | } |
| 9303 | else |
| 9304 | { |
| 9305 | //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] | 9306 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9307 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 9308 | } |
| 9309 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9310 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 9311 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9312 | { |
| 9313 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9314 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9315 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9316 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9317 | if (!pairwise) |
| 9318 | #else |
| 9319 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 9320 | #endif |
| 9321 | { |
| 9322 | /* set group key*/ |
| 9323 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 9324 | { |
| 9325 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9326 | "%s- %d: Perform Set key Complete", |
| 9327 | __func__, __LINE__); |
| 9328 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 9329 | } |
| 9330 | } |
| 9331 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9332 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 9333 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 9334 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 9335 | |
| 9336 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 9337 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9338 | params->key, params->key_len); |
| 9339 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9340 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9341 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 9342 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9343 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9344 | "%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] | 9345 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9346 | setKey.peerMac[2], setKey.peerMac[3], |
| 9347 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9348 | setKey.keyDirection); |
| 9349 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9350 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 9351 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9352 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 9353 | { |
| 9354 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9355 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 9356 | __LINE__, vos_status ); |
| 9357 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9358 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9359 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 9360 | status = -EINVAL; |
| 9361 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9362 | |
| 9363 | } |
| 9364 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9365 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9366 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 9367 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 9368 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9369 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9370 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9371 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9372 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 9373 | "%s: Update PreAuth Key success", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9374 | status = 0; |
| 9375 | goto end; |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 9376 | } |
| 9377 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 9378 | { |
| 9379 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9380 | "%s: Update PreAuth Key failed", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9381 | status = -EINVAL; |
| 9382 | goto end; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 9383 | } |
| 9384 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9385 | |
| 9386 | /* issue set key request to SME*/ |
| 9387 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9388 | pAdapter->sessionId, &setKey, &roamId ); |
| 9389 | |
| 9390 | if ( 0 != status ) |
| 9391 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9392 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9393 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 9394 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9395 | status = -EINVAL; |
| 9396 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9397 | } |
| 9398 | |
| 9399 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9400 | /* in case of IBSS as there was no information available about WEP keys during |
| 9401 | * 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] | 9402 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9403 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 9404 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 9405 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9406 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 9407 | ) |
| 9408 | && |
| 9409 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 9410 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 9411 | ) |
| 9412 | ) |
| 9413 | { |
| 9414 | setKey.keyDirection = eSIR_RX_ONLY; |
| 9415 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 9416 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9417 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9418 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9419 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9420 | setKey.peerMac[2], setKey.peerMac[3], |
| 9421 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9422 | setKey.keyDirection); |
| 9423 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9424 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9425 | pAdapter->sessionId, &setKey, &roamId ); |
| 9426 | |
| 9427 | if ( 0 != status ) |
| 9428 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9429 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9430 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9431 | __func__, status); |
| 9432 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9433 | status = -EINVAL; |
| 9434 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9435 | } |
| 9436 | } |
| 9437 | } |
| 9438 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9439 | end: |
| 9440 | /* Need to clear any trace of key value in the memory. |
| 9441 | * Thus zero out the memory even though it is local |
| 9442 | * variable. |
| 9443 | */ |
| 9444 | vos_mem_zero(&setKey, sizeof(setKey)); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9445 | EXIT(); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9446 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9447 | } |
| 9448 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9449 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9450 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 9451 | struct net_device *ndev, |
| 9452 | u8 key_index, bool pairwise, |
| 9453 | const u8 *mac_addr, |
| 9454 | struct key_params *params |
| 9455 | ) |
| 9456 | #else |
| 9457 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 9458 | struct net_device *ndev, |
| 9459 | u8 key_index, const u8 *mac_addr, |
| 9460 | struct key_params *params |
| 9461 | ) |
| 9462 | #endif |
| 9463 | { |
| 9464 | int ret; |
| 9465 | vos_ssr_protect(__func__); |
| 9466 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9467 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 9468 | mac_addr, params); |
| 9469 | #else |
| 9470 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 9471 | params); |
| 9472 | #endif |
| 9473 | vos_ssr_unprotect(__func__); |
| 9474 | |
| 9475 | return ret; |
| 9476 | } |
| 9477 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9478 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9479 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9480 | * This function is used to get the key information |
| 9481 | */ |
| 9482 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9483 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9484 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9485 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9486 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9487 | const u8 *mac_addr, void *cookie, |
| 9488 | void (*callback)(void *cookie, struct key_params*) |
| 9489 | ) |
| 9490 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9491 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9492 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9493 | struct net_device *ndev, |
| 9494 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 9495 | void (*callback)(void *cookie, struct key_params*) |
| 9496 | ) |
| 9497 | #endif |
| 9498 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9499 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9500 | hdd_wext_state_t *pWextState = NULL; |
| 9501 | tCsrRoamProfile *pRoamProfile = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9502 | struct key_params params; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9503 | hdd_context_t *pHddCtx; |
| 9504 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9505 | |
| 9506 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9507 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9508 | if (NULL == pAdapter) |
| 9509 | { |
| 9510 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9511 | "%s: HDD adapter is Null", __func__); |
| 9512 | return -ENODEV; |
| 9513 | } |
| 9514 | |
| 9515 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9516 | ret = wlan_hdd_validate_context(pHddCtx); |
| 9517 | if (0 != ret) |
| 9518 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9519 | return ret; |
| 9520 | } |
| 9521 | |
| 9522 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9523 | pRoamProfile = &(pWextState->roamProfile); |
| 9524 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9525 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 9526 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9527 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9528 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9529 | memset(¶ms, 0, sizeof(params)); |
| 9530 | |
| 9531 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9532 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9533 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9534 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9535 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9536 | |
| 9537 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 9538 | { |
| 9539 | case eCSR_ENCRYPT_TYPE_NONE: |
| 9540 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 9541 | break; |
| 9542 | |
| 9543 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 9544 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 9545 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 9546 | break; |
| 9547 | |
| 9548 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 9549 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 9550 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 9551 | break; |
| 9552 | |
| 9553 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 9554 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 9555 | break; |
| 9556 | |
| 9557 | case eCSR_ENCRYPT_TYPE_AES: |
| 9558 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 9559 | break; |
| 9560 | |
| 9561 | default: |
| 9562 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 9563 | break; |
| 9564 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9565 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 9566 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9567 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 9568 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9569 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9570 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 9571 | params.seq_len = 0; |
| 9572 | params.seq = NULL; |
| 9573 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 9574 | callback(cookie, ¶ms); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9575 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9576 | return 0; |
| 9577 | } |
| 9578 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9579 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9580 | static int wlan_hdd_cfg80211_get_key( |
| 9581 | struct wiphy *wiphy, |
| 9582 | struct net_device *ndev, |
| 9583 | u8 key_index, bool pairwise, |
| 9584 | const u8 *mac_addr, void *cookie, |
| 9585 | void (*callback)(void *cookie, struct key_params*) |
| 9586 | ) |
| 9587 | #else |
| 9588 | static int wlan_hdd_cfg80211_get_key( |
| 9589 | struct wiphy *wiphy, |
| 9590 | struct net_device *ndev, |
| 9591 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 9592 | void (*callback)(void *cookie, struct key_params*) |
| 9593 | ) |
| 9594 | #endif |
| 9595 | { |
| 9596 | int ret; |
| 9597 | |
| 9598 | vos_ssr_protect(__func__); |
| 9599 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9600 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 9601 | mac_addr, cookie, callback); |
| 9602 | #else |
| 9603 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 9604 | callback); |
| 9605 | #endif |
| 9606 | vos_ssr_unprotect(__func__); |
| 9607 | |
| 9608 | return ret; |
| 9609 | } |
| 9610 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9611 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9612 | * FUNCTION: __wlan_hdd_cfg80211_del_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9613 | * This function is used to delete the key information |
| 9614 | */ |
| 9615 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9616 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9617 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9618 | u8 key_index, |
| 9619 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9620 | const u8 *mac_addr |
| 9621 | ) |
| 9622 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9623 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9624 | struct net_device *ndev, |
| 9625 | u8 key_index, |
| 9626 | const u8 *mac_addr |
| 9627 | ) |
| 9628 | #endif |
| 9629 | { |
| 9630 | int status = 0; |
| 9631 | |
| 9632 | //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] | 9633 | //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] | 9634 | //it is observed that this is invalidating peer |
| 9635 | //key index whenever re-key is done. This is affecting data link. |
| 9636 | //It should be ok to ignore del_key. |
| 9637 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9638 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 9639 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9640 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 9641 | tCsrRoamSetKey setKey; |
| 9642 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9643 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9644 | ENTER(); |
| 9645 | |
| 9646 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 9647 | __func__,pAdapter->device_mode); |
| 9648 | |
| 9649 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9650 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9651 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9652 | key_index); |
| 9653 | |
| 9654 | return -EINVAL; |
| 9655 | } |
| 9656 | |
| 9657 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9658 | setKey.keyId = key_index; |
| 9659 | |
| 9660 | if (mac_addr) |
| 9661 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 9662 | else |
| 9663 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 9664 | |
| 9665 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 9666 | |
| 9667 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9668 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9669 | ) |
| 9670 | { |
| 9671 | |
| 9672 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9673 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 9674 | if( pHostapdState->bssState == BSS_START) |
| 9675 | { |
| 9676 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9677 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9678 | if ( status != eHAL_STATUS_SUCCESS ) |
| 9679 | { |
| 9680 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9681 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 9682 | __LINE__, status ); |
| 9683 | } |
| 9684 | } |
| 9685 | } |
| 9686 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9687 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9688 | ) |
| 9689 | { |
| 9690 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9691 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9692 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 9693 | |
| 9694 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9695 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9696 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9697 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9698 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9699 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 9700 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9701 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9702 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9703 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9704 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9705 | if ( 0 != status ) |
| 9706 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9707 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9708 | "%s: sme_RoamSetKey failure, returned %d", |
| 9709 | __func__, status); |
| 9710 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 9711 | return -EINVAL; |
| 9712 | } |
| 9713 | } |
| 9714 | } |
| 9715 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9716 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9717 | return status; |
| 9718 | } |
| 9719 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9720 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9721 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 9722 | struct net_device *ndev, |
| 9723 | u8 key_index, |
| 9724 | bool pairwise, |
| 9725 | const u8 *mac_addr |
| 9726 | ) |
| 9727 | #else |
| 9728 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 9729 | struct net_device *ndev, |
| 9730 | u8 key_index, |
| 9731 | const u8 *mac_addr |
| 9732 | ) |
| 9733 | #endif |
| 9734 | { |
| 9735 | int ret; |
| 9736 | |
| 9737 | vos_ssr_protect(__func__); |
| 9738 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9739 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, pairwise, |
| 9740 | mac_addr); |
| 9741 | #else |
| 9742 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, mac_addr); |
| 9743 | #endif |
| 9744 | vos_ssr_unprotect(__func__); |
| 9745 | |
| 9746 | return ret; |
| 9747 | } |
| 9748 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9749 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9750 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9751 | * This function is used to set the default tx key index |
| 9752 | */ |
| 9753 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9754 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9755 | struct net_device *ndev, |
| 9756 | u8 key_index, |
| 9757 | bool unicast, bool multicast) |
| 9758 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9759 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9760 | struct net_device *ndev, |
| 9761 | u8 key_index) |
| 9762 | #endif |
| 9763 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9764 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9765 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9766 | hdd_wext_state_t *pWextState; |
| 9767 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9768 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9769 | |
| 9770 | ENTER(); |
| 9771 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9772 | if ((NULL == pAdapter)) |
| 9773 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9774 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9775 | "invalid adapter"); |
| 9776 | return -EINVAL; |
| 9777 | } |
| 9778 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9779 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9780 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 9781 | pAdapter->sessionId, key_index)); |
| 9782 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9783 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9784 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9785 | |
| 9786 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 9787 | { |
| 9788 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9789 | "invalid Wext state or HDD context"); |
| 9790 | return -EINVAL; |
| 9791 | } |
| 9792 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9793 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9794 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9795 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9796 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9797 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9798 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9799 | key_index); |
| 9800 | |
| 9801 | return -EINVAL; |
| 9802 | } |
| 9803 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9804 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9805 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9806 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9807 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9808 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9809 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9810 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9811 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9812 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9813 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9814 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9815 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 9816 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9817 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 9818 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9819 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9820 | { |
| 9821 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9822 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9823 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9824 | tCsrRoamSetKey setKey; |
| 9825 | v_U32_t roamId= 0xFF; |
| 9826 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9827 | |
| 9828 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9829 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9830 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9831 | Keys->defaultIndex = (u8)key_index; |
| 9832 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9833 | setKey.keyId = key_index; |
| 9834 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9835 | |
| 9836 | vos_mem_copy(&setKey.Key[0], |
| 9837 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9838 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9839 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9840 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9841 | |
| 9842 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9843 | &pHddStaCtx->conn_info.bssId[0], |
| 9844 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9845 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9846 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 9847 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 9848 | eCSR_ENCRYPT_TYPE_WEP104) |
| 9849 | { |
| 9850 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 9851 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 9852 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 9853 | type(104) and switching encryption type to 40*/ |
| 9854 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 9855 | eCSR_ENCRYPT_TYPE_WEP40; |
| 9856 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 9857 | eCSR_ENCRYPT_TYPE_WEP40; |
| 9858 | } |
| 9859 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9860 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9861 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9862 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9863 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9864 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9865 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9866 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9867 | if ( 0 != status ) |
| 9868 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9869 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9870 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9871 | status); |
| 9872 | return -EINVAL; |
| 9873 | } |
| 9874 | } |
| 9875 | } |
| 9876 | |
| 9877 | /* In SoftAp mode setting key direction for default mode */ |
| 9878 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 9879 | { |
| 9880 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 9881 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 9882 | (eCSR_ENCRYPT_TYPE_AES != |
| 9883 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 9884 | ) |
| 9885 | { |
| 9886 | /* Saving key direction for default key index to TX default */ |
| 9887 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 9888 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 9889 | } |
| 9890 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9891 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9892 | return status; |
| 9893 | } |
| 9894 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9895 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9896 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 9897 | struct net_device *ndev, |
| 9898 | u8 key_index, |
| 9899 | bool unicast, bool multicast) |
| 9900 | #else |
| 9901 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 9902 | struct net_device *ndev, |
| 9903 | u8 key_index) |
| 9904 | #endif |
| 9905 | { |
| 9906 | int ret; |
| 9907 | vos_ssr_protect(__func__); |
| 9908 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9909 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 9910 | multicast); |
| 9911 | #else |
| 9912 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 9913 | #endif |
| 9914 | vos_ssr_unprotect(__func__); |
| 9915 | |
| 9916 | return ret; |
| 9917 | } |
| 9918 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9919 | /* |
| 9920 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 9921 | * This function is used to inform the BSS details to nl80211 interface. |
| 9922 | */ |
| 9923 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 9924 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 9925 | { |
| 9926 | struct net_device *dev = pAdapter->dev; |
| 9927 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 9928 | struct wiphy *wiphy = wdev->wiphy; |
| 9929 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 9930 | int chan_no; |
| 9931 | int ie_length; |
| 9932 | const char *ie; |
| 9933 | unsigned int freq; |
| 9934 | struct ieee80211_channel *chan; |
| 9935 | int rssi = 0; |
| 9936 | struct cfg80211_bss *bss = NULL; |
| 9937 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9938 | if( NULL == pBssDesc ) |
| 9939 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9940 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9941 | return bss; |
| 9942 | } |
| 9943 | |
| 9944 | chan_no = pBssDesc->channelId; |
| 9945 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 9946 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 9947 | |
| 9948 | if( NULL == ie ) |
| 9949 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9950 | 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] | 9951 | return bss; |
| 9952 | } |
| 9953 | |
| 9954 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 9955 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 9956 | { |
| 9957 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9958 | } |
| 9959 | else |
| 9960 | { |
| 9961 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9962 | } |
| 9963 | #else |
| 9964 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9965 | #endif |
| 9966 | |
| 9967 | chan = __ieee80211_get_channel(wiphy, freq); |
| 9968 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 9969 | if (!chan) { |
| 9970 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 9971 | return NULL; |
| 9972 | } |
| 9973 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9974 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9975 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 9976 | return cfg80211_inform_bss(wiphy, chan, |
| 9977 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 9978 | CFG80211_BSS_FTYPE_UNKNOWN, |
| 9979 | #endif |
| 9980 | pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9981 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9982 | pBssDesc->capabilityInfo, |
| 9983 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9984 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9985 | } |
| 9986 | |
| 9987 | |
| 9988 | |
| 9989 | /* |
| 9990 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 9991 | * This function is used to inform the BSS details to nl80211 interface. |
| 9992 | */ |
| 9993 | struct cfg80211_bss* |
| 9994 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 9995 | tSirBssDescription *bss_desc |
| 9996 | ) |
| 9997 | { |
| 9998 | /* |
| 9999 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 10000 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 10001 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 10002 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 10003 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 10004 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 10005 | cfg80211_inform_bss_frame. |
| 10006 | */ |
| 10007 | struct net_device *dev = pAdapter->dev; |
| 10008 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 10009 | struct wiphy *wiphy = wdev->wiphy; |
| 10010 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 10011 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 10012 | qcom_ie_age *qie_age = NULL; |
| 10013 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 10014 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10015 | 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] | 10016 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10017 | const char *ie = |
| 10018 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 10019 | unsigned int freq; |
| 10020 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 10021 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10022 | struct cfg80211_bss *bss_status = NULL; |
| 10023 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 10024 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10025 | hdd_context_t *pHddCtx; |
| 10026 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10027 | #ifdef WLAN_OPEN_SOURCE |
| 10028 | struct timespec ts; |
| 10029 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10030 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 10031 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10032 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10033 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10034 | if (0 != status) |
| 10035 | { |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 10036 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10037 | } |
| 10038 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 10039 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10040 | if (!mgmt) |
| 10041 | { |
| 10042 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10043 | "%s: memory allocation failed ", __func__); |
| 10044 | return NULL; |
| 10045 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 10046 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10047 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10048 | |
| 10049 | #ifdef WLAN_OPEN_SOURCE |
| 10050 | /* Android does not want the timestamp from the frame. |
| 10051 | Instead it wants a monotonic increasing value */ |
| 10052 | get_monotonic_boottime(&ts); |
| 10053 | mgmt->u.probe_resp.timestamp = |
| 10054 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 10055 | #else |
| 10056 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10057 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 10058 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10059 | |
| 10060 | #endif |
| 10061 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10062 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 10063 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 10064 | |
| 10065 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 10066 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 10067 | /* Assuming this is the last IE, copy at the end */ |
| 10068 | ie_length -=sizeof(qcom_ie_age); |
| 10069 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 10070 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 10071 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 10072 | qie_age->oui_1 = QCOM_OUI1; |
| 10073 | qie_age->oui_2 = QCOM_OUI2; |
| 10074 | qie_age->oui_3 = QCOM_OUI3; |
| 10075 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 10076 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 10077 | #endif |
| 10078 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10079 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 10080 | if (bss_desc->fProbeRsp) |
| 10081 | { |
| 10082 | mgmt->frame_control |= |
| 10083 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 10084 | } |
| 10085 | else |
| 10086 | { |
| 10087 | mgmt->frame_control |= |
| 10088 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 10089 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10090 | |
| 10091 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10092 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10093 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 10094 | { |
| 10095 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 10096 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10097 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10098 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 10099 | |
| 10100 | { |
| 10101 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 10102 | } |
| 10103 | else |
| 10104 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10105 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 10106 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10107 | kfree(mgmt); |
| 10108 | return NULL; |
| 10109 | } |
| 10110 | #else |
| 10111 | freq = ieee80211_channel_to_frequency(chan_no); |
| 10112 | #endif |
| 10113 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 10114 | /*when the band is changed on the fly using the GUI, three things are done |
| 10115 | * 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) |
| 10116 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 10117 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 10118 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 10119 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 10120 | * 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 |
| 10121 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 10122 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 10123 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 10124 | * So drop the bss and continue to next bss. |
| 10125 | */ |
| 10126 | if(chan == NULL) |
| 10127 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10128 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 10129 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 10130 | return NULL; |
| 10131 | } |
Hanumantha Reddy Pothula | 904bcef | 2015-06-19 11:56:29 +0530 | [diff] [blame] | 10132 | /*To keep the rssi icon of the connected AP in the scan window |
| 10133 | *and the rssi icon of the wireless networks in sync |
| 10134 | * */ |
| 10135 | if (( eConnectionState_Associated == |
| 10136 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 10137 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 10138 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 10139 | WNI_CFG_BSSID_LEN)) && |
| 10140 | (pHddCtx->hdd_wlan_suspended == FALSE)) |
| 10141 | { |
| 10142 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 10143 | rssi = (pAdapter->rssi * 100); |
| 10144 | } |
| 10145 | else |
| 10146 | { |
| 10147 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 10148 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10149 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10150 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
Sushant Kaushik | 0b34342 | 2015-05-25 17:15:55 +0530 | [diff] [blame] | 10151 | " RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 10152 | vos_freq_to_chan(chan->center_freq), (int)(rssi/100)); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10153 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10154 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 10155 | frame_len, rssi, GFP_KERNEL); |
| 10156 | kfree(mgmt); |
| 10157 | return bss_status; |
| 10158 | } |
| 10159 | |
| 10160 | /* |
| 10161 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 10162 | * This function is used to update the BSS data base of CFG8011 |
| 10163 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10164 | 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] | 10165 | tCsrRoamInfo *pRoamInfo |
| 10166 | ) |
| 10167 | { |
| 10168 | tCsrRoamConnectedProfile roamProfile; |
| 10169 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 10170 | struct cfg80211_bss *bss = NULL; |
| 10171 | |
| 10172 | ENTER(); |
| 10173 | |
| 10174 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 10175 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 10176 | |
| 10177 | if (NULL != roamProfile.pBssDesc) |
| 10178 | { |
Girish Gowli | f4b6802 | 2014-08-28 23:18:57 +0530 | [diff] [blame] | 10179 | bss = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 10180 | roamProfile.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10181 | |
| 10182 | if (NULL == bss) |
| 10183 | { |
| 10184 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 10185 | __func__); |
| 10186 | } |
| 10187 | |
| 10188 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 10189 | } |
| 10190 | else |
| 10191 | { |
| 10192 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 10193 | __func__); |
| 10194 | } |
| 10195 | return bss; |
| 10196 | } |
| 10197 | |
| 10198 | /* |
| 10199 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 10200 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10201 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 10202 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10203 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10204 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10205 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10206 | tCsrScanResultInfo *pScanResult; |
| 10207 | eHalStatus status = 0; |
| 10208 | tScanResultHandle pResult; |
| 10209 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10210 | hdd_context_t *pHddCtx; |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 10211 | bool is_p2p_scan = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10212 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10213 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10214 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10215 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 10216 | NO_SESSION, pAdapter->sessionId)); |
| 10217 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10218 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10219 | |
| 10220 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10221 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10222 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 10223 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 10224 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10225 | } |
| 10226 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10227 | |
| 10228 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 10229 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 10230 | { |
| 10231 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10232 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 10233 | return VOS_STATUS_E_PERM; |
| 10234 | } |
| 10235 | |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 10236 | if (pAdapter->request != NULL) |
| 10237 | { |
| 10238 | if ((pAdapter->request->n_ssids == 1) |
| 10239 | && (pAdapter->request->ssids != NULL) |
| 10240 | && vos_mem_compare(&pAdapter->request->ssids[0], "DIRECT-", 7)) |
| 10241 | is_p2p_scan = true; |
| 10242 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10243 | /* |
| 10244 | * start getting scan results and populate cgf80211 BSS database |
| 10245 | */ |
| 10246 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 10247 | |
| 10248 | /* no scan results */ |
| 10249 | if (NULL == pResult) |
| 10250 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10251 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 10252 | __func__, status); |
Mahesh A Saptasagar | 51dc36c | 2015-06-16 12:07:15 +0530 | [diff] [blame] | 10253 | wlan_hdd_get_frame_logs(pAdapter, |
| 10254 | WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10255 | return status; |
| 10256 | } |
| 10257 | |
| 10258 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 10259 | |
| 10260 | while (pScanResult) |
| 10261 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10262 | /* |
| 10263 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 10264 | * entry already exists in bss data base of cfg80211 for that |
| 10265 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 10266 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 10267 | * mgmt packet as input. As of now there is no possibility to get |
| 10268 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10269 | * ieee80211_mgmt(probe response) and passing to c |
| 10270 | * fg80211_inform_bss_frame. |
| 10271 | * */ |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 10272 | if(is_p2p_scan && (pScanResult->ssId.ssId != NULL) && |
| 10273 | !vos_mem_compare( pScanResult->ssId.ssId, "DIRECT-", 7) ) |
| 10274 | { |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 10275 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 10276 | continue; //Skip the non p2p bss entries |
| 10277 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10278 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 10279 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10280 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10281 | |
| 10282 | if (NULL == bss_status) |
| 10283 | { |
| 10284 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10285 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10286 | } |
| 10287 | else |
| 10288 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 10289 | cfg80211_put_bss( |
| 10290 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 10291 | wiphy, |
| 10292 | #endif |
| 10293 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10294 | } |
| 10295 | |
| 10296 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 10297 | } |
| 10298 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10299 | sme_ScanResultPurge(hHal, pResult); |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 10300 | is_p2p_scan = false; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10301 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10302 | } |
| 10303 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10304 | void |
| 10305 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 10306 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10307 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 10308 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10309 | } /****** end hddPrintMacAddr() ******/ |
| 10310 | |
| 10311 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 10312 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10313 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10314 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10315 | "%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] | 10316 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 10317 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 10318 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10319 | } /****** end hddPrintPmkId() ******/ |
| 10320 | |
| 10321 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 10322 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 10323 | |
| 10324 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 10325 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 10326 | |
| 10327 | #define dump_bssid(bssid) \ |
| 10328 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10329 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 10330 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10331 | } |
| 10332 | |
| 10333 | #define dump_pmkid(pMac, pmkid) \ |
| 10334 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10335 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 10336 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10337 | } |
| 10338 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 10339 | #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] | 10340 | /* |
| 10341 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 10342 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 10343 | */ |
| 10344 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10345 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10346 | int index, bool preauth ) |
| 10347 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10348 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10349 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10350 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10351 | |
| 10352 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10353 | 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] | 10354 | |
| 10355 | if( NULL == pRoamInfo ) |
| 10356 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10357 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10358 | return -EINVAL; |
| 10359 | } |
| 10360 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10361 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 10362 | { |
| 10363 | dump_bssid(pRoamInfo->bssid); |
| 10364 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10365 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 10366 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10367 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10368 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10369 | } |
| 10370 | #endif //FEATURE_WLAN_LFR |
| 10371 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 10372 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 10373 | /* |
| 10374 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 10375 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 10376 | * |
| 10377 | */ |
| 10378 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 10379 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 10380 | tCsrRoamInfo *pRoamInfo) |
| 10381 | { |
| 10382 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10383 | union iwreq_data wrqu; |
| 10384 | |
| 10385 | ENTER(); |
| 10386 | |
| 10387 | if (NULL == pAdapter) |
| 10388 | { |
| 10389 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10390 | return VOS_STATUS_E_FAILURE; |
| 10391 | } |
| 10392 | |
| 10393 | /* create the event */ |
| 10394 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10395 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10396 | |
| 10397 | wrqu.data.pointer = metrics_notification; |
| 10398 | wrqu.data.length = scnprintf(metrics_notification, |
| 10399 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 10400 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10401 | |
| 10402 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10403 | |
| 10404 | EXIT(); |
| 10405 | |
| 10406 | return VOS_STATUS_SUCCESS; |
| 10407 | } |
| 10408 | |
| 10409 | /* |
| 10410 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 10411 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 10412 | * or failure |
| 10413 | */ |
| 10414 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 10415 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 10416 | { |
| 10417 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10418 | union iwreq_data wrqu; |
| 10419 | |
| 10420 | ENTER(); |
| 10421 | |
| 10422 | if (NULL == pAdapter) |
| 10423 | { |
| 10424 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10425 | return VOS_STATUS_E_FAILURE; |
| 10426 | } |
| 10427 | |
| 10428 | /* create the event */ |
| 10429 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10430 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10431 | |
| 10432 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 10433 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 10434 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10435 | |
| 10436 | if (1 == preauth_status) |
| 10437 | strncat(metrics_notification, " TRUE", 5); |
| 10438 | else |
| 10439 | strncat(metrics_notification, " FALSE", 6); |
| 10440 | |
| 10441 | wrqu.data.pointer = metrics_notification; |
| 10442 | wrqu.data.length = strlen(metrics_notification); |
| 10443 | |
| 10444 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10445 | |
| 10446 | EXIT(); |
| 10447 | |
| 10448 | return VOS_STATUS_SUCCESS; |
| 10449 | } |
| 10450 | |
| 10451 | /* |
| 10452 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 10453 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 10454 | * |
| 10455 | */ |
| 10456 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 10457 | tCsrRoamInfo *pRoamInfo) |
| 10458 | { |
| 10459 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10460 | union iwreq_data wrqu; |
| 10461 | |
| 10462 | ENTER(); |
| 10463 | |
| 10464 | if (NULL == pAdapter) |
| 10465 | { |
| 10466 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10467 | return VOS_STATUS_E_FAILURE; |
| 10468 | } |
| 10469 | |
| 10470 | /* create the event */ |
| 10471 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10472 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10473 | |
| 10474 | wrqu.data.pointer = metrics_notification; |
| 10475 | wrqu.data.length = scnprintf(metrics_notification, |
| 10476 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 10477 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10478 | |
| 10479 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10480 | |
| 10481 | EXIT(); |
| 10482 | |
| 10483 | return VOS_STATUS_SUCCESS; |
| 10484 | } |
| 10485 | #endif |
| 10486 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10487 | /* |
| 10488 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 10489 | * scanning callback function, called after finishing scan |
| 10490 | * |
| 10491 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10492 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10493 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 10494 | { |
| 10495 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10496 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10497 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10498 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10499 | struct cfg80211_scan_request *req = NULL; |
| 10500 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10501 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10502 | long waitRet = 0; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10503 | tANI_U8 i; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10504 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10505 | |
| 10506 | ENTER(); |
| 10507 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10508 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Siddharth Bhal | 5c2e02d | 2015-05-05 17:35:29 +0530 | [diff] [blame] | 10509 | if (NULL == pHddCtx) { |
| 10510 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is Null")); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10511 | goto allow_suspend; |
| 10512 | } |
| 10513 | |
| 10514 | pScanInfo = &pHddCtx->scan_info; |
| 10515 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10516 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10517 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10518 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10519 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 10520 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10521 | pScanInfo->mScanPendingCounter = 0; |
| 10522 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10523 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10524 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10525 | &pScanInfo->scan_req_completion_event, |
| 10526 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10527 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10528 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10529 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10530 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10531 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10532 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10533 | } |
| 10534 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 10535 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10536 | { |
| 10537 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10538 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10539 | } |
| 10540 | |
| 10541 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10542 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10543 | { |
| 10544 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10545 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10546 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10547 | (int) scanId); |
| 10548 | } |
| 10549 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10550 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10551 | pAdapter); |
| 10552 | |
| 10553 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10554 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10555 | |
| 10556 | |
| 10557 | /* If any client wait scan result through WEXT |
| 10558 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10559 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10560 | { |
| 10561 | /* The other scan request waiting for current scan finish |
| 10562 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10563 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10564 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10565 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10566 | } |
| 10567 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10568 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10569 | { |
| 10570 | struct net_device *dev = pAdapter->dev; |
| 10571 | union iwreq_data wrqu; |
| 10572 | int we_event; |
| 10573 | char *msg; |
| 10574 | |
| 10575 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 10576 | we_event = SIOCGIWSCAN; |
| 10577 | msg = NULL; |
| 10578 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 10579 | } |
| 10580 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10581 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10582 | |
| 10583 | /* Get the Scan Req */ |
| 10584 | req = pAdapter->request; |
| 10585 | |
| 10586 | if (!req) |
| 10587 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10588 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10589 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10590 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10591 | } |
| 10592 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10593 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10594 | /* Scan is no longer pending */ |
| 10595 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10596 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10597 | /* last_scan_timestamp is used to decide if new scan |
| 10598 | * is needed or not on station interface. If last station |
| 10599 | * scan time and new station scan time is less then |
| 10600 | * last_scan_timestamp ; driver will return cached scan. |
| 10601 | */ |
| 10602 | if (req->no_cck == FALSE && status == eCSR_SCAN_SUCCESS) // no_cck will be set during p2p find |
| 10603 | { |
| 10604 | pScanInfo->last_scan_timestamp = vos_timer_get_system_time(); |
| 10605 | |
| 10606 | if ( req->n_channels ) |
| 10607 | { |
| 10608 | for (i = 0; i < req->n_channels ; i++ ) |
| 10609 | { |
| 10610 | pHddCtx->scan_info.last_scan_channelList[i] = req->channels[i]->hw_value; |
| 10611 | } |
| 10612 | /* store no of channel scanned */ |
| 10613 | pHddCtx->scan_info.last_scan_numChannels= req->n_channels; |
| 10614 | } |
| 10615 | |
| 10616 | } |
| 10617 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 10618 | /* |
| 10619 | * cfg80211_scan_done informing NL80211 about completion |
| 10620 | * of scanning |
| 10621 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10622 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 10623 | { |
| 10624 | aborted = true; |
| 10625 | } |
| 10626 | cfg80211_scan_done(req, aborted); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 10627 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10628 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10629 | if (pHddCtx->spoofMacAddr.isEnabled || pHddCtx->spoofMacAddr.isReqDeferred) { |
| 10630 | /* Generate new random mac addr for next scan */ |
| 10631 | hddLog(VOS_TRACE_LEVEL_INFO, "scan completed - generate new spoof mac addr"); |
| 10632 | hdd_processSpoofMacAddrRequest(pHddCtx); |
| 10633 | } |
| 10634 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10635 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10636 | /* release the wake lock at the end of the scan*/ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 10637 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10638 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 10639 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 10640 | * immediatly after the driver gets connect request(i.e after scan) |
| 10641 | * from supplicant, this result in app's is suspending and not able |
| 10642 | * to process the connect request to AP */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 10643 | hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 10644 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 10645 | #ifdef FEATURE_WLAN_TDLS |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10646 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 10647 | #endif |
| 10648 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10649 | EXIT(); |
| 10650 | return 0; |
| 10651 | } |
| 10652 | |
| 10653 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10654 | * FUNCTION: hdd_isConnectionInProgress |
| 10655 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10656 | * |
| 10657 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10658 | v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10659 | { |
| 10660 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 10661 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 10662 | hdd_adapter_t *pAdapter = NULL; |
| 10663 | VOS_STATUS status = 0; |
| 10664 | v_U8_t staId = 0; |
| 10665 | v_U8_t *staMac = NULL; |
| 10666 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 10667 | if (TRUE == pHddCtx->btCoexModeSet) |
| 10668 | { |
| 10669 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10670 | FL("BTCoex Mode operation in progress")); |
| 10671 | return VOS_TRUE; |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 10672 | } |
| 10673 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10674 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 10675 | |
| 10676 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 10677 | { |
| 10678 | pAdapter = pAdapterNode->pAdapter; |
| 10679 | |
| 10680 | if( pAdapter ) |
| 10681 | { |
| 10682 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10683 | "%s: Adapter with device mode %s (%d) exists", |
| 10684 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10685 | pAdapter->device_mode); |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10686 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10687 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10688 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 10689 | (eConnectionState_Connecting == |
| 10690 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 10691 | { |
| 10692 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10693 | "%s: %p(%d) Connection is in progress", __func__, |
| 10694 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 10695 | return VOS_TRUE; |
| 10696 | } |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10697 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Padma, Santhosh Kumar | 3b9657d | 2015-02-04 19:37:32 +0530 | [diff] [blame] | 10698 | smeNeighborMiddleOfRoaming(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10699 | { |
| 10700 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10701 | "%s: %p(%d) Reassociation is in progress", __func__, |
| 10702 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 10703 | return VOS_TRUE; |
| 10704 | } |
| 10705 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10706 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10707 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10708 | { |
| 10709 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10710 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10711 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10712 | { |
| 10713 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 10714 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10715 | "%s: client " MAC_ADDRESS_STR |
| 10716 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 10717 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10718 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10719 | } |
| 10720 | } |
| 10721 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 10722 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 10723 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10724 | v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 10725 | ptSapContext pSapCtx = NULL; |
| 10726 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 10727 | if(pSapCtx == NULL){ |
| 10728 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10729 | FL("psapCtx is NULL")); |
| 10730 | return VOS_FALSE; |
| 10731 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10732 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 10733 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10734 | if ((pSapCtx->aStaInfo[staId].isUsed) && |
| 10735 | (WLANTL_STA_CONNECTED == pSapCtx->aStaInfo[staId].tlSTAState)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10736 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10737 | staMac = (v_U8_t *) &(pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10738 | |
| 10739 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10740 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 10741 | "middle of WPS/EAPOL exchange.", __func__, |
| 10742 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10743 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10744 | } |
| 10745 | } |
| 10746 | } |
| 10747 | } |
| 10748 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 10749 | pAdapterNode = pNext; |
| 10750 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10751 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10752 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10753 | |
| 10754 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10755 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10756 | * this scan respond to scan trigger and update cfg80211 scan database |
| 10757 | * later, scan dump command can be used to recieve scan results |
| 10758 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10759 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 10760 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10761 | struct net_device *dev, |
| 10762 | #endif |
| 10763 | struct cfg80211_scan_request *request) |
| 10764 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10765 | hdd_adapter_t *pAdapter = NULL; |
| 10766 | hdd_context_t *pHddCtx = NULL; |
| 10767 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10768 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10769 | tCsrScanRequest scanRequest; |
| 10770 | tANI_U8 *channelList = NULL, i; |
| 10771 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10772 | int status; |
| 10773 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10774 | v_U8_t* pP2pIe = NULL; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10775 | int ret = 0; |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 10776 | v_U8_t *pWpsIe=NULL; |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 10777 | bool is_p2p_scan = false; |
Hanumantha Reddy Pothula | 2e282d1 | 2015-06-19 14:01:26 +0530 | [diff] [blame] | 10778 | v_S7_t rssi=0; |
| 10779 | hdd_station_ctx_t *pHddStaCtx=NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10780 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10781 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 10782 | struct net_device *dev = NULL; |
| 10783 | if (NULL == request) |
| 10784 | { |
| 10785 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10786 | "%s: scan req param null", __func__); |
| 10787 | return -EINVAL; |
| 10788 | } |
| 10789 | dev = request->wdev->netdev; |
| 10790 | #endif |
| 10791 | |
| 10792 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 10793 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 10794 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10795 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10796 | ENTER(); |
| 10797 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10798 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 10799 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10800 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10801 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10802 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10803 | if (0 != status) |
| 10804 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10805 | return status; |
| 10806 | } |
| 10807 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10808 | if (NULL == pwextBuf) |
| 10809 | { |
| 10810 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 10811 | __func__); |
| 10812 | return -EIO; |
| 10813 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10814 | cfg_param = pHddCtx->cfg_ini; |
| 10815 | pScanInfo = &pHddCtx->scan_info; |
| 10816 | |
Hanumantha Reddy Pothula | 2e282d1 | 2015-06-19 14:01:26 +0530 | [diff] [blame] | 10817 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10818 | if ( (pHddStaCtx != NULL) && (TRUE == hdd_connIsConnected(pHddStaCtx))) |
| 10819 | { |
| 10820 | wlan_hdd_get_roam_rssi(pAdapter, &rssi); |
| 10821 | hddLog(VOS_TRACE_LEVEL_INFO, FL("rssi: %d"), rssi); |
| 10822 | } |
| 10823 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10824 | #ifdef WLAN_BTAMP_FEATURE |
| 10825 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10826 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10827 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 10828 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10829 | "%s: No scanning when AMP is on", __func__); |
| 10830 | return -EOPNOTSUPP; |
| 10831 | } |
| 10832 | #endif |
| 10833 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10834 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10835 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10836 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10837 | "%s: Not scanning on device_mode = %s (%d)", |
| 10838 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10839 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10840 | return -EOPNOTSUPP; |
| 10841 | } |
| 10842 | |
| 10843 | if (TRUE == pScanInfo->mScanPending) |
| 10844 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10845 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 10846 | { |
| 10847 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 10848 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10849 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10850 | } |
| 10851 | |
Hanumantha Reddy Pothula | 4b6be06 | 2015-08-18 14:06:24 +0530 | [diff] [blame] | 10852 | // Don't allow scan if PNO scan is going on. |
| 10853 | if (pHddCtx->isPnoEnable) |
| 10854 | { |
| 10855 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10856 | FL("pno scan in progress")); |
| 10857 | return -EBUSY; |
| 10858 | } |
| 10859 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10860 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10861 | //Channel and action frame is pending |
| 10862 | //Otherwise Cancel Remain On Channel and allow Scan |
| 10863 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10864 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10865 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10866 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10867 | return -EBUSY; |
| 10868 | } |
| 10869 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10870 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 10871 | { |
| 10872 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 10873 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10874 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10875 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10876 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 10877 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10878 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10879 | "%s: MAX TM Level Scan not allowed", __func__); |
| 10880 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10881 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10882 | } |
| 10883 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 10884 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10885 | /* Check if scan is allowed at this point of time. |
| 10886 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10887 | if (hdd_isConnectionInProgress(pHddCtx)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10888 | { |
| 10889 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 10890 | return -EBUSY; |
| 10891 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10892 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10893 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 10894 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10895 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 10896 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 10897 | * is not aging out the scan results. |
| 10898 | */ |
| 10899 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10900 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10901 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10902 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10903 | |
| 10904 | if ((request->ssids) && (0 < request->n_ssids)) |
| 10905 | { |
| 10906 | tCsrSSIDInfo *SsidInfo; |
| 10907 | int j; |
| 10908 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 10909 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 10910 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 10911 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 10912 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 10913 | |
| 10914 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 10915 | { |
| 10916 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10917 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 10918 | return -ENOMEM; |
| 10919 | } |
| 10920 | |
| 10921 | /* copy all the ssid's and their length */ |
| 10922 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 10923 | { |
| 10924 | /* get the ssid length */ |
| 10925 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 10926 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 10927 | SsidInfo->SSID.length); |
| 10928 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 10929 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 10930 | j, SsidInfo->SSID.ssId); |
| 10931 | } |
| 10932 | /* set the scan type to active */ |
| 10933 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 10934 | } |
| 10935 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10936 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10937 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10938 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 10939 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10940 | /* set the scan type to active */ |
| 10941 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10942 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10943 | else |
| 10944 | { |
| 10945 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 10946 | scanRequest.scanType = pScanInfo->scan_mode; |
| 10947 | } |
| 10948 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 10949 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10950 | |
| 10951 | /* set BSSType to default type */ |
| 10952 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 10953 | |
| 10954 | /*TODO: scan the requested channels only*/ |
| 10955 | |
| 10956 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10957 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10958 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10959 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10960 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 10961 | request->n_channels = MAX_CHANNEL; |
| 10962 | } |
| 10963 | |
| 10964 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10965 | "No of Scan Channels: %d", request->n_channels); |
| 10966 | |
| 10967 | |
| 10968 | if( request->n_channels ) |
| 10969 | { |
| 10970 | char chList [(request->n_channels*5)+1]; |
| 10971 | int len; |
| 10972 | channelList = vos_mem_malloc( request->n_channels ); |
| 10973 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10974 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10975 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10976 | "%s: memory alloc failed channelList", __func__); |
| 10977 | status = -ENOMEM; |
| 10978 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10979 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10980 | |
| 10981 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 10982 | { |
| 10983 | channelList[i] = request->channels[i]->hw_value; |
| 10984 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 10985 | } |
| 10986 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10987 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10988 | "Channel-List: %s ", chList); |
| 10989 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10990 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10991 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 10992 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 10993 | |
| 10994 | /* set requestType to full scan */ |
| 10995 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 10996 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10997 | /* if there is back to back scan happening in driver with in |
| 10998 | * nDeferScanTimeInterval interval driver should defer new scan request |
| 10999 | * and should provide last cached scan results instead of new channel list. |
| 11000 | * This rule is not applicable if scan is p2p scan. |
| 11001 | * This condition will work only in case when last request no of channels |
| 11002 | * and channels are exactly same as new request. |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 11003 | * This should be done only in connected state |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 11004 | * Scan shouldn't be defered for WPS scan case. |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 11005 | */ |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 11006 | |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 11007 | pWpsIe = wlan_hdd_get_wps_ie_ptr((v_U8_t*)request->ie,request->ie_len); |
| 11008 | /* if wps ie is NULL , then only defer scan */ |
| 11009 | if ( pWpsIe == NULL && |
| 11010 | (VOS_STATUS_SUCCESS == hdd_is_any_session_connected(pHddCtx))) |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 11011 | { |
| 11012 | if ( pScanInfo->last_scan_timestamp !=0 && |
| 11013 | ((vos_timer_get_system_time() - pScanInfo->last_scan_timestamp ) < pHddCtx->cfg_ini->nDeferScanTimeInterval)) |
| 11014 | { |
| 11015 | if ( request->no_cck == FALSE && scanRequest.ChannelInfo.numOfChannels != 1 && |
| 11016 | (pScanInfo->last_scan_numChannels == scanRequest.ChannelInfo.numOfChannels) && |
| 11017 | vos_mem_compare(pScanInfo->last_scan_channelList, |
| 11018 | channelList, pScanInfo->last_scan_numChannels)) |
| 11019 | { |
| 11020 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 11021 | " New and old station scan time differ is less then %u", |
| 11022 | pHddCtx->cfg_ini->nDeferScanTimeInterval); |
| 11023 | |
| 11024 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 11025 | pAdapter); |
| 11026 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 11027 | hddLog(VOS_TRACE_LEVEL_WARN, |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 11028 | "Return old cached scan as all channels and no of channels are same"); |
| 11029 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 11030 | if (0 > ret) |
| 11031 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 11032 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 11033 | cfg80211_scan_done(request, eCSR_SCAN_SUCCESS); |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 11034 | |
| 11035 | status = eHAL_STATUS_SUCCESS; |
| 11036 | goto free_mem; |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 11037 | } |
| 11038 | } |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 11039 | } |
| 11040 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 11041 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 11042 | * search (Flush on both full scan and social scan but not on single |
| 11043 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 11044 | */ |
| 11045 | |
| 11046 | /* Supplicant does single channel scan after 8-way handshake |
| 11047 | * and in that case driver shoudnt flush scan results. If |
| 11048 | * driver flushes the scan results here and unfortunately if |
| 11049 | * the AP doesnt respond to our probe req then association |
| 11050 | * fails which is not desired |
| 11051 | */ |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 11052 | if ((request->n_ssids == 1) |
| 11053 | && (request->ssids != NULL) |
| 11054 | && vos_mem_compare(&request->ssids[0], "DIRECT-", 7)) |
| 11055 | is_p2p_scan = true; |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 11056 | |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 11057 | if( is_p2p_scan || |
| 11058 | (request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN) ) |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 11059 | { |
| 11060 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 11061 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11062 | pAdapter->sessionId ); |
| 11063 | } |
| 11064 | |
| 11065 | if( request->ie_len ) |
| 11066 | { |
| 11067 | /* save this for future association (join requires this) */ |
| 11068 | /*TODO: Array needs to be converted to dynamic allocation, |
| 11069 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 11070 | * CR 597966 |
| 11071 | */ |
| 11072 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 11073 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 11074 | pScanInfo->scanAddIE.length = request->ie_len; |
| 11075 | |
| 11076 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 11077 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 11078 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11079 | { |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11080 | if (request->ie_len <= SIR_MAC_MAX_ADD_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11081 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 11082 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 11083 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 11084 | request->ie, request->ie_len); |
| 11085 | } |
| 11086 | else |
| 11087 | { |
| 11088 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 11089 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11090 | } |
| 11091 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 11092 | } |
| 11093 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 11094 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 11095 | |
| 11096 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 11097 | request->ie_len); |
| 11098 | if (pP2pIe != NULL) |
| 11099 | { |
| 11100 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 11101 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 11102 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 11103 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 11104 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 11105 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 11106 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 11107 | "Go nego completed to Connection is started"); |
| 11108 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 11109 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 11110 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 11111 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 11112 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11113 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 11114 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 11115 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 11116 | "Disconnected state to Connection is started"); |
| 11117 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 11118 | "for 4way Handshake"); |
| 11119 | } |
| 11120 | #endif |
| 11121 | |
| 11122 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 11123 | if(TRUE == request->no_cck) |
| 11124 | { |
| 11125 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11126 | "%s: This is a P2P Search", __func__); |
| 11127 | scanRequest.p2pSearch = 1; |
| 11128 | |
| 11129 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 11130 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 11131 | /* set requestType to P2P Discovery */ |
| 11132 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 11133 | } |
| 11134 | |
| 11135 | /* |
| 11136 | Skip Dfs Channel in case of P2P Search |
| 11137 | if it is set in ini file |
| 11138 | */ |
| 11139 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 11140 | { |
| 11141 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 11142 | } |
| 11143 | else |
| 11144 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 11145 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 11146 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11147 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 11148 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11149 | } |
| 11150 | } |
| 11151 | |
| 11152 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 11153 | |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 11154 | #ifdef FEATURE_WLAN_TDLS |
| 11155 | /* if tdls disagree scan right now, return immediately. |
| 11156 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 11157 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 11158 | */ |
| 11159 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 11160 | wiphy, |
| 11161 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 11162 | dev, |
| 11163 | #endif |
| 11164 | request); |
| 11165 | if(status <= 0) |
| 11166 | { |
| 11167 | if(!status) |
| 11168 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 11169 | "scan rejected %d", __func__, status); |
| 11170 | else |
| 11171 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 11172 | __func__, status); |
| 11173 | |
| 11174 | return status; |
| 11175 | } |
| 11176 | #endif |
| 11177 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 11178 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 11179 | * address the following issues. |
| 11180 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 11181 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 11182 | * for long time, this result in apps running at full power for long time. |
| 11183 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 11184 | * be stuck in full power because of resume BMPS |
| 11185 | */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 11186 | hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11187 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 11188 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 11189 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11190 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 11191 | scanRequest.requestType, scanRequest.scanType, |
| 11192 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 11193 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 11194 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 11195 | if (pHddCtx->spoofMacAddr.isEnabled) |
| 11196 | { |
| 11197 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11198 | "%s: MAC Spoofing enabled for current scan", __func__); |
| 11199 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 11200 | * to fill TxBds for probe request during current scan |
| 11201 | */ |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 11202 | status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 11203 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 11204 | |
| 11205 | if(status != VOS_STATUS_SUCCESS) |
| 11206 | { |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 11207 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 11208 | status = -EFAULT; |
Ganesh Kondabattini | 6d3b490 | 2015-05-12 23:19:22 +0530 | [diff] [blame] | 11209 | #ifdef FEATURE_WLAN_TDLS |
| 11210 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 11211 | #endif |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 11212 | goto free_mem; |
| 11213 | } |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 11214 | } |
Mahesh A Saptasagar | 51dc36c | 2015-06-16 12:07:15 +0530 | [diff] [blame] | 11215 | 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] | 11216 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11217 | pAdapter->sessionId, &scanRequest, &scanId, |
| 11218 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11219 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11220 | if (eHAL_STATUS_SUCCESS != status) |
| 11221 | { |
| 11222 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11223 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 11224 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 11225 | if(eHAL_STATUS_RESOURCES == status) |
| 11226 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 11227 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 11228 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 11229 | status = -EBUSY; |
| 11230 | } else { |
| 11231 | status = -EIO; |
| 11232 | } |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 11233 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 11234 | |
| 11235 | #ifdef FEATURE_WLAN_TDLS |
| 11236 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 11237 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11238 | goto free_mem; |
| 11239 | } |
| 11240 | |
| 11241 | pScanInfo->mScanPending = TRUE; |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 11242 | pScanInfo->sessionId = pAdapter->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11243 | pAdapter->request = request; |
| 11244 | pScanInfo->scanId = scanId; |
| 11245 | |
| 11246 | complete(&pScanInfo->scan_req_completion_event); |
| 11247 | |
| 11248 | free_mem: |
| 11249 | if( scanRequest.SSIDs.SSIDList ) |
| 11250 | { |
| 11251 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 11252 | } |
| 11253 | |
| 11254 | if( channelList ) |
| 11255 | vos_mem_free( channelList ); |
| 11256 | |
| 11257 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11258 | return status; |
| 11259 | } |
| 11260 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11261 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 11262 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 11263 | struct net_device *dev, |
| 11264 | #endif |
| 11265 | struct cfg80211_scan_request *request) |
| 11266 | { |
| 11267 | int ret; |
| 11268 | |
| 11269 | vos_ssr_protect(__func__); |
| 11270 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 11271 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 11272 | dev, |
| 11273 | #endif |
| 11274 | request); |
| 11275 | vos_ssr_unprotect(__func__); |
| 11276 | |
| 11277 | return ret; |
| 11278 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11279 | |
| 11280 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 11281 | { |
| 11282 | v_U8_t iniDot11Mode = |
| 11283 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 11284 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 11285 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11286 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 11287 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11288 | switch ( iniDot11Mode ) |
| 11289 | { |
| 11290 | case eHDD_DOT11_MODE_AUTO: |
| 11291 | case eHDD_DOT11_MODE_11ac: |
| 11292 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 11293 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 4b1d235 | 2014-08-01 21:59:28 +0530 | [diff] [blame] | 11294 | if ( sme_IsFeatureSupportedByDriver(DOT11AC) && |
| 11295 | sme_IsFeatureSupportedByFW(DOT11AC) ) |
| 11296 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 11297 | else |
| 11298 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11299 | #else |
| 11300 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 11301 | #endif |
| 11302 | break; |
| 11303 | case eHDD_DOT11_MODE_11n: |
| 11304 | case eHDD_DOT11_MODE_11n_ONLY: |
| 11305 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 11306 | break; |
| 11307 | default: |
| 11308 | hddDot11Mode = iniDot11Mode; |
| 11309 | break; |
| 11310 | } |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 11311 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 11312 | if (operationChannel > SIR_11B_CHANNEL_END) |
| 11313 | #endif |
| 11314 | { |
| 11315 | /* This call decides required channel bonding mode */ |
| 11316 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11317 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 11318 | operationChannel); |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 11319 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11320 | } |
| 11321 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11322 | /* |
| 11323 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11324 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11325 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11326 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11327 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11328 | { |
| 11329 | int status = 0; |
| 11330 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11331 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11332 | v_U32_t roamId; |
| 11333 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11334 | eCsrAuthType RSNAuthType; |
| 11335 | |
| 11336 | ENTER(); |
| 11337 | |
| 11338 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11339 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11340 | |
| 11341 | status = wlan_hdd_validate_context(pHddCtx); |
| 11342 | if (status) |
| 11343 | { |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 11344 | return status; |
| 11345 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11346 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11347 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 11348 | { |
| 11349 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 11350 | return -EINVAL; |
| 11351 | } |
| 11352 | |
| 11353 | pRoamProfile = &pWextState->roamProfile; |
| 11354 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11355 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11356 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11357 | hdd_station_ctx_t *pHddStaCtx; |
| 11358 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11359 | |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 11360 | wlan_hdd_get_frame_logs(pAdapter, WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR); |
| 11361 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11362 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11363 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 11364 | { |
| 11365 | /*QoS not enabled in cfg file*/ |
| 11366 | pRoamProfile->uapsd_mask = 0; |
| 11367 | } |
| 11368 | else |
| 11369 | { |
| 11370 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11371 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11372 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 11373 | } |
| 11374 | |
| 11375 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 11376 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 11377 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11378 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11379 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 11380 | ssid, ssid_len); |
| 11381 | |
| 11382 | if (bssid) |
| 11383 | { |
| 11384 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 11385 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 11386 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11387 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 11388 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11389 | case of join failure we should send valid BSSID to supplicant |
| 11390 | */ |
| 11391 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 11392 | WNI_CFG_BSSID_LEN); |
| 11393 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 11394 | else |
| 11395 | { |
| 11396 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 11397 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11398 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11399 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 11400 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11401 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 11402 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11403 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11404 | /*set gen ie*/ |
| 11405 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 11406 | /*set auth*/ |
| 11407 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 11408 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11409 | #ifdef FEATURE_WLAN_WAPI |
| 11410 | if (pAdapter->wapi_info.nWapiMode) |
| 11411 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11412 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11413 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 11414 | { |
| 11415 | case WAPI_AUTH_MODE_PSK: |
| 11416 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11417 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11418 | pAdapter->wapi_info.wapiAuthMode); |
| 11419 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 11420 | break; |
| 11421 | } |
| 11422 | case WAPI_AUTH_MODE_CERT: |
| 11423 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11424 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11425 | pAdapter->wapi_info.wapiAuthMode); |
| 11426 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 11427 | break; |
| 11428 | } |
| 11429 | } // End of switch |
| 11430 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 11431 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 11432 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11433 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11434 | pRoamProfile->AuthType.numEntries = 1; |
| 11435 | pRoamProfile->EncryptionType.numEntries = 1; |
| 11436 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 11437 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 11438 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 11439 | } |
| 11440 | } |
| 11441 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11442 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11443 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11444 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 11445 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 11446 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 11447 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 11448 | sizeof (tSirGtkOffloadParams)); |
| 11449 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 11450 | } |
| 11451 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11452 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 11453 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11454 | if( operatingChannel ) |
| 11455 | { |
| 11456 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 11457 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 11458 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11459 | else |
| 11460 | { |
| 11461 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 11462 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 11463 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 11464 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 11465 | { |
| 11466 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 11467 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 11468 | |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 11469 | /* |
| 11470 | * Change conn_state to connecting before sme_RoamConnect(), |
| 11471 | * because sme_RoamConnect() has a direct path to call |
| 11472 | * hdd_smeRoamCallback(), which will change the conn_state |
| 11473 | * If direct path, conn_state will be accordingly changed |
| 11474 | * to NotConnected or Associated by either |
| 11475 | * hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() |
| 11476 | * in sme_RoamCallback() |
| 11477 | * if sme_RomConnect is to be queued, |
| 11478 | * Connecting state will remain until it is completed. |
| 11479 | * If connection state is not changed, |
| 11480 | * connection state will remain in eConnectionState_NotConnected state. |
| 11481 | * In hdd_AssociationCompletionHandler, "hddDisconInProgress" is set to true |
| 11482 | * if conn state is eConnectionState_NotConnected. |
| 11483 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 11484 | * informed of connect result indication which is an issue. |
| 11485 | */ |
| 11486 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 11487 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 11488 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 11489 | { |
| 11490 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 11491 | FL("Set HDD connState to eConnectionState_Connecting")); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11492 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 11493 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 11494 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11495 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11496 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 11497 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 11498 | if ((eHAL_STATUS_SUCCESS != status) && |
| 11499 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 11500 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11501 | |
| 11502 | { |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 11503 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11504 | FL("sme_RoamConnect (session %d) failed with status %d. -> NotConnected"), |
| 11505 | pAdapter->sessionId, status); |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11506 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11507 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11508 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11509 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11510 | |
| 11511 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 11512 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 11513 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11514 | } |
| 11515 | else |
| 11516 | { |
| 11517 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 11518 | return -EINVAL; |
| 11519 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 11520 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11521 | return status; |
| 11522 | } |
| 11523 | |
| 11524 | /* |
| 11525 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 11526 | * This function is used to set the authentication type (OPEN/SHARED). |
| 11527 | * |
| 11528 | */ |
| 11529 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 11530 | enum nl80211_auth_type auth_type) |
| 11531 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11532 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11533 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11534 | |
| 11535 | ENTER(); |
| 11536 | |
| 11537 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11538 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11539 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11540 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11541 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11542 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 11543 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 11544 | break; |
| 11545 | |
| 11546 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11547 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11548 | case NL80211_AUTHTYPE_FT: |
| 11549 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11550 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11551 | "%s: set authentication type to OPEN", __func__); |
| 11552 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 11553 | break; |
| 11554 | |
| 11555 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11556 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11557 | "%s: set authentication type to SHARED", __func__); |
| 11558 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 11559 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11560 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11561 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11562 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11563 | "%s: set authentication type to CCKM WPA", __func__); |
| 11564 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 11565 | break; |
| 11566 | #endif |
| 11567 | |
| 11568 | |
| 11569 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11570 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11571 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11572 | auth_type); |
| 11573 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 11574 | return -EINVAL; |
| 11575 | } |
| 11576 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11577 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11578 | pHddStaCtx->conn_info.authType; |
| 11579 | return 0; |
| 11580 | } |
| 11581 | |
| 11582 | /* |
| 11583 | * FUNCTION: wlan_hdd_set_akm_suite |
| 11584 | * This function is used to set the key mgmt type(PSK/8021x). |
| 11585 | * |
| 11586 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11587 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11588 | u32 key_mgmt |
| 11589 | ) |
| 11590 | { |
| 11591 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11592 | ENTER(); |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11593 | /* Should be in ieee802_11_defs.h */ |
| 11594 | #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05 |
| 11595 | #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11596 | /*set key mgmt type*/ |
| 11597 | switch(key_mgmt) |
| 11598 | { |
| 11599 | case WLAN_AKM_SUITE_PSK: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11600 | case WLAN_AKM_SUITE_PSK_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 11601 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11602 | case WLAN_AKM_SUITE_FT_PSK: |
| 11603 | #endif |
| 11604 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11605 | __func__); |
| 11606 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 11607 | break; |
| 11608 | |
| 11609 | case WLAN_AKM_SUITE_8021X: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11610 | case WLAN_AKM_SUITE_8021X_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 11611 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11612 | case WLAN_AKM_SUITE_FT_8021X: |
| 11613 | #endif |
| 11614 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11615 | __func__); |
| 11616 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 11617 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11618 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11619 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 11620 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 11621 | case WLAN_AKM_SUITE_CCKM: |
| 11622 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 11623 | __func__); |
| 11624 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 11625 | break; |
| 11626 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 11627 | #ifndef WLAN_AKM_SUITE_OSEN |
| 11628 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 11629 | case WLAN_AKM_SUITE_OSEN: |
| 11630 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 11631 | __func__); |
| 11632 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 11633 | break; |
| 11634 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11635 | |
| 11636 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11637 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11638 | __func__, key_mgmt); |
| 11639 | return -EINVAL; |
| 11640 | |
| 11641 | } |
| 11642 | return 0; |
| 11643 | } |
| 11644 | |
| 11645 | /* |
| 11646 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11647 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11648 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 11649 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11650 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 11651 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11652 | bool ucast |
| 11653 | ) |
| 11654 | { |
| 11655 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11656 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11657 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11658 | |
| 11659 | ENTER(); |
| 11660 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11661 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11662 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 11663 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11664 | __func__, cipher); |
| 11665 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11666 | } |
| 11667 | else |
| 11668 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11669 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11670 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11671 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11672 | { |
| 11673 | case IW_AUTH_CIPHER_NONE: |
| 11674 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11675 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11676 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11677 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11678 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11679 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11680 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11681 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11682 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11683 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11684 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11685 | case WLAN_CIPHER_SUITE_TKIP: |
| 11686 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 11687 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11688 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11689 | case WLAN_CIPHER_SUITE_CCMP: |
| 11690 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 11691 | break; |
| 11692 | #ifdef FEATURE_WLAN_WAPI |
| 11693 | case WLAN_CIPHER_SUITE_SMS4: |
| 11694 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 11695 | break; |
| 11696 | #endif |
| 11697 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11698 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11699 | case WLAN_CIPHER_SUITE_KRK: |
| 11700 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 11701 | break; |
| 11702 | #endif |
| 11703 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11704 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11705 | __func__, cipher); |
| 11706 | return -EOPNOTSUPP; |
| 11707 | } |
| 11708 | } |
| 11709 | |
| 11710 | if (ucast) |
| 11711 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11712 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11713 | __func__, encryptionType); |
| 11714 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 11715 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11716 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11717 | encryptionType; |
| 11718 | } |
| 11719 | else |
| 11720 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11721 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11722 | __func__, encryptionType); |
| 11723 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 11724 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 11725 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 11726 | } |
| 11727 | |
| 11728 | return 0; |
| 11729 | } |
| 11730 | |
| 11731 | |
| 11732 | /* |
| 11733 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 11734 | * This function is used to parse WPA/RSN IE's. |
| 11735 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11736 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 11737 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 11738 | const u8 *ie, |
| 11739 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11740 | u8 *ie, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 11741 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11742 | size_t ie_len |
| 11743 | ) |
| 11744 | { |
| 11745 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 11746 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 11747 | const u8 *genie = ie; |
| 11748 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11749 | u8 *genie = ie; |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 11750 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11751 | v_U16_t remLen = ie_len; |
| 11752 | #ifdef FEATURE_WLAN_WAPI |
| 11753 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 11754 | u16 *tmp; |
| 11755 | v_U16_t akmsuiteCount; |
| 11756 | int *akmlist; |
| 11757 | #endif |
| 11758 | ENTER(); |
| 11759 | |
| 11760 | /* clear previous assocAddIE */ |
| 11761 | pWextState->assocAddIE.length = 0; |
| 11762 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11763 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11764 | |
| 11765 | while (remLen >= 2) |
| 11766 | { |
| 11767 | v_U16_t eLen = 0; |
| 11768 | v_U8_t elementId; |
| 11769 | elementId = *genie++; |
| 11770 | eLen = *genie++; |
| 11771 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11772 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11773 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11774 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11775 | |
| 11776 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11777 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11778 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11779 | 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] | 11780 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11781 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11782 | "%s: Invalid WPA IE", __func__); |
| 11783 | return -EINVAL; |
| 11784 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11785 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11786 | { |
| 11787 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11788 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11789 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11790 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11791 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11792 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11793 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 11794 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11795 | VOS_ASSERT(0); |
| 11796 | return -ENOMEM; |
| 11797 | } |
| 11798 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 11799 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11800 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11801 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11802 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 11803 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11804 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11805 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11806 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 11807 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11808 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 11809 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 11810 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 11811 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 11812 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 11813 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11814 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 11815 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11816 | { |
| 11817 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11818 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11819 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11820 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11821 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11822 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11823 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11824 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11825 | VOS_ASSERT(0); |
| 11826 | return -ENOMEM; |
| 11827 | } |
| 11828 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 11829 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11830 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11831 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11832 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11833 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11834 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11835 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11836 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 11837 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11838 | /*Consider WFD IE, only for P2P Client */ |
| 11839 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 11840 | { |
| 11841 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11842 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11843 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11844 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11845 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11846 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11847 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11848 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11849 | VOS_ASSERT(0); |
| 11850 | return -ENOMEM; |
| 11851 | } |
| 11852 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 11853 | // WPS IE + P2P IE + WFD IE |
| 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 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11857 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11858 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11859 | } |
| 11860 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11861 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11862 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11863 | HS20_OUI_TYPE_SIZE)) ) |
| 11864 | { |
| 11865 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11866 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11867 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11868 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11869 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11870 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11871 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11872 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11873 | VOS_ASSERT(0); |
| 11874 | return -ENOMEM; |
| 11875 | } |
| 11876 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11877 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11878 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11879 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11880 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11881 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11882 | /* Appending OSEN Information Element in Assiciation Request */ |
| 11883 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 11884 | OSEN_OUI_TYPE_SIZE)) ) |
| 11885 | { |
| 11886 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 11887 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 11888 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11889 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 11890 | 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] | 11891 | { |
| 11892 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11893 | "Need bigger buffer space"); |
| 11894 | VOS_ASSERT(0); |
| 11895 | return -ENOMEM; |
| 11896 | } |
| 11897 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11898 | pWextState->assocAddIE.length += eLen + 2; |
| 11899 | |
| 11900 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 11901 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11902 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11903 | } |
| 11904 | |
Abhishek Singh | 4322e62 | 2015-06-10 15:42:54 +0530 | [diff] [blame] | 11905 | /* Update only for WPA IE */ |
| 11906 | if (!memcmp(genie, WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) && |
| 11907 | (WLAN_HDD_IBSS == pAdapter->device_mode)) { |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 11908 | |
| 11909 | /* populating as ADDIE in beacon frames */ |
| 11910 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 11911 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, (u8 *)genie - 2, eLen + 2, |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 11912 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 11913 | { |
| 11914 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11915 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 11916 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 11917 | { |
| 11918 | hddLog(LOGE, |
| 11919 | "Coldn't pass " |
| 11920 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 11921 | } |
| 11922 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 11923 | else |
| 11924 | hddLog(LOGE, |
| 11925 | "Could not pass on " |
| 11926 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 11927 | |
| 11928 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 11929 | beaconIE's need to be populated in probe response frames */ |
| 11930 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 11931 | { |
| 11932 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 11933 | u8 probe_rsp_ie_len[3] = {0}; |
| 11934 | u8 counter = 0; |
| 11935 | |
| 11936 | /* Check Probe Resp Length if it is greater then 255 then |
| 11937 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 11938 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 11939 | not able Store More then 255 bytes into One Variable */ |
| 11940 | |
| 11941 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 11942 | { |
| 11943 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 11944 | { |
| 11945 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 11946 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 11947 | } |
| 11948 | else |
| 11949 | { |
| 11950 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 11951 | rem_probe_resp_ie_len = 0; |
| 11952 | } |
| 11953 | } |
| 11954 | |
| 11955 | rem_probe_resp_ie_len = 0; |
| 11956 | |
| 11957 | if (probe_rsp_ie_len[0] > 0) |
| 11958 | { |
| 11959 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11960 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 11961 | (tANI_U8*)(genie - 2), |
| 11962 | probe_rsp_ie_len[0], NULL, |
| 11963 | eANI_BOOLEAN_FALSE) |
| 11964 | == eHAL_STATUS_FAILURE) |
| 11965 | { |
| 11966 | hddLog(LOGE, |
| 11967 | "Could not pass" |
| 11968 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 11969 | } |
| 11970 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 11971 | } |
| 11972 | |
| 11973 | if (probe_rsp_ie_len[1] > 0) |
| 11974 | { |
| 11975 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11976 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 11977 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 11978 | probe_rsp_ie_len[1], NULL, |
| 11979 | eANI_BOOLEAN_FALSE) |
| 11980 | == eHAL_STATUS_FAILURE) |
| 11981 | { |
| 11982 | hddLog(LOGE, |
| 11983 | "Could not pass" |
| 11984 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 11985 | } |
| 11986 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 11987 | } |
| 11988 | |
| 11989 | if (probe_rsp_ie_len[2] > 0) |
| 11990 | { |
| 11991 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11992 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 11993 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 11994 | probe_rsp_ie_len[2], NULL, |
| 11995 | eANI_BOOLEAN_FALSE) |
| 11996 | == eHAL_STATUS_FAILURE) |
| 11997 | { |
| 11998 | hddLog(LOGE, |
| 11999 | "Could not pass" |
| 12000 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 12001 | } |
| 12002 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 12003 | } |
| 12004 | |
| 12005 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12006 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 12007 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 12008 | { |
| 12009 | hddLog(LOGE, |
| 12010 | "Could not pass" |
| 12011 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 12012 | } |
| 12013 | } |
| 12014 | else |
| 12015 | { |
| 12016 | // Reset WNI_CFG_PROBE_RSP Flags |
| 12017 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 12018 | |
| 12019 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12020 | "%s: No Probe Response IE received in set beacon", |
| 12021 | __func__); |
| 12022 | } |
| 12023 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12024 | break; |
| 12025 | case DOT11F_EID_RSN: |
| 12026 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 12027 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 12028 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 12029 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 12030 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 12031 | break; |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 12032 | |
| 12033 | /* Appending Extended Capabilities with Interworking bit set |
| 12034 | * in Assoc Req. |
| 12035 | * |
| 12036 | * In assoc req this EXT Cap will only be taken into account if |
| 12037 | * interworkingService bit is set to 1. Currently |
| 12038 | * driver is only interested in interworkingService capability |
| 12039 | * from supplicant. If in future any other EXT Cap info is |
| 12040 | * required from supplicat, it needs to be handled while |
| 12041 | * sending Assoc Req in LIM. |
| 12042 | */ |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 12043 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12044 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 12045 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12046 | 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] | 12047 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12048 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 12049 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 12050 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 12051 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 12052 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 12053 | VOS_ASSERT(0); |
| 12054 | return -ENOMEM; |
| 12055 | } |
| 12056 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 12057 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12058 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 12059 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 12060 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 12061 | break; |
| 12062 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12063 | #ifdef FEATURE_WLAN_WAPI |
| 12064 | case WLAN_EID_WAPI: |
| 12065 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 12066 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12067 | pAdapter->wapi_info.nWapiMode); |
| 12068 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12069 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12070 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 12071 | tmp = tmp + 1; |
| 12072 | akmlist = (int *)(tmp); |
| 12073 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 12074 | { |
| 12075 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 12076 | } |
| 12077 | else |
| 12078 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12079 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12080 | VOS_ASSERT(0); |
| 12081 | return -EINVAL; |
| 12082 | } |
| 12083 | |
| 12084 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 12085 | { |
| 12086 | 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] | 12087 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12088 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12089 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12090 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12091 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12092 | 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] | 12093 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12094 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 12095 | } |
| 12096 | break; |
| 12097 | #endif |
| 12098 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12099 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12100 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 12101 | /* when Unknown IE is received we should break and continue |
| 12102 | * to the next IE in the buffer instead we were returning |
| 12103 | * so changing this to break */ |
| 12104 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12105 | } |
| 12106 | genie += eLen; |
| 12107 | remLen -= eLen; |
| 12108 | } |
| 12109 | EXIT(); |
| 12110 | return 0; |
| 12111 | } |
| 12112 | |
| 12113 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 12114 | * FUNCTION: hdd_isWPAIEPresent |
| 12115 | * Parse the received IE to find the WPA IE |
| 12116 | * |
| 12117 | */ |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 12118 | static bool hdd_isWPAIEPresent( |
| 12119 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 12120 | const u8 *ie, |
| 12121 | #else |
| 12122 | u8 *ie, |
| 12123 | #endif |
| 12124 | u8 ie_len) |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 12125 | { |
| 12126 | v_U8_t eLen = 0; |
| 12127 | v_U16_t remLen = ie_len; |
| 12128 | v_U8_t elementId = 0; |
| 12129 | |
| 12130 | while (remLen >= 2) |
| 12131 | { |
| 12132 | elementId = *ie++; |
| 12133 | eLen = *ie++; |
| 12134 | remLen -= 2; |
| 12135 | if (eLen > remLen) |
| 12136 | { |
| 12137 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12138 | "%s: IE length is wrong %d", __func__, eLen); |
| 12139 | return FALSE; |
| 12140 | } |
| 12141 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 12142 | { |
| 12143 | /* OUI - 0x00 0X50 0XF2 |
| 12144 | WPA Information Element - 0x01 |
| 12145 | WPA version - 0x01*/ |
| 12146 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 12147 | return TRUE; |
| 12148 | } |
| 12149 | ie += eLen; |
| 12150 | remLen -= eLen; |
| 12151 | } |
| 12152 | return FALSE; |
| 12153 | } |
| 12154 | |
| 12155 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12156 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12157 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12158 | * parameters during connect operation. |
| 12159 | */ |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 12160 | int wlan_hdd_cfg80211_set_privacy(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12161 | struct cfg80211_connect_params *req |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 12162 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12163 | { |
| 12164 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12165 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12166 | ENTER(); |
| 12167 | |
| 12168 | /*set wpa version*/ |
| 12169 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 12170 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12171 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12172 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 12173 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12174 | { |
| 12175 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 12176 | } |
| 12177 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 12178 | { |
| 12179 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 12180 | } |
| 12181 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12182 | |
| 12183 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12184 | pWextState->wpaVersion); |
| 12185 | |
| 12186 | /*set authentication type*/ |
| 12187 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 12188 | |
| 12189 | if (0 > status) |
| 12190 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12191 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12192 | "%s: failed to set authentication type ", __func__); |
| 12193 | return status; |
| 12194 | } |
| 12195 | |
| 12196 | /*set key mgmt type*/ |
| 12197 | if (req->crypto.n_akm_suites) |
| 12198 | { |
| 12199 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 12200 | if (0 > status) |
| 12201 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12202 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12203 | __func__); |
| 12204 | return status; |
| 12205 | } |
| 12206 | } |
| 12207 | |
| 12208 | /*set pairwise cipher type*/ |
| 12209 | if (req->crypto.n_ciphers_pairwise) |
| 12210 | { |
| 12211 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 12212 | req->crypto.ciphers_pairwise[0], true); |
| 12213 | if (0 > status) |
| 12214 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12215 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12216 | "%s: failed to set unicast cipher type", __func__); |
| 12217 | return status; |
| 12218 | } |
| 12219 | } |
| 12220 | else |
| 12221 | { |
| 12222 | /*Reset previous cipher suite to none*/ |
| 12223 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 12224 | if (0 > status) |
| 12225 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12226 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12227 | "%s: failed to set unicast cipher type", __func__); |
| 12228 | return status; |
| 12229 | } |
| 12230 | } |
| 12231 | |
| 12232 | /*set group cipher type*/ |
| 12233 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 12234 | false); |
| 12235 | |
| 12236 | if (0 > status) |
| 12237 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12238 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12239 | __func__); |
| 12240 | return status; |
| 12241 | } |
| 12242 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12243 | #ifdef WLAN_FEATURE_11W |
| 12244 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 12245 | #endif |
| 12246 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12247 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 12248 | if (req->ie_len) |
| 12249 | { |
| 12250 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 12251 | if ( 0 > status) |
| 12252 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12253 | 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] | 12254 | __func__); |
| 12255 | return status; |
| 12256 | } |
| 12257 | } |
| 12258 | |
| 12259 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12260 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12261 | { |
| 12262 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 12263 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 12264 | ) |
| 12265 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12266 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12267 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 12268 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12269 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12270 | __func__); |
| 12271 | return -EOPNOTSUPP; |
| 12272 | } |
| 12273 | else |
| 12274 | { |
| 12275 | u8 key_len = req->key_len; |
| 12276 | u8 key_idx = req->key_idx; |
| 12277 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12278 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12279 | && (CSR_MAX_NUM_KEY > key_idx) |
| 12280 | ) |
| 12281 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12282 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12283 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12284 | __func__, key_idx, key_len); |
| 12285 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12286 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12287 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12288 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12289 | (u8)key_len; |
| 12290 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 12291 | } |
| 12292 | } |
| 12293 | } |
| 12294 | } |
| 12295 | |
| 12296 | return status; |
| 12297 | } |
| 12298 | |
| 12299 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12300 | * FUNCTION: wlan_hdd_try_disconnect |
| 12301 | * This function is used to disconnect from previous |
| 12302 | * connection |
| 12303 | */ |
| 12304 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 12305 | { |
| 12306 | long ret = 0; |
| 12307 | hdd_station_ctx_t *pHddStaCtx; |
| 12308 | eMib_dot11DesiredBssType connectedBssType; |
| 12309 | |
| 12310 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12311 | |
| 12312 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 12313 | |
| 12314 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 12315 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 12316 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 12317 | { |
| 12318 | /* Issue disconnect to CSR */ |
| 12319 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 12320 | if( eHAL_STATUS_SUCCESS == |
| 12321 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12322 | pAdapter->sessionId, |
| 12323 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 12324 | { |
| 12325 | ret = wait_for_completion_interruptible_timeout( |
| 12326 | &pAdapter->disconnect_comp_var, |
| 12327 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 12328 | if (0 >= ret) |
| 12329 | { |
| 12330 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 12331 | return -EALREADY; |
| 12332 | } |
| 12333 | } |
| 12334 | } |
| 12335 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 12336 | { |
| 12337 | ret = wait_for_completion_interruptible_timeout( |
| 12338 | &pAdapter->disconnect_comp_var, |
| 12339 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 12340 | if (0 >= ret) |
| 12341 | { |
| 12342 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 12343 | return -EALREADY; |
| 12344 | } |
| 12345 | } |
| 12346 | |
| 12347 | return 0; |
| 12348 | } |
| 12349 | |
| 12350 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12351 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 12352 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12353 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12354 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12355 | struct net_device *ndev, |
| 12356 | struct cfg80211_connect_params *req |
| 12357 | ) |
| 12358 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12359 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12360 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12361 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 12362 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12363 | |
| 12364 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12365 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12366 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12367 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 12368 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12369 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12370 | "%s: device_mode = %s (%d)", __func__, |
| 12371 | hdd_device_modetoString(pAdapter->device_mode), |
| 12372 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12373 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12374 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 12375 | if (!pHddCtx) |
| 12376 | { |
| 12377 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12378 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12379 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 12380 | } |
| 12381 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12382 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12383 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12384 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12385 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12386 | } |
| 12387 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12388 | if (vos_max_concurrent_connections_reached()) { |
| 12389 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 12390 | return -ECONNREFUSED; |
| 12391 | } |
| 12392 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12393 | #ifdef WLAN_BTAMP_FEATURE |
| 12394 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12395 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12396 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12397 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12398 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 12399 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12400 | } |
| 12401 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12402 | |
| 12403 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 12404 | //P2P Mode will be taken care in Open/close adapter |
| 12405 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12406 | (vos_concurrent_open_sessions_running())) { |
| 12407 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 12408 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12409 | } |
| 12410 | |
| 12411 | /*Try disconnecting if already in connected state*/ |
| 12412 | status = wlan_hdd_try_disconnect(pAdapter); |
| 12413 | if ( 0 > status) |
| 12414 | { |
| 12415 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 12416 | " connection")); |
| 12417 | return -EALREADY; |
| 12418 | } |
| 12419 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12420 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12421 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12422 | |
| 12423 | if ( 0 > status) |
| 12424 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12425 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12426 | __func__); |
| 12427 | return status; |
| 12428 | } |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 12429 | if ( req->channel ) |
| 12430 | { |
| 12431 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 12432 | req->ssid_len, req->bssid, |
| 12433 | req->channel->hw_value); |
| 12434 | } |
| 12435 | else |
| 12436 | { |
| 12437 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12438 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 12439 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12440 | |
Sushant Kaushik | d708398 | 2015-03-18 14:33:24 +0530 | [diff] [blame] | 12441 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12442 | { |
| 12443 | //ReEnable BMPS if disabled |
| 12444 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 12445 | (NULL != pHddCtx)) |
| 12446 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 12447 | if (pHddCtx->hdd_wlan_suspended) |
| 12448 | { |
| 12449 | hdd_set_pwrparams(pHddCtx); |
| 12450 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12451 | //ReEnable Bmps and Imps back |
| 12452 | hdd_enable_bmps_imps(pHddCtx); |
| 12453 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12454 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12455 | return status; |
| 12456 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12457 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12458 | EXIT(); |
| 12459 | return status; |
| 12460 | } |
| 12461 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12462 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 12463 | struct net_device *ndev, |
| 12464 | struct cfg80211_connect_params *req) |
| 12465 | { |
| 12466 | int ret; |
| 12467 | vos_ssr_protect(__func__); |
| 12468 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 12469 | vos_ssr_unprotect(__func__); |
| 12470 | |
| 12471 | return ret; |
| 12472 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12473 | |
| 12474 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12475 | * FUNCTION: wlan_hdd_disconnect |
| 12476 | * This function is used to issue a disconnect request to SME |
| 12477 | */ |
| 12478 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 12479 | { |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12480 | int status, result = 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12481 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12482 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12483 | long ret; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12484 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12485 | ENTER(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12486 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12487 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12488 | if (0 != status) |
| 12489 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12490 | return status; |
| 12491 | } |
| 12492 | |
Sushant Kaushik | b4834d2 | 2015-07-15 15:29:05 +0530 | [diff] [blame] | 12493 | if (pHddStaCtx->conn_info.connState == eConnectionState_Connecting) |
| 12494 | { |
| 12495 | sme_abortConnection(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12496 | pAdapter->sessionId); |
| 12497 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12498 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12499 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12500 | /* Need to apply spin lock before decreasing active sessions |
| 12501 | * as there can be chance for double decrement if context switch |
| 12502 | * Calls hdd_DisConnectHandler. |
| 12503 | */ |
| 12504 | |
| 12505 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12506 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 12507 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12508 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 12509 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12510 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 12511 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 12512 | |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 12513 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 12514 | FL( "Set HDD connState to eConnectionState_Disconnecting" )); |
| 12515 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12516 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12517 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12518 | /* |
| 12519 | * stop tx queues before deleting STA/BSS context from the firmware. |
| 12520 | * tx has to be disabled because the firmware can get busy dropping |
| 12521 | * the tx frames after BSS/STA has been deleted and will not send |
| 12522 | * back a response resulting in WDI timeout |
| 12523 | */ |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 12524 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12525 | netif_tx_disable(pAdapter->dev); |
| 12526 | netif_carrier_off(pAdapter->dev); |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 12527 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12528 | /*issue disconnect*/ |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12529 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12530 | pAdapter->sessionId, reason); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12531 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
| 12532 | { |
| 12533 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12534 | FL("status = %d, already disconnected"), |
| 12535 | (int)status ); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12536 | |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12537 | } |
| 12538 | else if ( 0 != status ) |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12539 | { |
| 12540 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12541 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12542 | __func__, (int)status ); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12543 | result = -EINVAL; |
| 12544 | goto disconnected; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12545 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12546 | ret = wait_for_completion_interruptible_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12547 | &pAdapter->disconnect_comp_var, |
| 12548 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12549 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status )) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12550 | { |
| 12551 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12552 | "%s: Failed to disconnect, timed out", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12553 | result = -ETIMEDOUT; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12554 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12555 | else if (ret == -ERESTARTSYS) |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12556 | { |
| 12557 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12558 | "%s: Failed to disconnect, wait interrupted", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12559 | result = -ERESTARTSYS; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12560 | } |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12561 | disconnected: |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12562 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12563 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 12564 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 12565 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12566 | EXIT(); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12567 | return result; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12568 | } |
| 12569 | |
| 12570 | |
| 12571 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12572 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12573 | * This function is used to issue a disconnect request to SME |
| 12574 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12575 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12576 | struct net_device *dev, |
| 12577 | u16 reason |
| 12578 | ) |
| 12579 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12580 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12581 | int status; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12582 | tCsrRoamProfile *pRoamProfile; |
| 12583 | hdd_station_ctx_t *pHddStaCtx; |
| 12584 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12585 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12586 | tANI_U8 staIdx; |
| 12587 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12588 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12589 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12590 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12591 | if (!pAdapter) { |
| 12592 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 12593 | return -EINVAL; |
| 12594 | } |
| 12595 | |
| 12596 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12597 | if (!pHddStaCtx) { |
| 12598 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD STA context is NULL")); |
| 12599 | return -EINVAL; |
| 12600 | } |
| 12601 | |
| 12602 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12603 | status = wlan_hdd_validate_context(pHddCtx); |
| 12604 | if (0 != status) |
| 12605 | { |
| 12606 | return status; |
| 12607 | } |
| 12608 | |
| 12609 | pRoamProfile = &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
| 12610 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12611 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12612 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 12613 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12614 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 12615 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12616 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12617 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12618 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 12619 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12620 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12621 | if (NULL != pRoamProfile) |
| 12622 | { |
| 12623 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 12624 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 12625 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12626 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12627 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12628 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12629 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12630 | switch(reason) |
| 12631 | { |
| 12632 | case WLAN_REASON_MIC_FAILURE: |
| 12633 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 12634 | break; |
| 12635 | |
| 12636 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 12637 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 12638 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 12639 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 12640 | break; |
| 12641 | |
| 12642 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 12643 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 12644 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12645 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 12646 | break; |
| 12647 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12648 | default: |
| 12649 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 12650 | break; |
| 12651 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12652 | pScanInfo = &pHddCtx->scan_info; |
| 12653 | if (pScanInfo->mScanPending) |
| 12654 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 12655 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12656 | "Aborting Scan"); |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 12657 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 12658 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12659 | } |
Agarwal Ashish | c089cec | 2015-08-10 13:10:04 +0530 | [diff] [blame] | 12660 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12661 | #ifdef FEATURE_WLAN_TDLS |
| 12662 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12663 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12664 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12665 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 12666 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12667 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12668 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12669 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12670 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12671 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12672 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12673 | MAC_ADDR_ARRAY(mac)); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 12674 | status = sme_DeleteTdlsPeerSta( |
| 12675 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12676 | pAdapter->sessionId, |
| 12677 | mac); |
| 12678 | if (status != eHAL_STATUS_SUCCESS) { |
| 12679 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 12680 | return -EPERM; |
| 12681 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12682 | } |
| 12683 | } |
| 12684 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 12685 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12686 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 12687 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12688 | { |
| 12689 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12690 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12691 | __func__, (int)status ); |
| 12692 | return -EINVAL; |
| 12693 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12694 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 12695 | else |
| 12696 | { |
| 12697 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 12698 | "called while in %d state", __func__, |
| 12699 | pHddStaCtx->conn_info.connState); |
| 12700 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12701 | } |
| 12702 | else |
| 12703 | { |
| 12704 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 12705 | } |
| 12706 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12707 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12708 | return status; |
| 12709 | } |
| 12710 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12711 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 12712 | struct net_device *dev, |
| 12713 | u16 reason |
| 12714 | ) |
| 12715 | { |
| 12716 | int ret; |
| 12717 | vos_ssr_protect(__func__); |
| 12718 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 12719 | vos_ssr_unprotect(__func__); |
| 12720 | |
| 12721 | return ret; |
| 12722 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12723 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12724 | /* |
| 12725 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12726 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12727 | * settings in IBSS mode. |
| 12728 | */ |
| 12729 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12730 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12731 | struct cfg80211_ibss_params *params |
| 12732 | ) |
| 12733 | { |
| 12734 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12735 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12736 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 12737 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12738 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12739 | ENTER(); |
| 12740 | |
| 12741 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 12742 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12743 | |
| 12744 | if (params->ie_len && ( NULL != params->ie) ) |
| 12745 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12746 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 12747 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12748 | { |
| 12749 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 12750 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 12751 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12752 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12753 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12754 | tDot11fIEWPA dot11WPAIE; |
| 12755 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12756 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12757 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 12758 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12759 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 12760 | params->ie_len, DOT11F_EID_WPA); |
| 12761 | if ( NULL != ie ) |
| 12762 | { |
| 12763 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 12764 | // Unpack the WPA IE |
| 12765 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 12766 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 12767 | &ie[2+4], |
| 12768 | ie[1] - 4, |
| 12769 | &dot11WPAIE); |
| 12770 | /*Extract the multicast cipher, the encType for unicast |
| 12771 | cipher for wpa-none is none*/ |
| 12772 | encryptionType = |
| 12773 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 12774 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12775 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12776 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12777 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 12778 | |
| 12779 | if (0 > status) |
| 12780 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12781 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12782 | __func__); |
| 12783 | return status; |
| 12784 | } |
| 12785 | } |
| 12786 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12787 | pWextState->roamProfile.AuthType.authType[0] = |
| 12788 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12789 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 12790 | |
| 12791 | if (params->privacy) |
| 12792 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12793 | /* Security enabled IBSS, At this time there is no information available |
| 12794 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12795 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12796 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12797 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12798 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12799 | *enable privacy bit in beacons */ |
| 12800 | |
| 12801 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 12802 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12803 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 12804 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12805 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 12806 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 12807 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12808 | return status; |
| 12809 | } |
| 12810 | |
| 12811 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12812 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12813 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12814 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12815 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12816 | struct net_device *dev, |
| 12817 | struct cfg80211_ibss_params *params |
| 12818 | ) |
| 12819 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12820 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12821 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12822 | tCsrRoamProfile *pRoamProfile; |
| 12823 | int status; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12824 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12825 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 12826 | tSirMacAddr bssid; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12827 | |
| 12828 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12829 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12830 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12831 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 12832 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12833 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12834 | "%s: device_mode = %s (%d)", __func__, |
| 12835 | hdd_device_modetoString(pAdapter->device_mode), |
| 12836 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12837 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12838 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12839 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12840 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12841 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12842 | } |
| 12843 | |
| 12844 | if (NULL == pWextState) |
| 12845 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12846 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12847 | __func__); |
| 12848 | return -EIO; |
| 12849 | } |
| 12850 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12851 | if (vos_max_concurrent_connections_reached()) { |
| 12852 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 12853 | return -ECONNREFUSED; |
| 12854 | } |
| 12855 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12856 | /*Try disconnecting if already in connected state*/ |
| 12857 | status = wlan_hdd_try_disconnect(pAdapter); |
| 12858 | if ( 0 > status) |
| 12859 | { |
| 12860 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 12861 | " IBSS connection")); |
| 12862 | return -EALREADY; |
| 12863 | } |
| 12864 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12865 | pRoamProfile = &pWextState->roamProfile; |
| 12866 | |
| 12867 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 12868 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12869 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12870 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12871 | return -EINVAL; |
| 12872 | } |
| 12873 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12874 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 12875 | if (NULL != params->bssid) { |
| 12876 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 12877 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 12878 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12879 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 12880 | return -EIO; |
| 12881 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 12882 | vos_mem_copy((v_U8_t *)bssid, (v_U8_t *)params->bssid, sizeof(bssid)); |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12883 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12884 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 12885 | { |
| 12886 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 12887 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 12888 | { |
| 12889 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12890 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 12891 | return -EIO; |
| 12892 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 12893 | |
| 12894 | vos_mem_copy((v_U8_t *)bssid, |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12895 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 12896 | sizeof(bssid)); |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12897 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12898 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12899 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12900 | if (NULL != |
| 12901 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 12902 | params->chandef.chan) |
| 12903 | #else |
| 12904 | params->channel) |
| 12905 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12906 | { |
| 12907 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12908 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 12909 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 12910 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12911 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12912 | |
| 12913 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12914 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12915 | ieee80211_frequency_to_channel( |
| 12916 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 12917 | params->chandef.chan->center_freq); |
| 12918 | #else |
| 12919 | params->channel->center_freq); |
| 12920 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12921 | |
| 12922 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 12923 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12924 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12925 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 12926 | __func__); |
| 12927 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12928 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12929 | |
| 12930 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12931 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12932 | if (channelNum == validChan[indx]) |
| 12933 | { |
| 12934 | break; |
| 12935 | } |
| 12936 | } |
| 12937 | if (indx >= numChans) |
| 12938 | { |
| 12939 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12940 | __func__, channelNum); |
| 12941 | return -EINVAL; |
| 12942 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12943 | /* Set the Operational Channel */ |
| 12944 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 12945 | channelNum); |
| 12946 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 12947 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 12948 | pRoamProfile->ChannelInfo.ChannelList = |
| 12949 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12950 | } |
| 12951 | |
| 12952 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12953 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12954 | if (status < 0) |
| 12955 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12956 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12957 | __func__); |
| 12958 | return status; |
| 12959 | } |
| 12960 | |
| 12961 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12962 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12963 | params->ssid_len, params->bssid, |
| 12964 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12965 | |
| 12966 | if (0 > status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12967 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12968 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12969 | EXIT(); |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 12970 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12971 | } |
| 12972 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12973 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 12974 | struct net_device *dev, |
| 12975 | struct cfg80211_ibss_params *params |
| 12976 | ) |
| 12977 | { |
| 12978 | int ret = 0; |
| 12979 | |
| 12980 | vos_ssr_protect(__func__); |
| 12981 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 12982 | vos_ssr_unprotect(__func__); |
| 12983 | |
| 12984 | return ret; |
| 12985 | } |
| 12986 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12987 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12988 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12989 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12990 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12991 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12992 | struct net_device *dev |
| 12993 | ) |
| 12994 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12995 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12996 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12997 | tCsrRoamProfile *pRoamProfile; |
| 12998 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12999 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13000 | |
| 13001 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13002 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13003 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13004 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 13005 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13006 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13007 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13008 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13009 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13010 | } |
| 13011 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 13012 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 13013 | hdd_device_modetoString(pAdapter->device_mode), |
| 13014 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13015 | if (NULL == pWextState) |
| 13016 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13017 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13018 | __func__); |
| 13019 | return -EIO; |
| 13020 | } |
| 13021 | |
| 13022 | pRoamProfile = &pWextState->roamProfile; |
| 13023 | |
| 13024 | /* Issue disconnect only if interface type is set to IBSS */ |
| 13025 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 13026 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13027 | 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] | 13028 | __func__); |
| 13029 | return -EINVAL; |
| 13030 | } |
| 13031 | |
| 13032 | /* Issue Disconnect request */ |
| 13033 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 13034 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 13035 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 13036 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13037 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13038 | return 0; |
| 13039 | } |
| 13040 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13041 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 13042 | struct net_device *dev |
| 13043 | ) |
| 13044 | { |
| 13045 | int ret = 0; |
| 13046 | |
| 13047 | vos_ssr_protect(__func__); |
| 13048 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 13049 | vos_ssr_unprotect(__func__); |
| 13050 | |
| 13051 | return ret; |
| 13052 | } |
| 13053 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13054 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 13055 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13056 | * This function is used to set the phy parameters |
| 13057 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 13058 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 13059 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13060 | u32 changed) |
| 13061 | { |
| 13062 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 13063 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13064 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13065 | |
| 13066 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13067 | |
| 13068 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13069 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 13070 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13071 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13072 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13073 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13074 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13075 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13076 | } |
| 13077 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13078 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 13079 | { |
| 13080 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 13081 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 13082 | wiphy->rts_threshold; |
| 13083 | |
| 13084 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13085 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13086 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13087 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13088 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13089 | __func__, rts_threshold); |
| 13090 | return -EINVAL; |
| 13091 | } |
| 13092 | |
| 13093 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 13094 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13095 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13096 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13097 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13098 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13099 | __func__, rts_threshold); |
| 13100 | return -EIO; |
| 13101 | } |
| 13102 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13103 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13104 | rts_threshold); |
| 13105 | } |
| 13106 | |
| 13107 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 13108 | { |
| 13109 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 13110 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 13111 | wiphy->frag_threshold; |
| 13112 | |
| 13113 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13114 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13115 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13116 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13117 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13118 | frag_threshold); |
| 13119 | return -EINVAL; |
| 13120 | } |
| 13121 | |
| 13122 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 13123 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13124 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13125 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13126 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13127 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13128 | __func__, frag_threshold); |
| 13129 | return -EIO; |
| 13130 | } |
| 13131 | |
| 13132 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 13133 | frag_threshold); |
| 13134 | } |
| 13135 | |
| 13136 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 13137 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 13138 | { |
| 13139 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 13140 | wiphy->retry_short : |
| 13141 | wiphy->retry_long; |
| 13142 | |
| 13143 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 13144 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 13145 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13146 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13147 | __func__, retry_value); |
| 13148 | return -EINVAL; |
| 13149 | } |
| 13150 | |
| 13151 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 13152 | { |
| 13153 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 13154 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13155 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13156 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13157 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13158 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13159 | __func__, retry_value); |
| 13160 | return -EIO; |
| 13161 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13162 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13163 | __func__, retry_value); |
| 13164 | } |
| 13165 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 13166 | { |
| 13167 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 13168 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13169 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13170 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13171 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13172 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13173 | __func__, retry_value); |
| 13174 | return -EIO; |
| 13175 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13176 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13177 | __func__, retry_value); |
| 13178 | } |
| 13179 | } |
| 13180 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13181 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13182 | return 0; |
| 13183 | } |
| 13184 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 13185 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 13186 | u32 changed) |
| 13187 | { |
| 13188 | int ret; |
| 13189 | |
| 13190 | vos_ssr_protect(__func__); |
| 13191 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 13192 | vos_ssr_unprotect(__func__); |
| 13193 | |
| 13194 | return ret; |
| 13195 | } |
| 13196 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13197 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 13198 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13199 | * This function is used to set the txpower |
| 13200 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 13201 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 13202 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13203 | struct wireless_dev *wdev, |
| 13204 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13205 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13206 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13207 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13208 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13209 | #endif |
| 13210 | int dbm) |
| 13211 | { |
| 13212 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13213 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13214 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 13215 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13216 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13217 | |
| 13218 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13219 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13220 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13221 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 13222 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13223 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13224 | if (0 != status) |
| 13225 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13226 | return status; |
| 13227 | } |
| 13228 | |
| 13229 | hHal = pHddCtx->hHal; |
| 13230 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13231 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 13232 | dbm, ccmCfgSetCallback, |
| 13233 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13234 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13235 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13236 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 13237 | return -EIO; |
| 13238 | } |
| 13239 | |
| 13240 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 13241 | dbm); |
| 13242 | |
| 13243 | switch(type) |
| 13244 | { |
| 13245 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 13246 | /* Fall through */ |
| 13247 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 13248 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 13249 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13250 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 13251 | __func__); |
| 13252 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13253 | } |
| 13254 | break; |
| 13255 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13256 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13257 | __func__); |
| 13258 | return -EOPNOTSUPP; |
| 13259 | break; |
| 13260 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13261 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 13262 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13263 | return -EIO; |
| 13264 | } |
| 13265 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13266 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13267 | return 0; |
| 13268 | } |
| 13269 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 13270 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 13271 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13272 | struct wireless_dev *wdev, |
| 13273 | #endif |
| 13274 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 13275 | enum tx_power_setting type, |
| 13276 | #else |
| 13277 | enum nl80211_tx_power_setting type, |
| 13278 | #endif |
| 13279 | int dbm) |
| 13280 | { |
| 13281 | int ret; |
| 13282 | vos_ssr_protect(__func__); |
| 13283 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 13284 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13285 | wdev, |
| 13286 | #endif |
| 13287 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 13288 | type, |
| 13289 | #else |
| 13290 | type, |
| 13291 | #endif |
| 13292 | dbm); |
| 13293 | vos_ssr_unprotect(__func__); |
| 13294 | |
| 13295 | return ret; |
| 13296 | } |
| 13297 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13298 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13299 | * FUNCTION: __wlan_hdd_cfg80211_get_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13300 | * This function is used to read the txpower |
| 13301 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13302 | static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 13303 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13304 | struct wireless_dev *wdev, |
| 13305 | #endif |
| 13306 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13307 | { |
| 13308 | |
| 13309 | hdd_adapter_t *pAdapter; |
| 13310 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13311 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13312 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13313 | ENTER(); |
| 13314 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13315 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13316 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13317 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13318 | *dbm = 0; |
| 13319 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13320 | } |
| 13321 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13322 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 13323 | if (NULL == pAdapter) |
| 13324 | { |
| 13325 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 13326 | return -ENOENT; |
| 13327 | } |
| 13328 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 13329 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13330 | TRACE_CODE_HDD_CFG80211_GET_TXPOWER, |
| 13331 | pAdapter->sessionId, pAdapter->device_mode)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13332 | wlan_hdd_get_classAstats(pAdapter); |
| 13333 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 13334 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13335 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13336 | return 0; |
| 13337 | } |
| 13338 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13339 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 13340 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13341 | struct wireless_dev *wdev, |
| 13342 | #endif |
| 13343 | int *dbm) |
| 13344 | { |
| 13345 | int ret; |
| 13346 | |
| 13347 | vos_ssr_protect(__func__); |
| 13348 | ret = __wlan_hdd_cfg80211_get_txpower(wiphy, |
| 13349 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 13350 | wdev, |
| 13351 | #endif |
| 13352 | dbm); |
| 13353 | vos_ssr_unprotect(__func__); |
| 13354 | |
| 13355 | return ret; |
| 13356 | } |
| 13357 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13358 | static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 13359 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 13360 | const u8* mac, |
| 13361 | #else |
| 13362 | u8* mac, |
| 13363 | #endif |
| 13364 | struct station_info *sinfo) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13365 | { |
| 13366 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 13367 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13368 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13369 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13370 | |
| 13371 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 13372 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13373 | |
| 13374 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 13375 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 13376 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 13377 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 13378 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 13379 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 13380 | tANI_U16 maxRate = 0; |
| 13381 | tANI_U16 myRate; |
| 13382 | tANI_U16 currentRate = 0; |
| 13383 | tANI_U8 maxSpeedMCS = 0; |
| 13384 | tANI_U8 maxMCSIdx = 0; |
| 13385 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13386 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 13387 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13388 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13389 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13390 | #ifdef WLAN_FEATURE_11AC |
| 13391 | tANI_U32 vht_mcs_map; |
| 13392 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 13393 | #endif /* WLAN_FEATURE_11AC */ |
| 13394 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13395 | ENTER(); |
| 13396 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13397 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 13398 | (0 == ssidlen)) |
| 13399 | { |
| 13400 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 13401 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 13402 | /*To keep GUI happy*/ |
| 13403 | return 0; |
| 13404 | } |
| 13405 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 13406 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 13407 | { |
| 13408 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13409 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 13410 | return 0; |
| 13411 | } |
| 13412 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13413 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13414 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13415 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13416 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13417 | } |
| 13418 | |
Hanumantha Reddy Pothula | dce6674 | 2015-08-25 18:08:44 +0530 | [diff] [blame] | 13419 | wlan_hdd_get_station_stats(pAdapter); |
| 13420 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13421 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 13422 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 13423 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 13424 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 13425 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13426 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 13427 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13428 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13429 | { |
| 13430 | rate_flags = pAdapter->maxRateFlags; |
| 13431 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 13432 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13433 | //convert to the UI units of 100kbps |
| 13434 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 13435 | |
| 13436 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13437 | 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] | 13438 | sinfo->signal, |
| 13439 | pCfg->reportMaxLinkSpeed, |
| 13440 | myRate, |
| 13441 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13442 | (int) pCfg->linkSpeedRssiMid, |
| 13443 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13444 | (int) rate_flags, |
| 13445 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13446 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13447 | |
| 13448 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 13449 | { |
| 13450 | // we do not want to necessarily report the current speed |
| 13451 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 13452 | { |
| 13453 | // report the max possible speed |
| 13454 | rssidx = 0; |
| 13455 | } |
| 13456 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 13457 | { |
| 13458 | // report the max possible speed with RSSI scaling |
| 13459 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 13460 | { |
| 13461 | // report the max possible speed |
| 13462 | rssidx = 0; |
| 13463 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13464 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13465 | { |
| 13466 | // report middle speed |
| 13467 | rssidx = 1; |
| 13468 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13469 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 13470 | { |
| 13471 | // report middle speed |
| 13472 | rssidx = 2; |
| 13473 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13474 | else |
| 13475 | { |
| 13476 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 13477 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13478 | } |
| 13479 | } |
| 13480 | else |
| 13481 | { |
| 13482 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 13483 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13484 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 13485 | __func__, pCfg->reportMaxLinkSpeed); |
| 13486 | rssidx = 0; |
| 13487 | } |
| 13488 | |
| 13489 | maxRate = 0; |
| 13490 | |
| 13491 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13492 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 13493 | OperationalRates, &ORLeng)) |
| 13494 | { |
| 13495 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13496 | /*To keep GUI happy*/ |
| 13497 | return 0; |
| 13498 | } |
| 13499 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13500 | for (i = 0; i < ORLeng; i++) |
| 13501 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13502 | 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] | 13503 | { |
| 13504 | /* Validate Rate Set */ |
| 13505 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 13506 | { |
| 13507 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 13508 | break; |
| 13509 | } |
| 13510 | } |
| 13511 | /* Update MAX rate */ |
| 13512 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 13513 | } |
| 13514 | |
| 13515 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13516 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 13517 | ExtendedRates, &ERLeng)) |
| 13518 | { |
| 13519 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13520 | /*To keep GUI happy*/ |
| 13521 | return 0; |
| 13522 | } |
| 13523 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13524 | for (i = 0; i < ERLeng; i++) |
| 13525 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13526 | 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] | 13527 | { |
| 13528 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 13529 | { |
| 13530 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 13531 | break; |
| 13532 | } |
| 13533 | } |
| 13534 | /* Update MAX rate */ |
| 13535 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 13536 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13537 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 13538 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 13539 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 13540 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13541 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13542 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13543 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13544 | mode = 2; |
| 13545 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 13546 | mode = 1; |
| 13547 | else |
| 13548 | mode = 0; |
| 13549 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13550 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 13551 | MCSRates, &MCSLeng)) |
| 13552 | { |
| 13553 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13554 | /*To keep GUI happy*/ |
| 13555 | return 0; |
| 13556 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13557 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13558 | #ifdef WLAN_FEATURE_11AC |
| 13559 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13560 | 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] | 13561 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13562 | 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] | 13563 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13564 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13565 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13566 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13567 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13568 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13569 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13570 | maxMCSIdx = 7; |
| 13571 | } |
| 13572 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 13573 | { |
| 13574 | maxMCSIdx = 8; |
| 13575 | } |
| 13576 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 13577 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13578 | //VHT20 is supporting 0~8 |
| 13579 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13580 | maxMCSIdx = 8; |
| 13581 | else |
| 13582 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13583 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13584 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13585 | if (0 != rssidx)/*check for scaled */ |
| 13586 | { |
| 13587 | //get middle rate MCS index if rssi=1/2 |
| 13588 | for (i=0; i <= maxMCSIdx; i++) |
| 13589 | { |
| 13590 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 13591 | { |
| 13592 | maxMCSIdx = i; |
| 13593 | break; |
| 13594 | } |
| 13595 | } |
| 13596 | } |
| 13597 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13598 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13599 | { |
| 13600 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 13601 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 13602 | } |
| 13603 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 13604 | { |
| 13605 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 13606 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 13607 | } |
| 13608 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13609 | { |
| 13610 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 13611 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 13612 | } |
| 13613 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13614 | maxSpeedMCS = 1; |
| 13615 | if (currentRate > maxRate) |
| 13616 | { |
| 13617 | maxRate = currentRate; |
| 13618 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13619 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13620 | } |
| 13621 | else |
| 13622 | #endif /* WLAN_FEATURE_11AC */ |
| 13623 | { |
| 13624 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13625 | { |
| 13626 | rateFlag |= 1; |
| 13627 | } |
| 13628 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13629 | { |
| 13630 | rateFlag |= 2; |
| 13631 | } |
| 13632 | |
Girish Gowli | 01abcee | 2014-07-31 20:18:55 +0530 | [diff] [blame] | 13633 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13634 | if (rssidx == 1 || rssidx == 2) |
| 13635 | { |
| 13636 | //get middle rate MCS index if rssi=1/2 |
| 13637 | for (i=0; i <= 7; i++) |
| 13638 | { |
| 13639 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 13640 | { |
| 13641 | temp = i+1; |
| 13642 | break; |
| 13643 | } |
| 13644 | } |
| 13645 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13646 | |
| 13647 | for (i = 0; i < MCSLeng; i++) |
| 13648 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13649 | for (j = 0; j < temp; j++) |
| 13650 | { |
| 13651 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 13652 | { |
| 13653 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
Hanumantha Reddy Pothula | fa62374 | 2015-06-16 14:08:24 +0530 | [diff] [blame] | 13654 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13655 | break; |
| 13656 | } |
| 13657 | } |
| 13658 | if ((j < temp) && (currentRate > maxRate)) |
| 13659 | { |
| 13660 | maxRate = currentRate; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13661 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13662 | } |
Hanumantha Reddy Pothula | fa62374 | 2015-06-16 14:08:24 +0530 | [diff] [blame] | 13663 | maxSpeedMCS = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13664 | } |
| 13665 | } |
| 13666 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13667 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 13668 | { |
| 13669 | maxRate = myRate; |
| 13670 | maxSpeedMCS = 1; |
| 13671 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 13672 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13673 | // 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] | 13674 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13675 | { |
| 13676 | maxRate = myRate; |
| 13677 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 13678 | { |
| 13679 | maxSpeedMCS = 0; |
| 13680 | } |
| 13681 | else |
| 13682 | { |
| 13683 | maxSpeedMCS = 1; |
| 13684 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 13685 | } |
| 13686 | } |
| 13687 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13688 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13689 | { |
| 13690 | sinfo->txrate.legacy = maxRate; |
| 13691 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13692 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 13693 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13694 | } |
| 13695 | else |
| 13696 | { |
| 13697 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13698 | #ifdef WLAN_FEATURE_11AC |
| 13699 | sinfo->txrate.nss = 1; |
| 13700 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13701 | { |
| 13702 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13703 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13704 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13705 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13706 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13707 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13708 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13709 | } |
| 13710 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13711 | { |
| 13712 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13713 | } |
| 13714 | #endif /* WLAN_FEATURE_11AC */ |
| 13715 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 13716 | { |
| 13717 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 13718 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13719 | { |
| 13720 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13721 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13722 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13723 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13724 | { |
| 13725 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 13726 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13727 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13728 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13729 | pr_info("Reporting MCS rate %d flags %x\n", |
| 13730 | sinfo->txrate.mcs, |
| 13731 | sinfo->txrate.flags ); |
| 13732 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13733 | } |
| 13734 | } |
| 13735 | else |
| 13736 | { |
| 13737 | // report current rate instead of max rate |
| 13738 | |
| 13739 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 13740 | { |
| 13741 | //provide to the UI in units of 100kbps |
| 13742 | sinfo->txrate.legacy = myRate; |
| 13743 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13744 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 13745 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13746 | } |
| 13747 | else |
| 13748 | { |
| 13749 | //must be MCS |
| 13750 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13751 | #ifdef WLAN_FEATURE_11AC |
| 13752 | sinfo->txrate.nss = 1; |
| 13753 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13754 | { |
| 13755 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13756 | } |
| 13757 | else |
| 13758 | #endif /* WLAN_FEATURE_11AC */ |
| 13759 | { |
| 13760 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 13761 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13762 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13763 | { |
| 13764 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 13765 | } |
| 13766 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13767 | { |
| 13768 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13769 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13770 | #ifdef WLAN_FEATURE_11AC |
| 13771 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13772 | { |
| 13773 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 13774 | } |
| 13775 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13776 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13777 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 13778 | sinfo->txrate.mcs, |
| 13779 | sinfo->txrate.flags ); |
| 13780 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13781 | } |
| 13782 | } |
| 13783 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 13784 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 13785 | sinfo->tx_packets = |
| 13786 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 13787 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 13788 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 13789 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 13790 | |
| 13791 | sinfo->tx_retries = |
| 13792 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 13793 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 13794 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 13795 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 13796 | |
| 13797 | sinfo->tx_failed = |
| 13798 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 13799 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 13800 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 13801 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 13802 | |
| 13803 | sinfo->filled |= |
| 13804 | STATION_INFO_TX_PACKETS | |
| 13805 | STATION_INFO_TX_RETRIES | |
| 13806 | STATION_INFO_TX_FAILED; |
| 13807 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13808 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13809 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 13810 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 13811 | EXIT(); |
| 13812 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13813 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 13814 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 13815 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 13816 | const u8* mac, struct station_info *sinfo) |
| 13817 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13818 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 13819 | u8* mac, struct station_info *sinfo) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 13820 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13821 | { |
| 13822 | int ret; |
| 13823 | |
| 13824 | vos_ssr_protect(__func__); |
| 13825 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 13826 | vos_ssr_unprotect(__func__); |
| 13827 | |
| 13828 | return ret; |
| 13829 | } |
| 13830 | |
| 13831 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 13832 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13833 | { |
| 13834 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13835 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13836 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13837 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13838 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13839 | ENTER(); |
| 13840 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13841 | if (NULL == pAdapter) |
| 13842 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13843 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13844 | return -ENODEV; |
| 13845 | } |
| 13846 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13847 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13848 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 13849 | pAdapter->sessionId, timeout)); |
| 13850 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13851 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13852 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13853 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13854 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13855 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13856 | } |
| 13857 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13858 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 13859 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 13860 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 13861 | (eConnectionState_Associated == |
| 13862 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 13863 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 13864 | |
| 13865 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13866 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 13867 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13868 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13869 | { |
| 13870 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13871 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13872 | __func__, vos_status); |
| 13873 | } |
| 13874 | } |
| 13875 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13876 | /**The get power cmd from the supplicant gets updated by the nl only |
| 13877 | *on successful execution of the function call |
| 13878 | *we are oppositely mapped w.r.t mode in the driver |
| 13879 | **/ |
| 13880 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 13881 | |
| 13882 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 13883 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13884 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13885 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13886 | return -EINVAL; |
| 13887 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13888 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13889 | return 0; |
| 13890 | } |
| 13891 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13892 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 13893 | struct net_device *dev, bool mode, int timeout) |
| 13894 | { |
| 13895 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13896 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13897 | vos_ssr_protect(__func__); |
| 13898 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 13899 | vos_ssr_unprotect(__func__); |
| 13900 | |
| 13901 | return ret; |
| 13902 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13903 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13904 | static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 13905 | struct net_device *netdev, |
| 13906 | u8 key_index) |
| 13907 | { |
| 13908 | ENTER(); |
| 13909 | return 0; |
| 13910 | } |
| 13911 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13912 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13913 | struct net_device *netdev, |
| 13914 | u8 key_index) |
| 13915 | { |
| 13916 | int ret; |
| 13917 | vos_ssr_protect(__func__); |
| 13918 | ret = __wlan_hdd_set_default_mgmt_key(wiphy, netdev, key_index); |
| 13919 | vos_ssr_unprotect(__func__); |
| 13920 | return ret; |
| 13921 | } |
| 13922 | #endif //LINUX_VERSION_CODE |
| 13923 | |
| 13924 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 13925 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13926 | struct net_device *dev, |
| 13927 | struct ieee80211_txq_params *params) |
| 13928 | { |
| 13929 | ENTER(); |
| 13930 | return 0; |
| 13931 | } |
| 13932 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13933 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13934 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13935 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13936 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13937 | return 0; |
| 13938 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13939 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13940 | |
| 13941 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 13942 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13943 | struct net_device *dev, |
| 13944 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13945 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13946 | int ret; |
| 13947 | |
| 13948 | vos_ssr_protect(__func__); |
| 13949 | ret = __wlan_hdd_set_txq_params(wiphy, dev, params); |
| 13950 | vos_ssr_unprotect(__func__); |
| 13951 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13952 | } |
| 13953 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13954 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13955 | struct ieee80211_txq_params *params) |
| 13956 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13957 | int ret; |
| 13958 | |
| 13959 | vos_ssr_protect(__func__); |
| 13960 | ret = __wlan_hdd_set_txq_params(wiphy, params); |
| 13961 | vos_ssr_unprotect(__func__); |
| 13962 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13963 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13964 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13965 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13966 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13967 | struct net_device *dev, |
| 13968 | struct tagCsrDelStaParams *pDelStaParams) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13969 | { |
| 13970 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13971 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13972 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13973 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13974 | v_U8_t staId; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13975 | v_CONTEXT_t pVosContext = NULL; |
| 13976 | ptSapContext pSapCtx = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13977 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13978 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13979 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13980 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13981 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13982 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13983 | return -EINVAL; |
| 13984 | } |
| 13985 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13986 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13987 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 13988 | pAdapter->sessionId, pAdapter->device_mode)); |
| 13989 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13990 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13991 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13992 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13993 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13994 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13995 | } |
| 13996 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13997 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13998 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13999 | ) |
| 14000 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 14001 | pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 14002 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 14003 | if(pSapCtx == NULL){ |
| 14004 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14005 | FL("psapCtx is NULL")); |
| 14006 | return -ENOENT; |
| 14007 | } |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14008 | if (vos_is_macaddr_broadcast((v_MACADDR_t *)pDelStaParams->peerMacAddr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14009 | { |
| 14010 | v_U16_t i; |
| 14011 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 14012 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 14013 | if ((pSapCtx->aStaInfo[i].isUsed) && |
| 14014 | (!pSapCtx->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14015 | { |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14016 | vos_mem_copy(pDelStaParams->peerMacAddr, |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 14017 | pSapCtx->aStaInfo[i].macAddrSTA.bytes, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14018 | ETHER_ADDR_LEN); |
| 14019 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14020 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 14021 | "%s: Delete STA with MAC::" |
| 14022 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14023 | __func__, |
| 14024 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
| 14025 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 14026 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 14027 | pSapCtx->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14028 | } |
| 14029 | } |
| 14030 | } |
| 14031 | else |
| 14032 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 14033 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14034 | vos_status = hdd_softap_GetStaId(pAdapter, |
| 14035 | (v_MACADDR_t *)pDelStaParams->peerMacAddr, &staId); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 14036 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 14037 | { |
| 14038 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 14039 | "%s: Skip this DEL STA as this is not used::" |
| 14040 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14041 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 14042 | return -ENOENT; |
| 14043 | } |
| 14044 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 14045 | if( pSapCtx->aStaInfo[staId].isDeauthInProgress == TRUE) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 14046 | { |
| 14047 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 14048 | "%s: Skip this DEL STA as deauth is in progress::" |
| 14049 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14050 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 14051 | return -ENOENT; |
| 14052 | } |
| 14053 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 14054 | pSapCtx->aStaInfo[staId].isDeauthInProgress = TRUE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 14055 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14056 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14057 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 14058 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14059 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14060 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 14061 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14062 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 14063 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 14064 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 14065 | pSapCtx->aStaInfo[staId].isDeauthInProgress = FALSE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 14066 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14067 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 14068 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 14069 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14070 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 14071 | return -ENOENT; |
| 14072 | } |
| 14073 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14074 | } |
| 14075 | } |
| 14076 | |
| 14077 | EXIT(); |
| 14078 | |
| 14079 | return 0; |
| 14080 | } |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 14081 | |
| 14082 | #ifdef CFG80211_DEL_STA_V2 |
| 14083 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 14084 | struct net_device *dev, |
| 14085 | struct station_del_parameters *param) |
| 14086 | #else |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14087 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 14088 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 14089 | struct net_device *dev, const u8 *mac) |
| 14090 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14091 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 14092 | struct net_device *dev, u8 *mac) |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 14093 | #endif |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14094 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14095 | { |
| 14096 | int ret; |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14097 | struct tagCsrDelStaParams delStaParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14098 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14099 | vos_ssr_protect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14100 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 14101 | #ifdef CFG80211_DEL_STA_V2 |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14102 | if (NULL == param) { |
| 14103 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid argumet passed", __func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14104 | vos_ssr_unprotect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14105 | return -EINVAL; |
| 14106 | } |
| 14107 | |
| 14108 | WLANSAP_PopulateDelStaParams(param->mac, param->reason_code, |
| 14109 | param->subtype, &delStaParams); |
| 14110 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 14111 | #else |
Sushant Kaushik | 4cd28f6 | 2014-12-26 14:23:50 +0530 | [diff] [blame] | 14112 | WLANSAP_PopulateDelStaParams(mac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14113 | (SIR_MAC_MGMT_DEAUTH >> 4), &delStaParams); |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 14114 | #endif |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 14115 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, &delStaParams); |
| 14116 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14117 | vos_ssr_unprotect(__func__); |
| 14118 | |
| 14119 | return ret; |
| 14120 | } |
| 14121 | |
| 14122 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14123 | struct net_device *dev, |
| 14124 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 14125 | const u8 *mac, |
| 14126 | #else |
| 14127 | u8 *mac, |
| 14128 | #endif |
| 14129 | struct station_parameters *params) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14130 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14131 | hdd_adapter_t *pAdapter; |
| 14132 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14133 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14134 | #ifdef FEATURE_WLAN_TDLS |
| 14135 | u32 mask, set; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14136 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14137 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14138 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14139 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14140 | if (NULL == pAdapter) |
| 14141 | { |
| 14142 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14143 | "%s: Adapter is NULL",__func__); |
| 14144 | return -EINVAL; |
| 14145 | } |
| 14146 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14147 | status = wlan_hdd_validate_context(pHddCtx); |
| 14148 | if (0 != status) |
| 14149 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14150 | return status; |
| 14151 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14152 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14153 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14154 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 14155 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14156 | mask = params->sta_flags_mask; |
| 14157 | |
| 14158 | set = params->sta_flags_set; |
| 14159 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14160 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14161 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 14162 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14163 | |
| 14164 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 14165 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 14166 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14167 | } |
| 14168 | } |
| 14169 | #endif |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14170 | EXIT(); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14171 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14172 | } |
| 14173 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14174 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 14175 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 14176 | struct net_device *dev, const u8 *mac, |
| 14177 | struct station_parameters *params) |
| 14178 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14179 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 14180 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14181 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14182 | { |
| 14183 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14184 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14185 | vos_ssr_protect(__func__); |
| 14186 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 14187 | vos_ssr_unprotect(__func__); |
| 14188 | |
| 14189 | return ret; |
| 14190 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14191 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14192 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 14193 | 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] | 14194 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14195 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14196 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14197 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14198 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14199 | int status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14200 | hdd_context_t *pHddCtx; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14201 | tPmkidCacheInfo pmk_id; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14202 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14203 | ENTER(); |
| 14204 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14205 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14206 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14207 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14208 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14209 | return -EINVAL; |
| 14210 | } |
| 14211 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14212 | if (!pmksa) { |
| 14213 | hddLog(LOGE, FL("pmksa is NULL")); |
| 14214 | return -EINVAL; |
| 14215 | } |
| 14216 | |
| 14217 | if (!pmksa->bssid || !pmksa->pmkid) { |
| 14218 | hddLog(LOGE, FL("pmksa->bssid(%p) or pmksa->pmkid(%p) is NULL"), |
| 14219 | pmksa->bssid, pmksa->pmkid); |
| 14220 | return -EINVAL; |
| 14221 | } |
| 14222 | |
| 14223 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 14224 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 14225 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14226 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14227 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14228 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14229 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14230 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14231 | } |
| 14232 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14233 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14234 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14235 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14236 | vos_mem_copy(pmk_id.BSSID, pmksa->bssid, ETHER_ADDR_LEN); |
| 14237 | vos_mem_copy(pmk_id.PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14238 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14239 | /* Add to the PMKSA ID Cache in CSR */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14240 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14241 | &pmk_id, 1, FALSE); |
| 14242 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14243 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14244 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 14245 | pAdapter->sessionId, result)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14246 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14247 | EXIT(); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14248 | return HAL_STATUS_SUCCESS(result) ? 0 : -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14249 | } |
| 14250 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 14251 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 14252 | struct cfg80211_pmksa *pmksa) |
| 14253 | { |
| 14254 | int ret; |
| 14255 | |
| 14256 | vos_ssr_protect(__func__); |
| 14257 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 14258 | vos_ssr_unprotect(__func__); |
| 14259 | |
| 14260 | return ret; |
| 14261 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14262 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14263 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 14264 | 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] | 14265 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14266 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14267 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14268 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14269 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 14270 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14271 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14272 | ENTER(); |
| 14273 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14274 | /* Validate pAdapter */ |
| 14275 | if (NULL == pAdapter) |
| 14276 | { |
| 14277 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 14278 | return -EINVAL; |
| 14279 | } |
| 14280 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14281 | if (!pmksa) { |
| 14282 | hddLog(LOGE, FL("pmksa is NULL")); |
| 14283 | return -EINVAL; |
| 14284 | } |
| 14285 | |
| 14286 | if (!pmksa->bssid) { |
| 14287 | hddLog(LOGE, FL("pmksa->bssid is NULL")); |
| 14288 | return -EINVAL; |
| 14289 | } |
| 14290 | |
Kiet Lam | 98c46a1 | 2014-10-31 15:34:57 -0700 | [diff] [blame] | 14291 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 14292 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 14293 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14294 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14295 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14296 | if (0 != status) |
| 14297 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14298 | return status; |
| 14299 | } |
| 14300 | |
| 14301 | /*Retrieve halHandle*/ |
| 14302 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14303 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 14304 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14305 | TRACE_CODE_HDD_CFG80211_DEL_PMKSA, |
| 14306 | pAdapter->sessionId, 0)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14307 | /* Delete the PMKID CSR cache */ |
| 14308 | if (eHAL_STATUS_SUCCESS != |
| 14309 | sme_RoamDelPMKIDfromCache(halHandle, |
| 14310 | pAdapter->sessionId, pmksa->bssid, FALSE)) { |
| 14311 | hddLog(LOGE, FL("Failed to delete PMKSA for "MAC_ADDRESS_STR), |
| 14312 | MAC_ADDR_ARRAY(pmksa->bssid)); |
| 14313 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14314 | } |
| 14315 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14316 | EXIT(); |
| 14317 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14318 | } |
| 14319 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14320 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 14321 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 14322 | struct cfg80211_pmksa *pmksa) |
| 14323 | { |
| 14324 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14325 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 14326 | vos_ssr_protect(__func__); |
| 14327 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 14328 | vos_ssr_unprotect(__func__); |
| 14329 | |
| 14330 | return ret; |
| 14331 | |
| 14332 | } |
| 14333 | |
| 14334 | 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] | 14335 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14336 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14337 | tHalHandle halHandle; |
| 14338 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 14339 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14340 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14341 | ENTER(); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14342 | |
| 14343 | /* Validate pAdapter */ |
| 14344 | if (NULL == pAdapter) |
| 14345 | { |
| 14346 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 14347 | "%s: Invalid Adapter" ,__func__); |
| 14348 | return -EINVAL; |
| 14349 | } |
| 14350 | |
| 14351 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14352 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14353 | if (0 != status) |
| 14354 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14355 | return status; |
| 14356 | } |
| 14357 | |
| 14358 | /*Retrieve halHandle*/ |
| 14359 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14360 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 14361 | /* Flush the PMKID cache in CSR */ |
| 14362 | if (eHAL_STATUS_SUCCESS != |
| 14363 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, NULL, TRUE)) { |
| 14364 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Cannot flush PMKIDCache")); |
| 14365 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 14366 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14367 | EXIT(); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 14368 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14369 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 14370 | |
| 14371 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 14372 | { |
| 14373 | int ret; |
| 14374 | |
| 14375 | vos_ssr_protect(__func__); |
| 14376 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 14377 | vos_ssr_unprotect(__func__); |
| 14378 | |
| 14379 | return ret; |
| 14380 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14381 | #endif |
| 14382 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14383 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14384 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 14385 | struct net_device *dev, |
| 14386 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14387 | { |
| 14388 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14389 | hdd_station_ctx_t *pHddStaCtx; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14390 | hdd_context_t *pHddCtx; |
| 14391 | int ret = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14392 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14393 | ENTER(); |
| 14394 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14395 | if (NULL == pAdapter) |
| 14396 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14397 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14398 | return -ENODEV; |
| 14399 | } |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14400 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14401 | ret = wlan_hdd_validate_context(pHddCtx); |
| 14402 | if (0 != ret) |
| 14403 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 14404 | return ret; |
| 14405 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14406 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14407 | if (NULL == pHddStaCtx) |
| 14408 | { |
| 14409 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: STA Context is NULL", __func__); |
| 14410 | return -EINVAL; |
| 14411 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14412 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14413 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14414 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 14415 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14416 | // Added for debug on reception of Re-assoc Req. |
| 14417 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 14418 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14419 | 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] | 14420 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14421 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14422 | } |
| 14423 | |
| 14424 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14425 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14426 | ftie->ie_len); |
| 14427 | #endif |
| 14428 | |
| 14429 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 14430 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 14431 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14432 | ftie->ie_len); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14433 | |
| 14434 | EXIT(); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14435 | return 0; |
| 14436 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14437 | |
| 14438 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 14439 | struct net_device *dev, |
| 14440 | struct cfg80211_update_ft_ies_params *ftie) |
| 14441 | { |
| 14442 | int ret; |
| 14443 | |
| 14444 | vos_ssr_protect(__func__); |
| 14445 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 14446 | vos_ssr_unprotect(__func__); |
| 14447 | |
| 14448 | return ret; |
| 14449 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14450 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14451 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14452 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 14453 | |
| 14454 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 14455 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 14456 | { |
| 14457 | int ret; |
| 14458 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 14459 | hdd_context_t *pHddCtx; |
| 14460 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14461 | ENTER(); |
| 14462 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14463 | if (NULL == pAdapter) |
| 14464 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 14465 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14466 | "%s: HDD adapter is Null", __func__); |
| 14467 | return ; |
| 14468 | } |
| 14469 | |
| 14470 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14471 | if (NULL == pHddCtx) |
| 14472 | { |
| 14473 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14474 | "%s: HDD context is Null!!!", __func__); |
| 14475 | return ; |
| 14476 | } |
| 14477 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14478 | spin_lock(&pHddCtx->schedScan_lock); |
| 14479 | if (TRUE == pHddCtx->isWiphySuspended) |
| 14480 | { |
| 14481 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 14482 | spin_unlock(&pHddCtx->schedScan_lock); |
| 14483 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14484 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 14485 | return ; |
| 14486 | } |
| 14487 | spin_unlock(&pHddCtx->schedScan_lock); |
| 14488 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14489 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 14490 | |
| 14491 | if (0 > ret) |
| 14492 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 14493 | |
| 14494 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14495 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14496 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14497 | } |
| 14498 | |
| 14499 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14500 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14501 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14502 | */ |
| 14503 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 14504 | { |
| 14505 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 14506 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14507 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14508 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14509 | int status = 0; |
| 14510 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 14511 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14512 | /* The current firmware design does not allow PNO during any |
| 14513 | * active sessions. Hence, determine the active sessions |
| 14514 | * and return a failure. |
| 14515 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14516 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 14517 | { |
| 14518 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14519 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14520 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14521 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 14522 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 14523 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 14524 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 14525 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
Siddharth Bhal | 63a19a7 | 2014-11-07 14:31:56 +0530 | [diff] [blame] | 14526 | || (WLAN_HDD_TM_LEVEL_4 == pHddCtx->tmInfo.currentTmLevel) |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14527 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14528 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14529 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14530 | } |
| 14531 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 14532 | pAdapterNode = pNext; |
| 14533 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14534 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14535 | } |
| 14536 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14537 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 14538 | { |
| 14539 | hdd_adapter_t *pAdapter = callbackContext; |
| 14540 | hdd_context_t *pHddCtx; |
| 14541 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14542 | ENTER(); |
| 14543 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14544 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 14545 | { |
| 14546 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14547 | FL("Invalid adapter or adapter has invalid magic")); |
| 14548 | return; |
| 14549 | } |
| 14550 | |
| 14551 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14552 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 14553 | { |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14554 | return; |
| 14555 | } |
| 14556 | |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 14557 | if (VOS_STATUS_SUCCESS != status) |
| 14558 | { |
| 14559 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14560 | FL("PNO enable response status = %d"), status); |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 14561 | pHddCtx->isPnoEnable = FALSE; |
| 14562 | } |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14563 | |
| 14564 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 14565 | complete(&pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14566 | EXIT(); |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14567 | } |
| 14568 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14569 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14570 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 14571 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14572 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14573 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14574 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 14575 | { |
| 14576 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14577 | tSirPNOScanReq pnoRequest = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14578 | hdd_context_t *pHddCtx; |
| 14579 | tHalHandle hHal; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14580 | v_U32_t i, indx, num_ch, tempInterval, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 14581 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 14582 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14583 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 14584 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14585 | int ret = 0; |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14586 | hdd_config_t *pConfig = NULL; |
| 14587 | v_U32_t num_ignore_dfs_ch = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14588 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14589 | ENTER(); |
| 14590 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14591 | if (NULL == pAdapter) |
| 14592 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14593 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14594 | "%s: HDD adapter is Null", __func__); |
| 14595 | return -ENODEV; |
| 14596 | } |
| 14597 | |
| 14598 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14599 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14600 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14601 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14602 | { |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14603 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14604 | } |
| 14605 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14606 | pConfig = pHddCtx->cfg_ini; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14607 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14608 | if (NULL == hHal) |
| 14609 | { |
| 14610 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14611 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14612 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14613 | } |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 14614 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14615 | TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START, |
| 14616 | pAdapter->sessionId, pAdapter->device_mode)); |
Sushant Kaushik | 2fe8993 | 2014-09-03 10:58:09 +0530 | [diff] [blame] | 14617 | sme_ScanFlushResult(hHal, pAdapter->sessionId); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 14618 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 14619 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 14620 | { |
| 14621 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14622 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 14623 | return -EBUSY; |
| 14624 | } |
| 14625 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14626 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14627 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14628 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14629 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14630 | return -EBUSY; |
| 14631 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14632 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14633 | if (TRUE == pHddCtx->isPnoEnable) |
| 14634 | { |
| 14635 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 14636 | FL("already PNO is enabled")); |
| 14637 | return -EBUSY; |
| 14638 | } |
c_hpothu | 225aa7c | 2014-10-22 17:45:13 +0530 | [diff] [blame] | 14639 | |
| 14640 | if (VOS_STATUS_SUCCESS != wlan_hdd_cancel_remain_on_channel(pHddCtx)) |
| 14641 | { |
| 14642 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14643 | "%s: abort ROC failed ", __func__); |
| 14644 | return -EBUSY; |
| 14645 | } |
| 14646 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14647 | pHddCtx->isPnoEnable = TRUE; |
| 14648 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14649 | pnoRequest.enable = 1; /*Enable PNO */ |
| 14650 | pnoRequest.ucNetworksCount = request->n_match_sets; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14651 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14652 | if (( !pnoRequest.ucNetworksCount ) || |
| 14653 | ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14654 | { |
| 14655 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14656 | "%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] | 14657 | __func__, pnoRequest.ucNetworksCount, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14658 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14659 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14660 | goto error; |
| 14661 | } |
| 14662 | |
| 14663 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 14664 | { |
| 14665 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14666 | "%s: Incorrect number of channels %d", |
| 14667 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14668 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14669 | goto error; |
| 14670 | } |
| 14671 | |
| 14672 | /* Framework provides one set of channels(all) |
| 14673 | * common for all saved profile */ |
| 14674 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 14675 | channels_allowed, &num_channels_allowed)) |
| 14676 | { |
| 14677 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14678 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14679 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14680 | goto error; |
| 14681 | } |
| 14682 | /* Checking each channel against allowed channel list */ |
| 14683 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14684 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14685 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14686 | char chList [(request->n_channels*5)+1]; |
| 14687 | int len; |
| 14688 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14689 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14690 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14691 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14692 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 14693 | { |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14694 | if ((!pConfig->enableDFSPnoChnlScan) && |
| 14695 | (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channels_allowed[indx]))) |
| 14696 | { |
| 14697 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14698 | "%s : Dropping DFS channel : %d", |
| 14699 | __func__,channels_allowed[indx]); |
| 14700 | num_ignore_dfs_ch++; |
| 14701 | break; |
| 14702 | } |
| 14703 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14704 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 14705 | len += snprintf(chList+len, 5, "%d ", |
| 14706 | request->channels[i]->hw_value); |
| 14707 | break ; |
| 14708 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14709 | } |
| 14710 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14711 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14712 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14713 | /*If all channels are DFS and dropped, then ignore the PNO request*/ |
| 14714 | if (num_ignore_dfs_ch == request->n_channels) |
| 14715 | { |
| 14716 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14717 | "%s : All requested channels are DFS channels", __func__); |
| 14718 | ret = -EINVAL; |
| 14719 | goto error; |
| 14720 | } |
| 14721 | } |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14722 | |
| 14723 | pnoRequest.aNetworks = |
| 14724 | vos_mem_malloc(sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14725 | if (pnoRequest.aNetworks == NULL) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14726 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14727 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14728 | FL("failed to allocate memory aNetworks %u"), |
| 14729 | (uint32)sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14730 | goto error; |
| 14731 | } |
| 14732 | vos_mem_zero(pnoRequest.aNetworks, |
| 14733 | sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14734 | |
| 14735 | /* Filling per profile params */ |
| 14736 | for (i = 0; i < pnoRequest.ucNetworksCount; i++) |
| 14737 | { |
| 14738 | pnoRequest.aNetworks[i].ssId.length = |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14739 | request->match_sets[i].ssid.ssid_len; |
| 14740 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14741 | if (( 0 == pnoRequest.aNetworks[i].ssId.length ) || |
| 14742 | ( pnoRequest.aNetworks[i].ssId.length > 32 ) ) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14743 | { |
| 14744 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14745 | "%s: SSID Len %d is not correct for network %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14746 | __func__, pnoRequest.aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14747 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14748 | goto error; |
| 14749 | } |
| 14750 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14751 | memcpy(pnoRequest.aNetworks[i].ssId.ssId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14752 | request->match_sets[i].ssid.ssid, |
| 14753 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14754 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14755 | "%s: SSID of network %d is %s ", __func__, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14756 | i, pnoRequest.aNetworks[i].ssId.ssId); |
| 14757 | pnoRequest.aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 14758 | pnoRequest.aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 14759 | pnoRequest.aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14760 | |
| 14761 | /*Copying list of valid channel into request */ |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14762 | memcpy(pnoRequest.aNetworks[i].aChannels, valid_ch, num_ch); |
| 14763 | pnoRequest.aNetworks[i].ucChannelCount = num_ch; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14764 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14765 | pnoRequest.aNetworks[i].rssiThreshold = 0; //Default value |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14766 | } |
| 14767 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14768 | for (i = 0; i < request->n_ssids; i++) |
| 14769 | { |
| 14770 | j = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14771 | while (j < pnoRequest.ucNetworksCount) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14772 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14773 | if ((pnoRequest.aNetworks[j].ssId.length == |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14774 | request->ssids[i].ssid_len) && |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14775 | (0 == memcmp(pnoRequest.aNetworks[j].ssId.ssId, |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14776 | request->ssids[i].ssid, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14777 | pnoRequest.aNetworks[j].ssId.length))) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14778 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14779 | pnoRequest.aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14780 | break; |
| 14781 | } |
| 14782 | j++; |
| 14783 | } |
| 14784 | } |
| 14785 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14786 | "Number of hidden networks being Configured = %d", |
| 14787 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14788 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 14789 | "request->ie_len = %zu", request->ie_len); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14790 | |
| 14791 | pnoRequest.p24GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 14792 | if (pnoRequest.p24GProbeTemplate == NULL) |
| 14793 | { |
| 14794 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14795 | FL("failed to allocate memory p24GProbeTemplate %u"), |
| 14796 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 14797 | goto error; |
| 14798 | } |
| 14799 | |
| 14800 | pnoRequest.p5GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 14801 | if (pnoRequest.p5GProbeTemplate == NULL) |
| 14802 | { |
| 14803 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14804 | FL("failed to allocate memory p5GProbeTemplate %u"), |
| 14805 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 14806 | goto error; |
| 14807 | } |
| 14808 | |
| 14809 | vos_mem_zero(pnoRequest.p24GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 14810 | vos_mem_zero(pnoRequest.p5GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 14811 | |
Hanumantha Reddy Pothula | 06e87b2 | 2015-03-02 18:02:23 +0530 | [diff] [blame] | 14812 | if ((0 < request->ie_len) && (request->ie_len <= SIR_PNO_MAX_PB_REQ_SIZE) && |
| 14813 | (NULL != request->ie)) |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14814 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14815 | pnoRequest.us24GProbeTemplateLen = request->ie_len; |
| 14816 | memcpy(pnoRequest.p24GProbeTemplate, request->ie, |
| 14817 | pnoRequest.us24GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14818 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14819 | pnoRequest.us5GProbeTemplateLen = request->ie_len; |
| 14820 | memcpy(pnoRequest.p5GProbeTemplate, request->ie, |
| 14821 | pnoRequest.us5GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14822 | } |
| 14823 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14824 | /* Driver gets only one time interval which is hardcoded in |
| 14825 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 14826 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 14827 | * 80,160,320 secs. And number of scan cycle for each timer |
| 14828 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 14829 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 14830 | * will be repeated after each interval specified by supplicant |
| 14831 | * till PNO is disabled. |
| 14832 | */ |
| 14833 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14834 | pnoRequest.scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14835 | else |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14836 | pnoRequest.scanTimers.ucScanTimersCount = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14837 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 14838 | |
| 14839 | tempInterval = (request->interval)/1000; |
| 14840 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14841 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 14842 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14843 | for ( i = 0; i < pnoRequest.scanTimers.ucScanTimersCount; i++) |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14844 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14845 | pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14846 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14847 | pnoRequest.scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14848 | tempInterval *= 2; |
| 14849 | } |
| 14850 | //Repeat last timer until pno disabled. |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14851 | pnoRequest.scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14852 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14853 | pnoRequest.modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14854 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14855 | INIT_COMPLETION(pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14856 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 14857 | pnoRequest.callbackContext = pAdapter; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14858 | pAdapter->pno_req_status = 0; |
| 14859 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14860 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14861 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14862 | pAdapter->sessionId, pnoRequest.enable, pnoRequest.modePNO, |
| 14863 | pnoRequest.scanTimers.ucScanTimersCount); |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14864 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14865 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14866 | &pnoRequest, pAdapter->sessionId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14867 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 14868 | if (eHAL_STATUS_SUCCESS != status) |
| 14869 | { |
| 14870 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14871 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14872 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14873 | goto error; |
| 14874 | } |
| 14875 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14876 | ret = wait_for_completion_timeout( |
| 14877 | &pAdapter->pno_comp_var, |
| 14878 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 14879 | if (0 >= ret) |
| 14880 | { |
| 14881 | // Did not receive the response for PNO enable in time. |
| 14882 | // Assuming the PNO enable was success. |
| 14883 | // Returning error from here, because we timeout, results |
| 14884 | // in side effect of Wifi (Wifi Setting) not to work. |
| 14885 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14886 | FL("Timed out waiting for PNO to be Enabled")); |
| 14887 | ret = 0; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14888 | } |
| 14889 | |
| 14890 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14891 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14892 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14893 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14894 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14895 | FL("PNO scanRequest offloaded ret = %d"), ret); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14896 | pHddCtx->isPnoEnable = FALSE; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14897 | if (pnoRequest.aNetworks) |
| 14898 | vos_mem_free(pnoRequest.aNetworks); |
| 14899 | if (pnoRequest.p24GProbeTemplate) |
| 14900 | vos_mem_free(pnoRequest.p24GProbeTemplate); |
| 14901 | if (pnoRequest.p5GProbeTemplate) |
| 14902 | vos_mem_free(pnoRequest.p5GProbeTemplate); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14903 | |
| 14904 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14905 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14906 | } |
| 14907 | |
| 14908 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14909 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 14910 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14911 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14912 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 14913 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 14914 | { |
| 14915 | int ret; |
| 14916 | |
| 14917 | vos_ssr_protect(__func__); |
| 14918 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 14919 | vos_ssr_unprotect(__func__); |
| 14920 | |
| 14921 | return ret; |
| 14922 | } |
| 14923 | |
| 14924 | /* |
| 14925 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 14926 | * Function to disable PNO |
| 14927 | */ |
| 14928 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14929 | struct net_device *dev) |
| 14930 | { |
| 14931 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14932 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14933 | hdd_context_t *pHddCtx; |
| 14934 | tHalHandle hHal; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14935 | tSirPNOScanReq pnoRequest = {0}; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14936 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14937 | |
| 14938 | ENTER(); |
| 14939 | |
| 14940 | if (NULL == pAdapter) |
| 14941 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14942 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14943 | "%s: HDD adapter is Null", __func__); |
| 14944 | return -ENODEV; |
| 14945 | } |
| 14946 | |
| 14947 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14948 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14949 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14950 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14951 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14952 | "%s: HDD context is Null", __func__); |
| 14953 | return -ENODEV; |
| 14954 | } |
| 14955 | |
| 14956 | /* The return 0 is intentional when isLogpInProgress and |
| 14957 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 14958 | * failure in sched_scan_stop , especially for a case where the unload |
| 14959 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 14960 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 14961 | * success. If it returns a failure , then its next invocation due to the |
| 14962 | * clean up of the second interface will have the dev pointer corresponding |
| 14963 | * to the first one leading to a crash. |
| 14964 | */ |
| 14965 | if (pHddCtx->isLogpInProgress) |
| 14966 | { |
| 14967 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14968 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14969 | return ret; |
| 14970 | } |
| 14971 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 14972 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14973 | { |
| 14974 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14975 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14976 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14977 | } |
| 14978 | |
| 14979 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14980 | if (NULL == hHal) |
| 14981 | { |
| 14982 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14983 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14984 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14985 | } |
| 14986 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14987 | pnoRequest.enable = 0; /* Disable PNO */ |
| 14988 | pnoRequest.ucNetworksCount = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14989 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 14990 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14991 | TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP, |
| 14992 | pAdapter->sessionId, pAdapter->device_mode)); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14993 | status = sme_SetPreferredNetworkList(hHal, &pnoRequest, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14994 | pAdapter->sessionId, |
| 14995 | NULL, pAdapter); |
| 14996 | if (eHAL_STATUS_SUCCESS != status) |
| 14997 | { |
| 14998 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14999 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 15000 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 15001 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 15002 | } |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 15003 | pHddCtx->isPnoEnable = FALSE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 15004 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 15005 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15006 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 15007 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 15008 | |
| 15009 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 15010 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 15011 | } |
| 15012 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 15013 | /* |
| 15014 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 15015 | * NL interface to disable PNO |
| 15016 | */ |
| 15017 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 15018 | struct net_device *dev) |
| 15019 | { |
| 15020 | int ret; |
| 15021 | |
| 15022 | vos_ssr_protect(__func__); |
| 15023 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 15024 | vos_ssr_unprotect(__func__); |
| 15025 | |
| 15026 | return ret; |
| 15027 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 15028 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 15029 | |
| 15030 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15031 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15032 | #if TDLS_MGMT_VERSION2 |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 15033 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 15034 | struct net_device *dev, |
| 15035 | u8 *peer, u8 action_code, |
| 15036 | u8 dialog_token, |
| 15037 | u16 status_code, u32 peer_capability, |
| 15038 | const u8 *buf, size_t len) |
| 15039 | #else /* TDLS_MGMT_VERSION2 */ |
| 15040 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS) |
| 15041 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 15042 | struct net_device *dev, |
| 15043 | const u8 *peer, u8 action_code, |
| 15044 | u8 dialog_token, u16 status_code, |
| 15045 | u32 peer_capability, bool initiator, |
| 15046 | const u8 *buf, size_t len) |
| 15047 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) |
| 15048 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 15049 | struct net_device *dev, |
| 15050 | const u8 *peer, u8 action_code, |
| 15051 | u8 dialog_token, u16 status_code, |
| 15052 | u32 peer_capability, const u8 *buf, |
| 15053 | size_t len) |
| 15054 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 15055 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 15056 | struct net_device *dev, |
| 15057 | u8 *peer, u8 action_code, |
| 15058 | u8 dialog_token, |
| 15059 | u16 status_code, u32 peer_capability, |
| 15060 | const u8 *buf, size_t len) |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15061 | #else |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 15062 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 15063 | struct net_device *dev, |
| 15064 | u8 *peer, u8 action_code, |
| 15065 | u8 dialog_token, |
| 15066 | u16 status_code, const u8 *buf, |
| 15067 | size_t len) |
| 15068 | #endif |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15069 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15070 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 15071 | hdd_adapter_t *pAdapter; |
| 15072 | hdd_context_t *pHddCtx; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15073 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 15074 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 15075 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 15076 | long rc; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 15077 | int ret; |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 15078 | #if !(TDLS_MGMT_VERSION2) && (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15079 | u32 peer_capability = 0; |
| 15080 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 15081 | tANI_U16 numCurrTdlsPeers; |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 15082 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15083 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 15084 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15085 | if (NULL == pAdapter) |
| 15086 | { |
| 15087 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15088 | "%s: Adapter is NULL",__func__); |
| 15089 | return -EINVAL; |
| 15090 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15091 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15092 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 15093 | pAdapter->sessionId, action_code)); |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 15094 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 15095 | pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 15096 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15097 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15098 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15099 | "Invalid arguments"); |
| 15100 | return -EINVAL; |
| 15101 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 15102 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 15103 | if (pHddCtx->isLogpInProgress) |
| 15104 | { |
| 15105 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15106 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15107 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 15108 | peer, |
| 15109 | eTDLS_LINK_IDLE, |
| 15110 | eTDLS_LINK_UNSPECIFIED); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 15111 | return -EBUSY; |
| 15112 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 15113 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 15114 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
| 15115 | { |
| 15116 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15117 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 15118 | return -EAGAIN; |
| 15119 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 15120 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 15121 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15122 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 15123 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 15124 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 15125 | MAC_ADDRESS_STR " action %d declined.", |
| 15126 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15127 | return -ENOTSUPP; |
| 15128 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15129 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 15130 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15131 | |
| 15132 | if( NULL == pHddStaCtx ) |
| 15133 | { |
| 15134 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15135 | "%s: HDD station context NULL ",__func__); |
| 15136 | return -EINVAL; |
| 15137 | } |
| 15138 | |
| 15139 | /* STA should be connected and authenticated |
| 15140 | * before sending any TDLS frames |
| 15141 | */ |
| 15142 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 15143 | (FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 15144 | { |
| 15145 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15146 | "STA is not connected or unauthenticated. " |
| 15147 | "connState %u, uIsAuthenticated %u", |
| 15148 | pHddStaCtx->conn_info.connState, |
| 15149 | pHddStaCtx->conn_info.uIsAuthenticated); |
| 15150 | return -EAGAIN; |
| 15151 | } |
| 15152 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 15153 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 15154 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 15155 | { |
| 15156 | /* if tdls_mode is disabled to respond to peer's request */ |
| 15157 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 15158 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 15159 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 15160 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 15161 | " TDLS mode is disabled. action %d declined.", |
| 15162 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 15163 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 15164 | return -ENOTSUPP; |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 15165 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 15166 | |
| 15167 | if (vos_max_concurrent_connections_reached()) |
| 15168 | { |
| 15169 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 15170 | return -EINVAL; |
| 15171 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 15172 | } |
| 15173 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15174 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 15175 | { |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 15176 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15177 | { |
| 15178 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15179 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 15180 | " TDLS setup is ongoing. action %d declined.", |
| 15181 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 15182 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15183 | } |
| 15184 | } |
| 15185 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 15186 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 15187 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15188 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 15189 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15190 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15191 | { |
| 15192 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 15193 | we return error code at 'add_station()'. Hence we have this |
| 15194 | check again in addtion to add_station(). |
| 15195 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 15196 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15197 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15198 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15199 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 15200 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 15201 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 15202 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 15203 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15204 | } |
| 15205 | else |
| 15206 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15207 | /* maximum reached. tweak to send error code to peer and return |
| 15208 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15209 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15210 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15211 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 15212 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 15213 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 15214 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 15215 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15216 | /* fall through to send setup resp with failure status |
| 15217 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15218 | } |
| 15219 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 15220 | else |
| 15221 | { |
| 15222 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 15223 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15224 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 15225 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15226 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 15227 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 15228 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 15229 | return -EPERM; |
| 15230 | } |
| 15231 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15232 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15233 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 15234 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 15235 | "%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] | 15236 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 15237 | action_code, dialog_token, status_code, len); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15238 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 15239 | /*Except teardown responder will not be used so just make 0*/ |
| 15240 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 15241 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 15242 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 15243 | |
| 15244 | hddTdlsPeer_t *pTdlsPeer; |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 15245 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 15246 | |
| 15247 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 15248 | responder = pTdlsPeer->is_responder; |
| 15249 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 15250 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 15251 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 15252 | "%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] | 15253 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 15254 | dialog_token, status_code, len); |
| 15255 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 15256 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15257 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15258 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 15259 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 15260 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15261 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 15262 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 15263 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15264 | { |
| 15265 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 15266 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 15267 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 15268 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15269 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 15270 | if (status != VOS_STATUS_SUCCESS) { |
| 15271 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
| 15272 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15273 | } |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15274 | if (SIR_MAC_TDLS_DIS_REQ != action_code) { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 15275 | if (0 != wlan_hdd_tdls_set_cap(pAdapter, peer, eTDLS_CAP_SUPPORTED)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15276 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS capabilities")); |
| 15277 | } |
| 15278 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15279 | } |
| 15280 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15281 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 15282 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 15283 | { |
| 15284 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 15285 | "%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] | 15286 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 15287 | ret = -EBUSY; |
| 15288 | goto tx_failed; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15289 | } |
| 15290 | |
| 15291 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15292 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 15293 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 15294 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15295 | pAdapter->sessionId, peer, action_code, dialog_token, |
| 15296 | status_code, peer_capability, (tANI_U8 *)buf, len, |
| 15297 | responder); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15298 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15299 | if (VOS_STATUS_SUCCESS != status) |
| 15300 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15301 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15302 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15303 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 15304 | ret = -EINVAL; |
| 15305 | goto tx_failed; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15306 | } |
| 15307 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 15308 | if ((SIR_MAC_TDLS_DIS_REQ == action_code) || |
| 15309 | (SIR_MAC_TDLS_DIS_RSP == action_code)) |
| 15310 | { |
| 15311 | /* for DIS_REQ/DIS_RSP, supplicant don't consider the return status. |
| 15312 | * So we no need to wait for tdls_mgmt_comp for sending ack status. |
| 15313 | */ |
| 15314 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15315 | "%s: tx done for frm %u", __func__, action_code); |
| 15316 | return 0; |
| 15317 | } |
| 15318 | |
| 15319 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15320 | "%s: Wait for tdls_mgmt_comp. Timeout %u ms", __func__, |
| 15321 | WAIT_TIME_TDLS_MGMT); |
| 15322 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 15323 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 15324 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 15325 | |
| 15326 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15327 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 15328 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 15329 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 15330 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15331 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 15332 | |
| 15333 | if (pHddCtx->isLogpInProgress) |
| 15334 | { |
| 15335 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15336 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 15337 | return -EAGAIN; |
| 15338 | } |
| 15339 | |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 15340 | ret = -EINVAL; |
| 15341 | goto tx_failed; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15342 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 15343 | else |
| 15344 | { |
| 15345 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15346 | "%s: Mgmt Tx Completion status %ld TxCompletion %u", |
| 15347 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
| 15348 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15349 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 15350 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15351 | { |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 15352 | ret = max_sta_failed; |
| 15353 | goto tx_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15354 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15355 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 15356 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 15357 | { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 15358 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peer, TRUE)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15359 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 15360 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 15361 | } |
| 15362 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 15363 | { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 15364 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peer, FALSE)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15365 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 15366 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 15367 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15368 | |
| 15369 | return 0; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 15370 | |
| 15371 | tx_failed: |
| 15372 | /* add_station will be called before sending TDLS_SETUP_REQ and |
| 15373 | * TDLS_SETUP_RSP and as part of add_station driver will enable |
| 15374 | * BMPS. NL80211_TDLS_DISABLE_LINK will be called if the tx of |
| 15375 | * TDLS_SETUP_REQ or TDLS_SETUP_RSP fails. BMPS will be enabled |
| 15376 | * as part of processing NL80211_TDLS_DISABLE_LINK. So need to |
| 15377 | * enable BMPS for TDLS_SETUP_REQ and TDLS_SETUP_RSP if tx fails. |
| 15378 | */ |
| 15379 | |
| 15380 | if ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 15381 | (SIR_MAC_TDLS_SETUP_RSP == action_code)) |
| 15382 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 15383 | return ret; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15384 | } |
| 15385 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15386 | #if TDLS_MGMT_VERSION2 |
| 15387 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 15388 | u8 *peer, u8 action_code, u8 dialog_token, |
| 15389 | u16 status_code, u32 peer_capability, |
| 15390 | const u8 *buf, size_t len) |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 15391 | #else /* TDLS_MGMT_VERSION2 */ |
| 15392 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) |
| 15393 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 15394 | struct net_device *dev, |
| 15395 | const u8 *peer, u8 action_code, |
| 15396 | u8 dialog_token, u16 status_code, |
| 15397 | u32 peer_capability, bool initiator, |
| 15398 | const u8 *buf, size_t len) |
| 15399 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 15400 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 15401 | struct net_device *dev, |
| 15402 | const u8 *peer, u8 action_code, |
| 15403 | u8 dialog_token, u16 status_code, |
| 15404 | u32 peer_capability, const u8 *buf, |
| 15405 | size_t len) |
| 15406 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 15407 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 15408 | struct net_device *dev, |
| 15409 | u8 *peer, u8 action_code, |
| 15410 | u8 dialog_token, |
| 15411 | u16 status_code, u32 peer_capability, |
| 15412 | const u8 *buf, size_t len) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15413 | #else |
| 15414 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 15415 | u8 *peer, u8 action_code, u8 dialog_token, |
| 15416 | u16 status_code, const u8 *buf, size_t len) |
| 15417 | #endif |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 15418 | #endif |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15419 | { |
| 15420 | int ret; |
| 15421 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 15422 | vos_ssr_protect(__func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15423 | #if TDLS_MGMT_VERSION2 |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 15424 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 15425 | dialog_token, status_code, |
| 15426 | peer_capability, buf, len); |
| 15427 | #else /* TDLS_MGMT_VERSION2 */ |
| 15428 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS) |
| 15429 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 15430 | dialog_token, status_code, |
| 15431 | peer_capability, initiator, |
| 15432 | buf, len); |
| 15433 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) |
| 15434 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 15435 | dialog_token, status_code, |
| 15436 | peer_capability, buf, len); |
| 15437 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 15438 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 15439 | dialog_token, status_code, |
| 15440 | peer_capability, buf, len); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15441 | #else |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 15442 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 15443 | dialog_token, status_code, buf, len); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15444 | #endif |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 15445 | #endif |
| 15446 | vos_ssr_unprotect(__func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15447 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 15448 | return ret; |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15449 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15450 | |
| 15451 | int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 15452 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 15453 | const u8 *peer, |
| 15454 | #else |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15455 | u8 *peer, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 15456 | #endif |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15457 | tdls_req_params_t *tdls_peer_params, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15458 | cfg80211_exttdls_callback callback) |
| 15459 | { |
| 15460 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15461 | hddTdlsPeer_t *pTdlsPeer = NULL; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15462 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15463 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15464 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15465 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 15466 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15467 | |
| 15468 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 15469 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 15470 | |
| 15471 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15472 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 15473 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 15474 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15475 | return -ENOTSUPP; |
| 15476 | } |
| 15477 | |
| 15478 | /* To cater the requirement of establishing the TDLS link |
| 15479 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 15480 | */ |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 15481 | mutex_lock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15482 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 15483 | if (pTdlsPeer == NULL) { |
| 15484 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15485 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 15486 | __func__, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 15487 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15488 | return -EINVAL; |
| 15489 | } |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 15490 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15491 | |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 15492 | /* check FW TDLS Off Channel capability */ |
| 15493 | if ((TRUE == sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)) && |
Pradeep Reddy POTTETI | 0cb99bc | 2015-06-08 12:59:09 +0530 | [diff] [blame] | 15494 | (TRUE == pHddCtx->cfg_ini->fEnableTDLSOffChannel) && |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 15495 | (NULL != tdls_peer_params)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15496 | { |
| 15497 | pTdlsPeer->peerParams.channel = tdls_peer_params->channel; |
| 15498 | pTdlsPeer->peerParams.global_operating_class = |
| 15499 | tdls_peer_params->global_operating_class; |
| 15500 | pTdlsPeer->peerParams.max_latency_ms = tdls_peer_params->max_latency_ms; |
| 15501 | pTdlsPeer->peerParams.min_bandwidth_kbps = |
| 15502 | tdls_peer_params->min_bandwidth_kbps; |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15503 | /* check configured channel is valid, non dfs and |
| 15504 | * not current operating channel */ |
| 15505 | if ((sme_IsTdlsOffChannelValid(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15506 | tdls_peer_params->channel)) && |
| 15507 | (pHddStaCtx) && |
| 15508 | (tdls_peer_params->channel != |
| 15509 | pHddStaCtx->conn_info.operationChannel)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15510 | { |
| 15511 | pTdlsPeer->isOffChannelConfigured = TRUE; |
| 15512 | } |
| 15513 | else |
| 15514 | { |
| 15515 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 15516 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15517 | "%s: Configured Tdls Off Channel is not valid", __func__); |
| 15518 | |
| 15519 | } |
| 15520 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15521 | "%s: tdls_off_channel %d isOffChannelConfigured %d " |
| 15522 | "current operating channel %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15523 | __func__, pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 15524 | pTdlsPeer->isOffChannelConfigured, |
| 15525 | (pHddStaCtx ? pHddStaCtx->conn_info.operationChannel : 0)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15526 | } |
| 15527 | else |
| 15528 | { |
| 15529 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pradeep Reddy POTTETI | 0cb99bc | 2015-06-08 12:59:09 +0530 | [diff] [blame] | 15530 | "%s: TDLS off channel FW capability %d, " |
| 15531 | "host capab %d or Invalid TDLS Peer Params", __func__, |
| 15532 | sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL), |
| 15533 | pHddCtx->cfg_ini->fEnableTDLSOffChannel); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15534 | } |
| 15535 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15536 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 15537 | |
| 15538 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15539 | " %s TDLS Add Force Peer Failed", |
| 15540 | __func__); |
| 15541 | return -EINVAL; |
| 15542 | } |
| 15543 | /*EXT TDLS*/ |
| 15544 | |
| 15545 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) { |
| 15546 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15547 | " %s TDLS set callback Failed", |
| 15548 | __func__); |
| 15549 | return -EINVAL; |
| 15550 | } |
| 15551 | |
| 15552 | return(0); |
| 15553 | |
| 15554 | } |
| 15555 | |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 15556 | int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, |
| 15557 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 15558 | const u8 *peer |
| 15559 | #else |
| 15560 | u8 *peer |
| 15561 | #endif |
| 15562 | ) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15563 | { |
| 15564 | |
| 15565 | hddTdlsPeer_t *pTdlsPeer; |
| 15566 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15567 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15568 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 15569 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15570 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 15571 | if (0 != wlan_hdd_validate_context(pHddCtx)) { |
| 15572 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is NULL")); |
| 15573 | return -EINVAL; |
| 15574 | } |
| 15575 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15576 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 15577 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 15578 | |
| 15579 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15580 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 15581 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 15582 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15583 | return -ENOTSUPP; |
| 15584 | } |
| 15585 | |
| 15586 | |
| 15587 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 15588 | |
| 15589 | if ( NULL == pTdlsPeer ) { |
| 15590 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15591 | " peer not existing", |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15592 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15593 | return -EINVAL; |
| 15594 | } |
| 15595 | else { |
| 15596 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 15597 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15598 | /* if channel switch is configured, reset |
| 15599 | the channel for this peer */ |
| 15600 | if (TRUE == pTdlsPeer->isOffChannelConfigured) |
| 15601 | { |
| 15602 | pTdlsPeer->peerParams.channel = 0; |
| 15603 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 15604 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15605 | } |
| 15606 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15607 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) { |
| 15608 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set force peer")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15609 | return -EINVAL; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15610 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15611 | |
| 15612 | /*EXT TDLS*/ |
| 15613 | |
| 15614 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) { |
| 15615 | |
| 15616 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15617 | " %s TDLS set callback Failed", |
| 15618 | __func__); |
| 15619 | return -EINVAL; |
| 15620 | } |
| 15621 | return(0); |
| 15622 | |
| 15623 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15624 | static int __wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 15625 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 15626 | const u8 *peer, |
| 15627 | #else |
| 15628 | u8 *peer, |
| 15629 | #endif |
| 15630 | enum nl80211_tdls_operation oper) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15631 | { |
| 15632 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15633 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15634 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15635 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15636 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15637 | ENTER(); |
| 15638 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 15639 | if (!pAdapter) { |
| 15640 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 15641 | return -EINVAL; |
| 15642 | } |
| 15643 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15644 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15645 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 15646 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15647 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15648 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 15649 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 15650 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15651 | return -EINVAL; |
| 15652 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15653 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15654 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15655 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 15656 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15657 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 15658 | } |
| 15659 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15660 | |
| 15661 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15662 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15663 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 15664 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15665 | "TDLS Disabled in INI (%d) OR not enabled in FW (%d) " |
| 15666 | "Cannot process TDLS commands", |
| 15667 | pHddCtx->cfg_ini->fEnableTDLSSupport, |
| 15668 | sme_IsFeatureSupportedByFW(TDLS)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15669 | return -ENOTSUPP; |
| 15670 | } |
| 15671 | |
| 15672 | switch (oper) { |
| 15673 | case NL80211_TDLS_ENABLE_LINK: |
| 15674 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15675 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15676 | long ret; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15677 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15678 | WLAN_STADescType staDesc; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15679 | tANI_U16 numCurrTdlsPeers = 0; |
| 15680 | hddTdlsPeer_t *connPeer = NULL; |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15681 | tANI_U8 suppChannelLen = 0; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15682 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15683 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15684 | " %s : NL80211_TDLS_ENABLE_LINK for " MAC_ADDRESS_STR, |
| 15685 | __func__, MAC_ADDR_ARRAY(peer)); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15686 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15687 | memset(&staDesc, 0, sizeof(staDesc)); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15688 | if ( NULL == pTdlsPeer ) { |
| 15689 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 15690 | " (oper %d) not exsting. ignored", |
| 15691 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 15692 | return -EINVAL; |
| 15693 | } |
| 15694 | |
| 15695 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15696 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 15697 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 15698 | "NL80211_TDLS_ENABLE_LINK"); |
| 15699 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 15700 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 15701 | { |
| 15702 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 15703 | MAC_ADDRESS_STR " failed", |
| 15704 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 15705 | return -EINVAL; |
| 15706 | } |
| 15707 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 15708 | /* before starting tdls connection, set tdls |
| 15709 | * off channel established status to default value */ |
| 15710 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15711 | /* TDLS Off Channel, Disable tdls channel switch, |
| 15712 | when there are more than one tdls link */ |
| 15713 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 15714 | if (numCurrTdlsPeers == 2) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15715 | { |
| 15716 | /* get connected peer and send disable tdls off chan */ |
| 15717 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15718 | if ((connPeer) && |
| 15719 | (connPeer->isOffChannelSupported == TRUE) && |
| 15720 | (connPeer->isOffChannelConfigured == TRUE)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15721 | { |
| 15722 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15723 | "%s: More then one peer connected, Disable " |
| 15724 | "TDLS channel switch", __func__); |
| 15725 | |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15726 | connPeer->isOffChannelEstablished = FALSE; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15727 | ret = sme_SendTdlsChanSwitchReq( |
| 15728 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15729 | pAdapter->sessionId, |
| 15730 | connPeer->peerMac, |
| 15731 | connPeer->peerParams.channel, |
| 15732 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15733 | TDLS_CHANNEL_SWITCH_DISABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15734 | if (ret != VOS_STATUS_SUCCESS) { |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15735 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15736 | FL("Failed to send TDLS switch channel request")); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15737 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15738 | } |
| 15739 | else |
| 15740 | { |
| 15741 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15742 | "%s: No TDLS Connected Peer or " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15743 | "isOffChannelSupported %d " |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15744 | "isOffChannelConfigured %d", |
| 15745 | __func__, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15746 | (connPeer ? (connPeer->isOffChannelSupported) |
| 15747 | : -1), |
| 15748 | (connPeer ? (connPeer->isOffChannelConfigured) |
| 15749 | : -1)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15750 | } |
| 15751 | } |
| 15752 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15753 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15754 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15755 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 15756 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15757 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 15758 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15759 | 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] | 15760 | return -EINVAL; |
| 15761 | } |
| 15762 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15763 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15764 | ret = sme_SendTdlsLinkEstablishParams( |
| 15765 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15766 | pAdapter->sessionId, peer, |
| 15767 | &tdlsLinkEstablishParams); |
| 15768 | if (ret != VOS_STATUS_SUCCESS) { |
| 15769 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send link establishment params")); |
| 15770 | } |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15771 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 15772 | * register with the TL on after the response for this operation |
| 15773 | * is received . |
| 15774 | */ |
| 15775 | ret = wait_for_completion_interruptible_timeout( |
| 15776 | &pAdapter->tdls_link_establish_req_comp, |
| 15777 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 15778 | if (ret <= 0) |
| 15779 | { |
| 15780 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15781 | FL("Link Establish Request Failed Status %ld"), |
| 15782 | ret); |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15783 | return -EINVAL; |
| 15784 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15785 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15786 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 15787 | eTDLS_LINK_CONNECTED, |
| 15788 | eTDLS_LINK_SUCCESS); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15789 | staDesc.ucSTAId = pTdlsPeer->staId; |
| 15790 | staDesc.ucQosEnabled = tdlsLinkEstablishParams.qos; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15791 | ret = WLANTL_UpdateTdlsSTAClient( |
| 15792 | pHddCtx->pvosContext, |
| 15793 | &staDesc); |
| 15794 | if (ret != VOS_STATUS_SUCCESS) { |
| 15795 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to update TDLS STA params")); |
| 15796 | } |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15797 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 15798 | /* Mark TDLS client Authenticated .*/ |
| 15799 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 15800 | pTdlsPeer->staId, |
| 15801 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 15802 | if (VOS_STATUS_SUCCESS == status) |
| 15803 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15804 | if (pTdlsPeer->is_responder == 0) |
| 15805 | { |
| 15806 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 15807 | |
| 15808 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 15809 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 15810 | WAIT_TIME_TDLS_INITIATOR); |
| 15811 | /* suspend initiator TX until it receives direct packet from the |
| 15812 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15813 | ret = WLANTL_SuspendDataTx( |
| 15814 | (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 15815 | &staId, NULL); |
| 15816 | if (ret != VOS_STATUS_SUCCESS) { |
| 15817 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to suspend data tx")); |
| 15818 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15819 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15820 | |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15821 | if ((TRUE == pTdlsPeer->isOffChannelSupported) && |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15822 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15823 | { |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15824 | suppChannelLen = |
| 15825 | tdlsLinkEstablishParams.supportedChannelsLen; |
| 15826 | |
| 15827 | if ((suppChannelLen > 0) && |
| 15828 | (suppChannelLen <= SIR_MAC_MAX_SUPP_CHANNELS)) |
| 15829 | { |
| 15830 | tANI_U8 suppPeerChannel = 0; |
| 15831 | int i = 0; |
| 15832 | for (i = 0U; i < suppChannelLen; i++) |
| 15833 | { |
| 15834 | suppPeerChannel = |
| 15835 | tdlsLinkEstablishParams.supportedChannels[i]; |
| 15836 | |
| 15837 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 15838 | if (suppPeerChannel == |
| 15839 | pTdlsPeer->peerParams.channel) |
| 15840 | { |
| 15841 | pTdlsPeer->isOffChannelSupported = TRUE; |
| 15842 | break; |
| 15843 | } |
| 15844 | } |
| 15845 | } |
| 15846 | else |
| 15847 | { |
| 15848 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 15849 | } |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15850 | } |
| 15851 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15852 | "%s: TDLS channel switch request for channel " |
| 15853 | "%d isOffChannelConfigured %d suppChannelLen " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15854 | "%d isOffChannelSupported %d", __func__, |
| 15855 | pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15856 | pTdlsPeer->isOffChannelConfigured, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 15857 | suppChannelLen, |
| 15858 | pTdlsPeer->isOffChannelSupported); |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 15859 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15860 | /* TDLS Off Channel, Enable tdls channel switch, |
| 15861 | when their is only one tdls link and it supports */ |
| 15862 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15863 | if ((numCurrTdlsPeers == 1) && |
| 15864 | (TRUE == pTdlsPeer->isOffChannelSupported) && |
| 15865 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
| 15866 | { |
| 15867 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15868 | "%s: Send TDLS channel switch request for channel %d", |
| 15869 | __func__, pTdlsPeer->peerParams.channel); |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15870 | |
| 15871 | pTdlsPeer->isOffChannelEstablished = TRUE; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15872 | ret = sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15873 | pAdapter->sessionId, |
| 15874 | pTdlsPeer->peerMac, |
| 15875 | pTdlsPeer->peerParams.channel, |
| 15876 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15877 | TDLS_CHANNEL_SWITCH_ENABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15878 | if (ret != VOS_STATUS_SUCCESS) { |
| 15879 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS offchannel: Failed to send TDLS switch channel req")); |
| 15880 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15881 | } |
| 15882 | else |
| 15883 | { |
| 15884 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15885 | "%s: TDLS channel switch request not sent" |
| 15886 | " numCurrTdlsPeers %d " |
| 15887 | "isOffChannelSupported %d " |
| 15888 | "isOffChannelConfigured %d", |
| 15889 | __func__, numCurrTdlsPeers, |
| 15890 | pTdlsPeer->isOffChannelSupported, |
| 15891 | pTdlsPeer->isOffChannelConfigured); |
| 15892 | } |
| 15893 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 15894 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15895 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15896 | |
| 15897 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15898 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 15899 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15900 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15901 | int ac; |
| 15902 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 15903 | WLANTL_AC_VI, |
| 15904 | WLANTL_AC_BK, |
| 15905 | WLANTL_AC_BE }; |
| 15906 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 15907 | for(ac=0; ac < 4; ac++) |
| 15908 | { |
| 15909 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 15910 | pTdlsPeer->staId, ucAc[ac], |
| 15911 | tlTid[ac], tlTid[ac], 0, 0, |
| 15912 | WLANTL_BI_DIR ); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15913 | if (status != VOS_STATUS_SUCCESS) { |
| 15914 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to enable UAPSD for AC")); |
| 15915 | } |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15916 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15917 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15918 | } |
| 15919 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15920 | } |
| 15921 | break; |
| 15922 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15923 | { |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15924 | tANI_U16 numCurrTdlsPeers = 0; |
| 15925 | hddTdlsPeer_t *connPeer = NULL; |
| 15926 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15927 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15928 | " %s : NL80211_TDLS_DISABLE_LINK for " MAC_ADDRESS_STR, |
| 15929 | __func__, MAC_ADDR_ARRAY(peer)); |
| 15930 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15931 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 15932 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 15933 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15934 | if ( NULL == pTdlsPeer ) { |
| 15935 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 15936 | " (oper %d) not exsting. ignored", |
| 15937 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 15938 | return -EINVAL; |
| 15939 | } |
| 15940 | |
| 15941 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15942 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 15943 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 15944 | "NL80211_TDLS_DISABLE_LINK"); |
| 15945 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15946 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15947 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15948 | long status; |
| 15949 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 15950 | /* set tdls off channel status to false for this peer */ |
| 15951 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 15952 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 15953 | eTDLS_LINK_TEARING, |
| 15954 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 15955 | eTDLS_LINK_UNSPECIFIED: |
| 15956 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15957 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 15958 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15959 | status = sme_DeleteTdlsPeerSta( |
| 15960 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15961 | pAdapter->sessionId, peer ); |
| 15962 | if (status != VOS_STATUS_SUCCESS) { |
| 15963 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 15964 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15965 | |
| 15966 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 15967 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 15968 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
Atul Mittal | 454664b | 2014-10-10 11:03:46 +0530 | [diff] [blame] | 15969 | eTDLS_LINK_IDLE, |
| 15970 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15971 | if (status <= 0) |
| 15972 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15973 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15974 | "%s: Del station failed status %ld", |
| 15975 | __func__, status); |
| 15976 | return -EPERM; |
| 15977 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15978 | |
| 15979 | /* TDLS Off Channel, Enable tdls channel switch, |
| 15980 | when their is only one tdls link and it supports */ |
| 15981 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15982 | if (numCurrTdlsPeers == 1) |
| 15983 | { |
| 15984 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
| 15985 | if ((connPeer) && |
| 15986 | (connPeer->isOffChannelSupported == TRUE) && |
| 15987 | (connPeer->isOffChannelConfigured == TRUE)) |
| 15988 | { |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 15989 | connPeer->isOffChannelEstablished = TRUE; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15990 | status = sme_SendTdlsChanSwitchReq( |
| 15991 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15992 | pAdapter->sessionId, |
| 15993 | connPeer->peerMac, |
| 15994 | connPeer->peerParams.channel, |
| 15995 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15996 | TDLS_CHANNEL_SWITCH_ENABLE); |
| 15997 | if (status != VOS_STATUS_SUCCESS) { |
| 15998 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel req")); |
| 15999 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 16000 | } |
| 16001 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16002 | "%s: TDLS channel switch " |
| 16003 | "isOffChannelSupported %d " |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 16004 | "isOffChannelConfigured %d " |
| 16005 | "isOffChannelEstablished %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 16006 | __func__, |
| 16007 | (connPeer ? connPeer->isOffChannelSupported : -1), |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 16008 | (connPeer ? connPeer->isOffChannelConfigured : -1), |
| 16009 | (connPeer ? connPeer->isOffChannelEstablished : -1)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 16010 | } |
| 16011 | else |
| 16012 | { |
| 16013 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16014 | "%s: TDLS channel switch request not sent " |
| 16015 | "numCurrTdlsPeers %d ", |
| 16016 | __func__, numCurrTdlsPeers); |
| 16017 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 16018 | } |
| 16019 | else |
| 16020 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 16021 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16022 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 16023 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 16024 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 16025 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16026 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 16027 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 16028 | status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 16029 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 16030 | if (0 != status) |
| 16031 | { |
| 16032 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 16033 | FL("Error in TDLS Teardown")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 16034 | return status; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 16035 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 16036 | break; |
| 16037 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16038 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 16039 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 16040 | status = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 16041 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 16042 | NULL, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 16043 | NULL); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 16044 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 16045 | if (0 != status) |
| 16046 | { |
| 16047 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 16048 | FL("Error in TDLS Setup")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 16049 | return status; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 16050 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 16051 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 16052 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16053 | case NL80211_TDLS_DISCOVERY_REQ: |
| 16054 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 16055 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 16056 | "%s: Driver doesn't support in-driver setup/teardown/discovery " |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 16057 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16058 | return -ENOTSUPP; |
| 16059 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 16060 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16061 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16062 | return -ENOTSUPP; |
| 16063 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16064 | |
| 16065 | EXIT(); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16066 | return 0; |
| 16067 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 16068 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16069 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 16070 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 16071 | const u8 *peer, |
| 16072 | #else |
| 16073 | u8 *peer, |
| 16074 | #endif |
| 16075 | enum nl80211_tdls_operation oper) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16076 | { |
| 16077 | int ret; |
| 16078 | |
| 16079 | vos_ssr_protect(__func__); |
| 16080 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 16081 | vos_ssr_unprotect(__func__); |
| 16082 | |
| 16083 | return ret; |
| 16084 | } |
| 16085 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 16086 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 16087 | struct net_device *dev, u8 *peer) |
| 16088 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 16089 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 16090 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 16091 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 16092 | |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 16093 | #if TDLS_MGMT_VERSION2 |
| 16094 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 16095 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 16096 | #else |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 16097 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) |
| 16098 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 16099 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, 0, NULL, 0); |
| 16100 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 16101 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 16102 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 16103 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 16104 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 16105 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 16106 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 16107 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 16108 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 16109 | #endif |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 16110 | #endif /* KERNEL_VERSION */ |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 16111 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16112 | #endif |
| 16113 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16114 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 16115 | /* |
| 16116 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 16117 | * Callback rountine called upon receiving response for |
| 16118 | * get offload info |
| 16119 | */ |
| 16120 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 16121 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 16122 | { |
| 16123 | |
| 16124 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 16125 | tANI_U8 tempReplayCounter[8]; |
| 16126 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16127 | |
| 16128 | ENTER(); |
| 16129 | |
| 16130 | if (NULL == pAdapter) |
| 16131 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 16132 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16133 | "%s: HDD adapter is Null", __func__); |
| 16134 | return ; |
| 16135 | } |
| 16136 | |
| 16137 | if (NULL == pGtkOffloadGetInfoRsp) |
| 16138 | { |
| 16139 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16140 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 16141 | return ; |
| 16142 | } |
| 16143 | |
| 16144 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 16145 | { |
| 16146 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16147 | "%s: wlan Failed to get replay counter value", |
| 16148 | __func__); |
| 16149 | return ; |
| 16150 | } |
| 16151 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 16152 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 16153 | /* Update replay counter */ |
| 16154 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 16155 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 16156 | |
| 16157 | { |
| 16158 | /* changing from little to big endian since supplicant |
| 16159 | * works on big endian format |
| 16160 | */ |
| 16161 | int i; |
| 16162 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 16163 | |
| 16164 | for (i = 0; i < 8; i++) |
| 16165 | { |
| 16166 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 16167 | } |
| 16168 | } |
| 16169 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16170 | /* Update replay counter to NL */ |
| 16171 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 16172 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16173 | } |
| 16174 | |
| 16175 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16176 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16177 | * This function is used to offload GTK rekeying job to the firmware. |
| 16178 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16179 | 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] | 16180 | struct cfg80211_gtk_rekey_data *data) |
| 16181 | { |
| 16182 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16183 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 16184 | hdd_station_ctx_t *pHddStaCtx; |
| 16185 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16186 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 16187 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16188 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 16189 | |
| 16190 | ENTER(); |
| 16191 | |
| 16192 | if (NULL == pAdapter) |
| 16193 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 16194 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16195 | "%s: HDD adapter is Null", __func__); |
| 16196 | return -ENODEV; |
| 16197 | } |
| 16198 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16199 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16200 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 16201 | pAdapter->sessionId, pAdapter->device_mode)); |
| 16202 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16203 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16204 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16205 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16206 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16207 | } |
| 16208 | |
| 16209 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 16210 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16211 | if (NULL == hHal) |
| 16212 | { |
| 16213 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16214 | "%s: HAL context is Null!!!", __func__); |
| 16215 | return -EAGAIN; |
| 16216 | } |
| 16217 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 16218 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 16219 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 16220 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 16221 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16222 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 16223 | { |
| 16224 | /* changing from big to little endian since driver |
| 16225 | * works on little endian format |
| 16226 | */ |
| 16227 | tANI_U8 *p = |
| 16228 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 16229 | int i; |
| 16230 | |
| 16231 | for (i = 0; i < 8; i++) |
| 16232 | { |
| 16233 | p[7-i] = data->replay_ctr[i]; |
| 16234 | } |
| 16235 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16236 | |
| 16237 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 16238 | { |
| 16239 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 16240 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 16241 | sizeof (tSirGtkOffloadParams)); |
| 16242 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16243 | pAdapter->sessionId); |
| 16244 | |
| 16245 | if (eHAL_STATUS_SUCCESS != status) |
| 16246 | { |
| 16247 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16248 | "%s: sme_SetGTKOffload failed, returned %d", |
| 16249 | __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 16250 | |
| 16251 | /* Need to clear any trace of key value in the memory. |
| 16252 | * Thus zero out the memory even though it is local |
| 16253 | * variable. |
| 16254 | */ |
| 16255 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 16256 | sizeof(hddGtkOffloadReqParams)); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16257 | return status; |
| 16258 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16259 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16260 | "%s: sme_SetGTKOffload successfull", __func__); |
| 16261 | } |
| 16262 | else |
| 16263 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16264 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16265 | "%s: wlan not suspended GTKOffload request is stored", |
| 16266 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16267 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 16268 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 16269 | /* Need to clear any trace of key value in the memory. |
| 16270 | * Thus zero out the memory even though it is local |
| 16271 | * variable. |
| 16272 | */ |
| 16273 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 16274 | sizeof(hddGtkOffloadReqParams)); |
| 16275 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16276 | EXIT(); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 16277 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16278 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16279 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16280 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 16281 | struct cfg80211_gtk_rekey_data *data) |
| 16282 | { |
| 16283 | int ret; |
| 16284 | |
| 16285 | vos_ssr_protect(__func__); |
| 16286 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 16287 | vos_ssr_unprotect(__func__); |
| 16288 | |
| 16289 | return ret; |
| 16290 | } |
| 16291 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16292 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16293 | * FUNCTION: __wlan_hdd_cfg80211_set_mac_acl |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16294 | * This function is used to set access control policy |
| 16295 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16296 | static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 16297 | struct net_device *dev, |
| 16298 | const struct cfg80211_acl_data *params) |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16299 | { |
| 16300 | int i; |
| 16301 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16302 | hdd_hostapd_state_t *pHostapdState; |
| 16303 | tsap_Config_t *pConfig; |
| 16304 | v_CONTEXT_t pVosContext = NULL; |
| 16305 | hdd_context_t *pHddCtx; |
| 16306 | int status; |
| 16307 | |
| 16308 | ENTER(); |
| 16309 | |
| 16310 | if (NULL == pAdapter) |
| 16311 | { |
| 16312 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 16313 | "%s: HDD adapter is Null", __func__); |
| 16314 | return -ENODEV; |
| 16315 | } |
| 16316 | |
| 16317 | if (NULL == params) |
| 16318 | { |
| 16319 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 16320 | "%s: params is Null", __func__); |
| 16321 | return -EINVAL; |
| 16322 | } |
| 16323 | |
| 16324 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16325 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16326 | if (0 != status) |
| 16327 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16328 | return status; |
| 16329 | } |
| 16330 | |
| 16331 | pVosContext = pHddCtx->pvosContext; |
| 16332 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 16333 | |
| 16334 | if (NULL == pHostapdState) |
| 16335 | { |
| 16336 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 16337 | "%s: pHostapdState is Null", __func__); |
| 16338 | return -EINVAL; |
| 16339 | } |
| 16340 | |
| 16341 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 16342 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 16343 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16344 | TRACE_CODE_HDD_CFG80211_SET_MAC_ACL, |
| 16345 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16346 | |
| 16347 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 16348 | { |
| 16349 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 16350 | |
| 16351 | /* default value */ |
| 16352 | pConfig->num_accept_mac = 0; |
| 16353 | pConfig->num_deny_mac = 0; |
| 16354 | |
| 16355 | /** |
| 16356 | * access control policy |
| 16357 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 16358 | * listed in hostapd.deny file. |
| 16359 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 16360 | * listed in hostapd.accept file. |
| 16361 | */ |
| 16362 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 16363 | { |
| 16364 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 16365 | } |
| 16366 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 16367 | { |
| 16368 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 16369 | } |
| 16370 | else |
| 16371 | { |
| 16372 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16373 | "%s:Acl Policy : %d is not supported", |
| 16374 | __func__, params->acl_policy); |
| 16375 | return -ENOTSUPP; |
| 16376 | } |
| 16377 | |
| 16378 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 16379 | { |
| 16380 | pConfig->num_accept_mac = params->n_acl_entries; |
| 16381 | for (i = 0; i < params->n_acl_entries; i++) |
| 16382 | { |
| 16383 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16384 | "** Add ACL MAC entry %i in WhiletList :" |
| 16385 | MAC_ADDRESS_STR, i, |
| 16386 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 16387 | |
| 16388 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 16389 | sizeof(qcmacaddr)); |
| 16390 | } |
| 16391 | } |
| 16392 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 16393 | { |
| 16394 | pConfig->num_deny_mac = params->n_acl_entries; |
| 16395 | for (i = 0; i < params->n_acl_entries; i++) |
| 16396 | { |
| 16397 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16398 | "** Add ACL MAC entry %i in BlackList :" |
| 16399 | MAC_ADDRESS_STR, i, |
| 16400 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 16401 | |
| 16402 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 16403 | sizeof(qcmacaddr)); |
| 16404 | } |
| 16405 | } |
| 16406 | |
| 16407 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 16408 | { |
| 16409 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16410 | "%s: SAP Set Mac Acl fail", __func__); |
| 16411 | return -EINVAL; |
| 16412 | } |
| 16413 | } |
| 16414 | else |
| 16415 | { |
| 16416 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 16417 | "%s: Invalid device_mode = %s (%d)", |
| 16418 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 16419 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16420 | return -EINVAL; |
| 16421 | } |
| 16422 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16423 | EXIT(); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16424 | return 0; |
| 16425 | } |
| 16426 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16427 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 16428 | struct net_device *dev, |
| 16429 | const struct cfg80211_acl_data *params) |
| 16430 | { |
| 16431 | int ret; |
| 16432 | vos_ssr_protect(__func__); |
| 16433 | ret = __wlan_hdd_cfg80211_set_mac_acl(wiphy, dev, params); |
| 16434 | vos_ssr_unprotect(__func__); |
| 16435 | |
| 16436 | return ret; |
| 16437 | } |
| 16438 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16439 | #ifdef WLAN_NL80211_TESTMODE |
| 16440 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16441 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16442 | ( |
| 16443 | void *pAdapter, |
| 16444 | void *indCont |
| 16445 | ) |
| 16446 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16447 | tSirLPHBInd *lphbInd; |
| 16448 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 16449 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16450 | |
| 16451 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16452 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16453 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 16454 | if (pAdapter == NULL) |
| 16455 | { |
| 16456 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16457 | "%s: pAdapter is NULL\n",__func__); |
| 16458 | return; |
| 16459 | } |
| 16460 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16461 | if (NULL == indCont) |
| 16462 | { |
| 16463 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16464 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16465 | return; |
| 16466 | } |
| 16467 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 16468 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16469 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16470 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 16471 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16472 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16473 | GFP_ATOMIC); |
| 16474 | if (!skb) |
| 16475 | { |
| 16476 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16477 | "LPHB timeout, NL buffer alloc fail"); |
| 16478 | return; |
| 16479 | } |
| 16480 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 16481 | 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] | 16482 | { |
| 16483 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16484 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 16485 | goto nla_put_failure; |
| 16486 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 16487 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16488 | { |
| 16489 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16490 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 16491 | goto nla_put_failure; |
| 16492 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 16493 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16494 | sizeof(tSirLPHBInd), lphbInd)) |
| 16495 | { |
| 16496 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16497 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 16498 | goto nla_put_failure; |
| 16499 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16500 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 16501 | return; |
| 16502 | |
| 16503 | nla_put_failure: |
| 16504 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16505 | "NLA Put fail"); |
| 16506 | kfree_skb(skb); |
| 16507 | |
| 16508 | return; |
| 16509 | } |
| 16510 | #endif /* FEATURE_WLAN_LPHB */ |
| 16511 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16512 | 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] | 16513 | { |
| 16514 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 16515 | int err = 0; |
| 16516 | #ifdef FEATURE_WLAN_LPHB |
| 16517 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16518 | eHalStatus smeStatus; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16519 | |
| 16520 | ENTER(); |
| 16521 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16522 | err = wlan_hdd_validate_context(pHddCtx); |
| 16523 | if (0 != err) |
| 16524 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16525 | return err; |
| 16526 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16527 | #endif /* FEATURE_WLAN_LPHB */ |
| 16528 | |
| 16529 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 16530 | if (err) |
| 16531 | { |
| 16532 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16533 | "%s Testmode INV ATTR", __func__); |
| 16534 | return err; |
| 16535 | } |
| 16536 | |
| 16537 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 16538 | { |
| 16539 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16540 | "%s Testmode INV CMD", __func__); |
| 16541 | return -EINVAL; |
| 16542 | } |
| 16543 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 16544 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16545 | TRACE_CODE_HDD_CFG80211_TESTMODE, |
| 16546 | NO_SESSION, nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD]))); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16547 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 16548 | { |
| 16549 | #ifdef FEATURE_WLAN_LPHB |
| 16550 | /* Low Power Heartbeat configuration request */ |
| 16551 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 16552 | { |
| 16553 | int buf_len; |
| 16554 | void *buf; |
| 16555 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 16556 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16557 | |
| 16558 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 16559 | { |
| 16560 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16561 | "%s Testmode INV DATA", __func__); |
| 16562 | return -EINVAL; |
| 16563 | } |
| 16564 | |
| 16565 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 16566 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 16567 | |
| 16568 | hb_params_temp =(tSirLPHBReq *)buf; |
| 16569 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 16570 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 16571 | return -EINVAL; |
| 16572 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16573 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 16574 | if (NULL == hb_params) |
| 16575 | { |
| 16576 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16577 | "%s Request Buffer Alloc Fail", __func__); |
| 16578 | return -EINVAL; |
| 16579 | } |
| 16580 | |
| 16581 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16582 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 16583 | hb_params, |
| 16584 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 16585 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16586 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 16587 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16588 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16589 | vos_mem_free(hb_params); |
| 16590 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16591 | return 0; |
| 16592 | } |
| 16593 | #endif /* FEATURE_WLAN_LPHB */ |
| 16594 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 16595 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16596 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16597 | return -EOPNOTSUPP; |
| 16598 | } |
| 16599 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16600 | EXIT(); |
| 16601 | return err; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16602 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16603 | |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 16604 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, |
| 16605 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) |
| 16606 | struct wireless_dev *wdev, |
| 16607 | #endif |
| 16608 | void *data, int len) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16609 | { |
| 16610 | int ret; |
| 16611 | |
| 16612 | vos_ssr_protect(__func__); |
| 16613 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 16614 | vos_ssr_unprotect(__func__); |
| 16615 | |
| 16616 | return ret; |
| 16617 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16618 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 16619 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16620 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16621 | struct net_device *dev, |
| 16622 | int idx, struct survey_info *survey) |
| 16623 | { |
| 16624 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16625 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16626 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16627 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16628 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16629 | v_S7_t snr,rssi; |
| 16630 | int status, i, j, filled = 0; |
| 16631 | |
| 16632 | ENTER(); |
| 16633 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16634 | if (NULL == pAdapter) |
| 16635 | { |
| 16636 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 16637 | "%s: HDD adapter is Null", __func__); |
| 16638 | return -ENODEV; |
| 16639 | } |
| 16640 | |
| 16641 | if (NULL == wiphy) |
| 16642 | { |
| 16643 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 16644 | "%s: wiphy is Null", __func__); |
| 16645 | return -ENODEV; |
| 16646 | } |
| 16647 | |
| 16648 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16649 | status = wlan_hdd_validate_context(pHddCtx); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16650 | if (0 != status) |
| 16651 | { |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16652 | return status; |
| 16653 | } |
| 16654 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16655 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 16656 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16657 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 16658 | 0 != pAdapter->survey_idx || |
| 16659 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16660 | { |
| 16661 | /* The survey dump ops when implemented completely is expected to |
| 16662 | * return a survey of all channels and the ops is called by the |
| 16663 | * kernel with incremental values of the argument 'idx' till it |
| 16664 | * returns -ENONET. But we can only support the survey for the |
| 16665 | * operating channel for now. survey_idx is used to track |
| 16666 | * that the ops is called only once and then return -ENONET for |
| 16667 | * the next iteration |
| 16668 | */ |
| 16669 | pAdapter->survey_idx = 0; |
| 16670 | return -ENONET; |
| 16671 | } |
| 16672 | |
Mukul Sharma | 9d5233b | 2015-06-11 20:28:20 +0530 | [diff] [blame] | 16673 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 16674 | { |
| 16675 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16676 | "%s: Roaming in progress, hence return ", __func__); |
| 16677 | return -ENONET; |
| 16678 | } |
| 16679 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16680 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16681 | |
| 16682 | wlan_hdd_get_snr(pAdapter, &snr); |
| 16683 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 16684 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 16685 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16686 | TRACE_CODE_HDD_CFG80211_DUMP_SURVEY, |
| 16687 | pAdapter->sessionId, pAdapter->device_mode)); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16688 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 16689 | hdd_wlan_get_freq(channel, &freq); |
| 16690 | |
| 16691 | |
| 16692 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 16693 | { |
| 16694 | if (NULL == wiphy->bands[i]) |
| 16695 | { |
| 16696 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 16697 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 16698 | continue; |
| 16699 | } |
| 16700 | |
| 16701 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 16702 | { |
| 16703 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 16704 | |
| 16705 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 16706 | { |
| 16707 | survey->channel = &band->channels[j]; |
| 16708 | /* The Rx BDs contain SNR values in dB for the received frames |
| 16709 | * while the supplicant expects noise. So we calculate and |
| 16710 | * return the value of noise (dBm) |
| 16711 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 16712 | */ |
| 16713 | survey->noise = rssi - snr; |
| 16714 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 16715 | filled = 1; |
| 16716 | } |
| 16717 | } |
| 16718 | } |
| 16719 | |
| 16720 | if (filled) |
| 16721 | pAdapter->survey_idx = 1; |
| 16722 | else |
| 16723 | { |
| 16724 | pAdapter->survey_idx = 0; |
| 16725 | return -ENONET; |
| 16726 | } |
| 16727 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16728 | EXIT(); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16729 | return 0; |
| 16730 | } |
| 16731 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16732 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 16733 | struct net_device *dev, |
| 16734 | int idx, struct survey_info *survey) |
| 16735 | { |
| 16736 | int ret; |
| 16737 | |
| 16738 | vos_ssr_protect(__func__); |
| 16739 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 16740 | vos_ssr_unprotect(__func__); |
| 16741 | |
| 16742 | return ret; |
| 16743 | } |
| 16744 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16745 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16746 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16747 | * this is called when cfg80211 driver resume |
| 16748 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 16749 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16750 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16751 | { |
| 16752 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 16753 | hdd_adapter_t *pAdapter; |
| 16754 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 16755 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 16756 | |
| 16757 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16758 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16759 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16760 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16761 | return 0; |
| 16762 | } |
| 16763 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 16764 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_CFG80211_RESUME_WLAN, |
| 16765 | NO_SESSION, pHddCtx->isWiphySuspended)); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16766 | spin_lock(&pHddCtx->schedScan_lock); |
| 16767 | pHddCtx->isWiphySuspended = FALSE; |
| 16768 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 16769 | { |
| 16770 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16771 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16772 | "%s: Return resume is not due to PNO indication", __func__); |
| 16773 | return 0; |
| 16774 | } |
| 16775 | // Reset flag to avoid updatating cfg80211 data old results again |
| 16776 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 16777 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16778 | |
| 16779 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 16780 | |
| 16781 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 16782 | { |
| 16783 | pAdapter = pAdapterNode->pAdapter; |
| 16784 | if ( (NULL != pAdapter) && |
| 16785 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 16786 | { |
| 16787 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16788 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16789 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 16790 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16791 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16792 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16793 | { |
| 16794 | /* Acquire wakelock to handle the case where APP's tries to |
| 16795 | * suspend immediately after updating the scan results. Whis |
| 16796 | * results in app's is in suspended state and not able to |
| 16797 | * process the connect request to AP |
| 16798 | */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 16799 | hdd_prevent_suspend_timeout(2000, |
| 16800 | WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16801 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16802 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16803 | |
| 16804 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16805 | "%s : cfg80211 scan result database updated", __func__); |
| 16806 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16807 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16808 | return 0; |
| 16809 | |
| 16810 | } |
| 16811 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 16812 | pAdapterNode = pNext; |
| 16813 | } |
| 16814 | |
| 16815 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16816 | "%s: Failed to find Adapter", __func__); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16817 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16818 | return 0; |
| 16819 | } |
| 16820 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16821 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 16822 | { |
| 16823 | int ret; |
| 16824 | |
| 16825 | vos_ssr_protect(__func__); |
| 16826 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 16827 | vos_ssr_unprotect(__func__); |
| 16828 | |
| 16829 | return ret; |
| 16830 | } |
| 16831 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16832 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16833 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16834 | * this is called when cfg80211 driver suspends |
| 16835 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16836 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16837 | struct cfg80211_wowlan *wow) |
| 16838 | { |
| 16839 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16840 | int ret = 0; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16841 | |
| 16842 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16843 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16844 | ret = wlan_hdd_validate_context(pHddCtx); |
| 16845 | if (0 != ret) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16846 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16847 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16848 | } |
| 16849 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16850 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 16851 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16852 | TRACE_CODE_HDD_CFG80211_SUSPEND_WLAN, |
| 16853 | NO_SESSION, pHddCtx->isWiphySuspended)); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16854 | pHddCtx->isWiphySuspended = TRUE; |
| 16855 | |
| 16856 | EXIT(); |
| 16857 | |
| 16858 | return 0; |
| 16859 | } |
| 16860 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16861 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 16862 | struct cfg80211_wowlan *wow) |
| 16863 | { |
| 16864 | int ret; |
| 16865 | |
| 16866 | vos_ssr_protect(__func__); |
| 16867 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 16868 | vos_ssr_unprotect(__func__); |
| 16869 | |
| 16870 | return ret; |
| 16871 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16872 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16873 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16874 | { |
| 16875 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 16876 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 16877 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 16878 | .change_station = wlan_hdd_change_station, |
| 16879 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 16880 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 16881 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 16882 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16883 | #else |
| 16884 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 16885 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 16886 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16887 | #endif |
| 16888 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 16889 | .add_key = wlan_hdd_cfg80211_add_key, |
| 16890 | .get_key = wlan_hdd_cfg80211_get_key, |
| 16891 | .del_key = wlan_hdd_cfg80211_del_key, |
| 16892 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 16893 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16894 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 16895 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16896 | .scan = wlan_hdd_cfg80211_scan, |
| 16897 | .connect = wlan_hdd_cfg80211_connect, |
| 16898 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 16899 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 16900 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 16901 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 16902 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 16903 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16904 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 16905 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 16906 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16907 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 16908 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 16909 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 16910 | .set_txq_params = wlan_hdd_set_txq_params, |
| 16911 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16912 | .get_station = wlan_hdd_cfg80211_get_station, |
| 16913 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 16914 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16915 | .add_station = wlan_hdd_cfg80211_add_station, |
| 16916 | #ifdef FEATURE_WLAN_LFR |
| 16917 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 16918 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 16919 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 16920 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16921 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 16922 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 16923 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16924 | #ifdef FEATURE_WLAN_TDLS |
| 16925 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 16926 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 16927 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16928 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 16929 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 16930 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16931 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 16932 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 16933 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 16934 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16935 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 16936 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16937 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16938 | #ifdef WLAN_NL80211_TESTMODE |
| 16939 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 16940 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16941 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16942 | }; |
| 16943 | |