Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 26 | * |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame] | 27 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 28 | |
| 29 | |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 30 | |
| 31 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 32 | /**======================================================================== |
| 33 | |
| 34 | \file wlan_hdd_cfg80211.c |
| 35 | |
| 36 | \brief WLAN Host Device Driver implementation |
| 37 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 38 | ========================================================================*/ |
| 39 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 40 | /**========================================================================= |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 41 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 42 | EDIT HISTORY FOR FILE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 43 | |
| 44 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 45 | This section contains comments describing changes made to the module. |
| 46 | Notice that changes are listed in reverse chronological order. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 47 | |
| 48 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 49 | $Header:$ $DateTime: $ $Author: $ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 50 | |
| 51 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 52 | when who what, where, why |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 53 | -------- --- -------------------------------------------------------- |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 54 | 21/12/09 Ashwani Created module. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 55 | |
| 56 | 07/06/10 Kumar Deepak Implemented cfg80211 callbacks for ANDROID |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 57 | Ganesh K |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 58 | ==========================================================================*/ |
| 59 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 60 | |
| 61 | #include <linux/version.h> |
| 62 | #include <linux/module.h> |
| 63 | #include <linux/kernel.h> |
| 64 | #include <linux/init.h> |
| 65 | #include <linux/wireless.h> |
| 66 | #include <wlan_hdd_includes.h> |
| 67 | #include <net/arp.h> |
| 68 | #include <net/cfg80211.h> |
| 69 | #include <linux/wireless.h> |
| 70 | #include <wlan_hdd_wowl.h> |
| 71 | #include <aniGlobal.h> |
| 72 | #include "ccmApi.h" |
| 73 | #include "sirParams.h" |
| 74 | #include "dot11f.h" |
| 75 | #include "wlan_hdd_assoc.h" |
| 76 | #include "wlan_hdd_wext.h" |
| 77 | #include "sme_Api.h" |
| 78 | #include "wlan_hdd_p2p.h" |
| 79 | #include "wlan_hdd_cfg80211.h" |
| 80 | #include "wlan_hdd_hostapd.h" |
| 81 | #include "sapInternal.h" |
| 82 | #include "wlan_hdd_softap_tx_rx.h" |
| 83 | #include "wlan_hdd_main.h" |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 84 | #include "wlan_hdd_assoc.h" |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 85 | #include "wlan_hdd_power.h" |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 86 | #include "wlan_hdd_trace.h" |
| 87 | #include "vos_types.h" |
| 88 | #include "vos_trace.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 89 | #ifdef WLAN_BTAMP_FEATURE |
| 90 | #include "bap_hdd_misc.h" |
| 91 | #endif |
| 92 | #include <qc_sap_ioctl.h> |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 93 | #ifdef FEATURE_WLAN_TDLS |
| 94 | #include "wlan_hdd_tdls.h" |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 95 | #include "wlan_hdd_wmm.h" |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 96 | #include "wlan_qct_wda.h" |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 97 | #endif |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 98 | #include "wlan_nv.h" |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 99 | #include "wlan_hdd_dev_pwr.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 100 | |
| 101 | #define g_mode_rates_size (12) |
| 102 | #define a_mode_rates_size (8) |
| 103 | #define FREQ_BASE_80211G (2407) |
| 104 | #define FREQ_BAND_DIFF_80211G (5) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 105 | #define MAX_SCAN_SSID 9 |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 106 | #define MAX_PENDING_LOG 5 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 107 | #define GET_IE_LEN_IN_BSS_DESC(lenInBss) ( lenInBss + sizeof(lenInBss) - \ |
krunal soni | 2a6a906 | 2014-02-11 14:14:23 -0800 | [diff] [blame] | 108 | ((uintptr_t)OFFSET_OF( tSirBssDescription, ieFields))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 109 | |
| 110 | #define HDD2GHZCHAN(freq, chan, flag) { \ |
| 111 | .band = IEEE80211_BAND_2GHZ, \ |
| 112 | .center_freq = (freq), \ |
| 113 | .hw_value = (chan),\ |
| 114 | .flags = (flag), \ |
| 115 | .max_antenna_gain = 0 ,\ |
| 116 | .max_power = 30, \ |
| 117 | } |
| 118 | |
| 119 | #define HDD5GHZCHAN(freq, chan, flag) { \ |
| 120 | .band = IEEE80211_BAND_5GHZ, \ |
| 121 | .center_freq = (freq), \ |
| 122 | .hw_value = (chan),\ |
| 123 | .flags = (flag), \ |
| 124 | .max_antenna_gain = 0 ,\ |
| 125 | .max_power = 30, \ |
| 126 | } |
| 127 | |
| 128 | #define HDD_G_MODE_RATETAB(rate, rate_id, flag)\ |
| 129 | {\ |
| 130 | .bitrate = rate, \ |
| 131 | .hw_value = rate_id, \ |
| 132 | .flags = flag, \ |
| 133 | } |
| 134 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 135 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 136 | #define WLAN_AKM_SUITE_FT_8021X 0x000FAC03 |
| 137 | #define WLAN_AKM_SUITE_FT_PSK 0x000FAC04 |
| 138 | #endif |
| 139 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 140 | #define HDD_CHANNEL_14 14 |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 141 | #define WLAN_HDD_MAX_FEATURE_SET 8 |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 142 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 143 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 144 | /* |
| 145 | * Used to allocate the size of 4096 for the link layer stats. |
| 146 | * The size of 4096 is considered assuming that all data per |
| 147 | * respective event fit with in the limit.Please take a call |
| 148 | * on the limit based on the data requirements on link layer |
| 149 | * statistics. |
| 150 | */ |
| 151 | #define LL_STATS_EVENT_BUF_SIZE 4096 |
| 152 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 153 | #ifdef WLAN_FEATURE_EXTSCAN |
| 154 | /* |
| 155 | * Used to allocate the size of 4096 for the EXTScan NL data. |
| 156 | * The size of 4096 is considered assuming that all data per |
| 157 | * respective event fit with in the limit.Please take a call |
| 158 | * on the limit based on the data requirements. |
| 159 | */ |
| 160 | |
| 161 | #define EXTSCAN_EVENT_BUF_SIZE 4096 |
| 162 | #define EXTSCAN_MAX_CACHED_RESULTS_PER_IND 32 |
| 163 | #endif |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 164 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 165 | /*EXT TDLS*/ |
| 166 | /* |
| 167 | * Used to allocate the size of 4096 for the TDLS. |
| 168 | * The size of 4096 is considered assuming that all data per |
| 169 | * respective event fit with in the limit.Please take a call |
| 170 | * on the limit based on the data requirements on link layer |
| 171 | * statistics. |
| 172 | */ |
| 173 | #define EXTTDLS_EVENT_BUF_SIZE 4096 |
| 174 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 175 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 176 | { |
| 177 | WLAN_CIPHER_SUITE_WEP40, |
| 178 | WLAN_CIPHER_SUITE_WEP104, |
| 179 | WLAN_CIPHER_SUITE_TKIP, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 180 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 181 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 182 | WLAN_CIPHER_SUITE_KRK, |
| 183 | WLAN_CIPHER_SUITE_CCMP, |
| 184 | #else |
| 185 | WLAN_CIPHER_SUITE_CCMP, |
| 186 | #endif |
| 187 | #ifdef FEATURE_WLAN_WAPI |
| 188 | WLAN_CIPHER_SUITE_SMS4, |
| 189 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 190 | #ifdef WLAN_FEATURE_11W |
| 191 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 192 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 193 | }; |
| 194 | |
| 195 | static inline int is_broadcast_ether_addr(const u8 *addr) |
| 196 | { |
| 197 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && |
| 198 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 199 | } |
| 200 | |
| 201 | static struct ieee80211_channel hdd_channels_2_4_GHZ[] = |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 202 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 203 | HDD2GHZCHAN(2412, 1, 0) , |
| 204 | HDD2GHZCHAN(2417, 2, 0) , |
| 205 | HDD2GHZCHAN(2422, 3, 0) , |
| 206 | HDD2GHZCHAN(2427, 4, 0) , |
| 207 | HDD2GHZCHAN(2432, 5, 0) , |
| 208 | HDD2GHZCHAN(2437, 6, 0) , |
| 209 | HDD2GHZCHAN(2442, 7, 0) , |
| 210 | HDD2GHZCHAN(2447, 8, 0) , |
| 211 | HDD2GHZCHAN(2452, 9, 0) , |
| 212 | HDD2GHZCHAN(2457, 10, 0) , |
| 213 | HDD2GHZCHAN(2462, 11, 0) , |
| 214 | HDD2GHZCHAN(2467, 12, 0) , |
| 215 | HDD2GHZCHAN(2472, 13, 0) , |
| 216 | HDD2GHZCHAN(2484, 14, 0) , |
| 217 | }; |
| 218 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 219 | static struct ieee80211_channel hdd_social_channels_2_4_GHZ[] = |
| 220 | { |
| 221 | HDD2GHZCHAN(2412, 1, 0) , |
| 222 | HDD2GHZCHAN(2437, 6, 0) , |
| 223 | HDD2GHZCHAN(2462, 11, 0) , |
| 224 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 225 | |
| 226 | static struct ieee80211_channel hdd_channels_5_GHZ[] = |
| 227 | { |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 228 | HDD5GHZCHAN(4920, 240, 0) , |
| 229 | HDD5GHZCHAN(4940, 244, 0) , |
| 230 | HDD5GHZCHAN(4960, 248, 0) , |
| 231 | HDD5GHZCHAN(4980, 252, 0) , |
| 232 | HDD5GHZCHAN(5040, 208, 0) , |
| 233 | HDD5GHZCHAN(5060, 212, 0) , |
| 234 | HDD5GHZCHAN(5080, 216, 0) , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 235 | HDD5GHZCHAN(5180, 36, 0) , |
| 236 | HDD5GHZCHAN(5200, 40, 0) , |
| 237 | HDD5GHZCHAN(5220, 44, 0) , |
| 238 | HDD5GHZCHAN(5240, 48, 0) , |
| 239 | HDD5GHZCHAN(5260, 52, 0) , |
| 240 | HDD5GHZCHAN(5280, 56, 0) , |
| 241 | HDD5GHZCHAN(5300, 60, 0) , |
| 242 | HDD5GHZCHAN(5320, 64, 0) , |
| 243 | HDD5GHZCHAN(5500,100, 0) , |
| 244 | HDD5GHZCHAN(5520,104, 0) , |
| 245 | HDD5GHZCHAN(5540,108, 0) , |
| 246 | HDD5GHZCHAN(5560,112, 0) , |
| 247 | HDD5GHZCHAN(5580,116, 0) , |
| 248 | HDD5GHZCHAN(5600,120, 0) , |
| 249 | HDD5GHZCHAN(5620,124, 0) , |
| 250 | HDD5GHZCHAN(5640,128, 0) , |
| 251 | HDD5GHZCHAN(5660,132, 0) , |
| 252 | HDD5GHZCHAN(5680,136, 0) , |
| 253 | HDD5GHZCHAN(5700,140, 0) , |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 254 | #ifdef FEATURE_WLAN_CH144 |
| 255 | HDD5GHZCHAN(5720,144, 0) , |
| 256 | #endif /* FEATURE_WLAN_CH144 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 257 | HDD5GHZCHAN(5745,149, 0) , |
| 258 | HDD5GHZCHAN(5765,153, 0) , |
| 259 | HDD5GHZCHAN(5785,157, 0) , |
| 260 | HDD5GHZCHAN(5805,161, 0) , |
| 261 | HDD5GHZCHAN(5825,165, 0) , |
| 262 | }; |
| 263 | |
| 264 | static struct ieee80211_rate g_mode_rates[] = |
| 265 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 266 | HDD_G_MODE_RATETAB(10, 0x1, 0), |
| 267 | HDD_G_MODE_RATETAB(20, 0x2, 0), |
| 268 | HDD_G_MODE_RATETAB(55, 0x4, 0), |
| 269 | HDD_G_MODE_RATETAB(110, 0x8, 0), |
| 270 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 271 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 272 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 273 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 274 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 275 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 276 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 277 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 278 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 279 | |
| 280 | static struct ieee80211_rate a_mode_rates[] = |
| 281 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 282 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 283 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 284 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 285 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 286 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 287 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 288 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 289 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
| 290 | }; |
| 291 | |
| 292 | static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ = |
| 293 | { |
| 294 | .channels = hdd_channels_2_4_GHZ, |
| 295 | .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ), |
| 296 | .band = IEEE80211_BAND_2GHZ, |
| 297 | .bitrates = g_mode_rates, |
| 298 | .n_bitrates = g_mode_rates_size, |
| 299 | .ht_cap.ht_supported = 1, |
| 300 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 301 | | IEEE80211_HT_CAP_GRN_FLD |
| 302 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 303 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 304 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 305 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 306 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 307 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 308 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 309 | }; |
| 310 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 311 | static struct ieee80211_supported_band wlan_hdd_band_p2p_2_4_GHZ = |
| 312 | { |
| 313 | .channels = hdd_social_channels_2_4_GHZ, |
| 314 | .n_channels = ARRAY_SIZE(hdd_social_channels_2_4_GHZ), |
| 315 | .band = IEEE80211_BAND_2GHZ, |
| 316 | .bitrates = g_mode_rates, |
| 317 | .n_bitrates = g_mode_rates_size, |
| 318 | .ht_cap.ht_supported = 1, |
| 319 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 320 | | IEEE80211_HT_CAP_GRN_FLD |
| 321 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 322 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 323 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 324 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 325 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 326 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 327 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 328 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 329 | |
| 330 | static struct ieee80211_supported_band wlan_hdd_band_5_GHZ = |
| 331 | { |
| 332 | .channels = hdd_channels_5_GHZ, |
| 333 | .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ), |
| 334 | .band = IEEE80211_BAND_5GHZ, |
| 335 | .bitrates = a_mode_rates, |
| 336 | .n_bitrates = a_mode_rates_size, |
| 337 | .ht_cap.ht_supported = 1, |
| 338 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 339 | | IEEE80211_HT_CAP_GRN_FLD |
| 340 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 341 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT |
| 342 | | IEEE80211_HT_CAP_SGI_40 |
| 343 | | IEEE80211_HT_CAP_SUP_WIDTH_20_40, |
| 344 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 345 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 346 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 347 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 348 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 349 | }; |
| 350 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 351 | /* This structure contain information what kind of frame are expected in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 352 | TX/RX direction for each kind of interface */ |
| 353 | static const struct ieee80211_txrx_stypes |
| 354 | wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = { |
| 355 | [NL80211_IFTYPE_STATION] = { |
| 356 | .tx = 0xffff, |
| 357 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 358 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 359 | }, |
| 360 | [NL80211_IFTYPE_AP] = { |
| 361 | .tx = 0xffff, |
| 362 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 363 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 364 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 365 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 366 | BIT(SIR_MAC_MGMT_AUTH) | |
| 367 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 368 | BIT(SIR_MAC_MGMT_ACTION), |
| 369 | }, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 370 | [NL80211_IFTYPE_ADHOC] = { |
| 371 | .tx = 0xffff, |
| 372 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 373 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 374 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 375 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 376 | BIT(SIR_MAC_MGMT_AUTH) | |
| 377 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 378 | BIT(SIR_MAC_MGMT_ACTION), |
| 379 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 380 | [NL80211_IFTYPE_P2P_CLIENT] = { |
| 381 | .tx = 0xffff, |
| 382 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 383 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 384 | }, |
| 385 | [NL80211_IFTYPE_P2P_GO] = { |
| 386 | /* This is also same as for SoftAP */ |
| 387 | .tx = 0xffff, |
| 388 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 389 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 390 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 391 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 392 | BIT(SIR_MAC_MGMT_AUTH) | |
| 393 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 394 | BIT(SIR_MAC_MGMT_ACTION), |
| 395 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 396 | }; |
| 397 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 398 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 399 | static const struct ieee80211_iface_limit |
| 400 | wlan_hdd_iface_limit[] = { |
| 401 | { |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 402 | /* max = 3 ; Our driver create two interfaces during driver init |
| 403 | * wlan0 and p2p0 interfaces. p2p0 is considered as station |
| 404 | * interface until a group is formed. In JB architecture, once the |
| 405 | * group is formed, interface type of p2p0 is changed to P2P GO or |
| 406 | * Client. |
| 407 | * When supplicant remove the group, it first issue a set interface |
| 408 | * cmd to change the mode back to Station. In JB this works fine as |
| 409 | * we advertize two station type interface during driver init. |
| 410 | * Some vendors create separate interface for P2P GO/Client, |
| 411 | * after group formation(Third one). But while group remove |
| 412 | * supplicant first tries to change the mode(3rd interface) to STATION |
| 413 | * But as we advertized only two sta type interfaces nl80211 was |
| 414 | * returning error for the third one which was leading to failure in |
| 415 | * delete interface. Ideally while removing the group, supplicant |
| 416 | * should not try to change the 3rd interface mode to Station type. |
| 417 | * Till we get a fix in wpa_supplicant, we advertize max STA |
| 418 | * interface type to 3 |
| 419 | */ |
| 420 | .max = 3, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 421 | .types = BIT(NL80211_IFTYPE_STATION), |
| 422 | }, |
| 423 | { |
| 424 | .max = 1, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 425 | .types = BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP), |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 426 | }, |
| 427 | { |
| 428 | .max = 1, |
| 429 | .types = BIT(NL80211_IFTYPE_P2P_GO) | |
| 430 | BIT(NL80211_IFTYPE_P2P_CLIENT), |
| 431 | }, |
| 432 | }; |
| 433 | |
| 434 | /* By default, only single channel concurrency is allowed */ |
| 435 | static struct ieee80211_iface_combination |
| 436 | wlan_hdd_iface_combination = { |
| 437 | .limits = wlan_hdd_iface_limit, |
| 438 | .num_different_channels = 1, |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 439 | /* |
| 440 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 441 | * and p2p0 interfaces during driver init |
| 442 | * Some vendors create separate interface for P2P operations. |
| 443 | * wlan0: STA interface |
| 444 | * p2p0: P2P Device interface, action frames goes |
| 445 | * through this interface. |
| 446 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 447 | * created for p2p operations(GO/CLIENT interface). |
| 448 | */ |
| 449 | .max_interfaces = WLAN_MAX_INTERFACES, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 450 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 451 | .beacon_int_infra_match = false, |
| 452 | }; |
| 453 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 454 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 455 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 456 | |
| 457 | /* Data rate 100KBPS based on IE Index */ |
| 458 | struct index_data_rate_type |
| 459 | { |
| 460 | v_U8_t beacon_rate_index; |
| 461 | v_U16_t supported_rate[4]; |
| 462 | }; |
| 463 | |
| 464 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 465 | The IDX field is the rate index |
| 466 | The HI field is the rate when RSSI is strong or being ignored |
| 467 | (in this case we report actual rate) |
| 468 | The MID field is the rate when RSSI is moderate |
| 469 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 470 | The LO field is the rate when RSSI is low |
| 471 | (in this case we don't report rates, actual current rate used) |
| 472 | */ |
| 473 | static const struct |
| 474 | { |
| 475 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 476 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 477 | } supported_data_rate[] = |
| 478 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 479 | /* IDX HI HM LM LO (RSSI-based index */ |
| 480 | {2, { 10, 10, 10, 0}}, |
| 481 | {4, { 20, 20, 10, 0}}, |
| 482 | {11, { 55, 20, 10, 0}}, |
| 483 | {12, { 60, 55, 20, 0}}, |
| 484 | {18, { 90, 55, 20, 0}}, |
| 485 | {22, {110, 55, 20, 0}}, |
| 486 | {24, {120, 90, 60, 0}}, |
| 487 | {36, {180, 120, 60, 0}}, |
| 488 | {44, {220, 180, 60, 0}}, |
| 489 | {48, {240, 180, 90, 0}}, |
| 490 | {66, {330, 180, 90, 0}}, |
| 491 | {72, {360, 240, 90, 0}}, |
| 492 | {96, {480, 240, 120, 0}}, |
| 493 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 494 | }; |
| 495 | |
| 496 | /* MCS Based rate table */ |
| 497 | static struct index_data_rate_type supported_mcs_rate[] = |
| 498 | { |
| 499 | /* MCS L20 L40 S20 S40 */ |
| 500 | {0, {65, 135, 72, 150}}, |
| 501 | {1, {130, 270, 144, 300}}, |
| 502 | {2, {195, 405, 217, 450}}, |
| 503 | {3, {260, 540, 289, 600}}, |
| 504 | {4, {390, 810, 433, 900}}, |
| 505 | {5, {520, 1080, 578, 1200}}, |
| 506 | {6, {585, 1215, 650, 1350}}, |
| 507 | {7, {650, 1350, 722, 1500}} |
| 508 | }; |
| 509 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 510 | #ifdef WLAN_FEATURE_11AC |
| 511 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 512 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 513 | |
| 514 | struct index_vht_data_rate_type |
| 515 | { |
| 516 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 517 | v_U16_t supported_VHT80_rate[2]; |
| 518 | v_U16_t supported_VHT40_rate[2]; |
| 519 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 520 | }; |
| 521 | |
| 522 | typedef enum |
| 523 | { |
| 524 | DATA_RATE_11AC_MAX_MCS_7, |
| 525 | DATA_RATE_11AC_MAX_MCS_8, |
| 526 | DATA_RATE_11AC_MAX_MCS_9, |
| 527 | DATA_RATE_11AC_MAX_MCS_NA |
| 528 | } eDataRate11ACMaxMcs; |
| 529 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 530 | /* SSID broadcast type */ |
| 531 | typedef enum eSSIDBcastType |
| 532 | { |
| 533 | eBCAST_UNKNOWN = 0, |
| 534 | eBCAST_NORMAL = 1, |
| 535 | eBCAST_HIDDEN = 2, |
| 536 | } tSSIDBcastType; |
| 537 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 538 | /* MCS Based VHT rate table */ |
| 539 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 540 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 541 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 542 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 543 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 544 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 545 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 546 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 547 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 548 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 549 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 550 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 551 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 552 | }; |
| 553 | #endif /* WLAN_FEATURE_11AC */ |
| 554 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 555 | /*array index points to MCS and array value points respective rssi*/ |
| 556 | static int rssiMcsTbl[][10] = |
| 557 | { |
| 558 | /*MCS 0 1 2 3 4 5 6 7 8 9*/ |
| 559 | {-82, -79, -77, -74, -70, -66, -65, -64, -59, -57}, //20 |
| 560 | {-79, -76, -74, -71, -67, -63, -62, -61, -56, -54}, //40 |
| 561 | {-76, -73, -71, -68, -64, -60, -59, -58, -53, -51} //80 |
| 562 | }; |
| 563 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 564 | extern struct net_device_ops net_ops_struct; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 565 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 566 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter); |
| 567 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 568 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 569 | #ifdef WLAN_NL80211_TESTMODE |
| 570 | enum wlan_hdd_tm_attr |
| 571 | { |
| 572 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 573 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 574 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 575 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 576 | /* keep last */ |
| 577 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 578 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 579 | }; |
| 580 | |
| 581 | enum wlan_hdd_tm_cmd |
| 582 | { |
| 583 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 584 | }; |
| 585 | |
| 586 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 587 | |
| 588 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 589 | { |
| 590 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 591 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 592 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 593 | }; |
| 594 | #endif /* WLAN_NL80211_TESTMODE */ |
| 595 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 596 | #ifdef FEATURE_WLAN_CH_AVOID |
| 597 | /* |
| 598 | * FUNCTION: wlan_hdd_send_avoid_freq_event |
| 599 | * This is called when wlan driver needs to send vendor specific |
| 600 | * avoid frequency range event to userspace |
| 601 | */ |
| 602 | int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx, |
| 603 | tHddAvoidFreqList *pAvoidFreqList) |
| 604 | { |
| 605 | struct sk_buff *vendor_event; |
| 606 | |
| 607 | ENTER(); |
| 608 | |
| 609 | if (!pHddCtx) |
| 610 | { |
| 611 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 612 | "%s: HDD context is null", __func__); |
| 613 | return -1; |
| 614 | } |
| 615 | |
| 616 | if (!pAvoidFreqList) |
| 617 | { |
| 618 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 619 | "%s: pAvoidFreqList is null", __func__); |
| 620 | return -1; |
| 621 | } |
| 622 | |
| 623 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 624 | sizeof(tHddAvoidFreqList), |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 625 | QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 626 | GFP_KERNEL); |
| 627 | if (!vendor_event) |
| 628 | { |
| 629 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 630 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 631 | return -1; |
| 632 | } |
| 633 | |
| 634 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 635 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 636 | |
| 637 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 638 | |
| 639 | EXIT(); |
| 640 | return 0; |
| 641 | } |
| 642 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 643 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 644 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 645 | |
| 646 | static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats, |
| 647 | struct sk_buff *vendor_event) |
| 648 | { |
| 649 | if (nla_put_u8(vendor_event, |
| 650 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_PREAMBLE, |
| 651 | stats->rate.preamble) || |
| 652 | nla_put_u8(vendor_event, |
| 653 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_NSS, |
| 654 | stats->rate.nss) || |
| 655 | nla_put_u8(vendor_event, |
| 656 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BW, |
| 657 | stats->rate.bw) || |
| 658 | nla_put_u8(vendor_event, |
| 659 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX, |
| 660 | stats->rate.rateMcsIdx) || |
| 661 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE, |
| 662 | stats->rate.bitrate ) || |
| 663 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU, |
| 664 | stats->txMpdu ) || |
| 665 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU, |
| 666 | stats->rxMpdu ) || |
| 667 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST, |
| 668 | stats->mpduLost ) || |
| 669 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES, |
| 670 | stats->retries) || |
| 671 | nla_put_u32(vendor_event, |
| 672 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT, |
| 673 | stats->retriesShort ) || |
| 674 | nla_put_u32(vendor_event, |
| 675 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG, |
| 676 | stats->retriesLong)) |
| 677 | { |
| 678 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 679 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 680 | return FALSE; |
| 681 | } |
| 682 | return TRUE; |
| 683 | } |
| 684 | |
| 685 | static v_BOOL_t put_wifi_peer_info( tpSirWifiPeerInfo stats, |
| 686 | struct sk_buff *vendor_event) |
| 687 | { |
| 688 | u32 i = 0; |
| 689 | struct nlattr *rateInfo; |
| 690 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE, |
| 691 | stats->type) || |
| 692 | nla_put(vendor_event, |
| 693 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS, |
| 694 | VOS_MAC_ADDR_SIZE, &stats->peerMacAddress[0]) || |
| 695 | nla_put_u32(vendor_event, |
| 696 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES, |
| 697 | stats->capabilities) || |
| 698 | nla_put_u32(vendor_event, |
| 699 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES, |
| 700 | stats->numRate)) |
| 701 | { |
| 702 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 703 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 704 | goto error; |
| 705 | } |
| 706 | |
| 707 | rateInfo = nla_nest_start(vendor_event, |
| 708 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 709 | if(!rateInfo) |
| 710 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 711 | for (i = 0; i < stats->numRate; i++) |
| 712 | { |
| 713 | struct nlattr *rates; |
| 714 | tpSirWifiRateStat pRateStats = (tpSirWifiRateStat )((uint8 *) |
| 715 | stats->rateStats + |
| 716 | (i * sizeof(tSirWifiRateStat))); |
| 717 | rates = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 718 | if(!rates) |
| 719 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 720 | |
| 721 | if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event)) |
| 722 | { |
| 723 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 724 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 725 | return FALSE; |
| 726 | } |
| 727 | nla_nest_end(vendor_event, rates); |
| 728 | } |
| 729 | nla_nest_end(vendor_event, rateInfo); |
| 730 | |
| 731 | return TRUE; |
| 732 | error: |
| 733 | return FALSE; |
| 734 | } |
| 735 | |
| 736 | static v_BOOL_t put_wifi_wmm_ac_stat( tpSirWifiWmmAcStat stats, |
| 737 | struct sk_buff *vendor_event) |
| 738 | { |
| 739 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_AC, |
| 740 | stats->ac ) || |
| 741 | nla_put_u32(vendor_event, |
| 742 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MPDU, |
| 743 | stats->txMpdu ) || |
| 744 | nla_put_u32(vendor_event, |
| 745 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MPDU, |
| 746 | stats->rxMpdu ) || |
| 747 | nla_put_u32(vendor_event, |
| 748 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MCAST, |
| 749 | stats->txMcast ) || |
| 750 | nla_put_u32(vendor_event, |
| 751 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MCAST, |
| 752 | stats->rxMcast ) || |
| 753 | nla_put_u32(vendor_event, |
| 754 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_AMPDU, |
| 755 | stats->rxAmpdu ) || |
| 756 | nla_put_u32(vendor_event, |
| 757 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_AMPDU, |
| 758 | stats->txAmpdu ) || |
| 759 | nla_put_u32(vendor_event, |
| 760 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_MPDU_LOST, |
| 761 | stats->mpduLost )|| |
| 762 | nla_put_u32(vendor_event, |
| 763 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES, |
| 764 | stats->retries ) || |
| 765 | nla_put_u32(vendor_event, |
| 766 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_SHORT, |
| 767 | stats->retriesShort ) || |
| 768 | nla_put_u32(vendor_event, |
| 769 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_LONG, |
| 770 | stats->retriesLong ) || |
| 771 | nla_put_u32(vendor_event, |
| 772 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MIN, |
| 773 | stats->contentionTimeMin ) || |
| 774 | nla_put_u32(vendor_event, |
| 775 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MAX, |
| 776 | stats->contentionTimeMax ) || |
| 777 | nla_put_u32(vendor_event, |
| 778 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_AVG, |
| 779 | stats->contentionTimeAvg ) || |
| 780 | nla_put_u32(vendor_event, |
| 781 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_NUM_SAMPLES, |
| 782 | stats->contentionNumSamples )) |
| 783 | { |
| 784 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 785 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 786 | return FALSE; |
| 787 | } |
| 788 | return TRUE; |
| 789 | } |
| 790 | |
| 791 | static v_BOOL_t put_wifi_interface_info(tpSirWifiInterfaceInfo stats, |
| 792 | struct sk_buff *vendor_event) |
| 793 | { |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 794 | if (nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 795 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE, stats->mode ) || |
| 796 | nla_put(vendor_event, |
| 797 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MAC_ADDR, |
| 798 | VOS_MAC_ADDR_SIZE, stats->macAddr) || |
| 799 | nla_put_u32(vendor_event, |
| 800 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_STATE, |
| 801 | stats->state ) || |
| 802 | nla_put_u32(vendor_event, |
| 803 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_ROAMING, |
| 804 | stats->roaming ) || |
| 805 | nla_put_u32(vendor_event, |
| 806 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_CAPABILITIES, |
| 807 | stats->capabilities ) || |
| 808 | nla_put(vendor_event, |
| 809 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_SSID, |
| 810 | strlen(stats->ssid), stats->ssid) || |
| 811 | nla_put(vendor_event, |
| 812 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_BSSID, |
| 813 | WNI_CFG_BSSID_LEN, stats->bssid) || |
| 814 | nla_put(vendor_event, |
| 815 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_AP_COUNTRY_STR, |
| 816 | WNI_CFG_COUNTRY_CODE_LEN, stats->apCountryStr) || |
| 817 | nla_put(vendor_event, |
| 818 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_COUNTRY_STR, |
| 819 | WNI_CFG_COUNTRY_CODE_LEN, stats->countryStr) |
| 820 | ) |
| 821 | { |
| 822 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 823 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 824 | return FALSE; |
| 825 | } |
| 826 | return TRUE; |
| 827 | } |
| 828 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 829 | static v_BOOL_t put_wifi_iface_stats(hdd_adapter_t *pAdapter, |
| 830 | tpSirWifiIfaceStat pWifiIfaceStat, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 831 | struct sk_buff *vendor_event) |
| 832 | { |
| 833 | int i = 0; |
| 834 | struct nlattr *wmmInfo; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 835 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 836 | WLANTL_InterfaceStatsType *pWifiIfaceStatTL = NULL; |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 837 | tSirWifiWmmAcStat accessclassStats; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 838 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 839 | if (FALSE == put_wifi_interface_info( |
| 840 | &pWifiIfaceStat->info, |
| 841 | vendor_event)) |
| 842 | { |
| 843 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 844 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 845 | return FALSE; |
| 846 | |
| 847 | } |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 848 | pWifiIfaceStatTL = (WLANTL_InterfaceStatsType *) |
| 849 | vos_mem_malloc(sizeof(WLANTL_InterfaceStatsType)); |
| 850 | if (NULL == pWifiIfaceStatTL) |
| 851 | { |
| 852 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 853 | return FALSE; |
| 854 | } |
| 855 | |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 856 | accessclassStats = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK]; |
| 857 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK] = |
| 858 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE]; |
| 859 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE] = accessclassStats; |
| 860 | |
| 861 | accessclassStats.ac = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac; |
| 862 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac = |
| 863 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac; |
| 864 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac = accessclassStats.ac; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 865 | |
| 866 | if ( pWifiIfaceStat->info.state == WIFI_ASSOCIATED) |
| 867 | { |
| 868 | if (VOS_STATUS_SUCCESS == |
| 869 | WLANTL_CollectInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 870 | pHddStaCtx->conn_info.staId[0], pWifiIfaceStatTL)) |
| 871 | { |
| 872 | /* mgmtRx, MgmtActionRx, rxMcast, rxMpdu, rxAmpdu, rssiData are |
| 873 | * obtained from TL structure |
| 874 | */ |
| 875 | |
| 876 | pWifiIfaceStat->mgmtRx = pWifiIfaceStat->beaconRx + |
| 877 | pWifiIfaceStatTL->mgmtRx; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 878 | pWifiIfaceStat->rssiData = pWifiIfaceStatTL->rssiData; |
| 879 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 880 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMcast |
| 881 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMcast; |
| 882 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMcast |
| 883 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMcast; |
| 884 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMcast |
| 885 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMcast; |
| 886 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMcast |
| 887 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMcast; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 888 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 889 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMpdu |
| 890 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMpdu; |
| 891 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMpdu |
| 892 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMpdu; |
| 893 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMpdu |
| 894 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMpdu; |
| 895 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMpdu |
| 896 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 897 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 898 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxAmpdu |
| 899 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxAmpdu; |
| 900 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxAmpdu |
| 901 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxAmpdu; |
| 902 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxAmpdu |
| 903 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxAmpdu; |
| 904 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxAmpdu |
| 905 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxAmpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 906 | } |
| 907 | else |
| 908 | { |
| 909 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in getting stats from TL")); |
| 910 | } |
| 911 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 912 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].txMcast = |
| 913 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO]; |
| 914 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].txMcast = |
| 915 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI]; |
| 916 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].txMcast = |
| 917 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE]; |
| 918 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].txMcast = |
| 919 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK]; |
| 920 | } |
| 921 | else |
| 922 | { |
| 923 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Interface not Associated")); |
| 924 | } |
| 925 | |
| 926 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 927 | |
| 928 | if (nla_put_u32(vendor_event, |
| 929 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX, |
| 930 | pWifiIfaceStat->beaconRx) || |
| 931 | nla_put_u32(vendor_event, |
| 932 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_RX, |
| 933 | pWifiIfaceStat->mgmtRx) || |
| 934 | nla_put_u32(vendor_event, |
| 935 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_RX, |
| 936 | pWifiIfaceStat->mgmtActionRx) || |
| 937 | nla_put_u32(vendor_event, |
| 938 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_TX, |
| 939 | pWifiIfaceStat->mgmtActionTx) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 940 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 941 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_MGMT, |
| 942 | pWifiIfaceStat->rssiMgmt) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 943 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 944 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_DATA, |
| 945 | pWifiIfaceStat->rssiData) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 946 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 947 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_ACK, |
| 948 | pWifiIfaceStat->rssiAck)) |
| 949 | { |
| 950 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 951 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 952 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 953 | return FALSE; |
| 954 | } |
| 955 | |
| 956 | wmmInfo = nla_nest_start(vendor_event, |
| 957 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 958 | if(!wmmInfo) |
| 959 | { |
| 960 | vos_mem_free(pWifiIfaceStatTL); |
| 961 | return FALSE; |
| 962 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 963 | for (i = 0; i < WIFI_AC_MAX; i++) |
| 964 | { |
| 965 | struct nlattr *wmmStats; |
| 966 | wmmStats = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 967 | if(!wmmStats) |
| 968 | { |
| 969 | vos_mem_free(pWifiIfaceStatTL); |
| 970 | return FALSE; |
| 971 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 972 | if (FALSE == put_wifi_wmm_ac_stat( |
| 973 | &pWifiIfaceStat->AccessclassStats[i], |
| 974 | vendor_event)) |
| 975 | { |
| 976 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 977 | FL("QCA_WLAN_VENDOR_ATTR put Fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 978 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 979 | return FALSE; |
| 980 | } |
| 981 | |
| 982 | nla_nest_end(vendor_event, wmmStats); |
| 983 | } |
| 984 | nla_nest_end(vendor_event, wmmInfo); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 985 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 986 | return TRUE; |
| 987 | } |
| 988 | |
| 989 | static tSirWifiInterfaceMode |
| 990 | hdd_map_device_to_ll_iface_mode ( int deviceMode ) |
| 991 | { |
| 992 | switch (deviceMode) |
| 993 | { |
| 994 | case WLAN_HDD_INFRA_STATION: |
| 995 | return WIFI_INTERFACE_STA; |
| 996 | case WLAN_HDD_SOFTAP: |
| 997 | return WIFI_INTERFACE_SOFTAP; |
| 998 | case WLAN_HDD_P2P_CLIENT: |
| 999 | return WIFI_INTERFACE_P2P_CLIENT; |
| 1000 | case WLAN_HDD_P2P_GO: |
| 1001 | return WIFI_INTERFACE_P2P_GO; |
| 1002 | case WLAN_HDD_IBSS: |
| 1003 | return WIFI_INTERFACE_IBSS; |
| 1004 | default: |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 1005 | return WIFI_INTERFACE_UNKNOWN; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1006 | } |
| 1007 | } |
| 1008 | |
| 1009 | static v_BOOL_t hdd_get_interface_info(hdd_adapter_t *pAdapter, |
| 1010 | tpSirWifiInterfaceInfo pInfo) |
| 1011 | { |
| 1012 | v_U8_t *staMac = NULL; |
| 1013 | hdd_station_ctx_t *pHddStaCtx; |
| 1014 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1015 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1016 | |
| 1017 | pInfo->mode = hdd_map_device_to_ll_iface_mode(pAdapter->device_mode); |
| 1018 | |
| 1019 | vos_mem_copy(pInfo->macAddr, |
| 1020 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 1021 | |
| 1022 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1023 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 1024 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))) |
| 1025 | { |
| 1026 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1027 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) |
| 1028 | { |
| 1029 | pInfo->state = WIFI_DISCONNECTED; |
| 1030 | } |
| 1031 | if (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) |
| 1032 | { |
| 1033 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1034 | "%s: Session ID %d, Connection is in progress", __func__, |
| 1035 | pAdapter->sessionId); |
| 1036 | pInfo->state = WIFI_ASSOCIATING; |
| 1037 | } |
| 1038 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 1039 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 1040 | { |
| 1041 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 1042 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1043 | "%s: client " MAC_ADDRESS_STR |
| 1044 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 1045 | MAC_ADDR_ARRAY(staMac)); |
| 1046 | pInfo->state = WIFI_AUTHENTICATING; |
| 1047 | } |
| 1048 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 1049 | { |
| 1050 | pInfo->state = WIFI_ASSOCIATED; |
| 1051 | vos_mem_copy(pInfo->bssid, |
| 1052 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 1053 | vos_mem_copy(pInfo->ssid, |
| 1054 | pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 1055 | pHddStaCtx->conn_info.SSID.SSID.length); |
| 1056 | //NULL Terminate the string. |
| 1057 | pInfo->ssid[pHddStaCtx->conn_info.SSID.SSID.length] = 0; |
| 1058 | } |
| 1059 | } |
| 1060 | vos_mem_copy(pInfo->countryStr, |
| 1061 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1062 | |
| 1063 | vos_mem_copy(pInfo->apCountryStr, |
| 1064 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1065 | |
| 1066 | return TRUE; |
| 1067 | } |
| 1068 | |
| 1069 | /* |
| 1070 | * hdd_link_layer_process_peer_stats () - This function is called after |
| 1071 | * receiving Link Layer Peer statistics from FW.This function converts |
| 1072 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1073 | * layers. |
| 1074 | */ |
| 1075 | static v_VOID_t hdd_link_layer_process_peer_stats(hdd_adapter_t *pAdapter, |
| 1076 | v_VOID_t *pData) |
| 1077 | { |
| 1078 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1079 | tpSirWifiRateStat pWifiRateStat; |
| 1080 | tpSirWifiPeerStat pWifiPeerStat; |
| 1081 | tpSirWifiPeerInfo pWifiPeerInfo; |
| 1082 | struct nlattr *peerInfo; |
| 1083 | struct sk_buff *vendor_event; |
| 1084 | int status, i; |
| 1085 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1086 | ENTER(); |
| 1087 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1088 | status = wlan_hdd_validate_context(pHddCtx); |
| 1089 | if (0 != status) |
| 1090 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1091 | return; |
| 1092 | } |
| 1093 | |
| 1094 | pWifiPeerStat = (tpSirWifiPeerStat) pData; |
| 1095 | |
| 1096 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1097 | "LL_STATS_PEER_ALL : numPeers %u", |
| 1098 | pWifiPeerStat->numPeers); |
| 1099 | { |
| 1100 | for (i = 0; i < pWifiPeerStat->numPeers; i++) |
| 1101 | { |
| 1102 | pWifiPeerInfo = (tpSirWifiPeerInfo) |
| 1103 | ((uint8 *)pWifiPeerStat->peerInfo + |
| 1104 | ( i * sizeof(tSirWifiPeerInfo))); |
| 1105 | |
Dasari Srinivas | 1be0c4e | 2014-10-19 13:03:41 +0530 | [diff] [blame] | 1106 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) { |
| 1107 | pWifiPeerInfo->type = WIFI_PEER_AP; |
| 1108 | } |
| 1109 | if (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) { |
| 1110 | pWifiPeerInfo->type = WIFI_PEER_P2P_GO; |
| 1111 | } |
| 1112 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1113 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1114 | " %d) LL_STATS Channel Stats " |
| 1115 | " Peer Type %u " |
| 1116 | " peerMacAddress %pM " |
| 1117 | " capabilities 0x%x " |
| 1118 | " numRate %u ", |
| 1119 | i, |
| 1120 | pWifiPeerInfo->type, |
| 1121 | pWifiPeerInfo->peerMacAddress, |
| 1122 | pWifiPeerInfo->capabilities, |
| 1123 | pWifiPeerInfo->numRate); |
| 1124 | { |
| 1125 | int j; |
| 1126 | for (j = 0; j < pWifiPeerInfo->numRate; j++) |
| 1127 | { |
| 1128 | pWifiRateStat = (tpSirWifiRateStat) |
| 1129 | ((tANI_U8 *) pWifiPeerInfo->rateStats + |
| 1130 | ( j * sizeof(tSirWifiRateStat))); |
| 1131 | |
| 1132 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1133 | " peer Rate Stats " |
| 1134 | " preamble %u " |
| 1135 | " nss %u " |
| 1136 | " bw %u " |
| 1137 | " rateMcsIdx %u " |
| 1138 | " reserved %u " |
| 1139 | " bitrate %u " |
| 1140 | " txMpdu %u " |
| 1141 | " rxMpdu %u " |
| 1142 | " mpduLost %u " |
| 1143 | " retries %u " |
| 1144 | " retriesShort %u " |
| 1145 | " retriesLong %u", |
| 1146 | pWifiRateStat->rate.preamble, |
| 1147 | pWifiRateStat->rate.nss, |
| 1148 | pWifiRateStat->rate.bw, |
| 1149 | pWifiRateStat->rate.rateMcsIdx, |
| 1150 | pWifiRateStat->rate.reserved, |
| 1151 | pWifiRateStat->rate.bitrate, |
| 1152 | pWifiRateStat->txMpdu, |
| 1153 | pWifiRateStat->rxMpdu, |
| 1154 | pWifiRateStat->mpduLost, |
| 1155 | pWifiRateStat->retries, |
| 1156 | pWifiRateStat->retriesShort, |
| 1157 | pWifiRateStat->retriesLong); |
| 1158 | } |
| 1159 | } |
| 1160 | } |
| 1161 | } |
| 1162 | |
| 1163 | /* |
| 1164 | * Allocate a size of 4096 for the peer stats comprising |
| 1165 | * each of size = sizeof (tSirWifiPeerInfo) + numRate * |
| 1166 | * sizeof (tSirWifiRateStat).Each field is put with an |
| 1167 | * NL attribute.The size of 4096 is considered assuming |
| 1168 | * that number of rates shall not exceed beyond 50 with |
| 1169 | * the sizeof (tSirWifiRateStat) being 32. |
| 1170 | */ |
| 1171 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1172 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1173 | QCA_NL80211_VENDOR_SUBCMD_LL_PEER_INFO_STATS_INDEX, |
| 1174 | GFP_KERNEL); |
| 1175 | if (!vendor_event) |
| 1176 | { |
| 1177 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1178 | "%s: cfg80211_vendor_event_alloc failed", |
| 1179 | __func__); |
| 1180 | return; |
| 1181 | } |
| 1182 | if (nla_put_u32(vendor_event, |
| 1183 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS, |
| 1184 | pWifiPeerStat->numPeers)) |
| 1185 | { |
| 1186 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1187 | "%s: QCA_WLAN_VENDOR_ATTR put fail", __func__); |
| 1188 | kfree_skb(vendor_event); |
| 1189 | return; |
| 1190 | } |
| 1191 | |
| 1192 | peerInfo = nla_nest_start(vendor_event, |
| 1193 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1194 | if(!peerInfo) |
| 1195 | { |
| 1196 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1197 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO put fail", |
| 1198 | __func__); |
| 1199 | kfree_skb(vendor_event); |
| 1200 | return; |
| 1201 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1202 | |
| 1203 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1204 | pWifiPeerStat->peerInfo); |
| 1205 | |
| 1206 | for (i = 1; i <= pWifiPeerStat->numPeers; i++) |
| 1207 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1208 | int numRate = pWifiPeerInfo->numRate; |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1209 | struct nlattr *peers = nla_nest_start(vendor_event, i); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1210 | |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1211 | if(!peers) |
| 1212 | { |
| 1213 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1214 | "%s: peer stats put fail", |
| 1215 | __func__); |
| 1216 | kfree_skb(vendor_event); |
| 1217 | return; |
| 1218 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1219 | if (FALSE == put_wifi_peer_info( |
| 1220 | pWifiPeerInfo, vendor_event)) |
| 1221 | { |
| 1222 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1223 | "%s: put_wifi_peer_info put fail", __func__); |
| 1224 | kfree_skb(vendor_event); |
| 1225 | return; |
| 1226 | } |
| 1227 | |
| 1228 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1229 | pWifiPeerStat->peerInfo + |
| 1230 | (i * sizeof(tSirWifiPeerInfo)) + |
| 1231 | (numRate * sizeof (tSirWifiRateStat))); |
| 1232 | nla_nest_end(vendor_event, peers); |
| 1233 | } |
| 1234 | nla_nest_end(vendor_event, peerInfo); |
| 1235 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1236 | |
| 1237 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1238 | } |
| 1239 | |
| 1240 | /* |
| 1241 | * hdd_link_layer_process_iface_stats () - This function is called after |
| 1242 | * receiving Link Layer Interface statistics from FW.This function converts |
| 1243 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1244 | * layers. |
| 1245 | */ |
| 1246 | static v_VOID_t hdd_link_layer_process_iface_stats(hdd_adapter_t *pAdapter, |
| 1247 | v_VOID_t *pData) |
| 1248 | { |
| 1249 | tpSirWifiIfaceStat pWifiIfaceStat; |
| 1250 | struct sk_buff *vendor_event; |
| 1251 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1252 | int status; |
| 1253 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1254 | ENTER(); |
| 1255 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1256 | status = wlan_hdd_validate_context(pHddCtx); |
| 1257 | if (0 != status) |
| 1258 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1259 | return; |
| 1260 | } |
| 1261 | /* |
| 1262 | * Allocate a size of 4096 for the interface stats comprising |
| 1263 | * sizeof (tpSirWifiIfaceStat).The size of 4096 is considered |
| 1264 | * assuming that all these fit with in the limit.Please take |
| 1265 | * a call on the limit based on the data requirements on |
| 1266 | * interface statistics. |
| 1267 | */ |
| 1268 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1269 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 1270 | QCA_NL80211_VENDOR_SUBCMD_LL_IFACE_STATS_INDEX, |
| 1271 | GFP_KERNEL); |
| 1272 | if (!vendor_event) |
| 1273 | { |
| 1274 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1275 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1276 | return; |
| 1277 | } |
| 1278 | |
| 1279 | pWifiIfaceStat = (tpSirWifiIfaceStat) pData; |
| 1280 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1281 | |
| 1282 | if (FALSE == hdd_get_interface_info( pAdapter, |
| 1283 | &pWifiIfaceStat->info)) |
| 1284 | { |
| 1285 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1286 | FL("hdd_get_interface_info get fail") ); |
| 1287 | kfree_skb(vendor_event); |
| 1288 | return; |
| 1289 | } |
| 1290 | |
| 1291 | if (FALSE == put_wifi_iface_stats( pAdapter, pWifiIfaceStat, |
| 1292 | vendor_event)) |
| 1293 | { |
| 1294 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1295 | FL("put_wifi_iface_stats fail") ); |
| 1296 | kfree_skb(vendor_event); |
| 1297 | return; |
| 1298 | } |
| 1299 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1300 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1301 | "WMI_LINK_STATS_IFACE Data"); |
| 1302 | |
| 1303 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1304 | "LL_STATS_IFACE: " |
| 1305 | " Mode %u " |
| 1306 | " MAC %pM " |
| 1307 | " State %u " |
| 1308 | " Roaming %u " |
| 1309 | " capabilities 0x%x " |
| 1310 | " SSID %s " |
| 1311 | " BSSID %pM", |
| 1312 | pWifiIfaceStat->info.mode, |
| 1313 | pWifiIfaceStat->info.macAddr, |
| 1314 | pWifiIfaceStat->info.state, |
| 1315 | pWifiIfaceStat->info.roaming, |
| 1316 | pWifiIfaceStat->info.capabilities, |
| 1317 | pWifiIfaceStat->info.ssid, |
| 1318 | pWifiIfaceStat->info.bssid); |
| 1319 | |
| 1320 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1321 | " AP country str: %c%c%c", |
| 1322 | pWifiIfaceStat->info.apCountryStr[0], |
| 1323 | pWifiIfaceStat->info.apCountryStr[1], |
| 1324 | pWifiIfaceStat->info.apCountryStr[2]); |
| 1325 | |
| 1326 | |
| 1327 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1328 | " Country Str Association: %c%c%c", |
| 1329 | pWifiIfaceStat->info.countryStr[0], |
| 1330 | pWifiIfaceStat->info.countryStr[1], |
| 1331 | pWifiIfaceStat->info.countryStr[2]); |
| 1332 | |
| 1333 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1334 | " beaconRx %u " |
| 1335 | " mgmtRx %u " |
| 1336 | " mgmtActionRx %u " |
| 1337 | " mgmtActionTx %u " |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1338 | " rssiMgmt %d " |
| 1339 | " rssiData %d " |
| 1340 | " rssiAck %d", |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1341 | pWifiIfaceStat->beaconRx, |
| 1342 | pWifiIfaceStat->mgmtRx, |
| 1343 | pWifiIfaceStat->mgmtActionRx, |
| 1344 | pWifiIfaceStat->mgmtActionTx, |
| 1345 | pWifiIfaceStat->rssiMgmt, |
| 1346 | pWifiIfaceStat->rssiData, |
| 1347 | pWifiIfaceStat->rssiAck ); |
| 1348 | |
| 1349 | |
| 1350 | { |
| 1351 | int i; |
| 1352 | for (i = 0 ; i < WIFI_AC_MAX; i ++) |
| 1353 | { |
| 1354 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1355 | |
| 1356 | " %d) LL_STATS IFACE: " |
| 1357 | " ac: %u txMpdu: %u " |
| 1358 | " rxMpdu: %u txMcast: %u " |
| 1359 | " rxMcast: %u rxAmpdu: %u " |
| 1360 | " txAmpdu: %u mpduLost: %u " |
| 1361 | " retries: %u retriesShort: %u " |
| 1362 | " retriesLong: %u contentionTimeMin: %u " |
| 1363 | " contentionTimeMax: %u contentionTimeAvg: %u " |
| 1364 | " contentionNumSamples: %u", |
| 1365 | i, |
| 1366 | pWifiIfaceStat->AccessclassStats[i].ac, |
| 1367 | pWifiIfaceStat->AccessclassStats[i].txMpdu, |
| 1368 | pWifiIfaceStat->AccessclassStats[i].rxMpdu, |
| 1369 | pWifiIfaceStat->AccessclassStats[i].txMcast, |
| 1370 | pWifiIfaceStat->AccessclassStats[i].rxMcast, |
| 1371 | pWifiIfaceStat->AccessclassStats[i].rxAmpdu, |
| 1372 | pWifiIfaceStat->AccessclassStats[i].txAmpdu, |
| 1373 | pWifiIfaceStat->AccessclassStats[i].mpduLost, |
| 1374 | pWifiIfaceStat->AccessclassStats[i].retries, |
| 1375 | pWifiIfaceStat-> |
| 1376 | AccessclassStats[i].retriesShort, |
| 1377 | pWifiIfaceStat->AccessclassStats[i].retriesLong, |
| 1378 | pWifiIfaceStat-> |
| 1379 | AccessclassStats[i].contentionTimeMin, |
| 1380 | pWifiIfaceStat-> |
| 1381 | AccessclassStats[i].contentionTimeMax, |
| 1382 | pWifiIfaceStat-> |
| 1383 | AccessclassStats[i].contentionTimeAvg, |
| 1384 | pWifiIfaceStat-> |
| 1385 | AccessclassStats[i].contentionNumSamples); |
| 1386 | |
| 1387 | } |
| 1388 | } |
| 1389 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1390 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1391 | |
| 1392 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1393 | } |
| 1394 | |
| 1395 | /* |
| 1396 | * hdd_link_layer_process_radio_stats () - This function is called after |
| 1397 | * receiving Link Layer Radio statistics from FW.This function converts |
| 1398 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1399 | * layers. |
| 1400 | */ |
| 1401 | static v_VOID_t hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, |
| 1402 | v_VOID_t *pData) |
| 1403 | { |
| 1404 | int status, i; |
| 1405 | tpSirWifiRadioStat pWifiRadioStat; |
| 1406 | tpSirWifiChannelStats pWifiChannelStats; |
| 1407 | struct sk_buff *vendor_event; |
| 1408 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1409 | struct nlattr *chList; |
| 1410 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1411 | ENTER(); |
| 1412 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1413 | status = wlan_hdd_validate_context(pHddCtx); |
| 1414 | if (0 != status) |
| 1415 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1416 | return; |
| 1417 | } |
| 1418 | pWifiRadioStat = (tpSirWifiRadioStat) pData; |
| 1419 | |
| 1420 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1421 | "LL_STATS_RADIO" |
| 1422 | " radio is %d onTime is %u " |
| 1423 | " txTime is %u rxTime is %u " |
| 1424 | " onTimeScan is %u onTimeNbd is %u " |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1425 | " onTimeEXTScan is %u onTimeRoamScan is %u " |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1426 | " onTimePnoScan is %u onTimeHs20 is %u " |
| 1427 | " numChannels is %u", |
| 1428 | pWifiRadioStat->radio, pWifiRadioStat->onTime, |
| 1429 | pWifiRadioStat->txTime, pWifiRadioStat->rxTime, |
| 1430 | pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1431 | pWifiRadioStat->onTimeEXTScan, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1432 | pWifiRadioStat->onTimeRoamScan, |
| 1433 | pWifiRadioStat->onTimePnoScan, |
| 1434 | pWifiRadioStat->onTimeHs20, |
| 1435 | pWifiRadioStat->numChannels); |
| 1436 | /* |
| 1437 | * Allocate a size of 4096 for the Radio stats comprising |
| 1438 | * sizeof (tSirWifiRadioStat) + numChannels * sizeof |
| 1439 | * (tSirWifiChannelStats).Each channel data is put with an |
| 1440 | * NL attribute.The size of 4096 is considered assuming that |
| 1441 | * number of channels shall not exceed beyond 60 with the |
| 1442 | * sizeof (tSirWifiChannelStats) being 24 bytes. |
| 1443 | */ |
| 1444 | |
| 1445 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 1446 | LL_STATS_EVENT_BUF_SIZE + NLMSG_HDRLEN , |
| 1447 | QCA_NL80211_VENDOR_SUBCMD_LL_RADIO_STATS_INDEX, |
| 1448 | GFP_KERNEL); |
| 1449 | |
| 1450 | if (!vendor_event) |
| 1451 | { |
| 1452 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1453 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1454 | return; |
| 1455 | } |
| 1456 | |
| 1457 | if (nla_put_u32(vendor_event, |
| 1458 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID, |
| 1459 | pWifiRadioStat->radio) || |
| 1460 | nla_put_u32(vendor_event, |
| 1461 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME, |
| 1462 | pWifiRadioStat->onTime) || |
| 1463 | nla_put_u32(vendor_event, |
| 1464 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME, |
| 1465 | pWifiRadioStat->txTime) || |
| 1466 | nla_put_u32(vendor_event, |
| 1467 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME, |
| 1468 | pWifiRadioStat->rxTime) || |
| 1469 | nla_put_u32(vendor_event, |
| 1470 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN, |
| 1471 | pWifiRadioStat->onTimeScan) || |
| 1472 | nla_put_u32(vendor_event, |
| 1473 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD, |
| 1474 | pWifiRadioStat->onTimeNbd) || |
| 1475 | nla_put_u32(vendor_event, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1476 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_EXTSCAN, |
| 1477 | pWifiRadioStat->onTimeEXTScan)|| |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1478 | nla_put_u32(vendor_event, |
| 1479 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN, |
| 1480 | pWifiRadioStat->onTimeRoamScan) || |
| 1481 | nla_put_u32(vendor_event, |
| 1482 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN, |
| 1483 | pWifiRadioStat->onTimePnoScan) || |
| 1484 | nla_put_u32(vendor_event, |
| 1485 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20, |
| 1486 | pWifiRadioStat->onTimeHs20) || |
| 1487 | nla_put_u32(vendor_event, |
| 1488 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS, |
| 1489 | pWifiRadioStat->numChannels)) |
| 1490 | { |
| 1491 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1492 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1493 | kfree_skb(vendor_event); |
| 1494 | return ; |
| 1495 | } |
| 1496 | |
| 1497 | chList = nla_nest_start(vendor_event, |
| 1498 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1499 | if(!chList) |
| 1500 | { |
| 1501 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1502 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO put fail", |
| 1503 | __func__); |
| 1504 | kfree_skb(vendor_event); |
| 1505 | return; |
| 1506 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1507 | for (i = 0; i < pWifiRadioStat->numChannels; i++) |
| 1508 | { |
| 1509 | struct nlattr *chInfo; |
| 1510 | |
| 1511 | pWifiChannelStats = (tpSirWifiChannelStats) ((uint8*) |
| 1512 | pWifiRadioStat->channels + |
| 1513 | (i * sizeof(tSirWifiChannelStats))); |
| 1514 | |
| 1515 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1516 | " %d) Channel Info" |
| 1517 | " width is %u " |
| 1518 | " CenterFreq %u " |
| 1519 | " CenterFreq0 %u " |
| 1520 | " CenterFreq1 %u " |
| 1521 | " onTime %u " |
| 1522 | " ccaBusyTime %u", |
| 1523 | i, |
| 1524 | pWifiChannelStats->channel.width, |
| 1525 | pWifiChannelStats->channel.centerFreq, |
| 1526 | pWifiChannelStats->channel.centerFreq0, |
| 1527 | pWifiChannelStats->channel.centerFreq1, |
| 1528 | pWifiChannelStats->onTime, |
| 1529 | pWifiChannelStats->ccaBusyTime); |
| 1530 | |
| 1531 | |
| 1532 | chInfo = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1533 | if(!chInfo) |
| 1534 | { |
| 1535 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1536 | "%s: failed to put chInfo", |
| 1537 | __func__); |
| 1538 | kfree_skb(vendor_event); |
| 1539 | return; |
| 1540 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1541 | |
| 1542 | if (nla_put_u32(vendor_event, |
| 1543 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH, |
| 1544 | pWifiChannelStats->channel.width) || |
| 1545 | nla_put_u32(vendor_event, |
| 1546 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ, |
| 1547 | pWifiChannelStats->channel.centerFreq) || |
| 1548 | nla_put_u32(vendor_event, |
| 1549 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ0, |
| 1550 | pWifiChannelStats->channel.centerFreq0) || |
| 1551 | nla_put_u32(vendor_event, |
| 1552 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ1, |
| 1553 | pWifiChannelStats->channel.centerFreq1) || |
| 1554 | nla_put_u32(vendor_event, |
| 1555 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME, |
| 1556 | pWifiChannelStats->onTime) || |
| 1557 | nla_put_u32(vendor_event, |
| 1558 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME, |
| 1559 | pWifiChannelStats->ccaBusyTime)) |
| 1560 | { |
| 1561 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1562 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1563 | kfree_skb(vendor_event); |
| 1564 | return ; |
| 1565 | } |
| 1566 | nla_nest_end(vendor_event, chInfo); |
| 1567 | } |
| 1568 | nla_nest_end(vendor_event, chList); |
| 1569 | |
| 1570 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1571 | |
| 1572 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1573 | return; |
| 1574 | } |
| 1575 | |
| 1576 | /* |
| 1577 | * hdd_link_layer_stats_ind_callback () - This function is called after |
| 1578 | * receiving Link Layer indications from FW.This callback converts the firmware |
| 1579 | * data to the NL data and send the same to the kernel/upper layers. |
| 1580 | */ |
| 1581 | static void hdd_link_layer_stats_ind_callback ( void *pCtx, |
| 1582 | int indType, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1583 | void *pRsp, u8 *macAddr) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1584 | { |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1585 | hdd_context_t *pHddCtx = (hdd_context_t *)pCtx; |
| 1586 | hdd_adapter_t *pAdapter = NULL; |
| 1587 | tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults)pRsp; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1588 | int status; |
| 1589 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1590 | ENTER(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1591 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1592 | status = wlan_hdd_validate_context(pHddCtx); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1593 | if (0 != status) |
| 1594 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1595 | return; |
| 1596 | } |
| 1597 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1598 | pAdapter = hdd_get_adapter_by_macaddr(pHddCtx, macAddr); |
| 1599 | if (NULL == pAdapter) |
| 1600 | { |
| 1601 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1602 | FL(" MAC address %pM does not exist with host"), |
| 1603 | macAddr); |
| 1604 | return; |
| 1605 | } |
| 1606 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1607 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1608 | "%s: Interface: %s LLStats indType: %d", __func__, |
| 1609 | pAdapter->dev->name, indType); |
| 1610 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1611 | switch (indType) |
| 1612 | { |
| 1613 | case SIR_HAL_LL_STATS_RESULTS_RSP: |
| 1614 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1615 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1616 | FL("RESPONSE SIR_HAL_LL_STATS_RESULTS_RSP") ); |
| 1617 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1618 | "LL_STATS RESULTS RESPONSE paramID = 0x%x", |
| 1619 | linkLayerStatsResults->paramId); |
| 1620 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1621 | "LL_STATS RESULTS RESPONSE ifaceId = %u MAC: %pM", |
| 1622 | linkLayerStatsResults->ifaceId, macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1623 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1624 | "LL_STATS RESULTS RESPONSE respId = %u", |
| 1625 | linkLayerStatsResults->respId); |
| 1626 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1627 | "LL_STATS RESULTS RESPONSE moreResultToFollow = %u", |
| 1628 | linkLayerStatsResults->moreResultToFollow); |
| 1629 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1630 | "LL_STATS RESULTS RESPONSE result = %p", |
| 1631 | linkLayerStatsResults->result); |
| 1632 | if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO ) |
| 1633 | { |
| 1634 | hdd_link_layer_process_radio_stats(pAdapter, |
| 1635 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1636 | } |
| 1637 | else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE ) |
| 1638 | { |
| 1639 | hdd_link_layer_process_iface_stats(pAdapter, |
| 1640 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1641 | } |
| 1642 | else if ( linkLayerStatsResults->paramId & |
| 1643 | WMI_LINK_STATS_ALL_PEER ) |
| 1644 | { |
| 1645 | hdd_link_layer_process_peer_stats(pAdapter, |
| 1646 | (v_VOID_t *)linkLayerStatsResults->result); |
| 1647 | } /* WMI_LINK_STATS_ALL_PEER */ |
| 1648 | else |
| 1649 | { |
| 1650 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1651 | FL("INVALID LL_STATS_NOTIFY RESPONSE ***********")); |
| 1652 | } |
| 1653 | |
| 1654 | break; |
| 1655 | } |
| 1656 | default: |
| 1657 | hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType); |
| 1658 | break; |
| 1659 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1660 | |
| 1661 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1662 | return; |
| 1663 | } |
| 1664 | |
| 1665 | const struct |
| 1666 | nla_policy |
| 1667 | qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX +1] = |
| 1668 | { |
| 1669 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = |
| 1670 | { .type = NLA_U32 }, |
| 1671 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = |
| 1672 | { .type = NLA_U32 }, |
| 1673 | }; |
| 1674 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1675 | static int __wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1676 | struct wireless_dev *wdev, |
| 1677 | const void *data, |
| 1678 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1679 | { |
| 1680 | int status; |
| 1681 | 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] | 1682 | tSirLLStatsSetReq linkLayerStatsSetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1683 | struct net_device *dev = wdev->netdev; |
| 1684 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1685 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1686 | hdd_station_ctx_t *pHddStaCtx; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1687 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1688 | ENTER(); |
| 1689 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1690 | status = wlan_hdd_validate_context(pHddCtx); |
| 1691 | if (0 != status) |
| 1692 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1693 | return -EINVAL; |
| 1694 | } |
| 1695 | |
| 1696 | if (NULL == pAdapter) |
| 1697 | { |
| 1698 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1699 | FL("HDD adapter is Null")); |
| 1700 | return -ENODEV; |
| 1701 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1702 | /* check the LLStats Capability */ |
| 1703 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1704 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1705 | { |
| 1706 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1707 | FL("Link Layer Statistics not supported by Firmware")); |
| 1708 | return -EINVAL; |
| 1709 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1710 | |
| 1711 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, |
| 1712 | (struct nlattr *)data, |
| 1713 | data_len, qca_wlan_vendor_ll_set_policy)) |
| 1714 | { |
| 1715 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1716 | return -EINVAL; |
| 1717 | } |
| 1718 | if (!tb_vendor |
| 1719 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]) |
| 1720 | { |
| 1721 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MPDU size Not present")); |
| 1722 | return -EINVAL; |
| 1723 | } |
| 1724 | if (!tb_vendor[ |
| 1725 | QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]) |
| 1726 | { |
| 1727 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Stats Gathering Not Present")); |
| 1728 | return -EINVAL; |
| 1729 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1730 | // 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] | 1731 | linkLayerStatsSetReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1732 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1733 | linkLayerStatsSetReq.mpduSizeThreshold = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1734 | nla_get_u32( |
| 1735 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]); |
| 1736 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1737 | linkLayerStatsSetReq.aggressiveStatisticsGathering = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1738 | nla_get_u32( |
| 1739 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]); |
| 1740 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1741 | vos_mem_copy(linkLayerStatsSetReq.macAddr, |
| 1742 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1743 | |
| 1744 | |
| 1745 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1746 | "LL_STATS_SET reqId = %d", linkLayerStatsSetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1747 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1748 | "LL_STATS_SET MAC = %pM", linkLayerStatsSetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1749 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1750 | "LL_STATS_SET mpduSizeThreshold = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1751 | linkLayerStatsSetReq.mpduSizeThreshold); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1752 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1753 | "LL_STATS_SET aggressive Statistics Gathering = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1754 | linkLayerStatsSetReq.aggressiveStatisticsGathering); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1755 | |
| 1756 | if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB( |
| 1757 | pHddCtx->hHal, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1758 | hdd_link_layer_stats_ind_callback)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1759 | { |
| 1760 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1761 | "sme_SetLinkLayerStatsIndCB Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1762 | return -EINVAL; |
| 1763 | |
| 1764 | } |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1765 | |
| 1766 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1767 | if (VOS_STATUS_SUCCESS != |
| 1768 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1769 | pHddStaCtx->conn_info.staId[0], WIFI_STATS_IFACE)) |
| 1770 | { |
| 1771 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1772 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 1773 | return -EINVAL; |
| 1774 | } |
| 1775 | |
| 1776 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 1777 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 1778 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 1779 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 1780 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1781 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1782 | &linkLayerStatsSetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1783 | { |
| 1784 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1785 | "sme_LLStatsSetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1786 | return -EINVAL; |
| 1787 | } |
| 1788 | |
| 1789 | pAdapter->isLinkLayerStatsSet = 1; |
| 1790 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1791 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1792 | return 0; |
| 1793 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1794 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1795 | struct wireless_dev *wdev, |
| 1796 | const void *data, |
| 1797 | int data_len) |
| 1798 | { |
| 1799 | int ret = 0; |
| 1800 | |
| 1801 | vos_ssr_protect(__func__); |
| 1802 | ret = __wlan_hdd_cfg80211_ll_stats_set(wiphy, wdev, data, data_len); |
| 1803 | vos_ssr_unprotect(__func__); |
| 1804 | |
| 1805 | return ret; |
| 1806 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1807 | |
| 1808 | const struct |
| 1809 | nla_policy |
| 1810 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 1811 | { |
| 1812 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 1813 | * command. When reporting |
| 1814 | * the stats results, the driver uses the same value to indicate |
| 1815 | * which GET request the results |
| 1816 | * correspond to. |
| 1817 | */ |
| 1818 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 1819 | |
| 1820 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 1821 | requested for retrieval */ |
| 1822 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 1823 | }; |
| 1824 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1825 | static int __wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1826 | struct wireless_dev *wdev, |
| 1827 | const void *data, |
| 1828 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1829 | { |
| 1830 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1831 | 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] | 1832 | tSirLLStatsGetReq linkLayerStatsGetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1833 | struct net_device *dev = wdev->netdev; |
| 1834 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1835 | int status; |
| 1836 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1837 | ENTER(); |
| 1838 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1839 | status = wlan_hdd_validate_context(pHddCtx); |
| 1840 | if (0 != status) |
| 1841 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1842 | return -EINVAL ; |
| 1843 | } |
| 1844 | |
| 1845 | if (NULL == pAdapter) |
| 1846 | { |
| 1847 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1848 | "%s: HDD adapter is Null", __func__); |
| 1849 | return -ENODEV; |
| 1850 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1851 | /* check the LLStats Capability */ |
| 1852 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1853 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1854 | { |
| 1855 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1856 | FL("Link Layer Statistics not supported by Firmware")); |
| 1857 | return -EINVAL; |
| 1858 | } |
| 1859 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1860 | |
| 1861 | if (!pAdapter->isLinkLayerStatsSet) |
| 1862 | { |
| 1863 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1864 | "%s: isLinkLayerStatsSet : %d", |
| 1865 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1866 | return -EINVAL; |
| 1867 | } |
| 1868 | |
| 1869 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 1870 | (struct nlattr *)data, |
| 1871 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 1872 | { |
| 1873 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1874 | return -EINVAL; |
| 1875 | } |
| 1876 | |
| 1877 | if (!tb_vendor |
| 1878 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 1879 | { |
| 1880 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 1881 | return -EINVAL; |
| 1882 | } |
| 1883 | |
| 1884 | if (!tb_vendor |
| 1885 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 1886 | { |
| 1887 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 1888 | return -EINVAL; |
| 1889 | } |
| 1890 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1891 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1892 | linkLayerStatsGetReq.reqId = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1893 | nla_get_u32( tb_vendor[ |
| 1894 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1895 | linkLayerStatsGetReq.paramIdMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1896 | nla_get_u32( tb_vendor[ |
| 1897 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 1898 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1899 | vos_mem_copy(linkLayerStatsGetReq.macAddr, |
| 1900 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1901 | |
| 1902 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1903 | "LL_STATS_GET reqId = %d", linkLayerStatsGetReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1904 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1905 | "LL_STATS_GET MAC = %pM", linkLayerStatsGetReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1906 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1907 | "LL_STATS_GET paramIdMask = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1908 | linkLayerStatsGetReq.paramIdMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1909 | |
| 1910 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1911 | &linkLayerStatsGetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1912 | { |
| 1913 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1914 | "sme_LLStatsGetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1915 | return -EINVAL; |
| 1916 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1917 | |
| 1918 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1919 | return 0; |
| 1920 | } |
| 1921 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1922 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1923 | struct wireless_dev *wdev, |
| 1924 | const void *data, |
| 1925 | int data_len) |
| 1926 | { |
| 1927 | int ret = 0; |
| 1928 | |
| 1929 | vos_ssr_protect(__func__); |
| 1930 | ret = __wlan_hdd_cfg80211_ll_stats_get(wiphy, wdev, data, data_len); |
| 1931 | vos_ssr_unprotect(__func__); |
| 1932 | |
| 1933 | return ret; |
| 1934 | } |
| 1935 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1936 | const struct |
| 1937 | nla_policy |
| 1938 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 1939 | { |
| 1940 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 1941 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 1942 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 1943 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 1944 | }; |
| 1945 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1946 | static int __wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 1947 | struct wireless_dev *wdev, |
| 1948 | const void *data, |
| 1949 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1950 | { |
| 1951 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1952 | 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] | 1953 | tSirLLStatsClearReq linkLayerStatsClearReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1954 | struct net_device *dev = wdev->netdev; |
| 1955 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1956 | u32 statsClearReqMask; |
| 1957 | u8 stopReq; |
| 1958 | int status; |
| 1959 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1960 | ENTER(); |
| 1961 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1962 | status = wlan_hdd_validate_context(pHddCtx); |
| 1963 | if (0 != status) |
| 1964 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1965 | return -EINVAL; |
| 1966 | } |
| 1967 | |
| 1968 | if (NULL == pAdapter) |
| 1969 | { |
| 1970 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1971 | "%s: HDD adapter is Null", __func__); |
| 1972 | return -ENODEV; |
| 1973 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1974 | /* check the LLStats Capability */ |
| 1975 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1976 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1977 | { |
| 1978 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1979 | FL("Enable LLStats Capability")); |
| 1980 | return -EINVAL; |
| 1981 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1982 | |
| 1983 | if (!pAdapter->isLinkLayerStatsSet) |
| 1984 | { |
| 1985 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1986 | "%s: isLinkLayerStatsSet : %d", |
| 1987 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1988 | return -EINVAL; |
| 1989 | } |
| 1990 | |
| 1991 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 1992 | (struct nlattr *)data, |
| 1993 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 1994 | { |
| 1995 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1996 | return -EINVAL; |
| 1997 | } |
| 1998 | |
| 1999 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 2000 | |
| 2001 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 2002 | { |
| 2003 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 2004 | return -EINVAL; |
| 2005 | |
| 2006 | } |
| 2007 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2008 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2009 | statsClearReqMask = linkLayerStatsClearReq.statsClearReqMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2010 | nla_get_u32( |
| 2011 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 2012 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2013 | stopReq = linkLayerStatsClearReq.stopReq = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2014 | nla_get_u8( |
| 2015 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 2016 | |
| 2017 | // 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] | 2018 | linkLayerStatsClearReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2019 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2020 | vos_mem_copy(linkLayerStatsClearReq.macAddr, |
| 2021 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2022 | |
| 2023 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2024 | "LL_STATS_CLEAR reqId = %d", linkLayerStatsClearReq.reqId); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2025 | hddLog(VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2026 | "LL_STATS_CLEAR MAC = %pM", linkLayerStatsClearReq.macAddr); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2027 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2028 | "LL_STATS_CLEAR statsClearReqMask = 0x%X", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2029 | linkLayerStatsClearReq.statsClearReqMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2030 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2031 | "LL_STATS_CLEAR stopReq = %d", |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2032 | linkLayerStatsClearReq.stopReq); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2033 | |
| 2034 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2035 | &linkLayerStatsClearReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2036 | { |
| 2037 | struct sk_buff *temp_skbuff; |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 2038 | hdd_station_ctx_t *pHddStaCtx; |
| 2039 | |
| 2040 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2041 | if (VOS_STATUS_SUCCESS != |
| 2042 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 2043 | pHddStaCtx->conn_info.staId[0], statsClearReqMask)) |
| 2044 | { |
| 2045 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2046 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 2047 | return -EINVAL; |
| 2048 | } |
| 2049 | if ((statsClearReqMask & WIFI_STATS_IFACE_AC) || |
| 2050 | (statsClearReqMask & WIFI_STATS_IFACE)) { |
| 2051 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 2052 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 2053 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 2054 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 2055 | } |
| 2056 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2057 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 2058 | 2 * sizeof(u32) + |
| 2059 | NLMSG_HDRLEN); |
| 2060 | |
| 2061 | if (temp_skbuff != NULL) |
| 2062 | { |
| 2063 | |
| 2064 | if (nla_put_u32(temp_skbuff, |
| 2065 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 2066 | statsClearReqMask) || |
| 2067 | nla_put_u32(temp_skbuff, |
| 2068 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 2069 | stopReq)) |
| 2070 | { |
| 2071 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 2072 | kfree_skb(temp_skbuff); |
| 2073 | return -EINVAL; |
| 2074 | } |
| 2075 | /* If the ask is to stop the stats collection as part of clear |
| 2076 | * (stopReq = 1) , ensure that no further requests of get |
| 2077 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 2078 | * However it the stopReq as part of the clear request is 0 , |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2079 | * the request to get the statistics are honoured as in this |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2080 | * case the firmware is just asked to clear the statistics. |
| 2081 | */ |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2082 | if (linkLayerStatsClearReq.stopReq == 1) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2083 | pAdapter->isLinkLayerStatsSet = 0; |
| 2084 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 2085 | } |
| 2086 | return -ENOMEM; |
| 2087 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2088 | |
| 2089 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2090 | return -EINVAL; |
| 2091 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2092 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 2093 | struct wireless_dev *wdev, |
| 2094 | const void *data, |
| 2095 | int data_len) |
| 2096 | { |
| 2097 | int ret = 0; |
| 2098 | |
| 2099 | vos_ssr_protect(__func__); |
| 2100 | ret = __wlan_hdd_cfg80211_ll_stats_clear(wiphy, wdev, data, data_len); |
| 2101 | vos_ssr_unprotect(__func__); |
| 2102 | |
| 2103 | return ret; |
| 2104 | |
| 2105 | |
| 2106 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2107 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 2108 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2109 | #ifdef WLAN_FEATURE_EXTSCAN |
| 2110 | static const struct nla_policy |
| 2111 | wlan_hdd_extscan_config_policy |
| 2112 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = |
| 2113 | { |
| 2114 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = |
| 2115 | { .type = NLA_U32 }, |
| 2116 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = |
| 2117 | { .type = NLA_U32 }, |
| 2118 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 }, |
| 2119 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = |
| 2120 | { .type = NLA_U32 }, |
| 2121 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = { .type = NLA_U8 }, |
| 2122 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = { .type = NLA_U8 }, |
| 2123 | |
| 2124 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = { .type = NLA_U8 }, |
| 2125 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = { .type = NLA_U8 }, |
| 2126 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 }, |
| 2127 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = |
| 2128 | { .type = NLA_U8 }, |
| 2129 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = |
| 2130 | { .type = NLA_U32 }, |
| 2131 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = |
| 2132 | { .type = NLA_U32 }, |
| 2133 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = |
| 2134 | { .type = NLA_U32 }, |
| 2135 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD] = |
| 2136 | { .type = NLA_U8 }, |
| 2137 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = |
| 2138 | { .type = NLA_U8 }, |
| 2139 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = |
| 2140 | { .type = NLA_U8 }, |
| 2141 | |
| 2142 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = |
| 2143 | { .type = NLA_U32 }, |
| 2144 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = |
| 2145 | { .type = NLA_UNSPEC }, |
| 2146 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = |
| 2147 | { .type = NLA_S32 }, |
| 2148 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = |
| 2149 | { .type = NLA_S32 }, |
| 2150 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = |
| 2151 | { .type = NLA_U32 }, |
| 2152 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = |
| 2153 | { .type = NLA_U32 }, |
| 2154 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE] = |
| 2155 | { .type = NLA_U32 }, |
| 2156 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE] |
| 2157 | = { .type = NLA_U32 }, |
| 2158 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING] = |
| 2159 | { .type = NLA_U32 }, |
| 2160 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP] = { .type = |
| 2161 | NLA_U32 }, |
| 2162 | }; |
| 2163 | |
| 2164 | static void wlan_hdd_cfg80211_extscan_get_capabilities_ind(void *ctx, void *pMsg) |
| 2165 | { |
| 2166 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2167 | struct sk_buff *skb = NULL; |
| 2168 | tpSirEXTScanCapabilitiesEvent pData = |
| 2169 | (tpSirEXTScanCapabilitiesEvent) pMsg; |
| 2170 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2171 | ENTER(); |
| 2172 | |
| 2173 | if (wlan_hdd_validate_context(pHddCtx)) |
| 2174 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2175 | return; |
| 2176 | } |
| 2177 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2178 | if (!pMsg) |
| 2179 | { |
| 2180 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2181 | return; |
| 2182 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2183 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2184 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2185 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES_INDEX, |
| 2186 | GFP_KERNEL); |
| 2187 | |
| 2188 | if (!skb) { |
| 2189 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2190 | FL("cfg80211_vendor_event_alloc failed")); |
| 2191 | return; |
| 2192 | } |
| 2193 | |
| 2194 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2195 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan cache size (%u)", pData->scanCacheSize); |
| 2196 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan buckets (%u)", pData->scanBuckets); |
| 2197 | hddLog(VOS_TRACE_LEVEL_INFO, "Max AP per scan (%u)", pData->maxApPerScan); |
| 2198 | hddLog(VOS_TRACE_LEVEL_INFO, "maxRssiSampleSize (%u)", |
| 2199 | pData->maxRssiSampleSize); |
| 2200 | hddLog(VOS_TRACE_LEVEL_INFO, "maxScanReportingThreshold (%u)", |
| 2201 | pData->maxScanReportingThreshold); |
| 2202 | hddLog(VOS_TRACE_LEVEL_INFO, "maxHotlistAPs (%u)", pData->maxHotlistAPs); |
| 2203 | hddLog(VOS_TRACE_LEVEL_INFO, "maxSignificantWifiChangeAPs (%u)", |
| 2204 | pData->maxSignificantWifiChangeAPs); |
| 2205 | hddLog(VOS_TRACE_LEVEL_INFO, "maxBsidHistoryEntries (%u)", |
| 2206 | pData->maxBsidHistoryEntries); |
| 2207 | |
| 2208 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2209 | pData->requestId) || |
| 2210 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status) || |
| 2211 | nla_put_u32(skb, |
| 2212 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE, |
| 2213 | pData->scanCacheSize) || |
| 2214 | nla_put_u32(skb, |
| 2215 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS, |
| 2216 | pData->scanBuckets) || |
| 2217 | nla_put_u32(skb, |
| 2218 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN, |
| 2219 | pData->maxApPerScan) || |
| 2220 | nla_put_u32(skb, |
| 2221 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE, |
| 2222 | pData->maxRssiSampleSize) || |
| 2223 | nla_put_u32(skb, |
| 2224 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD, |
| 2225 | pData->maxScanReportingThreshold) || |
| 2226 | nla_put_u32(skb, |
| 2227 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_APS, |
| 2228 | pData->maxHotlistAPs) || |
| 2229 | nla_put_u32(skb, |
| 2230 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS, |
| 2231 | pData->maxSignificantWifiChangeAPs) || |
| 2232 | nla_put_u32(skb, |
| 2233 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES, |
| 2234 | pData->maxBsidHistoryEntries)) { |
| 2235 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2236 | goto nla_put_failure; |
| 2237 | } |
| 2238 | |
| 2239 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2240 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2241 | return; |
| 2242 | |
| 2243 | nla_put_failure: |
| 2244 | kfree_skb(skb); |
| 2245 | return; |
| 2246 | } |
| 2247 | |
| 2248 | |
| 2249 | static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg) |
| 2250 | { |
| 2251 | tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg; |
| 2252 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2253 | struct sk_buff *skb = NULL; |
| 2254 | tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal ); |
| 2255 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2256 | ENTER(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2257 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2258 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2259 | return; |
| 2260 | } |
| 2261 | if (!pMsg) |
| 2262 | { |
| 2263 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2264 | return; |
| 2265 | } |
| 2266 | |
| 2267 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2268 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2269 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START_INDEX, |
| 2270 | GFP_KERNEL); |
| 2271 | |
| 2272 | if (!skb) { |
| 2273 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2274 | FL("cfg80211_vendor_event_alloc failed")); |
| 2275 | return; |
| 2276 | } |
| 2277 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2278 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2279 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2280 | |
| 2281 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2282 | pData->requestId) || |
| 2283 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2284 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2285 | goto nla_put_failure; |
| 2286 | } |
| 2287 | |
| 2288 | /* |
| 2289 | * Store the Request ID for comparing with the requestID obtained |
| 2290 | * in other requests.HDD shall return a failure is the extscan_stop |
| 2291 | * request is issued with a different requestId as that of the |
| 2292 | * extscan_start request. Also, This requestId shall be used while |
| 2293 | * indicating the full scan results to the upper layers. |
| 2294 | * The requestId is stored with the assumption that the firmware |
| 2295 | * shall return the ext scan start request's requestId in ext scan |
| 2296 | * start response. |
| 2297 | */ |
| 2298 | if (pData->status == 0) |
| 2299 | pMac->sme.extScanStartReqId = pData->requestId; |
| 2300 | |
| 2301 | |
| 2302 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2303 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2304 | return; |
| 2305 | |
| 2306 | nla_put_failure: |
| 2307 | kfree_skb(skb); |
| 2308 | return; |
| 2309 | } |
| 2310 | |
| 2311 | |
| 2312 | static void wlan_hdd_cfg80211_extscan_stop_rsp(void *ctx, void *pMsg) |
| 2313 | { |
| 2314 | tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg; |
| 2315 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2316 | struct sk_buff *skb = NULL; |
| 2317 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2318 | ENTER(); |
| 2319 | |
| 2320 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2321 | return; |
| 2322 | } |
| 2323 | if (!pMsg) |
| 2324 | { |
| 2325 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2326 | return; |
| 2327 | } |
| 2328 | |
| 2329 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2330 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2331 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP_INDEX, |
| 2332 | GFP_KERNEL); |
| 2333 | |
| 2334 | if (!skb) { |
| 2335 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2336 | FL("cfg80211_vendor_event_alloc failed")); |
| 2337 | return; |
| 2338 | } |
| 2339 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2340 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2341 | |
| 2342 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2343 | pData->requestId) || |
| 2344 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2345 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2346 | goto nla_put_failure; |
| 2347 | } |
| 2348 | |
| 2349 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2350 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2351 | return; |
| 2352 | |
| 2353 | nla_put_failure: |
| 2354 | kfree_skb(skb); |
| 2355 | return; |
| 2356 | } |
| 2357 | |
| 2358 | |
| 2359 | static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx, |
| 2360 | void *pMsg) |
| 2361 | { |
| 2362 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2363 | struct sk_buff *skb = NULL; |
| 2364 | tpSirEXTScanSetBssidHotListRspParams pData = |
| 2365 | (tpSirEXTScanSetBssidHotListRspParams) pMsg; |
| 2366 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2367 | ENTER(); |
| 2368 | |
| 2369 | if (wlan_hdd_validate_context(pHddCtx)){ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2370 | return; |
| 2371 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2372 | if (!pMsg) |
| 2373 | { |
| 2374 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2375 | return; |
| 2376 | } |
| 2377 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2378 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2379 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2380 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST_INDEX, |
| 2381 | GFP_KERNEL); |
| 2382 | |
| 2383 | if (!skb) { |
| 2384 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2385 | FL("cfg80211_vendor_event_alloc failed")); |
| 2386 | return; |
| 2387 | } |
| 2388 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2389 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2390 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2391 | |
| 2392 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2393 | pData->requestId) || |
| 2394 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2395 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2396 | goto nla_put_failure; |
| 2397 | } |
| 2398 | |
| 2399 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2400 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2401 | return; |
| 2402 | |
| 2403 | nla_put_failure: |
| 2404 | kfree_skb(skb); |
| 2405 | return; |
| 2406 | } |
| 2407 | |
| 2408 | static void wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(void *ctx, |
| 2409 | void *pMsg) |
| 2410 | { |
| 2411 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2412 | struct sk_buff *skb = NULL; |
| 2413 | tpSirEXTScanResetBssidHotlistRspParams pData = |
| 2414 | (tpSirEXTScanResetBssidHotlistRspParams) pMsg; |
| 2415 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2416 | ENTER(); |
| 2417 | |
| 2418 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2419 | return; |
| 2420 | } |
| 2421 | if (!pMsg) |
| 2422 | { |
| 2423 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2424 | return; |
| 2425 | } |
| 2426 | |
| 2427 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2428 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2429 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST_INDEX, |
| 2430 | GFP_KERNEL); |
| 2431 | |
| 2432 | if (!skb) { |
| 2433 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2434 | FL("cfg80211_vendor_event_alloc failed")); |
| 2435 | return; |
| 2436 | } |
| 2437 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2438 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2439 | |
| 2440 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2441 | pData->requestId) || |
| 2442 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2443 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2444 | goto nla_put_failure; |
| 2445 | } |
| 2446 | |
| 2447 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2448 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2449 | return; |
| 2450 | |
| 2451 | nla_put_failure: |
| 2452 | kfree_skb(skb); |
| 2453 | return; |
| 2454 | } |
| 2455 | |
| 2456 | |
| 2457 | static void wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(void *ctx, |
| 2458 | void *pMsg) |
| 2459 | { |
| 2460 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2461 | struct sk_buff *skb = NULL; |
| 2462 | tpSirEXTScanSetSignificantChangeRspParams pData = |
| 2463 | (tpSirEXTScanSetSignificantChangeRspParams) pMsg; |
| 2464 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2465 | ENTER(); |
| 2466 | |
| 2467 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2468 | return; |
| 2469 | } |
| 2470 | if (!pMsg) |
| 2471 | { |
| 2472 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2473 | return; |
| 2474 | } |
| 2475 | |
| 2476 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2477 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2478 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE_INDEX, |
| 2479 | GFP_KERNEL); |
| 2480 | |
| 2481 | if (!skb) { |
| 2482 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2483 | FL("cfg80211_vendor_event_alloc failed")); |
| 2484 | return; |
| 2485 | } |
| 2486 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2487 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2488 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2489 | |
| 2490 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2491 | pData->requestId) || |
| 2492 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2493 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2494 | goto nla_put_failure; |
| 2495 | } |
| 2496 | |
| 2497 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2498 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2499 | return; |
| 2500 | |
| 2501 | nla_put_failure: |
| 2502 | kfree_skb(skb); |
| 2503 | return; |
| 2504 | } |
| 2505 | |
| 2506 | |
| 2507 | static void wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(void *ctx, |
| 2508 | void *pMsg) |
| 2509 | { |
| 2510 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2511 | struct sk_buff *skb = NULL; |
| 2512 | tpSirEXTScanResetSignificantChangeRspParams pData = |
| 2513 | (tpSirEXTScanResetSignificantChangeRspParams) pMsg; |
| 2514 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2515 | ENTER(); |
| 2516 | |
| 2517 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2518 | return; |
| 2519 | } |
| 2520 | if (!pMsg) |
| 2521 | { |
| 2522 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2523 | return; |
| 2524 | } |
| 2525 | |
| 2526 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2527 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2528 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE_INDEX, |
| 2529 | GFP_KERNEL); |
| 2530 | |
| 2531 | if (!skb) { |
| 2532 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2533 | FL("cfg80211_vendor_event_alloc failed")); |
| 2534 | return; |
| 2535 | } |
| 2536 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2537 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2538 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2539 | |
| 2540 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2541 | pData->requestId) || |
| 2542 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS, pData->status)) { |
| 2543 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 2544 | goto nla_put_failure; |
| 2545 | } |
| 2546 | |
| 2547 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2548 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2549 | return; |
| 2550 | |
| 2551 | nla_put_failure: |
| 2552 | kfree_skb(skb); |
| 2553 | return; |
| 2554 | } |
| 2555 | |
| 2556 | static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx, |
| 2557 | void *pMsg) |
| 2558 | { |
| 2559 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2560 | struct sk_buff *skb = NULL; |
| 2561 | tANI_U32 i = 0, j, resultsPerEvent; |
| 2562 | tANI_S32 totalResults; |
| 2563 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2564 | tpSirWifiScanResult pSirWifiScanResult; |
| 2565 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2566 | ENTER(); |
| 2567 | |
| 2568 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2569 | return; |
| 2570 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2571 | if (!pMsg) |
| 2572 | { |
| 2573 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2574 | return; |
| 2575 | } |
| 2576 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2577 | totalResults = pData->numOfAps; |
| 2578 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2579 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2580 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2581 | |
| 2582 | do{ |
| 2583 | resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ? |
| 2584 | EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults); |
| 2585 | totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND; |
| 2586 | |
| 2587 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2588 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2589 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS_INDEX, |
| 2590 | GFP_KERNEL); |
| 2591 | |
| 2592 | if (!skb) { |
| 2593 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2594 | FL("cfg80211_vendor_event_alloc failed")); |
| 2595 | return; |
| 2596 | } |
| 2597 | |
| 2598 | hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent); |
| 2599 | |
| 2600 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2601 | pData->requestId) || |
| 2602 | nla_put_u32(skb, |
| 2603 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2604 | resultsPerEvent)) { |
| 2605 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2606 | goto fail; |
| 2607 | } |
| 2608 | if (nla_put_u8(skb, |
| 2609 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2610 | pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 ))) |
| 2611 | { |
| 2612 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2613 | goto fail; |
| 2614 | } |
| 2615 | |
| 2616 | if (resultsPerEvent) { |
| 2617 | struct nlattr *aps; |
| 2618 | |
| 2619 | aps = nla_nest_start(skb, |
| 2620 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2621 | if (!aps) |
| 2622 | { |
| 2623 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2624 | goto fail; |
| 2625 | } |
| 2626 | |
| 2627 | for (j = 0; j < resultsPerEvent; j++, i++) { |
| 2628 | struct nlattr *ap; |
| 2629 | pSirWifiScanResult = (tpSirWifiScanResult) ((tANI_U8 *) |
| 2630 | pData->ap + ( i* sizeof(tSirWifiScanResult))); |
| 2631 | |
| 2632 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) " |
| 2633 | "Ssid (%s)" |
| 2634 | "Bssid: %pM " |
| 2635 | "Channel (%u)" |
| 2636 | "Rssi (%d)" |
| 2637 | "RTT (%u)" |
| 2638 | "RTT_SD (%u)", |
| 2639 | i, |
| 2640 | pSirWifiScanResult->ts, |
| 2641 | pSirWifiScanResult->ssid, |
| 2642 | pSirWifiScanResult->bssid, |
| 2643 | pSirWifiScanResult->channel, |
| 2644 | pSirWifiScanResult->rssi, |
| 2645 | pSirWifiScanResult->rtt, |
| 2646 | pSirWifiScanResult->rtt_sd); |
| 2647 | |
| 2648 | ap = nla_nest_start(skb, j + 1); |
| 2649 | if (!ap) |
| 2650 | { |
| 2651 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2652 | goto fail; |
| 2653 | } |
| 2654 | |
| 2655 | if (nla_put_u64(skb, |
| 2656 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2657 | pSirWifiScanResult->ts) ) |
| 2658 | { |
| 2659 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2660 | goto fail; |
| 2661 | } |
| 2662 | if (nla_put(skb, |
| 2663 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2664 | sizeof(pSirWifiScanResult->ssid), |
| 2665 | pSirWifiScanResult->ssid) ) |
| 2666 | { |
| 2667 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2668 | goto fail; |
| 2669 | } |
| 2670 | if (nla_put(skb, |
| 2671 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2672 | sizeof(pSirWifiScanResult->bssid), |
| 2673 | pSirWifiScanResult->bssid) ) |
| 2674 | { |
| 2675 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2676 | goto fail; |
| 2677 | } |
| 2678 | if (nla_put_u32(skb, |
| 2679 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2680 | pSirWifiScanResult->channel) ) |
| 2681 | { |
| 2682 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2683 | goto fail; |
| 2684 | } |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 2685 | if (nla_put_s32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2686 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2687 | pSirWifiScanResult->rssi) ) |
| 2688 | { |
| 2689 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2690 | goto fail; |
| 2691 | } |
| 2692 | if (nla_put_u32(skb, |
| 2693 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2694 | pSirWifiScanResult->rtt) ) |
| 2695 | { |
| 2696 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2697 | goto fail; |
| 2698 | } |
| 2699 | if (nla_put_u32(skb, |
| 2700 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2701 | pSirWifiScanResult->rtt_sd)) |
| 2702 | { |
| 2703 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2704 | goto fail; |
| 2705 | } |
| 2706 | |
| 2707 | nla_nest_end(skb, ap); |
| 2708 | } |
| 2709 | nla_nest_end(skb, aps); |
| 2710 | |
| 2711 | } |
| 2712 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 2713 | } while (totalResults > 0); |
| 2714 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2715 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2716 | return; |
| 2717 | fail: |
| 2718 | kfree_skb(skb); |
| 2719 | return; |
| 2720 | } |
| 2721 | |
| 2722 | static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx, |
| 2723 | void *pMsg) |
| 2724 | { |
| 2725 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
| 2726 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2727 | struct sk_buff *skb = NULL; |
| 2728 | tANI_U32 i; |
| 2729 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2730 | ENTER(); |
| 2731 | |
| 2732 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2733 | return; |
| 2734 | } |
| 2735 | if (!pMsg) |
| 2736 | { |
| 2737 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2738 | return; |
| 2739 | } |
| 2740 | |
| 2741 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2742 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2743 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX, |
| 2744 | GFP_KERNEL); |
| 2745 | |
| 2746 | if (!skb) { |
| 2747 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2748 | FL("cfg80211_vendor_event_alloc failed")); |
| 2749 | return; |
| 2750 | } |
| 2751 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2752 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2753 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numOfAps); |
| 2754 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2755 | |
| 2756 | for (i = 0; i < pData->numOfAps; i++) { |
| 2757 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) " |
| 2758 | "Ssid (%s) " |
| 2759 | "Bssid (" MAC_ADDRESS_STR ") " |
| 2760 | "Channel (%u) " |
| 2761 | "Rssi (%d) " |
| 2762 | "RTT (%u) " |
| 2763 | "RTT_SD (%u) ", |
| 2764 | i, |
| 2765 | pData->ap[i].ts, |
| 2766 | pData->ap[i].ssid, |
| 2767 | MAC_ADDR_ARRAY(pData->ap[i].bssid), |
| 2768 | pData->ap[i].channel, |
| 2769 | pData->ap[i].rssi, |
| 2770 | pData->ap[i].rtt, |
| 2771 | pData->ap[i].rtt_sd); |
| 2772 | } |
| 2773 | |
| 2774 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2775 | pData->requestId) || |
| 2776 | nla_put_u32(skb, |
| 2777 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2778 | pData->numOfAps)) { |
| 2779 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2780 | goto fail; |
| 2781 | } |
| 2782 | if (pData->numOfAps) { |
| 2783 | struct nlattr *aps; |
| 2784 | |
| 2785 | aps = nla_nest_start(skb, |
| 2786 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2787 | if (!aps) |
| 2788 | goto fail; |
| 2789 | |
| 2790 | for (i = 0; i < pData->numOfAps; i++) { |
| 2791 | struct nlattr *ap; |
| 2792 | |
| 2793 | ap = nla_nest_start(skb, i + 1); |
| 2794 | if (!ap) |
| 2795 | goto fail; |
| 2796 | |
| 2797 | if (nla_put_u64(skb, |
| 2798 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2799 | pData->ap[i].ts) || |
| 2800 | nla_put(skb, |
| 2801 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2802 | sizeof(pData->ap[i].ssid), |
| 2803 | pData->ap[i].ssid) || |
| 2804 | nla_put(skb, |
| 2805 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2806 | sizeof(pData->ap[i].bssid), |
| 2807 | pData->ap[i].bssid) || |
| 2808 | nla_put_u32(skb, |
| 2809 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2810 | pData->ap[i].channel) || |
| 2811 | nla_put_s32(skb, |
| 2812 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2813 | pData->ap[i].rssi) || |
| 2814 | nla_put_u32(skb, |
| 2815 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2816 | pData->ap[i].rtt) || |
| 2817 | nla_put_u32(skb, |
| 2818 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2819 | pData->ap[i].rtt_sd)) |
| 2820 | goto fail; |
| 2821 | |
| 2822 | nla_nest_end(skb, ap); |
| 2823 | } |
| 2824 | nla_nest_end(skb, aps); |
| 2825 | |
| 2826 | if (nla_put_u8(skb, |
| 2827 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2828 | pData->moreData)) |
| 2829 | goto fail; |
| 2830 | } |
| 2831 | |
| 2832 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2833 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2834 | return; |
| 2835 | |
| 2836 | fail: |
| 2837 | kfree_skb(skb); |
| 2838 | return; |
| 2839 | |
| 2840 | } |
| 2841 | static void wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(void *ctx, |
| 2842 | void *pMsg) |
| 2843 | { |
| 2844 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2845 | struct sk_buff *skb = NULL; |
| 2846 | tANI_U32 i, j; |
| 2847 | tpSirWifiSignificantChangeEvent pData = |
| 2848 | (tpSirWifiSignificantChangeEvent) pMsg; |
| 2849 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2850 | ENTER(); |
| 2851 | |
| 2852 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2853 | return; |
| 2854 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2855 | if (!pMsg) |
| 2856 | { |
| 2857 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2858 | return; |
| 2859 | } |
| 2860 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2861 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2862 | EXTSCAN_EVENT_BUF_SIZE, |
| 2863 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE_INDEX, |
| 2864 | GFP_KERNEL); |
| 2865 | |
| 2866 | if (!skb) { |
| 2867 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2868 | FL("cfg80211_vendor_event_alloc failed")); |
| 2869 | return; |
| 2870 | } |
| 2871 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2872 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2873 | hddLog(VOS_TRACE_LEVEL_INFO, "total List Size %u ", pData->numSigRssiBss); |
| 2874 | hddLog(VOS_TRACE_LEVEL_INFO, " CUrrent List size (%u)", |
| 2875 | pData->numSigRssiBss); |
| 2876 | hddLog(VOS_TRACE_LEVEL_INFO, "moreData (%u)", pData->moreData); |
| 2877 | |
| 2878 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 2879 | hddLog(VOS_TRACE_LEVEL_INFO , "Rssi List [%d] BSSID: (%pM) Channel %u " |
| 2880 | " num RSSI %u ", |
| 2881 | i, pData->sigRssiResult[i].bssid, |
| 2882 | pData->sigRssiResult[i].channel, |
| 2883 | pData->sigRssiResult[i].numRssi); |
| 2884 | |
| 2885 | for (j = 0; j < pData->sigRssiResult[i].numRssi; j++){ |
| 2886 | |
| 2887 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2888 | " [%d]", |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 2889 | pData->sigRssiResult[i].rssi[j]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2890 | |
| 2891 | } |
| 2892 | } |
| 2893 | |
| 2894 | |
| 2895 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2896 | pData->requestId) || |
| 2897 | nla_put_u32(skb, |
| 2898 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2899 | pData->numSigRssiBss)) { |
| 2900 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2901 | goto fail; |
| 2902 | } |
| 2903 | |
| 2904 | if (pData->numSigRssiBss) { |
| 2905 | struct nlattr *aps; |
| 2906 | aps = nla_nest_start(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2907 | if (!aps) |
| 2908 | goto fail; |
| 2909 | for (i = 0; i < pData->numSigRssiBss; i++) { |
| 2910 | struct nlattr *ap; |
| 2911 | |
| 2912 | ap = nla_nest_start(skb, i); |
| 2913 | if (!ap) |
| 2914 | goto fail; |
| 2915 | if (nla_put(skb, |
| 2916 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_BSSID, |
| 2917 | sizeof(tSirMacAddr), pData->sigRssiResult[i].bssid) || |
| 2918 | nla_put_u32(skb, |
| 2919 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_CHANNEL, |
| 2920 | pData->sigRssiResult[i].channel) || |
| 2921 | nla_put_u32(skb, |
| 2922 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_NUM_RSSI, |
| 2923 | pData->sigRssiResult[i].numRssi) || |
| 2924 | nla_put(skb, |
| 2925 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SIGNIFICANT_CHANGE_RESULT_RSSI_LIST, |
| 2926 | sizeof(s32) * pData->sigRssiResult[i].numRssi, |
| 2927 | pData->sigRssiResult[i].rssi)) |
| 2928 | goto fail; |
| 2929 | nla_nest_end(skb, ap); |
| 2930 | } |
| 2931 | nla_nest_end(skb, aps); |
| 2932 | if (nla_put_u8(skb, |
| 2933 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2934 | pData->moreData)) |
| 2935 | goto fail; |
| 2936 | } |
| 2937 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2938 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2939 | return; |
| 2940 | fail: |
| 2941 | kfree_skb(skb); |
| 2942 | return; |
| 2943 | } |
| 2944 | |
| 2945 | static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx, |
| 2946 | void *pMsg) |
| 2947 | { |
| 2948 | struct sk_buff *skb; |
| 2949 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2950 | tpSirWifiFullScanResultEvent pData = |
| 2951 | (tpSirWifiFullScanResultEvent) (pMsg); |
| 2952 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2953 | ENTER(); |
| 2954 | |
| 2955 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2956 | return; |
| 2957 | } |
| 2958 | if (!pMsg) |
| 2959 | { |
| 2960 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2961 | return; |
| 2962 | } |
| 2963 | |
| 2964 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 2965 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 2966 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX, |
| 2967 | GFP_KERNEL); |
| 2968 | |
| 2969 | if (!skb) { |
| 2970 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2971 | FL("cfg80211_vendor_event_alloc failed")); |
| 2972 | return; |
| 2973 | } |
| 2974 | |
| 2975 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 2976 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId); |
| 2977 | hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData); |
| 2978 | hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) " |
| 2979 | "Ssid (%s)" |
| 2980 | "Bssid (" MAC_ADDRESS_STR ")" |
| 2981 | "Channel (%u)" |
| 2982 | "Rssi (%d)" |
| 2983 | "RTT (%u)" |
| 2984 | "RTT_SD (%u)"), |
| 2985 | pData->ap.ts, |
| 2986 | pData->ap.ssid, |
| 2987 | MAC_ADDR_ARRAY(pData->ap.bssid), |
| 2988 | pData->ap.channel, |
| 2989 | pData->ap.rssi, |
| 2990 | pData->ap.rtt, |
| 2991 | pData->ap.rtt_sd); |
| 2992 | hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength); |
| 2993 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2994 | pData->requestId) || |
| 2995 | nla_put_u64(skb, |
| 2996 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2997 | pData->ap.ts) || |
| 2998 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2999 | sizeof(pData->ap.ssid), |
| 3000 | pData->ap.ssid) || |
| 3001 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 3002 | WNI_CFG_BSSID_LEN, |
| 3003 | pData->ap.bssid) || |
| 3004 | nla_put_u32(skb, |
| 3005 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 3006 | pData->ap.channel) || |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 3007 | 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] | 3008 | pData->ap.rssi) || |
| 3009 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 3010 | pData->ap.rtt) || |
| 3011 | nla_put_u32(skb, |
| 3012 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 3013 | pData->ap.rtt_sd) || |
| 3014 | nla_put_u16(skb, |
| 3015 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 3016 | pData->ap.beaconPeriod) || |
| 3017 | nla_put_u16(skb, |
| 3018 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 3019 | pData->ap.capability) || |
| 3020 | nla_put_u32(skb, |
| 3021 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
| 3022 | pData->ieLength)) |
| 3023 | { |
| 3024 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3025 | goto nla_put_failure; |
| 3026 | } |
| 3027 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 3028 | pData->ieLength, |
| 3029 | pData->ie)) |
| 3030 | { |
| 3031 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3032 | goto nla_put_failure; |
| 3033 | } |
| 3034 | |
| 3035 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3036 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3037 | return; |
| 3038 | |
| 3039 | nla_put_failure: |
| 3040 | kfree_skb(skb); |
| 3041 | return; |
| 3042 | } |
| 3043 | |
| 3044 | static void wlan_hdd_cfg80211_extscan_scan_res_available_event(void *ctx, |
| 3045 | void *pMsg) |
| 3046 | { |
| 3047 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3048 | struct sk_buff *skb = NULL; |
| 3049 | tpSirEXTScanResultsAvailableIndParams pData = |
| 3050 | (tpSirEXTScanResultsAvailableIndParams) pMsg; |
| 3051 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3052 | ENTER(); |
| 3053 | |
| 3054 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 3055 | return; |
| 3056 | } |
| 3057 | if (!pMsg) |
| 3058 | { |
| 3059 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3060 | return; |
| 3061 | } |
| 3062 | |
| 3063 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 3064 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3065 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX, |
| 3066 | GFP_KERNEL); |
| 3067 | |
| 3068 | if (!skb) { |
| 3069 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3070 | FL("cfg80211_vendor_event_alloc failed")); |
| 3071 | return; |
| 3072 | } |
| 3073 | |
| 3074 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3075 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 3076 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", |
| 3077 | pData->numResultsAvailable); |
| 3078 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3079 | pData->requestId) || |
| 3080 | nla_put_u32(skb, |
| 3081 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3082 | pData->numResultsAvailable)) { |
| 3083 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3084 | goto nla_put_failure; |
| 3085 | } |
| 3086 | |
| 3087 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3088 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3089 | return; |
| 3090 | |
| 3091 | nla_put_failure: |
| 3092 | kfree_skb(skb); |
| 3093 | return; |
| 3094 | } |
| 3095 | |
| 3096 | static void wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx, void *pMsg) |
| 3097 | { |
| 3098 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3099 | struct sk_buff *skb = NULL; |
| 3100 | tpSirEXTScanProgressIndParams pData = |
| 3101 | (tpSirEXTScanProgressIndParams) pMsg; |
| 3102 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3103 | ENTER(); |
| 3104 | |
| 3105 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 3106 | return; |
| 3107 | } |
| 3108 | if (!pMsg) |
| 3109 | { |
| 3110 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3111 | return; |
| 3112 | } |
| 3113 | |
| 3114 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 3115 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3116 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX, |
| 3117 | GFP_KERNEL); |
| 3118 | |
| 3119 | if (!skb) { |
| 3120 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3121 | FL("cfg80211_vendor_event_alloc failed")); |
| 3122 | return; |
| 3123 | } |
| 3124 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
| 3125 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)", |
| 3126 | pData->extScanEventType); |
| 3127 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)", |
| 3128 | pData->status); |
| 3129 | |
| 3130 | if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE, |
| 3131 | pData->extScanEventType) || |
| 3132 | nla_put_u32(skb, |
Dasari Srinivas | 5a28865 | 2014-06-30 17:13:22 +0530 | [diff] [blame] | 3133 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3134 | pData->requestId) || |
| 3135 | nla_put_u32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3136 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS, |
| 3137 | pData->status)) { |
| 3138 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3139 | goto nla_put_failure; |
| 3140 | } |
| 3141 | |
| 3142 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3143 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3144 | return; |
| 3145 | |
| 3146 | nla_put_failure: |
| 3147 | kfree_skb(skb); |
| 3148 | return; |
| 3149 | } |
| 3150 | |
| 3151 | void wlan_hdd_cfg80211_extscan_callback(void *ctx, const tANI_U16 evType, |
| 3152 | void *pMsg) |
| 3153 | { |
| 3154 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3155 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3156 | ENTER(); |
| 3157 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3158 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3159 | return; |
| 3160 | } |
| 3161 | |
| 3162 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 3163 | |
| 3164 | |
| 3165 | switch(evType) { |
| 3166 | case SIR_HAL_EXTSCAN_START_RSP: |
| 3167 | wlan_hdd_cfg80211_extscan_start_rsp(ctx, pMsg); |
| 3168 | break; |
| 3169 | |
| 3170 | case SIR_HAL_EXTSCAN_STOP_RSP: |
| 3171 | wlan_hdd_cfg80211_extscan_stop_rsp(ctx, pMsg); |
| 3172 | break; |
| 3173 | case SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP: |
| 3174 | /* There is no need to send this response to upper layer |
| 3175 | Just log the message */ |
| 3176 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3177 | FL("Rcvd SIR_HAL_EXTSCAN_CACHED_RESULTS_RSP")); |
| 3178 | break; |
| 3179 | case SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP: |
| 3180 | wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(ctx, pMsg); |
| 3181 | break; |
| 3182 | |
| 3183 | case SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP: |
| 3184 | wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg); |
| 3185 | break; |
| 3186 | |
| 3187 | case SIR_HAL_EXTSCAN_SET_SIGNF_RSSI_CHANGE_RSP: |
| 3188 | wlan_hdd_cfg80211_extscan_set_signf_wifi_change_rsp(ctx, pMsg); |
| 3189 | break; |
| 3190 | |
| 3191 | case SIR_HAL_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_RSP: |
| 3192 | wlan_hdd_cfg80211_extscan_reset_signf_wifi_change_rsp(ctx, pMsg); |
| 3193 | break; |
| 3194 | case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP: |
| 3195 | wlan_hdd_cfg80211_extscan_get_capabilities_ind(ctx, pMsg); |
| 3196 | break; |
| 3197 | case SIR_HAL_EXTSCAN_PROGRESS_IND: |
| 3198 | wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg); |
| 3199 | break; |
| 3200 | case SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND: |
| 3201 | wlan_hdd_cfg80211_extscan_scan_res_available_event(ctx, pMsg); |
| 3202 | break; |
| 3203 | case SIR_HAL_EXTSCAN_SCAN_RESULT_IND: |
| 3204 | wlan_hdd_cfg80211_extscan_cached_results_ind(ctx, pMsg); |
| 3205 | break; |
| 3206 | case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND: |
| 3207 | wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg); |
| 3208 | break; |
| 3209 | case SIR_HAL_EXTSCAN_SIGNF_WIFI_CHANGE_IND: |
| 3210 | wlan_hdd_cfg80211_extscan_signif_wifi_change_results_ind(ctx, pMsg); |
| 3211 | break; |
| 3212 | case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 3213 | wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg); |
| 3214 | break; |
| 3215 | default: |
| 3216 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 3217 | break; |
| 3218 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3219 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3220 | } |
| 3221 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3222 | static int __wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3223 | struct wireless_dev *wdev, |
| 3224 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3225 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3226 | tSirGetEXTScanCapabilitiesReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3227 | struct net_device *dev = wdev->netdev; |
| 3228 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3229 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3230 | struct nlattr |
| 3231 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3232 | eHalStatus status; |
| 3233 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3234 | ENTER(); |
| 3235 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3236 | status = wlan_hdd_validate_context(pHddCtx); |
| 3237 | if (0 != status) |
| 3238 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3239 | return -EINVAL; |
| 3240 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3241 | /* check the EXTScan Capability */ |
| 3242 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3243 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3244 | { |
| 3245 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3246 | FL("EXTScan not enabled/supported by Firmware")); |
| 3247 | return -EINVAL; |
| 3248 | } |
| 3249 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3250 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3251 | data, dataLen, |
| 3252 | wlan_hdd_extscan_config_policy)) { |
| 3253 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3254 | return -EINVAL; |
| 3255 | } |
| 3256 | |
| 3257 | /* Parse and fetch request Id */ |
| 3258 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3259 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3260 | return -EINVAL; |
| 3261 | } |
| 3262 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3263 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3264 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3265 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3266 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3267 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3268 | reqMsg.sessionId = pAdapter->sessionId; |
| 3269 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3270 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3271 | status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3272 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3273 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3274 | FL("sme_EXTScanGetCapabilities failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3275 | return -EINVAL; |
| 3276 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3277 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3278 | return 0; |
| 3279 | } |
| 3280 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3281 | static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3282 | struct wireless_dev *wdev, |
| 3283 | const void *data, int dataLen) |
| 3284 | { |
| 3285 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3286 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3287 | vos_ssr_protect(__func__); |
| 3288 | ret = __wlan_hdd_cfg80211_extscan_get_capabilities(wiphy, wdev, data, dataLen); |
| 3289 | vos_ssr_unprotect(__func__); |
| 3290 | |
| 3291 | return ret; |
| 3292 | } |
| 3293 | |
| 3294 | static int __wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3295 | struct wireless_dev *wdev, |
| 3296 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3297 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3298 | tSirEXTScanGetCachedResultsReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3299 | struct net_device *dev = wdev->netdev; |
| 3300 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3301 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3302 | struct nlattr |
| 3303 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3304 | eHalStatus status; |
| 3305 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3306 | ENTER(); |
| 3307 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3308 | status = wlan_hdd_validate_context(pHddCtx); |
| 3309 | if (0 != status) |
| 3310 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3311 | return -EINVAL; |
| 3312 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3313 | /* check the EXTScan Capability */ |
| 3314 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3315 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3316 | { |
| 3317 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3318 | FL("EXTScan not enabled/supported by Firmware")); |
| 3319 | return -EINVAL; |
| 3320 | } |
| 3321 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3322 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3323 | data, dataLen, |
| 3324 | wlan_hdd_extscan_config_policy)) { |
| 3325 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3326 | return -EINVAL; |
| 3327 | } |
| 3328 | /* Parse and fetch request Id */ |
| 3329 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3330 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3331 | return -EINVAL; |
| 3332 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3333 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3334 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3335 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3336 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3337 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3338 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3339 | reqMsg.sessionId = pAdapter->sessionId; |
| 3340 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3341 | |
| 3342 | /* Parse and fetch flush parameter */ |
| 3343 | if (!tb |
| 3344 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]) |
| 3345 | { |
| 3346 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed")); |
| 3347 | goto failed; |
| 3348 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3349 | reqMsg.flush = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3350 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]); |
| 3351 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3352 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3353 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3354 | status = sme_getCachedResults(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3355 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3356 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3357 | FL("sme_getCachedResults failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3358 | return -EINVAL; |
| 3359 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3360 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3361 | return 0; |
| 3362 | |
| 3363 | failed: |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3364 | return -EINVAL; |
| 3365 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3366 | static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3367 | struct wireless_dev *wdev, |
| 3368 | const void *data, int dataLen) |
| 3369 | { |
| 3370 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3371 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3372 | vos_ssr_protect(__func__); |
| 3373 | ret = __wlan_hdd_cfg80211_extscan_get_cached_results(wiphy, wdev, data, dataLen); |
| 3374 | vos_ssr_unprotect(__func__); |
| 3375 | |
| 3376 | return ret; |
| 3377 | } |
| 3378 | |
| 3379 | static int __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3380 | struct wireless_dev *wdev, |
Edhar, Mahesh Kumar | ed8631f | 2015-01-20 14:31:47 +0530 | [diff] [blame] | 3381 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3382 | { |
| 3383 | tpSirEXTScanSetBssidHotListReqParams pReqMsg = NULL; |
| 3384 | struct net_device *dev = wdev->netdev; |
| 3385 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3386 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3387 | struct nlattr |
| 3388 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3389 | struct nlattr |
| 3390 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3391 | struct nlattr *apTh; |
| 3392 | eHalStatus status; |
| 3393 | tANI_U8 i = 0; |
| 3394 | int rem; |
| 3395 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3396 | ENTER(); |
| 3397 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3398 | status = wlan_hdd_validate_context(pHddCtx); |
| 3399 | if (0 != status) |
| 3400 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3401 | return -EINVAL; |
| 3402 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3403 | /* check the EXTScan Capability */ |
| 3404 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3405 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3406 | { |
| 3407 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3408 | FL("EXTScan not enabled/supported by Firmware")); |
| 3409 | return -EINVAL; |
| 3410 | } |
| 3411 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3412 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3413 | data, dataLen, |
| 3414 | wlan_hdd_extscan_config_policy)) { |
| 3415 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3416 | return -EINVAL; |
| 3417 | } |
| 3418 | |
| 3419 | /* Parse and fetch request Id */ |
| 3420 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3421 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3422 | return -EINVAL; |
| 3423 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3424 | pReqMsg = (tpSirEXTScanSetBssidHotListReqParams) |
| 3425 | vos_mem_malloc(sizeof(*pReqMsg)); |
| 3426 | if (!pReqMsg) { |
| 3427 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3428 | return -ENOMEM; |
| 3429 | } |
| 3430 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3431 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3432 | pReqMsg->requestId = nla_get_u32( |
| 3433 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3434 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3435 | |
| 3436 | /* Parse and fetch number of APs */ |
| 3437 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]) { |
| 3438 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3439 | goto fail; |
| 3440 | } |
| 3441 | |
| 3442 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3443 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3444 | |
| 3445 | pReqMsg->numAp = nla_get_u32( |
| 3446 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]); |
| 3447 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3448 | |
| 3449 | nla_for_each_nested(apTh, |
| 3450 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3451 | if(nla_parse(tb2, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3452 | nla_data(apTh), nla_len(apTh), |
| 3453 | NULL)) { |
| 3454 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3455 | goto fail; |
| 3456 | } |
| 3457 | |
| 3458 | /* Parse and fetch MAC address */ |
| 3459 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3460 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3461 | goto fail; |
| 3462 | } |
| 3463 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3464 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3465 | sizeof(tSirMacAddr)); |
| 3466 | hddLog(VOS_TRACE_LEVEL_INFO, FL("BSSID: %pM "), pReqMsg->ap[i].bssid); |
| 3467 | |
| 3468 | /* Parse and fetch low RSSI */ |
| 3469 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3470 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3471 | goto fail; |
| 3472 | } |
| 3473 | pReqMsg->ap[i].low = nla_get_s32( |
| 3474 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3475 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3476 | |
| 3477 | /* Parse and fetch high RSSI */ |
| 3478 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3479 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3480 | goto fail; |
| 3481 | } |
| 3482 | pReqMsg->ap[i].high = nla_get_s32( |
| 3483 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3484 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"), |
| 3485 | pReqMsg->ap[i].high); |
| 3486 | |
| 3487 | /* Parse and fetch channel */ |
| 3488 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3489 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3490 | goto fail; |
| 3491 | } |
| 3492 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3493 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3494 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3495 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3496 | i++; |
| 3497 | } |
| 3498 | status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg); |
| 3499 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3500 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3501 | FL("sme_SetBssHotlist failed(err=%d)"), status); |
| 3502 | vos_mem_free(pReqMsg); |
| 3503 | return -EINVAL; |
| 3504 | } |
| 3505 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3506 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3507 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3508 | return 0; |
| 3509 | |
| 3510 | fail: |
| 3511 | vos_mem_free(pReqMsg); |
| 3512 | return -EINVAL; |
| 3513 | } |
| 3514 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3515 | static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
| 3516 | struct wireless_dev *wdev, |
| 3517 | const void *data, int dataLen) |
| 3518 | { |
| 3519 | int ret = 0; |
| 3520 | |
| 3521 | vos_ssr_protect(__func__); |
| 3522 | ret = __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(wiphy, wdev, data, |
| 3523 | dataLen); |
| 3524 | vos_ssr_unprotect(__func__); |
| 3525 | |
| 3526 | return ret; |
| 3527 | } |
| 3528 | |
| 3529 | static int __wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3530 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3531 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3532 | { |
| 3533 | tpSirEXTScanSetSignificantChangeReqParams pReqMsg = NULL; |
| 3534 | struct net_device *dev = wdev->netdev; |
| 3535 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3536 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3537 | struct nlattr |
| 3538 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3539 | struct nlattr |
| 3540 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3541 | struct nlattr *apTh; |
| 3542 | eHalStatus status; |
| 3543 | int i = 0; |
| 3544 | int rem; |
| 3545 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3546 | ENTER(); |
| 3547 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3548 | status = wlan_hdd_validate_context(pHddCtx); |
| 3549 | if (0 != status) |
| 3550 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3551 | return -EINVAL; |
| 3552 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3553 | /* check the EXTScan Capability */ |
| 3554 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3555 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3556 | { |
| 3557 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3558 | FL("EXTScan not enabled/supported by Firmware")); |
| 3559 | return -EINVAL; |
| 3560 | } |
| 3561 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3562 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3563 | data, dataLen, |
| 3564 | wlan_hdd_extscan_config_policy)) { |
| 3565 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3566 | return -EINVAL; |
| 3567 | } |
| 3568 | |
| 3569 | /* Parse and fetch request Id */ |
| 3570 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3571 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3572 | return -EINVAL; |
| 3573 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3574 | pReqMsg = (tpSirEXTScanSetSignificantChangeReqParams) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3575 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3576 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3577 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3578 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3579 | } |
| 3580 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3581 | |
| 3582 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3583 | pReqMsg->requestId = nla_get_u32( |
| 3584 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3585 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3586 | |
| 3587 | /* Parse and fetch RSSI sample size */ |
| 3588 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]) |
| 3589 | { |
| 3590 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr RSSI sample size failed")); |
| 3591 | goto fail; |
| 3592 | } |
| 3593 | pReqMsg->rssiSampleSize = nla_get_u32( |
| 3594 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_RSSI_SAMPLE_SIZE]); |
| 3595 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3596 | FL("RSSI sample size (%u)"), pReqMsg->rssiSampleSize); |
| 3597 | |
| 3598 | /* Parse and fetch lost AP sample size */ |
| 3599 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]) |
| 3600 | { |
| 3601 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr lost AP sample size failed")); |
| 3602 | goto fail; |
| 3603 | } |
| 3604 | pReqMsg->lostApSampleSize = nla_get_u32( |
| 3605 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_LOST_AP_SAMPLE_SIZE]); |
| 3606 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3607 | FL("Lost AP sample size (%u)"), pReqMsg->lostApSampleSize); |
| 3608 | /* Parse and fetch minimum Breaching */ |
| 3609 | if (!tb |
| 3610 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]) { |
| 3611 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr minBreaching failed")); |
| 3612 | goto fail; |
| 3613 | } |
| 3614 | pReqMsg->minBreaching = nla_get_u32( |
| 3615 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_MIN_BREACHING]); |
| 3616 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" Breaching (%d)"), pReqMsg->minBreaching); |
| 3617 | |
| 3618 | /* Parse and fetch number of APs */ |
| 3619 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]) { |
| 3620 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3621 | goto fail; |
| 3622 | } |
| 3623 | pReqMsg->numAp = nla_get_u32( |
| 3624 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SIGNIFICANT_CHANGE_PARAMS_NUM_AP]); |
| 3625 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numAp); |
| 3626 | |
| 3627 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3628 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3629 | |
| 3630 | nla_for_each_nested(apTh, |
| 3631 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3632 | if(nla_parse(tb2, |
| 3633 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3634 | nla_data(apTh), nla_len(apTh), |
| 3635 | NULL)) { |
| 3636 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3637 | goto fail; |
| 3638 | } |
| 3639 | |
| 3640 | /* Parse and fetch MAC address */ |
| 3641 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3642 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3643 | goto fail; |
| 3644 | } |
| 3645 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3646 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3647 | sizeof(tSirMacAddr)); |
| 3648 | |
| 3649 | /* Parse and fetch low RSSI */ |
| 3650 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3651 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3652 | goto fail; |
| 3653 | } |
| 3654 | pReqMsg->ap[i].low = nla_get_s32( |
| 3655 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3656 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3657 | |
| 3658 | /* Parse and fetch high RSSI */ |
| 3659 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3660 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3661 | goto fail; |
| 3662 | } |
| 3663 | pReqMsg->ap[i].high = nla_get_s32( |
| 3664 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3665 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3666 | FL("RSSI High (%d)"), pReqMsg->ap[i].high); |
| 3667 | |
| 3668 | /* Parse and fetch channel */ |
| 3669 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]) { |
| 3670 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 3671 | goto fail; |
| 3672 | } |
| 3673 | pReqMsg->ap[i].channel = nla_get_u32( |
| 3674 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL]); |
| 3675 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3676 | FL("Channel (%u)"), pReqMsg->ap[i].channel); |
| 3677 | i++; |
| 3678 | } |
| 3679 | |
| 3680 | status = sme_SetSignificantChange(pHddCtx->hHal, pReqMsg); |
| 3681 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3682 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3683 | FL("sme_SetSignificantChange failed(err=%d)"), status); |
| 3684 | vos_mem_free(pReqMsg); |
| 3685 | return -EINVAL; |
| 3686 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3687 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3688 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3689 | return 0; |
| 3690 | |
| 3691 | fail: |
| 3692 | vos_mem_free(pReqMsg); |
| 3693 | return -EINVAL; |
| 3694 | } |
| 3695 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3696 | static int wlan_hdd_cfg80211_extscan_set_significant_change(struct wiphy *wiphy, |
| 3697 | struct wireless_dev *wdev, |
| 3698 | const void *data, int dataLen) |
| 3699 | { |
| 3700 | int ret = 0; |
| 3701 | |
| 3702 | vos_ssr_protect(__func__); |
| 3703 | ret = __wlan_hdd_cfg80211_extscan_set_significant_change(wiphy, wdev, data, |
| 3704 | dataLen); |
| 3705 | vos_ssr_unprotect(__func__); |
| 3706 | |
| 3707 | return ret; |
| 3708 | } |
| 3709 | |
| 3710 | static int __wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3711 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3712 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3713 | { |
| 3714 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3715 | tANI_U32 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 3716 | tANI_U8 numChannels = 0; |
| 3717 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3718 | tANI_U32 requestId; |
| 3719 | tWifiBand wifiBand; |
| 3720 | eHalStatus status; |
| 3721 | struct sk_buff *replySkb; |
| 3722 | tANI_U8 i; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3723 | int ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3724 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3725 | ENTER(); |
| 3726 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3727 | status = wlan_hdd_validate_context(pHddCtx); |
| 3728 | if (0 != status) |
| 3729 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3730 | return -EINVAL; |
| 3731 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3732 | /* check the EXTScan Capability */ |
| 3733 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3734 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3735 | { |
| 3736 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3737 | FL("EXTScan not enabled/supported by Firmware")); |
| 3738 | return -EINVAL; |
| 3739 | } |
| 3740 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3741 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3742 | data, dataLen, |
| 3743 | wlan_hdd_extscan_config_policy)) { |
| 3744 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3745 | return -EINVAL; |
| 3746 | } |
| 3747 | |
| 3748 | /* Parse and fetch request Id */ |
| 3749 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3750 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3751 | return -EINVAL; |
| 3752 | } |
| 3753 | requestId = nla_get_u32( |
| 3754 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3755 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); |
| 3756 | |
| 3757 | /* Parse and fetch wifi band */ |
| 3758 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) |
| 3759 | { |
| 3760 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3761 | return -EINVAL; |
| 3762 | } |
| 3763 | wifiBand = nla_get_u32( |
| 3764 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); |
| 3765 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); |
| 3766 | |
| 3767 | status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), |
| 3768 | wifiBand, ChannelList, |
| 3769 | &numChannels); |
| 3770 | if (eHAL_STATUS_SUCCESS != status) { |
| 3771 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3772 | FL("sme_GetValidChannelsByBand failed (err=%d)"), status); |
| 3773 | return -EINVAL; |
| 3774 | } |
| 3775 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of channels (%d)"), numChannels); |
| 3776 | for (i = 0; i < numChannels; i++) |
| 3777 | hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %u ", ChannelList[i]); |
| 3778 | |
| 3779 | replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 3780 | sizeof(u32) * numChannels + |
| 3781 | NLMSG_HDRLEN); |
| 3782 | |
| 3783 | if (!replySkb) { |
| 3784 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3785 | FL("valid channels: buffer alloc fail")); |
| 3786 | return -EINVAL; |
| 3787 | } |
| 3788 | if (nla_put_u32(replySkb, |
| 3789 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS, |
| 3790 | numChannels) || |
| 3791 | nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS, |
| 3792 | sizeof(u32) * numChannels, ChannelList)) { |
| 3793 | |
| 3794 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3795 | kfree_skb(replySkb); |
| 3796 | return -EINVAL; |
| 3797 | } |
| 3798 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3799 | ret = cfg80211_vendor_cmd_reply(replySkb); |
| 3800 | |
| 3801 | EXIT(); |
| 3802 | return ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3803 | } |
| 3804 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3805 | static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
| 3806 | struct wireless_dev *wdev, |
| 3807 | const void *data, int dataLen) |
| 3808 | { |
| 3809 | int ret = 0; |
| 3810 | |
| 3811 | vos_ssr_protect(__func__); |
| 3812 | ret = __wlan_hdd_cfg80211_extscan_get_valid_channels(wiphy, wdev, data, |
| 3813 | dataLen); |
| 3814 | vos_ssr_unprotect(__func__); |
| 3815 | |
| 3816 | return ret; |
| 3817 | } |
| 3818 | |
| 3819 | static int __wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3820 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 3821 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3822 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3823 | tpSirEXTScanStartReqParams pReqMsg = NULL; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3824 | struct net_device *dev = wdev->netdev; |
| 3825 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3826 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3827 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3828 | struct nlattr *bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3829 | struct nlattr *channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3830 | struct nlattr *buckets; |
| 3831 | struct nlattr *channels; |
| 3832 | int rem1; |
| 3833 | int rem2; |
| 3834 | eHalStatus status; |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3835 | tANI_U32 j = 0, index = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3836 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3837 | ENTER(); |
| 3838 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3839 | status = wlan_hdd_validate_context(pHddCtx); |
| 3840 | if (0 != status) |
| 3841 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3842 | return -EINVAL; |
| 3843 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3844 | /* check the EXTScan Capability */ |
| 3845 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 3846 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 3847 | { |
| 3848 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3849 | FL("EXTScan not enabled/supported by Firmware")); |
| 3850 | return -EINVAL; |
| 3851 | } |
| 3852 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3853 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3854 | data, dataLen, |
| 3855 | wlan_hdd_extscan_config_policy)) { |
| 3856 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3857 | return -EINVAL; |
| 3858 | } |
| 3859 | |
| 3860 | /* Parse and fetch request Id */ |
| 3861 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3862 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3863 | return -EINVAL; |
| 3864 | } |
| 3865 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3866 | pReqMsg = (tpSirEXTScanStartReqParams) |
| 3867 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3868 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3869 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3870 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3871 | } |
| 3872 | |
| 3873 | pReqMsg->requestId = nla_get_u32( |
| 3874 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3875 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3876 | |
| 3877 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3878 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3879 | |
| 3880 | /* Parse and fetch base period */ |
| 3881 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]) { |
| 3882 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed")); |
| 3883 | goto fail; |
| 3884 | } |
| 3885 | pReqMsg->basePeriod = nla_get_u32( |
| 3886 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD]); |
| 3887 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"), |
| 3888 | pReqMsg->basePeriod); |
| 3889 | |
| 3890 | /* Parse and fetch max AP per scan */ |
| 3891 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]) { |
| 3892 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed")); |
| 3893 | goto fail; |
| 3894 | } |
| 3895 | pReqMsg->maxAPperScan = nla_get_u32( |
| 3896 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN]); |
| 3897 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"), |
| 3898 | pReqMsg->maxAPperScan); |
| 3899 | |
| 3900 | /* Parse and fetch report threshold */ |
| 3901 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]) { |
| 3902 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed")); |
| 3903 | goto fail; |
| 3904 | } |
| 3905 | pReqMsg->reportThreshold = nla_get_u8( |
| 3906 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD]); |
| 3907 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"), |
| 3908 | pReqMsg->reportThreshold); |
| 3909 | |
| 3910 | /* Parse and fetch number of buckets */ |
| 3911 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]) { |
| 3912 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed")); |
| 3913 | goto fail; |
| 3914 | } |
| 3915 | pReqMsg->numBuckets = nla_get_u8( |
| 3916 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS]); |
| 3917 | if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) { |
| 3918 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets " |
| 3919 | "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS); |
| 3920 | pReqMsg->numBuckets = WLAN_EXTSCAN_MAX_BUCKETS; |
| 3921 | } |
| 3922 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"), |
| 3923 | pReqMsg->numBuckets); |
| 3924 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) { |
| 3925 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed")); |
| 3926 | goto fail; |
| 3927 | } |
| 3928 | |
| 3929 | nla_for_each_nested(buckets, |
| 3930 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) { |
| 3931 | if(nla_parse(bucket, |
| 3932 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3933 | nla_data(buckets), nla_len(buckets), NULL)) { //policy |
| 3934 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3935 | goto fail; |
| 3936 | } |
| 3937 | |
| 3938 | /* Parse and fetch bucket spec */ |
| 3939 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) { |
| 3940 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket index failed")); |
| 3941 | goto fail; |
| 3942 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3943 | |
| 3944 | pReqMsg->buckets[index].bucket = nla_get_u8( |
| 3945 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]); |
| 3946 | |
| 3947 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bucket spec Index (%d)"), |
| 3948 | pReqMsg->buckets[index].bucket); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3949 | |
| 3950 | /* Parse and fetch wifi band */ |
| 3951 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) { |
| 3952 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 3953 | goto fail; |
| 3954 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3955 | pReqMsg->buckets[index].band = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3956 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]); |
| 3957 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3958 | pReqMsg->buckets[index].band); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3959 | |
| 3960 | /* Parse and fetch period */ |
| 3961 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) { |
| 3962 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr period failed")); |
| 3963 | goto fail; |
| 3964 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3965 | pReqMsg->buckets[index].period = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3966 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]); |
| 3967 | hddLog(VOS_TRACE_LEVEL_INFO, FL("period (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3968 | pReqMsg->buckets[index].period); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3969 | |
| 3970 | /* Parse and fetch report events */ |
| 3971 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) { |
| 3972 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report events failed")); |
| 3973 | goto fail; |
| 3974 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3975 | pReqMsg->buckets[index].reportEvents = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3976 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]); |
| 3977 | hddLog(VOS_TRACE_LEVEL_INFO, FL("report events (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3978 | pReqMsg->buckets[index].reportEvents); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3979 | |
| 3980 | /* Parse and fetch number of channels */ |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3981 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) |
| 3982 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3983 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr num channels failed")); |
| 3984 | goto fail; |
| 3985 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3986 | pReqMsg->buckets[index].numChannels = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3987 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]); |
| 3988 | hddLog(VOS_TRACE_LEVEL_INFO, FL("num channels (%d)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 3989 | pReqMsg->buckets[index].numChannels); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3990 | |
| 3991 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) { |
| 3992 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel spec failed")); |
| 3993 | goto fail; |
| 3994 | } |
| 3995 | |
| 3996 | j = 0; |
| 3997 | nla_for_each_nested(channels, |
| 3998 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) { |
| 3999 | if(nla_parse(channel, |
| 4000 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4001 | nla_data(channels), nla_len(channels), |
| 4002 | NULL)) { //wlan_hdd_extscan_config_policy here |
| 4003 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 4004 | goto fail; |
| 4005 | } |
| 4006 | |
| 4007 | /* Parse and fetch channel */ |
| 4008 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) { |
| 4009 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 4010 | goto fail; |
| 4011 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4012 | pReqMsg->buckets[index].channels[j].channel = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4013 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]); |
| 4014 | hddLog(VOS_TRACE_LEVEL_INFO, FL("channel (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4015 | pReqMsg->buckets[index].channels[j].channel); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4016 | |
| 4017 | /* Parse and fetch dwell time */ |
| 4018 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) { |
| 4019 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dwelltime failed")); |
| 4020 | goto fail; |
| 4021 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4022 | pReqMsg->buckets[index].channels[j].dwellTimeMs = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4023 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]); |
| 4024 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Dwell time (%u ms)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4025 | pReqMsg->buckets[index].channels[j].dwellTimeMs); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4026 | |
| 4027 | /* Parse and fetch channel spec passive */ |
| 4028 | if (!channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) { |
| 4029 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4030 | FL("attr channel spec passive failed")); |
| 4031 | goto fail; |
| 4032 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4033 | pReqMsg->buckets[index].channels[j].passive = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4034 | channel[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]); |
| 4035 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Chnl spec passive (%u)"), |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4036 | pReqMsg->buckets[index].channels[j].passive); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4037 | j++; |
| 4038 | } |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4039 | index++; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4040 | } |
| 4041 | status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg); |
| 4042 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4043 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4044 | FL("sme_EXTScanStart failed(err=%d)"), status); |
| 4045 | vos_mem_free(pReqMsg); |
| 4046 | return -EINVAL; |
| 4047 | } |
| 4048 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4049 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4050 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4051 | return 0; |
| 4052 | |
| 4053 | fail: |
| 4054 | vos_mem_free(pReqMsg); |
| 4055 | return -EINVAL; |
| 4056 | } |
| 4057 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4058 | static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
| 4059 | struct wireless_dev *wdev, |
| 4060 | const void *data, int dataLen) |
| 4061 | { |
| 4062 | int ret = 0; |
| 4063 | |
| 4064 | vos_ssr_protect(__func__); |
| 4065 | ret = __wlan_hdd_cfg80211_extscan_start(wiphy, wdev, data, dataLen); |
| 4066 | vos_ssr_unprotect(__func__); |
| 4067 | |
| 4068 | return ret; |
| 4069 | } |
| 4070 | |
| 4071 | static int __wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4072 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4073 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4074 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4075 | tSirEXTScanStopReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4076 | struct net_device *dev = wdev->netdev; |
| 4077 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4078 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4079 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4080 | eHalStatus status; |
| 4081 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4082 | ENTER(); |
| 4083 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4084 | status = wlan_hdd_validate_context(pHddCtx); |
| 4085 | if (0 != status) |
| 4086 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4087 | return -EINVAL; |
| 4088 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4089 | /* check the EXTScan Capability */ |
| 4090 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4091 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4092 | { |
| 4093 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4094 | FL("EXTScan not enabled/supported by Firmware")); |
| 4095 | return -EINVAL; |
| 4096 | } |
| 4097 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4098 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4099 | data, dataLen, |
| 4100 | wlan_hdd_extscan_config_policy)) { |
| 4101 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4102 | return -EINVAL; |
| 4103 | } |
| 4104 | |
| 4105 | /* Parse and fetch request Id */ |
| 4106 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4107 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4108 | return -EINVAL; |
| 4109 | } |
| 4110 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4111 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4112 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4113 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4114 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4115 | reqMsg.sessionId = pAdapter->sessionId; |
| 4116 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4117 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4118 | status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4119 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4120 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4121 | FL("sme_EXTScanStop failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4122 | return -EINVAL; |
| 4123 | } |
| 4124 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4125 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4126 | return 0; |
| 4127 | } |
| 4128 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4129 | static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
| 4130 | struct wireless_dev *wdev, |
| 4131 | const void *data, int dataLen) |
| 4132 | { |
| 4133 | int ret = 0; |
| 4134 | |
| 4135 | vos_ssr_protect(__func__); |
| 4136 | ret = __wlan_hdd_cfg80211_extscan_stop(wiphy, wdev, data, dataLen); |
| 4137 | vos_ssr_unprotect(__func__); |
| 4138 | |
| 4139 | return ret; |
| 4140 | } |
| 4141 | |
| 4142 | static int __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4143 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4144 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4145 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4146 | tSirEXTScanResetBssidHotlistReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4147 | struct net_device *dev = wdev->netdev; |
| 4148 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4149 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4150 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4151 | eHalStatus status; |
| 4152 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4153 | ENTER(); |
| 4154 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4155 | status = wlan_hdd_validate_context(pHddCtx); |
| 4156 | if (0 != status) |
| 4157 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4158 | return -EINVAL; |
| 4159 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4160 | /* check the EXTScan Capability */ |
| 4161 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4162 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4163 | { |
| 4164 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4165 | FL("EXTScan not enabled/supported by Firmware")); |
| 4166 | return -EINVAL; |
| 4167 | } |
| 4168 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4169 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4170 | data, dataLen, |
| 4171 | wlan_hdd_extscan_config_policy)) { |
| 4172 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4173 | return -EINVAL; |
| 4174 | } |
| 4175 | |
| 4176 | /* Parse and fetch request Id */ |
| 4177 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4178 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4179 | return -EINVAL; |
| 4180 | } |
| 4181 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4182 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4183 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4184 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4185 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4186 | reqMsg.sessionId = pAdapter->sessionId; |
| 4187 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4188 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4189 | status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4190 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4191 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4192 | FL("sme_ResetBssHotlist failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4193 | return -EINVAL; |
| 4194 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4195 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4196 | return 0; |
| 4197 | } |
| 4198 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4199 | static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
| 4200 | struct wireless_dev *wdev, |
| 4201 | const void *data, int dataLen) |
| 4202 | { |
| 4203 | int ret = 0; |
| 4204 | |
| 4205 | vos_ssr_protect(__func__); |
| 4206 | ret = __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(wiphy, wdev, data, dataLen); |
| 4207 | vos_ssr_unprotect(__func__); |
| 4208 | |
| 4209 | return ret; |
| 4210 | } |
| 4211 | |
| 4212 | static int __wlan_hdd_cfg80211_extscan_reset_significant_change( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4213 | struct wiphy *wiphy, |
| 4214 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4215 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4216 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4217 | tSirEXTScanResetSignificantChangeReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4218 | struct net_device *dev = wdev->netdev; |
| 4219 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4220 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4221 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4222 | eHalStatus status; |
| 4223 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4224 | ENTER(); |
| 4225 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4226 | status = wlan_hdd_validate_context(pHddCtx); |
| 4227 | if (0 != status) |
| 4228 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4229 | return -EINVAL; |
| 4230 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4231 | /* check the EXTScan Capability */ |
| 4232 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
| 4233 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN))) |
| 4234 | { |
| 4235 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4236 | FL("EXTScan not enabled/supported by Firmware")); |
| 4237 | return -EINVAL; |
| 4238 | } |
| 4239 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4240 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4241 | data, dataLen, |
| 4242 | wlan_hdd_extscan_config_policy)) { |
| 4243 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4244 | return -EINVAL; |
| 4245 | } |
| 4246 | |
| 4247 | /* Parse and fetch request Id */ |
| 4248 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4249 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4250 | return -EINVAL; |
| 4251 | } |
| 4252 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4253 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4254 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4255 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4256 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4257 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4258 | reqMsg.sessionId = pAdapter->sessionId; |
| 4259 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4260 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4261 | status = sme_ResetSignificantChange(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4262 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4263 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4264 | FL("sme_ResetSignificantChange failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4265 | return -EINVAL; |
| 4266 | } |
| 4267 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4268 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4269 | return 0; |
| 4270 | } |
| 4271 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4272 | static int wlan_hdd_cfg80211_extscan_reset_significant_change( |
| 4273 | struct wiphy *wiphy, |
| 4274 | struct wireless_dev *wdev, |
| 4275 | const void *data, int dataLen) |
| 4276 | { |
| 4277 | int ret = 0; |
| 4278 | |
| 4279 | vos_ssr_protect(__func__); |
| 4280 | ret = __wlan_hdd_cfg80211_extscan_reset_significant_change(wiphy, |
| 4281 | wdev, data, |
| 4282 | dataLen); |
| 4283 | vos_ssr_unprotect(__func__); |
| 4284 | |
| 4285 | return ret; |
| 4286 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4287 | #endif /* WLAN_FEATURE_EXTSCAN */ |
| 4288 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4289 | /*EXT TDLS*/ |
| 4290 | static const struct nla_policy |
| 4291 | wlan_hdd_tdls_config_enable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX +1] = |
| 4292 | { |
| 4293 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4294 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL] = {.type = NLA_S32 }, |
| 4295 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS] = |
| 4296 | {.type = NLA_S32 }, |
| 4297 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS] = {.type = NLA_S32 }, |
| 4298 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS] = {.type = NLA_S32 }, |
| 4299 | |
| 4300 | }; |
| 4301 | |
| 4302 | static const struct nla_policy |
| 4303 | wlan_hdd_tdls_config_disable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX +1] = |
| 4304 | { |
| 4305 | [QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4306 | |
| 4307 | }; |
| 4308 | |
| 4309 | static const struct nla_policy |
| 4310 | wlan_hdd_tdls_config_state_change_policy[ |
| 4311 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAX +1] = |
| 4312 | { |
| 4313 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4314 | [QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE] = {.type = NLA_S32 }, |
| 4315 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4316 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL] = {.type = NLA_S32 }, |
| 4317 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS] = |
| 4318 | {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4319 | |
| 4320 | }; |
| 4321 | |
| 4322 | static const struct nla_policy |
| 4323 | wlan_hdd_tdls_config_get_status_policy[ |
| 4324 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX +1] = |
| 4325 | { |
| 4326 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4327 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE] = {.type = NLA_S32 }, |
| 4328 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4329 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL] = {.type = NLA_S32 }, |
| 4330 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS] |
| 4331 | = {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4332 | |
| 4333 | }; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4334 | |
| 4335 | static const struct nla_policy |
| 4336 | wlan_hdd_mac_config[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX+1] = |
| 4337 | { |
| 4338 | [QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI] = {.type = NLA_UNSPEC }, |
| 4339 | }; |
| 4340 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4341 | static int __wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4342 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4343 | const void *data, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4344 | int data_len) |
| 4345 | { |
| 4346 | |
| 4347 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4348 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX + 1]; |
| 4349 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4350 | ENTER(); |
| 4351 | |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4352 | if (0 != wlan_hdd_validate_context(pHddCtx)){ |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4353 | return -EINVAL; |
| 4354 | } |
| 4355 | if (FALSE == pHddCtx->cfg_ini->enableMacSpoofing) { |
| 4356 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN disabled in ini")); |
| 4357 | return -ENOTSUPP; |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4358 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4359 | if (TRUE != sme_IsFeatureSupportedByFW(MAC_SPOOFED_SCAN)){ |
| 4360 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MAC_SPOOFED_SCAN not supported by FW")); |
| 4361 | return -ENOTSUPP; |
| 4362 | } |
| 4363 | |
| 4364 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX, |
| 4365 | data, data_len, wlan_hdd_mac_config)) { |
| 4366 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4367 | return -EINVAL; |
| 4368 | } |
| 4369 | |
| 4370 | /* Parse and fetch mac address */ |
| 4371 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]) { |
| 4372 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4373 | return -EINVAL; |
| 4374 | } |
| 4375 | |
| 4376 | memcpy(pHddCtx->spoofMacAddr.randomMacAddr.bytes, nla_data( |
| 4377 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4378 | VOS_MAC_ADDR_LAST_3_BYTES); |
| 4379 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4380 | pHddCtx->spoofMacAddr.isEnabled = TRUE; |
| 4381 | |
| 4382 | 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] | 4383 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 4384 | VOS_MAC_ADDR_FIRST_3_BYTES); |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4385 | if ((pHddCtx->spoofMacAddr.randomMacAddr.bytes[0] == 0) && |
| 4386 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[1] == 0) && |
| 4387 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[2] == 0)) |
| 4388 | { |
| 4389 | hddLog(LOG1, FL("ZERO MAC OUI Recieved. Disabling Spoofing")); |
| 4390 | vos_mem_zero(pHddCtx->spoofMacAddr.randomMacAddr.bytes, |
| 4391 | VOS_MAC_ADDRESS_LEN); |
| 4392 | pHddCtx->spoofMacAddr.isEnabled = FALSE; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4393 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4394 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 4395 | if (VOS_STATUS_SUCCESS != hdd_processSpoofMacAddrRequest(pHddCtx)) |
| 4396 | { |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4397 | hddLog(LOGE, FL("Failed to send Spoof Mac Addr to FW")); |
| 4398 | } |
| 4399 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4400 | EXIT(); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 4401 | return 0; |
| 4402 | } |
| 4403 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4404 | static int wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
| 4405 | struct wireless_dev *wdev, |
| 4406 | const void *data, |
| 4407 | int data_len) |
| 4408 | { |
| 4409 | int ret = 0; |
| 4410 | |
| 4411 | vos_ssr_protect(__func__); |
| 4412 | ret = __wlan_hdd_cfg80211_set_spoofed_mac_oui(wiphy, wdev, data, data_len); |
| 4413 | vos_ssr_unprotect(__func__); |
| 4414 | |
| 4415 | return ret; |
| 4416 | } |
| 4417 | |
| 4418 | static int __wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4419 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4420 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4421 | int data_len) |
| 4422 | { |
| 4423 | u8 peer[6] = {0}; |
| 4424 | struct net_device *dev = wdev->netdev; |
| 4425 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4426 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4427 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; |
| 4428 | eHalStatus ret; |
| 4429 | tANI_S32 state; |
| 4430 | tANI_S32 reason; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4431 | tANI_S32 global_operating_class = 0; |
| 4432 | tANI_S32 channel = 0; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4433 | struct sk_buff *skb = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4434 | int retVal; |
| 4435 | |
| 4436 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4437 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4438 | if (!pAdapter) { |
| 4439 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 4440 | return -EINVAL; |
| 4441 | } |
| 4442 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4443 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4444 | if (0 != ret) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4445 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4446 | return -EINVAL; |
| 4447 | } |
| 4448 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4449 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4450 | return -ENOTSUPP; |
| 4451 | } |
| 4452 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, |
| 4453 | data, data_len, |
| 4454 | wlan_hdd_tdls_config_get_status_policy)) { |
| 4455 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4456 | return -EINVAL; |
| 4457 | } |
| 4458 | |
| 4459 | /* Parse and fetch mac address */ |
| 4460 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]) { |
| 4461 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4462 | return -EINVAL; |
| 4463 | } |
| 4464 | |
| 4465 | memcpy(peer, nla_data( |
| 4466 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]), |
| 4467 | sizeof(peer)); |
| 4468 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4469 | |
| 4470 | ret = wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason); |
| 4471 | |
| 4472 | if (0 != ret) { |
| 4473 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4474 | FL("get status Failed")); |
| 4475 | return -EINVAL; |
| 4476 | } |
| 4477 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4478 | 4 * sizeof(s32) + |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4479 | NLMSG_HDRLEN); |
| 4480 | |
| 4481 | if (!skb) { |
| 4482 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4483 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 4484 | return -EINVAL; |
| 4485 | } |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4486 | 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] | 4487 | reason, |
| 4488 | state, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4489 | global_operating_class, |
| 4490 | channel, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4491 | MAC_ADDR_ARRAY(peer)); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4492 | if (nla_put_s32(skb, |
| 4493 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE, |
| 4494 | state) || |
| 4495 | nla_put_s32(skb, |
| 4496 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON, |
| 4497 | reason) || |
| 4498 | nla_put_s32(skb, |
| 4499 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS, |
| 4500 | global_operating_class) || |
| 4501 | nla_put_s32(skb, |
| 4502 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL, |
| 4503 | channel)) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4504 | |
| 4505 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4506 | goto nla_put_failure; |
| 4507 | } |
| 4508 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4509 | retVal = cfg80211_vendor_cmd_reply(skb); |
| 4510 | EXIT(); |
| 4511 | return retVal; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4512 | |
| 4513 | nla_put_failure: |
| 4514 | kfree_skb(skb); |
| 4515 | return -EINVAL; |
| 4516 | } |
| 4517 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4518 | static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
| 4519 | struct wireless_dev *wdev, |
| 4520 | const void *data, |
| 4521 | int data_len) |
| 4522 | { |
| 4523 | int ret = 0; |
| 4524 | |
| 4525 | vos_ssr_protect(__func__); |
| 4526 | ret = __wlan_hdd_cfg80211_exttdls_get_status(wiphy, wdev, data, data_len); |
| 4527 | vos_ssr_unprotect(__func__); |
| 4528 | |
| 4529 | return ret; |
| 4530 | } |
| 4531 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4532 | static int wlan_hdd_cfg80211_exttdls_callback(tANI_U8* mac, |
| 4533 | tANI_S32 state, |
| 4534 | tANI_S32 reason, |
| 4535 | void *ctx) |
| 4536 | { |
| 4537 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)ctx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4538 | struct sk_buff *skb = NULL; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4539 | tANI_S32 global_operating_class = 0; |
| 4540 | tANI_S32 channel = 0; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4541 | hdd_context_t *pHddCtx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4542 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4543 | ENTER(); |
| 4544 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4545 | if (!pAdapter) { |
| 4546 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 4547 | return -EINVAL; |
| 4548 | } |
| 4549 | |
| 4550 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4551 | if (wlan_hdd_validate_context(pHddCtx)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4552 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4553 | return -EINVAL; |
| 4554 | } |
| 4555 | |
| 4556 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4557 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4558 | return -ENOTSUPP; |
| 4559 | } |
| 4560 | skb = cfg80211_vendor_event_alloc( |
| 4561 | pHddCtx->wiphy, |
| 4562 | EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 4563 | QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX, |
| 4564 | GFP_KERNEL); |
| 4565 | |
| 4566 | if (!skb) { |
| 4567 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4568 | FL("cfg80211_vendor_event_alloc failed")); |
| 4569 | return -EINVAL; |
| 4570 | } |
| 4571 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4572 | hddLog(VOS_TRACE_LEVEL_INFO, "Reason: (%d) Status: (%d) Class: (%d) Channel: (%d)", |
| 4573 | reason, |
| 4574 | state, |
| 4575 | global_operating_class, |
| 4576 | channel); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4577 | hddLog(VOS_TRACE_LEVEL_WARN, "tdls peer " MAC_ADDRESS_STR, |
| 4578 | MAC_ADDR_ARRAY(mac)); |
| 4579 | |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4580 | if (nla_put(skb, |
| 4581 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR, |
| 4582 | VOS_MAC_ADDR_SIZE, mac) || |
| 4583 | nla_put_s32(skb, |
| 4584 | QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE, |
| 4585 | state) || |
| 4586 | nla_put_s32(skb, |
| 4587 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON, |
| 4588 | reason) || |
| 4589 | nla_put_s32(skb, |
| 4590 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL, |
| 4591 | channel) || |
| 4592 | nla_put_s32(skb, |
| 4593 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS, |
| 4594 | global_operating_class) |
| 4595 | ) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4596 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4597 | goto nla_put_failure; |
| 4598 | } |
| 4599 | |
| 4600 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4601 | EXIT(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4602 | return (0); |
| 4603 | |
| 4604 | nla_put_failure: |
| 4605 | kfree_skb(skb); |
| 4606 | return -EINVAL; |
| 4607 | } |
| 4608 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4609 | static int __wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4610 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4611 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4612 | int data_len) |
| 4613 | { |
| 4614 | u8 peer[6] = {0}; |
| 4615 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4616 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4617 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1]; |
| 4618 | eHalStatus status; |
| 4619 | tdls_req_params_t pReqMsg = {0}; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4620 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4621 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4622 | |
| 4623 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4624 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4625 | if (!dev) { |
| 4626 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 4627 | return -EINVAL; |
| 4628 | } |
| 4629 | |
| 4630 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4631 | if (!pAdapter) { |
| 4632 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 4633 | return -EINVAL; |
| 4634 | } |
| 4635 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4636 | status = wlan_hdd_validate_context(pHddCtx); |
| 4637 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4638 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4639 | return -EINVAL; |
| 4640 | } |
| 4641 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4642 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4643 | return -ENOTSUPP; |
| 4644 | } |
| 4645 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX, |
| 4646 | data, data_len, |
| 4647 | wlan_hdd_tdls_config_enable_policy)) { |
| 4648 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4649 | return -EINVAL; |
| 4650 | } |
| 4651 | |
| 4652 | /* Parse and fetch mac address */ |
| 4653 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]) { |
| 4654 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4655 | return -EINVAL; |
| 4656 | } |
| 4657 | |
| 4658 | memcpy(peer, nla_data( |
| 4659 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]), |
| 4660 | sizeof(peer)); |
| 4661 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4662 | |
| 4663 | /* Parse and fetch channel */ |
| 4664 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]) { |
| 4665 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 4666 | return -EINVAL; |
| 4667 | } |
| 4668 | pReqMsg.channel = nla_get_s32( |
| 4669 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]); |
| 4670 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Channel Num (%d)"), pReqMsg.channel); |
| 4671 | |
| 4672 | /* Parse and fetch global operating class */ |
| 4673 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]) { |
| 4674 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr operating class failed")); |
| 4675 | return -EINVAL; |
| 4676 | } |
| 4677 | pReqMsg.global_operating_class = nla_get_s32( |
| 4678 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]); |
| 4679 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Operating class (%d)"), |
| 4680 | pReqMsg.global_operating_class); |
| 4681 | |
| 4682 | /* Parse and fetch latency ms */ |
| 4683 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]) { |
| 4684 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr latency failed")); |
| 4685 | return -EINVAL; |
| 4686 | } |
| 4687 | pReqMsg.max_latency_ms = nla_get_s32( |
| 4688 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]); |
| 4689 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Latency (%d)"), |
| 4690 | pReqMsg.max_latency_ms); |
| 4691 | |
| 4692 | /* Parse and fetch required bandwidth kbps */ |
| 4693 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]) { |
| 4694 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bandwidth failed")); |
| 4695 | return -EINVAL; |
| 4696 | } |
| 4697 | |
| 4698 | pReqMsg.min_bandwidth_kbps = nla_get_s32( |
| 4699 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]); |
| 4700 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bandwidth (%d)"), |
| 4701 | pReqMsg.min_bandwidth_kbps); |
| 4702 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4703 | ret = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4704 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 4705 | &pReqMsg, |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4706 | wlan_hdd_cfg80211_exttdls_callback); |
| 4707 | |
| 4708 | EXIT(); |
| 4709 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4710 | } |
| 4711 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4712 | static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
| 4713 | struct wireless_dev *wdev, |
| 4714 | const void *data, |
| 4715 | int data_len) |
| 4716 | { |
| 4717 | int ret = 0; |
| 4718 | |
| 4719 | vos_ssr_protect(__func__); |
| 4720 | ret = __wlan_hdd_cfg80211_exttdls_enable(wiphy, wdev, data, data_len); |
| 4721 | vos_ssr_unprotect(__func__); |
| 4722 | |
| 4723 | return ret; |
| 4724 | } |
| 4725 | |
| 4726 | static int __wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4727 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4728 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4729 | int data_len) |
| 4730 | { |
| 4731 | u8 peer[6] = {0}; |
| 4732 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4733 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4734 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1]; |
| 4735 | eHalStatus status; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4736 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4737 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4738 | |
| 4739 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4740 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 4741 | if (!dev) { |
| 4742 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 4743 | return -EINVAL; |
| 4744 | } |
| 4745 | |
| 4746 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4747 | if (!pAdapter) { |
| 4748 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 4749 | return -EINVAL; |
| 4750 | } |
| 4751 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4752 | status = wlan_hdd_validate_context(pHddCtx); |
| 4753 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4754 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4755 | return -EINVAL; |
| 4756 | } |
| 4757 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 4758 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4759 | return -ENOTSUPP; |
| 4760 | } |
| 4761 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX, |
| 4762 | data, data_len, |
| 4763 | wlan_hdd_tdls_config_disable_policy)) { |
| 4764 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4765 | return -EINVAL; |
| 4766 | } |
| 4767 | /* Parse and fetch mac address */ |
| 4768 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]) { |
| 4769 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 4770 | return -EINVAL; |
| 4771 | } |
| 4772 | |
| 4773 | memcpy(peer, nla_data( |
| 4774 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]), |
| 4775 | sizeof(peer)); |
| 4776 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 4777 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4778 | ret = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
| 4779 | |
| 4780 | EXIT(); |
| 4781 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4782 | } |
| 4783 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4784 | static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
| 4785 | struct wireless_dev *wdev, |
| 4786 | const void *data, |
| 4787 | int data_len) |
| 4788 | { |
| 4789 | int ret = 0; |
| 4790 | |
| 4791 | vos_ssr_protect(__func__); |
| 4792 | ret = __wlan_hdd_cfg80211_exttdls_disable(wiphy, wdev, data, data_len); |
| 4793 | vos_ssr_unprotect(__func__); |
| 4794 | |
| 4795 | return ret; |
| 4796 | } |
| 4797 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4798 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4799 | __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4800 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4801 | const void *data, int data_len) |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4802 | { |
| 4803 | struct net_device *dev = wdev->netdev; |
| 4804 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4805 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4806 | struct sk_buff *skb = NULL; |
| 4807 | tANI_U32 fset = 0; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4808 | int ret = 0; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4809 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4810 | ENTER(); |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4811 | |
| 4812 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4813 | if (0 != ret) |
| 4814 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4815 | return ret; |
| 4816 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4817 | if (wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { |
| 4818 | hddLog(LOG1, FL("Infra Station mode is supported by driver")); |
| 4819 | fset |= WIFI_FEATURE_INFRA; |
| 4820 | } |
| 4821 | |
| 4822 | if (TRUE == hdd_is_5g_supported(pHddCtx)) { |
| 4823 | hddLog(LOG1, FL("INFRA_5G is supported by firmware")); |
| 4824 | fset |= WIFI_FEATURE_INFRA_5G; |
| 4825 | } |
| 4826 | |
| 4827 | #ifdef WLAN_FEATURE_P2P |
| 4828 | if ((wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) && |
| 4829 | (wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_GO))) { |
| 4830 | hddLog(LOG1, FL("WiFi-Direct is supported by driver")); |
| 4831 | fset |= WIFI_FEATURE_P2P; |
| 4832 | } |
| 4833 | #endif |
| 4834 | |
| 4835 | /* Soft-AP is supported currently by default */ |
| 4836 | fset |= WIFI_FEATURE_SOFT_AP; |
| 4837 | |
| 4838 | #ifdef WLAN_FEATURE_EXTSCAN |
| 4839 | if ((TRUE == pHddCtx->cfg_ini->fEnableEXTScan) && |
| 4840 | sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) { |
| 4841 | hddLog(LOG1, FL("EXTScan is supported by firmware")); |
| 4842 | fset |= WIFI_FEATURE_EXTSCAN; |
| 4843 | } |
| 4844 | #endif |
| 4845 | |
| 4846 | #ifdef WLAN_FEATURE_NAN |
| 4847 | if (sme_IsFeatureSupportedByFW(NAN)) { |
| 4848 | hddLog(LOG1, FL("NAN is supported by firmware")); |
| 4849 | fset |= WIFI_FEATURE_NAN; |
| 4850 | } |
| 4851 | #endif |
| 4852 | |
| 4853 | /* D2D RTT is not supported currently by default */ |
| 4854 | if (sme_IsFeatureSupportedByFW(RTT)) { |
| 4855 | hddLog(LOG1, FL("RTT is supported by firmware")); |
| 4856 | fset |= WIFI_FEATURE_D2AP_RTT; |
| 4857 | } |
| 4858 | |
| 4859 | #ifdef FEATURE_WLAN_BATCH_SCAN |
| 4860 | if (fset & WIFI_FEATURE_EXTSCAN) { |
| 4861 | hddLog(LOG1, FL("Batch scan is supported as extscan is supported")); |
| 4862 | fset &= ~WIFI_FEATURE_BATCH_SCAN; |
| 4863 | } else if (sme_IsFeatureSupportedByFW(BATCH_SCAN)) { |
| 4864 | hddLog(LOG1, FL("Batch scan is supported by firmware")); |
| 4865 | fset |= WIFI_FEATURE_BATCH_SCAN; |
| 4866 | } |
| 4867 | #endif |
| 4868 | |
| 4869 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 4870 | if (pHddCtx->cfg_ini->configPNOScanSupport && |
| 4871 | (eHAL_STATUS_SUCCESS == wlan_hdd_is_pno_allowed(pAdapter))) { |
| 4872 | hddLog(LOG1, FL("PNO is supported by firmware")); |
| 4873 | fset |= WIFI_FEATURE_PNO; |
| 4874 | } |
| 4875 | #endif |
| 4876 | |
| 4877 | /* STA+STA is supported currently by default */ |
| 4878 | fset |= WIFI_FEATURE_ADDITIONAL_STA; |
| 4879 | |
| 4880 | #ifdef FEATURE_WLAN_TDLS |
| 4881 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSSupport) && |
| 4882 | sme_IsFeatureSupportedByFW(TDLS)) { |
| 4883 | hddLog(LOG1, FL("TDLS is supported by firmware")); |
| 4884 | fset |= WIFI_FEATURE_TDLS; |
| 4885 | } |
| 4886 | |
| 4887 | /* TDLS_OFFCHANNEL is not supported currently by default */ |
| 4888 | #endif |
| 4889 | |
| 4890 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 4891 | /* AP+STA concurrency is supported currently by default */ |
| 4892 | fset |= WIFI_FEATURE_AP_STA; |
| 4893 | #endif |
| 4894 | |
| 4895 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) + |
| 4896 | NLMSG_HDRLEN); |
| 4897 | |
| 4898 | if (!skb) { |
| 4899 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 4900 | return -EINVAL; |
| 4901 | } |
| 4902 | hddLog(LOG1, FL("Supported Features : 0x%x"), fset); |
| 4903 | |
| 4904 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_FEATURE_SET, fset)) { |
| 4905 | hddLog(LOGE, FL("nla put fail")); |
| 4906 | goto nla_put_failure; |
| 4907 | } |
| 4908 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4909 | ret = cfg80211_vendor_cmd_reply(skb); |
| 4910 | EXIT(); |
| 4911 | return ret; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 4912 | |
| 4913 | nla_put_failure: |
| 4914 | kfree_skb(skb); |
| 4915 | return -EINVAL; |
| 4916 | } |
| 4917 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 4918 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4919 | wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
| 4920 | struct wireless_dev *wdev, |
| 4921 | const void *data, int data_len) |
| 4922 | { |
| 4923 | int ret = 0; |
| 4924 | |
| 4925 | vos_ssr_protect(__func__); |
| 4926 | ret = __wlan_hdd_cfg80211_get_supported_features(wiphy, wdev, data, data_len); |
| 4927 | vos_ssr_unprotect(__func__); |
| 4928 | |
| 4929 | return ret; |
| 4930 | } |
| 4931 | |
| 4932 | static int |
| 4933 | __wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 4934 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4935 | const void *data, int data_len) |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 4936 | { |
| 4937 | uint32_t feature_set_matrix[WLAN_HDD_MAX_FEATURE_SET] = {0}; |
| 4938 | uint8_t i, feature_sets, max_feature_sets; |
| 4939 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX + 1]; |
| 4940 | struct sk_buff *reply_skb; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4941 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4942 | int ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 4943 | |
| 4944 | ENTER(); |
| 4945 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4946 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4947 | if (0 != ret) |
| 4948 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4949 | return ret; |
| 4950 | } |
| 4951 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 4952 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX, |
| 4953 | data, data_len, NULL)) { |
| 4954 | hddLog(LOGE, FL("Invalid ATTR")); |
| 4955 | return -EINVAL; |
| 4956 | } |
| 4957 | |
| 4958 | /* Parse and fetch max feature set */ |
| 4959 | if (!tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]) { |
| 4960 | hddLog(LOGE, FL("Attr max feature set size failed")); |
| 4961 | return -EINVAL; |
| 4962 | } |
| 4963 | max_feature_sets = nla_get_u32( |
| 4964 | tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]); |
| 4965 | hddLog(LOG1, FL("Max feature set size (%d)"), max_feature_sets); |
| 4966 | |
| 4967 | /* Fill feature combination matrix */ |
| 4968 | feature_sets = 0; |
| 4969 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 4970 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 4971 | WIFI_FEATURE_P2P; |
| 4972 | |
| 4973 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 4974 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 4975 | WIFI_FEATURE_SOFT_AP; |
| 4976 | |
| 4977 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 4978 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_P2P | |
| 4979 | WIFI_FEATURE_SOFT_AP; |
| 4980 | |
| 4981 | if (feature_sets >= WLAN_HDD_MAX_FEATURE_SET) goto max_buffer_err; |
| 4982 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 4983 | WIFI_FEATURE_SOFT_AP | |
| 4984 | WIFI_FEATURE_P2P; |
| 4985 | |
| 4986 | /* Add more feature combinations here */ |
| 4987 | |
| 4988 | feature_sets = VOS_MIN(feature_sets, max_feature_sets); |
| 4989 | hddLog(LOG1, FL("Number of feature sets (%d)"), feature_sets); |
| 4990 | hddLog(LOG1, "Feature set matrix"); |
| 4991 | for (i = 0; i < feature_sets; i++) |
| 4992 | hddLog(LOG1, "[%d] 0x%02X", i, feature_set_matrix[i]); |
| 4993 | |
| 4994 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 4995 | sizeof(u32) * feature_sets + |
| 4996 | NLMSG_HDRLEN); |
| 4997 | |
| 4998 | if (reply_skb) { |
| 4999 | if (nla_put_u32(reply_skb, |
| 5000 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET_SIZE, |
| 5001 | feature_sets) || |
| 5002 | nla_put(reply_skb, |
| 5003 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET, |
| 5004 | sizeof(u32) * feature_sets, feature_set_matrix)) { |
| 5005 | hddLog(LOGE, FL("nla put fail")); |
| 5006 | kfree_skb(reply_skb); |
| 5007 | return -EINVAL; |
| 5008 | } |
| 5009 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5010 | ret = cfg80211_vendor_cmd_reply(reply_skb); |
| 5011 | EXIT(); |
| 5012 | return ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5013 | } |
| 5014 | hddLog(LOGE, FL("Feature set matrix: buffer alloc fail")); |
| 5015 | return -ENOMEM; |
| 5016 | |
| 5017 | max_buffer_err: |
| 5018 | hddLog(LOGE, FL("Feature set max buffer size reached. feature_sets(%d) max(%d)"), |
| 5019 | feature_sets, WLAN_HDD_MAX_FEATURE_SET); |
| 5020 | return -EINVAL; |
| 5021 | } |
| 5022 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5023 | static int |
| 5024 | wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
| 5025 | struct wireless_dev *wdev, |
| 5026 | const void *data, int data_len) |
| 5027 | { |
| 5028 | int ret = 0; |
| 5029 | |
| 5030 | vos_ssr_protect(__func__); |
| 5031 | ret = __wlan_hdd_cfg80211_get_concurrency_matrix(wiphy, wdev, data, |
| 5032 | data_len); |
| 5033 | vos_ssr_unprotect(__func__); |
| 5034 | |
| 5035 | return ret; |
| 5036 | } |
| 5037 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5038 | static const struct nla_policy |
| 5039 | wlan_hdd_set_no_dfs_flag_config_policy[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX |
| 5040 | +1] = |
| 5041 | { |
| 5042 | [QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG] = {.type = NLA_U32 }, |
| 5043 | }; |
| 5044 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5045 | static int __wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5046 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5047 | const void *data, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5048 | int data_len) |
| 5049 | { |
| 5050 | struct net_device *dev = wdev->netdev; |
| 5051 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5052 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5053 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5054 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX + 1]; |
| 5055 | eHalStatus status; |
| 5056 | u32 dfsFlag = 0; |
| 5057 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5058 | ENTER(); |
| 5059 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5060 | status = wlan_hdd_validate_context(pHddCtx); |
| 5061 | if (0 != status) { |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5062 | return -EINVAL; |
| 5063 | } |
| 5064 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX, |
| 5065 | data, data_len, |
| 5066 | wlan_hdd_set_no_dfs_flag_config_policy)) { |
| 5067 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5068 | return -EINVAL; |
| 5069 | } |
| 5070 | |
| 5071 | /* Parse and fetch required bandwidth kbps */ |
| 5072 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]) { |
| 5073 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dfs flag failed")); |
| 5074 | return -EINVAL; |
| 5075 | } |
| 5076 | |
| 5077 | dfsFlag = nla_get_u32( |
| 5078 | tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]); |
| 5079 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" DFS flag (%d)"), |
| 5080 | dfsFlag); |
| 5081 | |
| 5082 | pHddCtx->disable_dfs_flag = dfsFlag; |
| 5083 | |
| 5084 | sme_disable_dfs_channel(hHal, dfsFlag); |
| 5085 | sme_FilterScanResults(hHal, pAdapter->sessionId); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5086 | |
| 5087 | EXIT(); |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5088 | return 0; |
| 5089 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5090 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5091 | static int wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
| 5092 | struct wireless_dev *wdev, |
| 5093 | const void *data, |
| 5094 | int data_len) |
| 5095 | { |
| 5096 | int ret = 0; |
| 5097 | |
| 5098 | vos_ssr_protect(__func__); |
| 5099 | ret = __wlan_hdd_cfg80211_disable_dfs_channels(wiphy, wdev, data, data_len); |
| 5100 | vos_ssr_unprotect(__func__); |
| 5101 | |
| 5102 | return ret; |
| 5103 | |
| 5104 | } |
| 5105 | |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5106 | const struct |
| 5107 | nla_policy qca_wlan_vendor_attr[QCA_WLAN_VENDOR_ATTR_MAX+1] = |
| 5108 | { |
| 5109 | [QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY] = { .type = NLA_U32 }, |
| 5110 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { .type = NLA_UNSPEC }, |
| 5111 | }; |
| 5112 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5113 | static int __wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5114 | struct wireless_dev *wdev, const void *data, int data_len) |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5115 | { |
| 5116 | |
| 5117 | u8 bssid[6] = {0}; |
| 5118 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5119 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 5120 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5121 | v_U32_t isFwrRoamEnabled = FALSE; |
| 5122 | int ret; |
| 5123 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5124 | ENTER(); |
| 5125 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5126 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5127 | if (0 != ret) { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5128 | return ret; |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5129 | } |
| 5130 | |
| 5131 | ret = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, |
| 5132 | data, data_len, |
| 5133 | qca_wlan_vendor_attr); |
| 5134 | if (ret){ |
| 5135 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5136 | return -EINVAL; |
| 5137 | } |
| 5138 | |
| 5139 | /* Parse and fetch Enable flag */ |
| 5140 | if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]) { |
| 5141 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr enable failed")); |
| 5142 | return -EINVAL; |
| 5143 | } |
| 5144 | |
| 5145 | isFwrRoamEnabled = nla_get_u32( |
| 5146 | tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]); |
| 5147 | |
| 5148 | hddLog(VOS_TRACE_LEVEL_INFO, FL("isFwrRoamEnabled (%d)"), isFwrRoamEnabled); |
| 5149 | |
| 5150 | /* Parse and fetch bssid */ |
| 5151 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 5152 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bss id failed")); |
| 5153 | return -EINVAL; |
| 5154 | } |
| 5155 | |
| 5156 | memcpy(bssid, nla_data( |
| 5157 | tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 5158 | sizeof(bssid)); |
| 5159 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(bssid)); |
| 5160 | |
| 5161 | //Update roaming |
| 5162 | status = sme_ConfigFwrRoaming((tHalHandle)(pHddCtx->hHal), isFwrRoamEnabled); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5163 | EXIT(); |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5164 | return status; |
| 5165 | } |
| 5166 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5167 | static int wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
| 5168 | struct wireless_dev *wdev, const void *data, int data_len) |
| 5169 | { |
| 5170 | int ret = 0; |
| 5171 | |
| 5172 | vos_ssr_protect(__func__); |
| 5173 | ret = __wlan_hdd_cfg80211_firmware_roaming(wiphy, wdev, data, data_len); |
| 5174 | vos_ssr_unprotect(__func__); |
| 5175 | |
| 5176 | return ret; |
| 5177 | } |
| 5178 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5179 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 5180 | { |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5181 | { |
| 5182 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5183 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAMING, |
| 5184 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5185 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5186 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5187 | .doit = wlan_hdd_cfg80211_firmware_roaming |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 5188 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5189 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5190 | { |
| 5191 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5192 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 5193 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5194 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5195 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5196 | .doit = wlan_hdd_cfg80211_ll_stats_clear |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5197 | }, |
| 5198 | |
| 5199 | { |
| 5200 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5201 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 5202 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5203 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5204 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5205 | .doit = wlan_hdd_cfg80211_ll_stats_set |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5206 | }, |
| 5207 | |
| 5208 | { |
| 5209 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5210 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 5211 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5212 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5213 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5214 | .doit = wlan_hdd_cfg80211_ll_stats_get |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5215 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5216 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5217 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5218 | { |
| 5219 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5220 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START, |
| 5221 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5222 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5223 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5224 | .doit = wlan_hdd_cfg80211_extscan_start |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5225 | }, |
| 5226 | { |
| 5227 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5228 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP, |
| 5229 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5230 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5231 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5232 | .doit = wlan_hdd_cfg80211_extscan_stop |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5233 | }, |
| 5234 | { |
| 5235 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5236 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS, |
| 5237 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5238 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5239 | .doit = wlan_hdd_cfg80211_extscan_get_valid_channels |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5240 | }, |
| 5241 | { |
| 5242 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5243 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES, |
| 5244 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5245 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5246 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5247 | .doit = wlan_hdd_cfg80211_extscan_get_capabilities |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5248 | }, |
| 5249 | { |
| 5250 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5251 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS, |
| 5252 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5253 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5254 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5255 | .doit = wlan_hdd_cfg80211_extscan_get_cached_results |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5256 | }, |
| 5257 | { |
| 5258 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5259 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST, |
| 5260 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5261 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5262 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5263 | .doit = wlan_hdd_cfg80211_extscan_set_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5264 | }, |
| 5265 | { |
| 5266 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5267 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST, |
| 5268 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5269 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5270 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5271 | .doit = wlan_hdd_cfg80211_extscan_reset_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5272 | }, |
| 5273 | { |
| 5274 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5275 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE, |
| 5276 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5277 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5278 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5279 | .doit = wlan_hdd_cfg80211_extscan_set_significant_change |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5280 | }, |
| 5281 | { |
| 5282 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5283 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE, |
| 5284 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5285 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5286 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5287 | .doit = wlan_hdd_cfg80211_extscan_reset_significant_change |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5288 | }, |
| 5289 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5290 | /*EXT TDLS*/ |
| 5291 | { |
| 5292 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5293 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE, |
| 5294 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5295 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5296 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5297 | .doit = wlan_hdd_cfg80211_exttdls_enable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5298 | }, |
| 5299 | { |
| 5300 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5301 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE, |
| 5302 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5303 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 5304 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5305 | .doit = wlan_hdd_cfg80211_exttdls_disable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5306 | }, |
| 5307 | { |
| 5308 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5309 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS, |
| 5310 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5311 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5312 | .doit = wlan_hdd_cfg80211_exttdls_get_status |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5313 | }, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5314 | { |
| 5315 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5316 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES, |
| 5317 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5318 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5319 | .doit = wlan_hdd_cfg80211_get_supported_features |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5320 | }, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5321 | { |
| 5322 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5323 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG, |
| 5324 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5325 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5326 | .doit = wlan_hdd_cfg80211_disable_dfs_channels |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5327 | }, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5328 | { |
| 5329 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5330 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MAC_OUI, |
| 5331 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5332 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5333 | .doit = wlan_hdd_cfg80211_set_spoofed_mac_oui |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5334 | }, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5335 | { |
| 5336 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 5337 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX, |
| 5338 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 5339 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 5340 | .doit = wlan_hdd_cfg80211_get_concurrency_matrix |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5341 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5342 | }; |
| 5343 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5344 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5345 | static const |
| 5346 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5347 | { |
| 5348 | #ifdef FEATURE_WLAN_CH_AVOID |
| 5349 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5350 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5351 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5352 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5353 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 5354 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5355 | { |
| 5356 | /* Index = 1*/ |
| 5357 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5358 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 5359 | }, |
| 5360 | { |
| 5361 | /* Index = 2*/ |
| 5362 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5363 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 5364 | }, |
| 5365 | { |
| 5366 | /* Index = 3*/ |
| 5367 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5368 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 5369 | }, |
| 5370 | { |
| 5371 | /* Index = 4*/ |
| 5372 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5373 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 5374 | }, |
| 5375 | { |
| 5376 | /* Index = 5*/ |
| 5377 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5378 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 5379 | }, |
| 5380 | { |
| 5381 | /* Index = 6*/ |
| 5382 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5383 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 5384 | }, |
| 5385 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5386 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5387 | { |
| 5388 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5389 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START |
| 5390 | }, |
| 5391 | { |
| 5392 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5393 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP |
| 5394 | }, |
| 5395 | { |
| 5396 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5397 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES |
| 5398 | }, |
| 5399 | { |
| 5400 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5401 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS |
| 5402 | }, |
| 5403 | { |
| 5404 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5405 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE |
| 5406 | }, |
| 5407 | { |
| 5408 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5409 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT |
| 5410 | }, |
| 5411 | { |
| 5412 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5413 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT |
| 5414 | }, |
| 5415 | { |
| 5416 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5417 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND |
| 5418 | }, |
| 5419 | { |
| 5420 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5421 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST |
| 5422 | }, |
| 5423 | { |
| 5424 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5425 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST |
| 5426 | }, |
| 5427 | { |
| 5428 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5429 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SIGNIFICANT_CHANGE |
| 5430 | }, |
| 5431 | { |
| 5432 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5433 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SIGNIFICANT_CHANGE |
| 5434 | }, |
| 5435 | { |
| 5436 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5437 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SIGNIFICANT_CHANGE |
| 5438 | }, |
| 5439 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5440 | /*EXT TDLS*/ |
| 5441 | { |
| 5442 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 5443 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE |
| 5444 | }, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5445 | }; |
| 5446 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5447 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5448 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5449 | * This function is called by hdd_wlan_startup() |
| 5450 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5451 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5452 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5453 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5454 | { |
| 5455 | struct wiphy *wiphy; |
| 5456 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5457 | /* |
| 5458 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5459 | */ |
| 5460 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 5461 | |
| 5462 | if (!wiphy) |
| 5463 | { |
| 5464 | /* Print error and jump into err label and free the memory */ |
| 5465 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 5466 | return NULL; |
| 5467 | } |
| 5468 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5469 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5470 | return wiphy; |
| 5471 | } |
| 5472 | |
| 5473 | /* |
| 5474 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5475 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5476 | * private ioctl to change the band value |
| 5477 | */ |
| 5478 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 5479 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5480 | int i, j; |
| 5481 | eNVChannelEnabledType channelEnabledState; |
| 5482 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5483 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 5484 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5485 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5486 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5487 | |
| 5488 | if (NULL == wiphy->bands[i]) |
| 5489 | { |
| 5490 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 5491 | __func__, i); |
| 5492 | continue; |
| 5493 | } |
| 5494 | |
| 5495 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 5496 | { |
| 5497 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 5498 | |
| 5499 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 5500 | band->channels[j].hw_value); |
| 5501 | |
| 5502 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 5503 | { |
Abhishek Singh | 678227a | 2014-11-04 10:52:38 +0530 | [diff] [blame] | 5504 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5505 | continue; |
| 5506 | } |
| 5507 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 5508 | { |
| 5509 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5510 | continue; |
| 5511 | } |
| 5512 | |
| 5513 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 5514 | NV_CHANNEL_INVALID == channelEnabledState) |
| 5515 | { |
| 5516 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5517 | } |
| 5518 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 5519 | { |
| 5520 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 5521 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 5522 | } |
| 5523 | else |
| 5524 | { |
| 5525 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 5526 | |IEEE80211_CHAN_RADAR); |
| 5527 | } |
| 5528 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5529 | } |
| 5530 | return 0; |
| 5531 | } |
| 5532 | /* |
| 5533 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5534 | * This function is called by hdd_wlan_startup() |
| 5535 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5536 | * This function is used to initialize and register wiphy structure. |
| 5537 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5538 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5539 | struct wiphy *wiphy, |
| 5540 | hdd_config_t *pCfg |
| 5541 | ) |
| 5542 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5543 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 5544 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5545 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5546 | ENTER(); |
| 5547 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5548 | /* Now bind the underlying wlan device with wiphy */ |
| 5549 | set_wiphy_dev(wiphy, dev); |
| 5550 | |
| 5551 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5552 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5553 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 5554 | /* the flag for the other case would be initialzed in |
| 5555 | vos_init_wiphy_from_nv_bin */ |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 5556 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5557 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5558 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5559 | /* This will disable updating of NL channels from passive to |
| 5560 | * active if a beacon is received on passive channel. */ |
| 5561 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Amar Singhal | f007319 | 2013-09-20 12:34:56 -0700 | [diff] [blame] | 5562 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5563 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5564 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5565 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 5566 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 5567 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 5568 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5569 | | WIPHY_FLAG_OFFCHAN_TX; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 5570 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5571 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5572 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5573 | #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] | 5574 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 5575 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 5576 | || pCfg->isFastRoamIniFeatureEnabled |
| 5577 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5578 | #ifdef FEATURE_WLAN_ESE |
| 5579 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 5580 | #endif |
| 5581 | ) |
| 5582 | { |
| 5583 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 5584 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 5585 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5586 | #ifdef FEATURE_WLAN_TDLS |
| 5587 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 5588 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 5589 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 5590 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 5591 | if (pCfg->configPNOScanSupport) |
| 5592 | { |
| 5593 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 5594 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 5595 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 5596 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 5597 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 5598 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 5599 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5600 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 5601 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 5602 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5603 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 5604 | driver need to determine what to do with both |
| 5605 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5606 | |
| 5607 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 5608 | #else |
| 5609 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 5610 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5611 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5612 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 5613 | |
Madan Mohan Koyyalamudi | 6815b16 | 2013-07-19 17:17:46 +0530 | [diff] [blame] | 5614 | wiphy->max_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5615 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 5616 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 5617 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5618 | /* Supports STATION & AD-HOC modes right now */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5619 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5620 | | BIT(NL80211_IFTYPE_ADHOC) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5621 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 5622 | | BIT(NL80211_IFTYPE_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5623 | | BIT(NL80211_IFTYPE_AP); |
| 5624 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5625 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5626 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5627 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 5628 | if( pCfg->enableMCC ) |
| 5629 | { |
| 5630 | /* Currently, supports up to two channels */ |
| 5631 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5632 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5633 | if( !pCfg->allowMCCGODiffBI ) |
| 5634 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5635 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5636 | } |
| 5637 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 5638 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5639 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 5640 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 5641 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5642 | /* Before registering we need to update the ht capabilitied based |
| 5643 | * on ini values*/ |
| 5644 | if( !pCfg->ShortGI20MhzEnable ) |
| 5645 | { |
| 5646 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5647 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5648 | wlan_hdd_band_p2p_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 5649 | } |
| 5650 | |
| 5651 | if( !pCfg->ShortGI40MhzEnable ) |
| 5652 | { |
| 5653 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 5654 | } |
| 5655 | |
| 5656 | if( !pCfg->nChannelBondingMode5GHz ) |
| 5657 | { |
| 5658 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 5659 | } |
| 5660 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5661 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 5662 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 5663 | { |
| 5664 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 5665 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 5666 | |
| 5667 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 5668 | { |
| 5669 | |
| 5670 | if (NULL == wiphy->bands[i]) |
| 5671 | { |
| 5672 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 5673 | __func__, i); |
| 5674 | continue; |
| 5675 | } |
| 5676 | |
| 5677 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 5678 | { |
| 5679 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 5680 | |
| 5681 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 5682 | { |
| 5683 | // Enable social channels for P2P |
| 5684 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 5685 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 5686 | else |
| 5687 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5688 | continue; |
| 5689 | } |
| 5690 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 5691 | { |
| 5692 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 5693 | continue; |
| 5694 | } |
| 5695 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5696 | } |
| 5697 | /*Initialise the supported cipher suite details*/ |
| 5698 | wiphy->cipher_suites = hdd_cipher_suites; |
| 5699 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 5700 | |
| 5701 | /*signal strength in mBm (100*dBm) */ |
| 5702 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 5703 | |
| 5704 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 5705 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5706 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5707 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 5708 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 5709 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 5710 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 5711 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 5712 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5713 | EXIT(); |
| 5714 | return 0; |
| 5715 | } |
| 5716 | |
| 5717 | /* In this function we are registering wiphy. */ |
| 5718 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 5719 | { |
| 5720 | ENTER(); |
| 5721 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5722 | if (0 > wiphy_register(wiphy)) |
| 5723 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5724 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5725 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 5726 | return -EIO; |
| 5727 | } |
| 5728 | |
| 5729 | EXIT(); |
| 5730 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5731 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5732 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5733 | /* In this function we are updating channel list when, |
| 5734 | regulatory domain is FCC and country code is US. |
| 5735 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 5736 | As per FCC smart phone is not a indoor device. |
| 5737 | GO should not opeate on indoor channels */ |
| 5738 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 5739 | { |
| 5740 | int j; |
| 5741 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5742 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 5743 | //Default counrtycode from NV at the time of wiphy initialization. |
| 5744 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 5745 | &defaultCountryCode[0])) |
| 5746 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 5747 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5748 | } |
| 5749 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 5750 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 5751 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 5752 | { |
| 5753 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 5754 | return; |
| 5755 | } |
| 5756 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 5757 | { |
| 5758 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 5759 | // Mark UNII -1 band channel as passive |
| 5760 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 5761 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 5762 | } |
| 5763 | } |
| 5764 | } |
| 5765 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 5766 | /* This function registers for all frame which supplicant is interested in */ |
| 5767 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5768 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5769 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5770 | /* Register for all P2P action, public action etc frames */ |
| 5771 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 5772 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5773 | ENTER(); |
| 5774 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5775 | /* Right now we are registering these frame when driver is getting |
| 5776 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 5777 | frame register ops, we will move this code as a part of that */ |
| 5778 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5779 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5780 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 5781 | |
| 5782 | /* GAS Initial Response */ |
| 5783 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5784 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5785 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5786 | /* GAS Comeback Request */ |
| 5787 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5788 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 5789 | |
| 5790 | /* GAS Comeback Response */ |
| 5791 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5792 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 5793 | |
| 5794 | /* P2P Public Action */ |
| 5795 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5796 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5797 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 5798 | |
| 5799 | /* P2P Action */ |
| 5800 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5801 | (v_U8_t*)P2P_ACTION_FRAME, |
| 5802 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5803 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 5804 | /* WNM BSS Transition Request frame */ |
| 5805 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5806 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 5807 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 5808 | |
| 5809 | /* WNM-Notification */ |
| 5810 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5811 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 5812 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5813 | } |
| 5814 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 5815 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5816 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5817 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5818 | /* Register for all P2P action, public action etc frames */ |
| 5819 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 5820 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5821 | ENTER(); |
| 5822 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5823 | /* Right now we are registering these frame when driver is getting |
| 5824 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 5825 | frame register ops, we will move this code as a part of that */ |
| 5826 | /* GAS Initial Request */ |
| 5827 | |
| 5828 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5829 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 5830 | |
| 5831 | /* GAS Initial Response */ |
| 5832 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5833 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5834 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5835 | /* GAS Comeback Request */ |
| 5836 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5837 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 5838 | |
| 5839 | /* GAS Comeback Response */ |
| 5840 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5841 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 5842 | |
| 5843 | /* P2P Public Action */ |
| 5844 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5845 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5846 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 5847 | |
| 5848 | /* P2P Action */ |
| 5849 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5850 | (v_U8_t*)P2P_ACTION_FRAME, |
| 5851 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 5852 | /* WNM-Notification */ |
| 5853 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 5854 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 5855 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5856 | } |
| 5857 | |
| 5858 | #ifdef FEATURE_WLAN_WAPI |
| 5859 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
| 5860 | const u8 *mac_addr, u8 *key , int key_Len) |
| 5861 | { |
| 5862 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5863 | tCsrRoamSetKey setKey; |
| 5864 | v_BOOL_t isConnected = TRUE; |
| 5865 | int status = 0; |
| 5866 | v_U32_t roamId= 0xFF; |
| 5867 | tANI_U8 *pKeyPtr = NULL; |
| 5868 | int n = 0; |
| 5869 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 5870 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 5871 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 5872 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5873 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 5874 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5875 | setKey.keyId = key_index; // Store Key ID |
| 5876 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 5877 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 5878 | setKey.paeRole = 0 ; // the PAE role |
| 5879 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 5880 | { |
| 5881 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 5882 | } |
| 5883 | else |
| 5884 | { |
| 5885 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 5886 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 5887 | } |
| 5888 | setKey.keyLength = key_Len; |
| 5889 | pKeyPtr = setKey.Key; |
| 5890 | memcpy( pKeyPtr, key, key_Len); |
| 5891 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5892 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5893 | __func__, key_Len); |
| 5894 | for (n = 0 ; n < key_Len; n++) |
| 5895 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 5896 | __func__,n,setKey.Key[n]); |
| 5897 | |
| 5898 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 5899 | if ( isConnected ) |
| 5900 | { |
| 5901 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5902 | pAdapter->sessionId, &setKey, &roamId ); |
| 5903 | } |
| 5904 | if ( status != 0 ) |
| 5905 | { |
| 5906 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5907 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 5908 | __LINE__, status ); |
| 5909 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 5910 | } |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 5911 | /* Need to clear any trace of key value in the memory. |
| 5912 | * Thus zero out the memory even though it is local |
| 5913 | * variable. |
| 5914 | */ |
| 5915 | vos_mem_zero(&setKey, sizeof(setKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5916 | } |
| 5917 | #endif /* FEATURE_WLAN_WAPI*/ |
| 5918 | |
| 5919 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5920 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5921 | beacon_data_t **ppBeacon, |
| 5922 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5923 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5924 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5925 | beacon_data_t **ppBeacon, |
| 5926 | struct cfg80211_beacon_data *params, |
| 5927 | int dtim_period) |
| 5928 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 5929 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5930 | int size; |
| 5931 | beacon_data_t *beacon = NULL; |
| 5932 | beacon_data_t *old = NULL; |
| 5933 | int head_len,tail_len; |
| 5934 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5935 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5936 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5937 | { |
| 5938 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5939 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5940 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5941 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5942 | |
| 5943 | old = pAdapter->sessionCtx.ap.beacon; |
| 5944 | |
| 5945 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5946 | { |
| 5947 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5948 | FL("session(%d) old and new heads points to NULL"), |
| 5949 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5950 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5951 | } |
| 5952 | |
| 5953 | if (params->tail && !params->tail_len) |
| 5954 | { |
| 5955 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5956 | FL("tail_len is zero but tail is not NULL")); |
| 5957 | return -EINVAL; |
| 5958 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5959 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5960 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 5961 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 5962 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5963 | { |
| 5964 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5965 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5966 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5967 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5968 | #endif |
| 5969 | |
| 5970 | if(params->head) |
| 5971 | head_len = params->head_len; |
| 5972 | else |
| 5973 | head_len = old->head_len; |
| 5974 | |
| 5975 | if(params->tail || !old) |
| 5976 | tail_len = params->tail_len; |
| 5977 | else |
| 5978 | tail_len = old->tail_len; |
| 5979 | |
| 5980 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 5981 | |
| 5982 | beacon = kzalloc(size, GFP_KERNEL); |
| 5983 | |
| 5984 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5985 | { |
| 5986 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5987 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5988 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 5989 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5990 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5991 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5992 | if(params->dtim_period || !old ) |
| 5993 | beacon->dtim_period = params->dtim_period; |
| 5994 | else |
| 5995 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5996 | #else |
| 5997 | if(dtim_period || !old ) |
| 5998 | beacon->dtim_period = dtim_period; |
| 5999 | else |
| 6000 | beacon->dtim_period = old->dtim_period; |
| 6001 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6002 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6003 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 6004 | beacon->tail = beacon->head + head_len; |
| 6005 | beacon->head_len = head_len; |
| 6006 | beacon->tail_len = tail_len; |
| 6007 | |
| 6008 | if(params->head) { |
| 6009 | memcpy (beacon->head,params->head,beacon->head_len); |
| 6010 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6011 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6012 | if(old) |
| 6013 | memcpy (beacon->head,old->head,beacon->head_len); |
| 6014 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6015 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6016 | if(params->tail) { |
| 6017 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 6018 | } |
| 6019 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6020 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6021 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 6022 | } |
| 6023 | |
| 6024 | *ppBeacon = beacon; |
| 6025 | |
| 6026 | kfree(old); |
| 6027 | |
| 6028 | return 0; |
| 6029 | |
| 6030 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6031 | |
| 6032 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr(v_U8_t *pIes, int length, v_U8_t eid) |
| 6033 | { |
| 6034 | int left = length; |
| 6035 | v_U8_t *ptr = pIes; |
| 6036 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6037 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6038 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6039 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6040 | elem_id = ptr[0]; |
| 6041 | elem_len = ptr[1]; |
| 6042 | left -= 2; |
| 6043 | if(elem_len > left) |
| 6044 | { |
| 6045 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 6046 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6047 | eid,elem_len,left); |
| 6048 | return NULL; |
| 6049 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6050 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6051 | { |
| 6052 | return ptr; |
| 6053 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6054 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6055 | left -= elem_len; |
| 6056 | ptr += (elem_len + 2); |
| 6057 | } |
| 6058 | return NULL; |
| 6059 | } |
| 6060 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6061 | /* Check if rate is 11g rate or not */ |
| 6062 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 6063 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 6064 | 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] | 6065 | u8 i; |
| 6066 | for (i = 0; i < 8; i++) |
| 6067 | { |
| 6068 | if(rate == gRateArray[i]) |
| 6069 | return TRUE; |
| 6070 | } |
| 6071 | return FALSE; |
| 6072 | } |
| 6073 | |
| 6074 | /* Check for 11g rate and set proper 11g only mode */ |
| 6075 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 6076 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 6077 | { |
| 6078 | u8 i, num_rates = pIe[0]; |
| 6079 | |
| 6080 | pIe += 1; |
| 6081 | for ( i = 0; i < num_rates; i++) |
| 6082 | { |
| 6083 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 6084 | { |
| 6085 | /* If rate set have 11g rate than change the mode to 11G */ |
| 6086 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 6087 | if (pIe[i] & BASIC_RATE_MASK) |
| 6088 | { |
| 6089 | /* If we have 11g rate as basic rate, it means mode |
| 6090 | is 11g only mode. |
| 6091 | */ |
| 6092 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 6093 | *pCheckRatesfor11g = FALSE; |
| 6094 | } |
| 6095 | } |
| 6096 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 6097 | { |
| 6098 | *require_ht = TRUE; |
| 6099 | } |
| 6100 | } |
| 6101 | return; |
| 6102 | } |
| 6103 | |
| 6104 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 6105 | { |
| 6106 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 6107 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6108 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 6109 | u8 checkRatesfor11g = TRUE; |
| 6110 | u8 require_ht = FALSE; |
| 6111 | u8 *pIe=NULL; |
| 6112 | |
| 6113 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 6114 | |
| 6115 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 6116 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 6117 | if (pIe != NULL) |
| 6118 | { |
| 6119 | pIe += 1; |
| 6120 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 6121 | &pConfig->SapHw_mode); |
| 6122 | } |
| 6123 | |
| 6124 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 6125 | WLAN_EID_EXT_SUPP_RATES); |
| 6126 | if (pIe != NULL) |
| 6127 | { |
| 6128 | |
| 6129 | pIe += 1; |
| 6130 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 6131 | &pConfig->SapHw_mode); |
| 6132 | } |
| 6133 | |
| 6134 | if( pConfig->channel > 14 ) |
| 6135 | { |
| 6136 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 6137 | } |
| 6138 | |
| 6139 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 6140 | WLAN_EID_HT_CAPABILITY); |
| 6141 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6142 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6143 | { |
| 6144 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 6145 | if(require_ht) |
| 6146 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 6147 | } |
| 6148 | } |
| 6149 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6150 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 6151 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 6152 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6153 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6154 | v_U8_t *pIe = NULL; |
| 6155 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6156 | |
| 6157 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 6158 | pBeacon->tail, pBeacon->tail_len); |
| 6159 | |
| 6160 | if (pIe) |
| 6161 | { |
| 6162 | ielen = pIe[1] + 2; |
| 6163 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 6164 | { |
| 6165 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 6166 | } |
| 6167 | else |
| 6168 | { |
| 6169 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 6170 | return -EINVAL; |
| 6171 | } |
| 6172 | *total_ielen += ielen; |
| 6173 | } |
| 6174 | return 0; |
| 6175 | } |
| 6176 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6177 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 6178 | v_U8_t *genie, v_U8_t *total_ielen) |
| 6179 | { |
| 6180 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6181 | int left = pBeacon->tail_len; |
| 6182 | v_U8_t *ptr = pBeacon->tail; |
| 6183 | v_U8_t elem_id, elem_len; |
| 6184 | v_U16_t ielen = 0; |
| 6185 | |
| 6186 | if ( NULL == ptr || 0 == left ) |
| 6187 | return; |
| 6188 | |
| 6189 | while (left >= 2) |
| 6190 | { |
| 6191 | elem_id = ptr[0]; |
| 6192 | elem_len = ptr[1]; |
| 6193 | left -= 2; |
| 6194 | if (elem_len > left) |
| 6195 | { |
| 6196 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 6197 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 6198 | elem_id, elem_len, left); |
| 6199 | return; |
| 6200 | } |
| 6201 | if (IE_EID_VENDOR == elem_id) |
| 6202 | { |
| 6203 | /* skipping the VSIE's which we don't want to include or |
| 6204 | * it will be included by existing code |
| 6205 | */ |
| 6206 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 6207 | #ifdef WLAN_FEATURE_WFD |
| 6208 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 6209 | #endif |
| 6210 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6211 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6212 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 6213 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 6214 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 6215 | { |
| 6216 | ielen = ptr[1] + 2; |
| 6217 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 6218 | { |
| 6219 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 6220 | *total_ielen += ielen; |
| 6221 | } |
| 6222 | else |
| 6223 | { |
| 6224 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 6225 | "IE Length is too big " |
| 6226 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 6227 | elem_id, elem_len, *total_ielen); |
| 6228 | } |
| 6229 | } |
| 6230 | } |
| 6231 | |
| 6232 | left -= elem_len; |
| 6233 | ptr += (elem_len + 2); |
| 6234 | } |
| 6235 | return; |
| 6236 | } |
| 6237 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6238 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6239 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 6240 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6241 | #else |
| 6242 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 6243 | struct cfg80211_beacon_data *params) |
| 6244 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6245 | { |
| 6246 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6247 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6248 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6249 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6250 | |
| 6251 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 6252 | |
| 6253 | if(genie == NULL) { |
| 6254 | |
| 6255 | return -ENOMEM; |
| 6256 | } |
| 6257 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6258 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6259 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6260 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6261 | hddLog(LOGE, |
| 6262 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6263 | ret = -EINVAL; |
| 6264 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6265 | } |
| 6266 | |
| 6267 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6268 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6269 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 6270 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6271 | hddLog(LOGE, |
| 6272 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6273 | ret = -EINVAL; |
| 6274 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6275 | } |
| 6276 | #endif |
| 6277 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6278 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 6279 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6280 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 6281 | hddLog(LOGE, |
| 6282 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6283 | ret = -EINVAL; |
| 6284 | goto done; |
| 6285 | } |
| 6286 | |
| 6287 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 6288 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 6289 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6290 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6291 | |
| 6292 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6293 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 6294 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 6295 | { |
| 6296 | hddLog(LOGE, |
| 6297 | "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] | 6298 | ret = -EINVAL; |
| 6299 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6300 | } |
| 6301 | |
| 6302 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6303 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 6304 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6305 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6306 | ==eHAL_STATUS_FAILURE) |
| 6307 | { |
| 6308 | hddLog(LOGE, |
| 6309 | "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] | 6310 | ret = -EINVAL; |
| 6311 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6312 | } |
| 6313 | |
| 6314 | // Added for ProResp IE |
| 6315 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 6316 | { |
| 6317 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 6318 | u8 probe_rsp_ie_len[3] = {0}; |
| 6319 | u8 counter = 0; |
| 6320 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 6321 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 6322 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 6323 | Store More then 255 bytes into One Variable. |
| 6324 | */ |
| 6325 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 6326 | { |
| 6327 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 6328 | { |
| 6329 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 6330 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 6331 | } |
| 6332 | else |
| 6333 | { |
| 6334 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 6335 | rem_probe_resp_ie_len = 0; |
| 6336 | } |
| 6337 | } |
| 6338 | |
| 6339 | rem_probe_resp_ie_len = 0; |
| 6340 | |
| 6341 | if (probe_rsp_ie_len[0] > 0) |
| 6342 | { |
| 6343 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6344 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 6345 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6346 | probe_rsp_ie_len[0], NULL, |
| 6347 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6348 | { |
| 6349 | hddLog(LOGE, |
| 6350 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6351 | ret = -EINVAL; |
| 6352 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6353 | } |
| 6354 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 6355 | } |
| 6356 | |
| 6357 | if (probe_rsp_ie_len[1] > 0) |
| 6358 | { |
| 6359 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6360 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 6361 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6362 | probe_rsp_ie_len[1], NULL, |
| 6363 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6364 | { |
| 6365 | hddLog(LOGE, |
| 6366 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6367 | ret = -EINVAL; |
| 6368 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6369 | } |
| 6370 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 6371 | } |
| 6372 | |
| 6373 | if (probe_rsp_ie_len[2] > 0) |
| 6374 | { |
| 6375 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6376 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 6377 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 6378 | probe_rsp_ie_len[2], NULL, |
| 6379 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6380 | { |
| 6381 | hddLog(LOGE, |
| 6382 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6383 | ret = -EINVAL; |
| 6384 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6385 | } |
| 6386 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 6387 | } |
| 6388 | |
| 6389 | if (probe_rsp_ie_len[1] == 0 ) |
| 6390 | { |
| 6391 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6392 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 6393 | eANI_BOOLEAN_FALSE) ) |
| 6394 | { |
| 6395 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6396 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6397 | } |
| 6398 | } |
| 6399 | |
| 6400 | if (probe_rsp_ie_len[2] == 0 ) |
| 6401 | { |
| 6402 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6403 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 6404 | eANI_BOOLEAN_FALSE) ) |
| 6405 | { |
| 6406 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6407 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6408 | } |
| 6409 | } |
| 6410 | |
| 6411 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6412 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 6413 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6414 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6415 | == eHAL_STATUS_FAILURE) |
| 6416 | { |
| 6417 | hddLog(LOGE, |
| 6418 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6419 | ret = -EINVAL; |
| 6420 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6421 | } |
| 6422 | } |
| 6423 | else |
| 6424 | { |
| 6425 | // Reset WNI_CFG_PROBE_RSP Flags |
| 6426 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 6427 | |
| 6428 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6429 | "%s: No Probe Response IE received in set beacon", |
| 6430 | __func__); |
| 6431 | } |
| 6432 | |
| 6433 | // Added for AssocResp IE |
| 6434 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 6435 | { |
| 6436 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6437 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 6438 | params->assocresp_ies_len, NULL, |
| 6439 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 6440 | { |
| 6441 | hddLog(LOGE, |
| 6442 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6443 | ret = -EINVAL; |
| 6444 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6445 | } |
| 6446 | |
| 6447 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6448 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 6449 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 6450 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 6451 | == eHAL_STATUS_FAILURE) |
| 6452 | { |
| 6453 | hddLog(LOGE, |
| 6454 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6455 | ret = -EINVAL; |
| 6456 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6457 | } |
| 6458 | } |
| 6459 | else |
| 6460 | { |
| 6461 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6462 | "%s: No Assoc Response IE received in set beacon", |
| 6463 | __func__); |
| 6464 | |
| 6465 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 6466 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 6467 | eANI_BOOLEAN_FALSE) ) |
| 6468 | { |
| 6469 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6470 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6471 | } |
| 6472 | } |
| 6473 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6474 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6475 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 6476 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6477 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6478 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6479 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6480 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 6481 | * called by wlan_hdd_cfg80211_start_bss() and |
| 6482 | * wlan_hdd_cfg80211_set_channel() |
| 6483 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6484 | * channel list. |
| 6485 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 6486 | 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] | 6487 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6488 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6489 | v_U32_t num_ch = 0; |
| 6490 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 6491 | u32 indx = 0; |
| 6492 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6493 | v_U8_t fValidChannel = FALSE, count = 0; |
| 6494 | 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] | 6495 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6496 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6497 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6498 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6499 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6500 | /* Validate the channel */ |
| 6501 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6502 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6503 | if ( channel == rfChannels[count].channelNum ) |
| 6504 | { |
| 6505 | fValidChannel = TRUE; |
| 6506 | break; |
| 6507 | } |
| 6508 | } |
| 6509 | if (fValidChannel != TRUE) |
| 6510 | { |
| 6511 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6512 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6513 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6514 | } |
| 6515 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6516 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6517 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 6518 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 6519 | valid_ch, &num_ch)) |
| 6520 | { |
| 6521 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6522 | "%s: failed to get valid channel list", __func__); |
| 6523 | return VOS_STATUS_E_FAILURE; |
| 6524 | } |
| 6525 | for (indx = 0; indx < num_ch; indx++) |
| 6526 | { |
| 6527 | if (channel == valid_ch[indx]) |
| 6528 | { |
| 6529 | break; |
| 6530 | } |
| 6531 | } |
| 6532 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6533 | if (indx >= num_ch) |
| 6534 | { |
| 6535 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6536 | { |
| 6537 | eCsrBand band; |
| 6538 | unsigned int freq; |
| 6539 | |
| 6540 | sme_GetFreqBand(hHal, &band); |
| 6541 | |
| 6542 | if (eCSR_BAND_5G == band) |
| 6543 | { |
| 6544 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 6545 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 6546 | { |
| 6547 | freq = ieee80211_channel_to_frequency(channel, |
| 6548 | IEEE80211_BAND_2GHZ); |
| 6549 | } |
| 6550 | else |
| 6551 | { |
| 6552 | freq = ieee80211_channel_to_frequency(channel, |
| 6553 | IEEE80211_BAND_5GHZ); |
| 6554 | } |
| 6555 | #else |
| 6556 | freq = ieee80211_channel_to_frequency(channel); |
| 6557 | #endif |
| 6558 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 6559 | return VOS_STATUS_SUCCESS; |
| 6560 | } |
| 6561 | } |
| 6562 | |
| 6563 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6564 | "%s: Invalid Channel [%d]", __func__, channel); |
| 6565 | return VOS_STATUS_E_FAILURE; |
| 6566 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6567 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 6568 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6569 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6570 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6571 | } |
| 6572 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6573 | /** |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6574 | * FUNCTION: __wlan_hdd_cfg80211_set_channel |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6575 | * This function is used to set the channel number |
| 6576 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6577 | 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] | 6578 | struct ieee80211_channel *chan, |
| 6579 | enum nl80211_channel_type channel_type |
| 6580 | ) |
| 6581 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6582 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6583 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6584 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6585 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6586 | hdd_context_t *pHddCtx; |
| 6587 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6588 | |
| 6589 | ENTER(); |
| 6590 | |
| 6591 | if( NULL == dev ) |
| 6592 | { |
| 6593 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6594 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6595 | return -ENODEV; |
| 6596 | } |
| 6597 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 6598 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 6599 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 6600 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 6601 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6602 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6603 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 6604 | hdd_device_modetoString(pAdapter->device_mode), |
| 6605 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6606 | |
| 6607 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6608 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6609 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6610 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6611 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6612 | } |
| 6613 | |
| 6614 | /* |
| 6615 | * Do freq to chan conversion |
| 6616 | * TODO: for 11a |
| 6617 | */ |
| 6618 | |
| 6619 | channel = ieee80211_frequency_to_channel(freq); |
| 6620 | |
| 6621 | /* Check freq range */ |
| 6622 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 6623 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 6624 | { |
| 6625 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6626 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6627 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 6628 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 6629 | return -EINVAL; |
| 6630 | } |
| 6631 | |
| 6632 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 6633 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 6634 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 6635 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6636 | { |
| 6637 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6638 | { |
| 6639 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6640 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6641 | return -EINVAL; |
| 6642 | } |
| 6643 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 6644 | "%s: set channel to [%d] for device mode =%d", |
| 6645 | __func__, channel,pAdapter->device_mode); |
| 6646 | } |
| 6647 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6648 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6649 | ) |
| 6650 | { |
| 6651 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6652 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 6653 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6654 | |
| 6655 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 6656 | { |
| 6657 | /* Link is up then return cant set channel*/ |
| 6658 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6659 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6660 | return -EINVAL; |
| 6661 | } |
| 6662 | |
| 6663 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 6664 | pHddStaCtx->conn_info.operationChannel = channel; |
| 6665 | pRoamProfile->ChannelInfo.ChannelList = |
| 6666 | &pHddStaCtx->conn_info.operationChannel; |
| 6667 | } |
| 6668 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6669 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6670 | ) |
| 6671 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6672 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 6673 | { |
| 6674 | if(VOS_STATUS_SUCCESS != |
| 6675 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6676 | { |
| 6677 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6678 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6679 | return -EINVAL; |
| 6680 | } |
| 6681 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 6682 | } |
| 6683 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6684 | { |
| 6685 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 6686 | |
| 6687 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 6688 | channel set by supplicant |
| 6689 | */ |
| 6690 | if ( cfg_param->apAutoChannelSelection ) |
| 6691 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6692 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 6693 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6694 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 6695 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 6696 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 6697 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6698 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6699 | else |
| 6700 | { |
| 6701 | if(VOS_STATUS_SUCCESS != |
| 6702 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 6703 | { |
| 6704 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6705 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 6706 | return -EINVAL; |
| 6707 | } |
| 6708 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 6709 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6710 | } |
| 6711 | } |
| 6712 | else |
| 6713 | { |
| 6714 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 6715 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 6716 | return -EINVAL; |
| 6717 | } |
| 6718 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 6719 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 6720 | } |
| 6721 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 6722 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, |
| 6723 | struct net_device *dev, |
| 6724 | struct ieee80211_channel *chan, |
| 6725 | enum nl80211_channel_type channel_type |
| 6726 | ) |
| 6727 | { |
| 6728 | int ret; |
| 6729 | |
| 6730 | vos_ssr_protect(__func__); |
| 6731 | ret = __wlan_hdd_cfg80211_set_channel(wiphy, dev, chan, channel_type); |
| 6732 | vos_ssr_unprotect(__func__); |
| 6733 | |
| 6734 | return ret; |
| 6735 | } |
| 6736 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6737 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 6738 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 6739 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6740 | #else |
| 6741 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 6742 | struct cfg80211_beacon_data *params, |
| 6743 | const u8 *ssid, size_t ssid_len, |
| 6744 | enum nl80211_hidden_ssid hidden_ssid) |
| 6745 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6746 | { |
| 6747 | tsap_Config_t *pConfig; |
| 6748 | beacon_data_t *pBeacon = NULL; |
| 6749 | struct ieee80211_mgmt *pMgmt_frame; |
| 6750 | v_U8_t *pIe=NULL; |
| 6751 | v_U16_t capab_info; |
| 6752 | eCsrAuthType RSNAuthType; |
| 6753 | eCsrEncryptionType RSNEncryptType; |
| 6754 | eCsrEncryptionType mcRSNEncryptType; |
| 6755 | int status = VOS_STATUS_SUCCESS; |
| 6756 | tpWLAN_SAPEventCB pSapEventCallback; |
| 6757 | hdd_hostapd_state_t *pHostapdState; |
| 6758 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 6759 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6760 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6761 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6762 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6763 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 6764 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6765 | tSmeConfigParams *psmeConfig; |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 6766 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 6767 | v_BOOL_t MFPRequired = VOS_FALSE; |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 6768 | v_BOOL_t sapEnable11AC = |
| 6769 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapEnable11AC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6770 | ENTER(); |
| 6771 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 6772 | iniConfig = pHddCtx->cfg_ini; |
| 6773 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6774 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 6775 | |
| 6776 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 6777 | |
| 6778 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 6779 | |
| 6780 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 6781 | |
| 6782 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 6783 | |
| 6784 | //channel is already set in the set_channel Call back |
| 6785 | //pConfig->channel = pCommitConfig->channel; |
| 6786 | |
| 6787 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6788 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6789 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 6790 | |
| 6791 | pConfig->dtim_period = pBeacon->dtim_period; |
| 6792 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6793 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6794 | pConfig->dtim_period); |
| 6795 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 6796 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6797 | { |
| 6798 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6799 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 6800 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 6801 | { |
| 6802 | tANI_BOOLEAN restartNeeded; |
| 6803 | pConfig->ieee80211d = 1; |
| 6804 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 6805 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 6806 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 6807 | } |
| 6808 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6809 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6810 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6811 | pConfig->ieee80211d = 1; |
| 6812 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 6813 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 6814 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6815 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6816 | else |
| 6817 | { |
| 6818 | pConfig->ieee80211d = 0; |
| 6819 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6820 | /* |
| 6821 | * If auto channel is configured i.e. channel is 0, |
| 6822 | * so skip channel validation. |
| 6823 | */ |
| 6824 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 6825 | { |
| 6826 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 6827 | { |
| 6828 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6829 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 6830 | return -EINVAL; |
| 6831 | } |
| 6832 | } |
| 6833 | else |
| 6834 | { |
| 6835 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 6836 | { |
| 6837 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 6838 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 6839 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 6840 | } |
| 6841 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 6842 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6843 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6844 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6845 | { |
| 6846 | pConfig->ieee80211d = 0; |
| 6847 | } |
| 6848 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 6849 | |
| 6850 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6851 | |
| 6852 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6853 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 6854 | |
| 6855 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 6856 | |
| 6857 | /*Set wps station to configured*/ |
| 6858 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 6859 | |
| 6860 | if(pIe) |
| 6861 | { |
| 6862 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 6863 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6864 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6865 | return -EINVAL; |
| 6866 | } |
| 6867 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 6868 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 6869 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6870 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 6871 | * WPS state |
| 6872 | */ |
| 6873 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 6874 | { |
| 6875 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 6876 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 6877 | { |
| 6878 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 6879 | } |
| 6880 | } |
| 6881 | } |
| 6882 | else |
| 6883 | { |
| 6884 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 6885 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6886 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6887 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 6888 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 6889 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 6890 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 6891 | eCSR_ENCRYPT_TYPE_NONE; |
| 6892 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6893 | pConfig->RSNWPAReqIELength = 0; |
| 6894 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6895 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6896 | WLAN_EID_RSN); |
| 6897 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6898 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6899 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 6900 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 6901 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6902 | /* The actual processing may eventually be more extensive than |
| 6903 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6904 | * by the app. |
| 6905 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6906 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6907 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 6908 | &RSNEncryptType, |
| 6909 | &mcRSNEncryptType, |
| 6910 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6911 | &MFPCapable, |
| 6912 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6913 | pConfig->pRSNWPAReqIE[1]+2, |
| 6914 | pConfig->pRSNWPAReqIE ); |
| 6915 | |
| 6916 | if( VOS_STATUS_SUCCESS == status ) |
| 6917 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6918 | /* Now copy over all the security attributes you have |
| 6919 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6920 | * */ |
| 6921 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 6922 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 6923 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 6924 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 6925 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6926 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6927 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 6928 | } |
| 6929 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6930 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6931 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 6932 | pBeacon->tail, pBeacon->tail_len); |
| 6933 | |
| 6934 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 6935 | { |
| 6936 | if (pConfig->pRSNWPAReqIE) |
| 6937 | { |
| 6938 | /*Mixed mode WPA/WPA2*/ |
| 6939 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 6940 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 6941 | } |
| 6942 | else |
| 6943 | { |
| 6944 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 6945 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 6946 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6947 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6948 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 6949 | &RSNEncryptType, |
| 6950 | &mcRSNEncryptType, |
| 6951 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 6952 | &MFPCapable, |
| 6953 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6954 | pConfig->pRSNWPAReqIE[1]+2, |
| 6955 | pConfig->pRSNWPAReqIE ); |
| 6956 | |
| 6957 | if( VOS_STATUS_SUCCESS == status ) |
| 6958 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6959 | /* Now copy over all the security attributes you have |
| 6960 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6961 | * */ |
| 6962 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 6963 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 6964 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 6965 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 6966 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6967 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6968 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 6969 | } |
| 6970 | } |
| 6971 | } |
| 6972 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 6973 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 6974 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 6975 | return -EINVAL; |
| 6976 | } |
| 6977 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6978 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 6979 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6980 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6981 | if (params->ssid != NULL) |
| 6982 | { |
| 6983 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 6984 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 6985 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 6986 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 6987 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6988 | #else |
| 6989 | if (ssid != NULL) |
| 6990 | { |
| 6991 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 6992 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 6993 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 6994 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 6995 | } |
| 6996 | #endif |
| 6997 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 6998 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6999 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7000 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7001 | /* default value */ |
| 7002 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 7003 | pConfig->num_accept_mac = 0; |
| 7004 | pConfig->num_deny_mac = 0; |
| 7005 | |
| 7006 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7007 | pBeacon->tail, pBeacon->tail_len); |
| 7008 | |
| 7009 | /* pIe for black list is following form: |
| 7010 | type : 1 byte |
| 7011 | length : 1 byte |
| 7012 | OUI : 4 bytes |
| 7013 | acl type : 1 byte |
| 7014 | no of mac addr in black list: 1 byte |
| 7015 | 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] | 7016 | */ |
| 7017 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7018 | { |
| 7019 | pConfig->SapMacaddr_acl = pIe[6]; |
| 7020 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7021 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7022 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7023 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 7024 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7025 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 7026 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 7027 | { |
| 7028 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 7029 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7030 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7031 | } |
| 7032 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 7033 | pBeacon->tail, pBeacon->tail_len); |
| 7034 | |
| 7035 | /* pIe for white list is following form: |
| 7036 | type : 1 byte |
| 7037 | length : 1 byte |
| 7038 | OUI : 4 bytes |
| 7039 | acl type : 1 byte |
| 7040 | no of mac addr in white list: 1 byte |
| 7041 | 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] | 7042 | */ |
| 7043 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7044 | { |
| 7045 | pConfig->SapMacaddr_acl = pIe[6]; |
| 7046 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7047 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7048 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7049 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 7050 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7051 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 7052 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 7053 | { |
| 7054 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 7055 | acl_entry++; |
| 7056 | } |
| 7057 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7058 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7059 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 7060 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7061 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 7062 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 7063 | * This is valid only if mode is set to 11n in hostapd, sapEnable11AC |
| 7064 | * 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] | 7065 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 7066 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 7067 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 7068 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 7069 | (sapEnable11AC) && (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 7070 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7071 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7072 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7073 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7074 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7075 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 7076 | /* If ACS disable and selected channel <= 14 |
| 7077 | * OR |
| 7078 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 7079 | * AND |
| 7080 | * VHT in 2.4G Disabled |
| 7081 | * THEN |
| 7082 | * Fallback to 11N mode |
| 7083 | */ |
| 7084 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 7085 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 7086 | operatingBand == eSAP_RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 7087 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7088 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 7089 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 7090 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 7091 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 7092 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7093 | } |
| 7094 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7095 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7096 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 7097 | pConfig->ht_capab = |
| 7098 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 7099 | |
| 7100 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 7101 | { |
| 7102 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 7103 | return -EINVAL; |
| 7104 | } |
| 7105 | |
| 7106 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7107 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7108 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 7109 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7110 | pConfig->obssProtEnabled = |
| 7111 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7112 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 7113 | #ifdef WLAN_FEATURE_11W |
| 7114 | pConfig->mfpCapable = MFPCapable; |
| 7115 | pConfig->mfpRequired = MFPRequired; |
| 7116 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 7117 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 7118 | #endif |
| 7119 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7120 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7121 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7122 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 7123 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 7124 | (int)pConfig->channel); |
| 7125 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 7126 | pConfig->SapHw_mode, pConfig->privacy, |
| 7127 | pConfig->authType); |
| 7128 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 7129 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 7130 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 7131 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7132 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7133 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7134 | { |
| 7135 | //Bss already started. just return. |
| 7136 | //TODO Probably it should update some beacon params. |
| 7137 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 7138 | EXIT(); |
| 7139 | return 0; |
| 7140 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7141 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7142 | if (vos_max_concurrent_connections_reached()) { |
| 7143 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7144 | return -EINVAL; |
| 7145 | } |
| 7146 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7147 | pConfig->persona = pHostapdAdapter->device_mode; |
| 7148 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7149 | psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams)); |
| 7150 | if ( NULL != psmeConfig) |
| 7151 | { |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 7152 | vos_mem_zero(psmeConfig, sizeof (tSmeConfigParams)); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7153 | sme_GetConfigParam(hHal, psmeConfig); |
| 7154 | pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference; |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 7155 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 7156 | if (((pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 7157 | || (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 7158 | && pHddCtx->cfg_ini->apHT40_24GEnabled) |
| 7159 | { |
| 7160 | psmeConfig->csrConfig.apHT40_24GEnabled = 1; |
| 7161 | sme_UpdateConfig (hHal, psmeConfig); |
| 7162 | } |
| 7163 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7164 | vos_mem_free(psmeConfig); |
| 7165 | } |
Peng Xu | afc34e3 | 2014-09-25 13:23:55 +0530 | [diff] [blame] | 7166 | pConfig->acsBandSwitchThreshold = iniConfig->acsBandSwitchThreshold; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 7167 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7168 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 7169 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 7170 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 7171 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7172 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7173 | return -EINVAL; |
| 7174 | } |
| 7175 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7176 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7177 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 7178 | |
| 7179 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7180 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7181 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7182 | { |
| 7183 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7184 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 7185 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7186 | VOS_ASSERT(0); |
| 7187 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7188 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7189 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Kaushik, Sushant | f607080 | 2014-10-15 15:09:23 +0530 | [diff] [blame] | 7190 | /* Initialize WMM configuation */ |
| 7191 | hdd_wmm_init(pHostapdAdapter); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7192 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7193 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7194 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7195 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 7196 | { |
| 7197 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 7198 | { |
| 7199 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 7200 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 7201 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7202 | } |
| 7203 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 7204 | { |
| 7205 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 7206 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 7207 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7208 | } |
| 7209 | } |
| 7210 | #endif |
| 7211 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7212 | pHostapdState->bCommit = TRUE; |
| 7213 | EXIT(); |
| 7214 | |
| 7215 | return 0; |
| 7216 | } |
| 7217 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7218 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7219 | static int __wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7220 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7221 | struct beacon_parameters *params) |
| 7222 | { |
| 7223 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7224 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7225 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7226 | |
| 7227 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7228 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7229 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7230 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 7231 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7232 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 7233 | hdd_device_modetoString(pAdapter->device_mode), |
| 7234 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7235 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7236 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7237 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7238 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7239 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7240 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7241 | } |
| 7242 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7243 | if (vos_max_concurrent_connections_reached()) { |
| 7244 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7245 | return -EINVAL; |
| 7246 | } |
| 7247 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7248 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7249 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7250 | ) |
| 7251 | { |
| 7252 | beacon_data_t *old,*new; |
| 7253 | |
| 7254 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7255 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7256 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7257 | { |
| 7258 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 7259 | FL("already beacon info added to session(%d)"), |
| 7260 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7261 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7262 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7263 | |
| 7264 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 7265 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7266 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7267 | { |
| 7268 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7269 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7270 | return -EINVAL; |
| 7271 | } |
| 7272 | |
| 7273 | pAdapter->sessionCtx.ap.beacon = new; |
| 7274 | |
| 7275 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 7276 | } |
| 7277 | |
| 7278 | EXIT(); |
| 7279 | return status; |
| 7280 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7281 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7282 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 7283 | struct net_device *dev, |
| 7284 | struct beacon_parameters *params) |
| 7285 | { |
| 7286 | int ret; |
| 7287 | |
| 7288 | vos_ssr_protect(__func__); |
| 7289 | ret = __wlan_hdd_cfg80211_add_beacon(wiphy, dev, params); |
| 7290 | vos_ssr_unprotect(__func__); |
| 7291 | |
| 7292 | return ret; |
| 7293 | } |
| 7294 | |
| 7295 | static int __wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7296 | struct net_device *dev, |
| 7297 | struct beacon_parameters *params) |
| 7298 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7299 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7300 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7301 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7302 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7303 | |
| 7304 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 7305 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7306 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7307 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 7308 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 7309 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7310 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7311 | pAdapter->device_mode); |
| 7312 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7313 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7314 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7315 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7316 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7317 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7318 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7319 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7320 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7321 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7322 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7323 | { |
| 7324 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7325 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7326 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7328 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7329 | { |
| 7330 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7331 | FL("session(%d) old and new heads points to NULL"), |
| 7332 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7333 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7334 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7335 | |
| 7336 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 7337 | |
| 7338 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7339 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7340 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7341 | return -EINVAL; |
| 7342 | } |
| 7343 | |
| 7344 | pAdapter->sessionCtx.ap.beacon = new; |
| 7345 | |
| 7346 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 7347 | } |
| 7348 | |
| 7349 | EXIT(); |
| 7350 | return status; |
| 7351 | } |
| 7352 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7353 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
| 7354 | struct net_device *dev, |
| 7355 | struct beacon_parameters *params) |
| 7356 | { |
| 7357 | int ret; |
| 7358 | |
| 7359 | vos_ssr_protect(__func__); |
| 7360 | ret = __wlan_hdd_cfg80211_set_beacon(wiphy, dev, params); |
| 7361 | vos_ssr_unprotect(__func__); |
| 7362 | |
| 7363 | return ret; |
| 7364 | } |
| 7365 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7366 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7367 | |
| 7368 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7369 | static int __wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7370 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7371 | #else |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7372 | static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7373 | struct net_device *dev) |
| 7374 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7375 | { |
| 7376 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7377 | hdd_context_t *pHddCtx = NULL; |
| 7378 | hdd_scaninfo_t *pScanInfo = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7379 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7380 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7381 | |
| 7382 | ENTER(); |
| 7383 | |
| 7384 | if (NULL == pAdapter) |
| 7385 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7386 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7387 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7388 | return -ENODEV; |
| 7389 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7390 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7391 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7392 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 7393 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7394 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7395 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7396 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7397 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7398 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7399 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7400 | |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7401 | pScanInfo = &pHddCtx->scan_info; |
| 7402 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7403 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7404 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7405 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7406 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7407 | ret = wlan_hdd_scan_abort(pAdapter); |
| 7408 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 7409 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7410 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7411 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7412 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7413 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7414 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7415 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7416 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7417 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 7418 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7419 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7420 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7421 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 7422 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7423 | } |
| 7424 | |
Rashmi Ramanna | 1f0948d | 2014-08-28 15:33:48 +0530 | [diff] [blame] | 7425 | /* Delete all associated STAs before stopping AP/P2P GO */ |
| 7426 | hdd_del_all_sta(pAdapter); |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 7427 | hdd_hostapd_stop(dev); |
| 7428 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7429 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7430 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7431 | ) |
| 7432 | { |
| 7433 | beacon_data_t *old; |
| 7434 | |
| 7435 | old = pAdapter->sessionCtx.ap.beacon; |
| 7436 | |
| 7437 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7438 | { |
| 7439 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7440 | FL("session(%d) beacon data points to NULL"), |
| 7441 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7442 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7443 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7444 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7445 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7446 | |
| 7447 | mutex_lock(&pHddCtx->sap_lock); |
| 7448 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 7449 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7450 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7451 | { |
| 7452 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 7453 | |
| 7454 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 7455 | |
| 7456 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 7457 | { |
| 7458 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7459 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7460 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7461 | } |
| 7462 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7463 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7464 | /* BSS stopped, clear the active sessions for this device mode */ |
| 7465 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7466 | } |
| 7467 | mutex_unlock(&pHddCtx->sap_lock); |
| 7468 | |
| 7469 | if(status != VOS_STATUS_SUCCESS) |
| 7470 | { |
| 7471 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7472 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7473 | return -EINVAL; |
| 7474 | } |
| 7475 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7476 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7477 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 7478 | ==eHAL_STATUS_FAILURE) |
| 7479 | { |
| 7480 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7481 | "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] | 7482 | } |
| 7483 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 7484 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7485 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 7486 | eANI_BOOLEAN_FALSE) ) |
| 7487 | { |
| 7488 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7489 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7490 | } |
| 7491 | |
| 7492 | // Reset WNI_CFG_PROBE_RSP Flags |
| 7493 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 7494 | |
| 7495 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 7496 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 7497 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 7498 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 7499 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 7500 | { |
| 7501 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 7502 | "GO got removed"); |
| 7503 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 7504 | } |
| 7505 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7506 | } |
| 7507 | EXIT(); |
| 7508 | return status; |
| 7509 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7510 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7511 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7512 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 7513 | struct net_device *dev) |
| 7514 | { |
| 7515 | int ret; |
| 7516 | |
| 7517 | vos_ssr_protect(__func__); |
| 7518 | ret = __wlan_hdd_cfg80211_del_beacon(wiphy, dev); |
| 7519 | vos_ssr_unprotect(__func__); |
| 7520 | |
| 7521 | return ret; |
| 7522 | } |
| 7523 | #else |
| 7524 | static int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, |
| 7525 | struct net_device *dev) |
| 7526 | { |
| 7527 | int ret; |
| 7528 | |
| 7529 | vos_ssr_protect(__func__); |
| 7530 | ret = __wlan_hdd_cfg80211_stop_ap(wiphy, dev); |
| 7531 | vos_ssr_unprotect(__func__); |
| 7532 | |
| 7533 | return ret; |
| 7534 | } |
| 7535 | #endif |
| 7536 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7537 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 7538 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7539 | static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7540 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7541 | struct cfg80211_ap_settings *params) |
| 7542 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7543 | hdd_adapter_t *pAdapter; |
| 7544 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7545 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7546 | |
| 7547 | ENTER(); |
| 7548 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7549 | if (NULL == dev || NULL == params) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7550 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7551 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7552 | "%s: Device or params is Null", __func__); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7553 | return -ENODEV; |
| 7554 | } |
| 7555 | |
| 7556 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7557 | if (NULL == pAdapter) |
| 7558 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7559 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7560 | "%s: HDD adapter is Null", __func__); |
| 7561 | return -ENODEV; |
| 7562 | } |
| 7563 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7564 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7565 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 7566 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7567 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 7568 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7569 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7570 | "%s: HDD adapter magic is invalid", __func__); |
| 7571 | return -ENODEV; |
| 7572 | } |
| 7573 | |
| 7574 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7575 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7576 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7577 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7578 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7579 | } |
| 7580 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7581 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 7582 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7583 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7584 | |
| 7585 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7586 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7587 | ) |
| 7588 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7589 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7590 | |
| 7591 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7592 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7593 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7594 | { |
| 7595 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 7596 | FL("already beacon info added to session(%d)"), |
| 7597 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7598 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7599 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7600 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 7601 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 7602 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 7603 | &new, |
| 7604 | ¶ms->beacon); |
| 7605 | #else |
| 7606 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 7607 | &new, |
| 7608 | ¶ms->beacon, |
| 7609 | params->dtim_period); |
| 7610 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7611 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7612 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7613 | { |
| 7614 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 7615 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7616 | return -EINVAL; |
| 7617 | } |
| 7618 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7619 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 7620 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 7621 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 7622 | params->channel, params->channel_type); |
| 7623 | #else |
| 7624 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 7625 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 7626 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7627 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
| 7628 | params->ssid_len, params->hidden_ssid); |
| 7629 | } |
| 7630 | |
| 7631 | EXIT(); |
| 7632 | return status; |
| 7633 | } |
| 7634 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7635 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 7636 | struct net_device *dev, |
| 7637 | struct cfg80211_ap_settings *params) |
| 7638 | { |
| 7639 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7640 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7641 | vos_ssr_protect(__func__); |
| 7642 | ret = __wlan_hdd_cfg80211_start_ap(wiphy, dev, params); |
| 7643 | vos_ssr_unprotect(__func__); |
| 7644 | |
| 7645 | return ret; |
| 7646 | } |
| 7647 | |
| 7648 | static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7649 | struct net_device *dev, |
| 7650 | struct cfg80211_beacon_data *params) |
| 7651 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7652 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7653 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7654 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7655 | |
| 7656 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7657 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7658 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7659 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 7660 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7661 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7662 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7663 | |
| 7664 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7665 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7666 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7667 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7668 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 7669 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7670 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7671 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7672 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7673 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7674 | { |
| 7675 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7676 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7677 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7678 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7679 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7680 | { |
| 7681 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7682 | FL("session(%d) beacon data points to NULL"), |
| 7683 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7684 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7685 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7686 | |
| 7687 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 7688 | |
| 7689 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7690 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7691 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7692 | return -EINVAL; |
| 7693 | } |
| 7694 | |
| 7695 | pAdapter->sessionCtx.ap.beacon = new; |
| 7696 | |
| 7697 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0); |
| 7698 | } |
| 7699 | |
| 7700 | EXIT(); |
| 7701 | return status; |
| 7702 | } |
| 7703 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7704 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
| 7705 | struct net_device *dev, |
| 7706 | struct cfg80211_beacon_data *params) |
| 7707 | { |
| 7708 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7709 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 7710 | vos_ssr_protect(__func__); |
| 7711 | ret = __wlan_hdd_cfg80211_change_beacon(wiphy, dev, params); |
| 7712 | vos_ssr_unprotect(__func__); |
| 7713 | |
| 7714 | return ret; |
| 7715 | } |
| 7716 | |
| 7717 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7718 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 7719 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7720 | struct net_device *dev, |
| 7721 | struct bss_parameters *params) |
| 7722 | { |
| 7723 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7724 | hdd_context_t *pHddCtx; |
| 7725 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7726 | |
| 7727 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 7728 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7729 | if (NULL == pAdapter) |
| 7730 | { |
| 7731 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7732 | "%s: HDD adapter is Null", __func__); |
| 7733 | return -ENODEV; |
| 7734 | } |
| 7735 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7736 | ret = wlan_hdd_validate_context(pHddCtx); |
| 7737 | if (0 != ret) |
| 7738 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 7739 | return ret; |
| 7740 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7741 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7742 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 7743 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7744 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7745 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7746 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7747 | |
| 7748 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7749 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7750 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7751 | { |
| 7752 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 7753 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7754 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7755 | { |
| 7756 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7757 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7758 | } |
| 7759 | |
| 7760 | EXIT(); |
| 7761 | return 0; |
| 7762 | } |
| 7763 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 7764 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 7765 | struct net_device *dev, |
| 7766 | struct bss_parameters *params) |
| 7767 | { |
| 7768 | int ret; |
| 7769 | |
| 7770 | vos_ssr_protect(__func__); |
| 7771 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 7772 | vos_ssr_unprotect(__func__); |
| 7773 | |
| 7774 | return ret; |
| 7775 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7776 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 7777 | * to wait for contry code completion |
| 7778 | */ |
| 7779 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 7780 | { |
| 7781 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 7782 | complete(&call_back_pAdapter->change_country_code); |
| 7783 | return NULL; |
| 7784 | } |
| 7785 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7786 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7787 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7788 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 7789 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 7790 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7791 | struct net_device *ndev, |
| 7792 | enum nl80211_iftype type, |
| 7793 | u32 *flags, |
| 7794 | struct vif_params *params |
| 7795 | ) |
| 7796 | { |
| 7797 | struct wireless_dev *wdev; |
| 7798 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7799 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7800 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7801 | tCsrRoamProfile *pRoamProfile = NULL; |
| 7802 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7803 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7804 | eMib_dot11DesiredBssType connectedBssType; |
| 7805 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 7806 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7807 | |
| 7808 | ENTER(); |
| 7809 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7810 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7811 | { |
| 7812 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7813 | "%s: Adapter context is null", __func__); |
| 7814 | return VOS_STATUS_E_FAILURE; |
| 7815 | } |
| 7816 | |
| 7817 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7818 | if (!pHddCtx) |
| 7819 | { |
| 7820 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7821 | "%s: HDD context is null", __func__); |
| 7822 | return VOS_STATUS_E_FAILURE; |
| 7823 | } |
| 7824 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7825 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 7826 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 7827 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7828 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7829 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7830 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7831 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7832 | } |
| 7833 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 7834 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 7835 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 7836 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7837 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 7838 | if (vos_max_concurrent_connections_reached()) { |
| 7839 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 7840 | return -EINVAL; |
| 7841 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 7842 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7843 | wdev = ndev->ieee80211_ptr; |
| 7844 | |
| 7845 | #ifdef WLAN_BTAMP_FEATURE |
| 7846 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 7847 | (NL80211_IFTYPE_ADHOC == type)|| |
| 7848 | (NL80211_IFTYPE_AP == type)|| |
| 7849 | (NL80211_IFTYPE_P2P_GO == type)) |
| 7850 | { |
| 7851 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 7852 | // stop AMP traffic |
| 7853 | status = WLANBAP_StopAmp(); |
| 7854 | if(VOS_STATUS_SUCCESS != status ) |
| 7855 | { |
| 7856 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 7857 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 7858 | "%s: Failed to stop AMP", __func__); |
| 7859 | return -EINVAL; |
| 7860 | } |
| 7861 | } |
| 7862 | #endif //WLAN_BTAMP_FEATURE |
| 7863 | /* Reset the current device mode bit mask*/ |
| 7864 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 7865 | |
| 7866 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7867 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7868 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7869 | ) |
| 7870 | { |
| 7871 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 7872 | if (!pWextState) |
| 7873 | { |
| 7874 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7875 | "%s: pWextState is null", __func__); |
| 7876 | return VOS_STATUS_E_FAILURE; |
| 7877 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7878 | pRoamProfile = &pWextState->roamProfile; |
| 7879 | LastBSSType = pRoamProfile->BSSType; |
| 7880 | |
| 7881 | switch (type) |
| 7882 | { |
| 7883 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7884 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7885 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7886 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 7887 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7888 | #ifdef WLAN_FEATURE_11AC |
| 7889 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 7890 | { |
| 7891 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 7892 | } |
| 7893 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7894 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7895 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7896 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 7897 | //Check for sub-string p2p to confirm its a p2p interface |
| 7898 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7899 | { |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 7900 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 7901 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 7902 | } |
| 7903 | else |
| 7904 | { |
| 7905 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7906 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 7907 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7908 | break; |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 7909 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7910 | case NL80211_IFTYPE_ADHOC: |
| 7911 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7912 | "%s: setting interface Type to ADHOC", __func__); |
| 7913 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 7914 | pRoamProfile->phyMode = |
| 7915 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 7916 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7917 | wdev->iftype = type; |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 7918 | hdd_set_ibss_ops( pAdapter ); |
| 7919 | hdd_ibss_init_tx_rx( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7920 | break; |
| 7921 | |
| 7922 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7923 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7924 | { |
| 7925 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 7926 | "%s: setting interface Type to %s", __func__, |
| 7927 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 7928 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 7929 | //Cancel any remain on channel for GO mode |
| 7930 | if (NL80211_IFTYPE_P2P_GO == type) |
| 7931 | { |
| 7932 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 7933 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7934 | if (NL80211_IFTYPE_AP == type) |
| 7935 | { |
| 7936 | /* As Loading WLAN Driver one interface being created for p2p device |
| 7937 | * address. This will take one HW STA and the max number of clients |
| 7938 | * that can connect to softAP will be reduced by one. so while changing |
| 7939 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 7940 | * interface as it is not required in SoftAP mode. |
| 7941 | */ |
| 7942 | |
| 7943 | // Get P2P Adapter |
| 7944 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 7945 | |
| 7946 | if (pP2pAdapter) |
| 7947 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 7948 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 7949 | hdd_deinit_adapter(pHddCtx, pP2pAdapter, TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7950 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 7951 | } |
| 7952 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 7953 | //Disable IMPS & BMPS for SAP/GO |
| 7954 | if(VOS_STATUS_E_FAILURE == |
| 7955 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 7956 | { |
| 7957 | //Fail to Exit BMPS |
| 7958 | VOS_ASSERT(0); |
| 7959 | } |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 7960 | |
| 7961 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
| 7962 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7963 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 7964 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7965 | /* A Mutex Lock is introduced while changing the mode to |
| 7966 | * protect the concurrent access for the Adapters by TDLS |
| 7967 | * module. |
| 7968 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 7969 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7970 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7971 | //De-init the adapter. |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 7972 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7973 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7974 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 7975 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 7976 | #ifdef FEATURE_WLAN_TDLS |
| 7977 | mutex_unlock(&pHddCtx->tdls_lock); |
| 7978 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 7979 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 7980 | (pConfig->apRandomBssidEnabled)) |
| 7981 | { |
| 7982 | /* To meet Android requirements create a randomized |
| 7983 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 7984 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 7985 | ndev->dev_addr[0] = 0x02; |
| 7986 | ndev->dev_addr[1] = 0x1A; |
| 7987 | ndev->dev_addr[2] = 0x11; |
| 7988 | ndev->dev_addr[3] |= 0xF0; |
| 7989 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 7990 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7991 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 7992 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 7993 | } |
| 7994 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7995 | hdd_set_ap_ops( pAdapter->dev ); |
| 7996 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 7997 | /* This is for only SAP mode where users can |
| 7998 | * control country through ini. |
| 7999 | * P2P GO follows station country code |
| 8000 | * acquired during the STA scanning. */ |
| 8001 | if((NL80211_IFTYPE_AP == type) && |
| 8002 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 8003 | { |
| 8004 | int status = 0; |
| 8005 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 8006 | "%s: setting country code from INI ", __func__); |
| 8007 | init_completion(&pAdapter->change_country_code); |
| 8008 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 8009 | (void *)(tSmeChangeCountryCallback) |
| 8010 | wlan_hdd_change_country_code_cb, |
| 8011 | pConfig->apCntryCode, pAdapter, |
| 8012 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 8013 | eSIR_FALSE, |
| 8014 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8015 | if (eHAL_STATUS_SUCCESS == status) |
| 8016 | { |
| 8017 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8018 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8019 | &pAdapter->change_country_code, |
| 8020 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8021 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8022 | { |
| 8023 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8024 | FL("SME Timed out while setting country code %ld"), |
| 8025 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 8026 | |
| 8027 | if (pHddCtx->isLogpInProgress) |
| 8028 | { |
| 8029 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8030 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 8031 | return -EAGAIN; |
| 8032 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8033 | } |
| 8034 | } |
| 8035 | else |
| 8036 | { |
| 8037 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8038 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 8039 | return -EINVAL; |
| 8040 | } |
| 8041 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8042 | status = hdd_init_ap_mode(pAdapter); |
| 8043 | if(status != VOS_STATUS_SUCCESS) |
| 8044 | { |
| 8045 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 8046 | "%s: Error initializing the ap mode", __func__); |
| 8047 | return -EINVAL; |
| 8048 | } |
| 8049 | hdd_set_conparam(1); |
| 8050 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8051 | /*interface type changed update in wiphy structure*/ |
| 8052 | if(wdev) |
| 8053 | { |
| 8054 | wdev->iftype = type; |
| 8055 | pHddCtx->change_iface = type; |
| 8056 | } |
| 8057 | else |
| 8058 | { |
| 8059 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8060 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 8061 | return -EINVAL; |
| 8062 | } |
| 8063 | goto done; |
| 8064 | } |
| 8065 | |
| 8066 | default: |
| 8067 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 8068 | __func__); |
| 8069 | return -EOPNOTSUPP; |
| 8070 | } |
| 8071 | } |
| 8072 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8073 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8074 | ) |
| 8075 | { |
| 8076 | switch(type) |
| 8077 | { |
| 8078 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8079 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8080 | case NL80211_IFTYPE_ADHOC: |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 8081 | |
| 8082 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8083 | #ifdef FEATURE_WLAN_TDLS |
| 8084 | |
| 8085 | /* A Mutex Lock is introduced while changing the mode to |
| 8086 | * protect the concurrent access for the Adapters by TDLS |
| 8087 | * module. |
| 8088 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8089 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8090 | #endif |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 8091 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8092 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 8093 | //Check for sub-string p2p to confirm its a p2p interface |
| 8094 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8095 | { |
| 8096 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 8097 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 8098 | } |
| 8099 | else |
| 8100 | { |
| 8101 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8102 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 8103 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8104 | hdd_set_conparam(0); |
| 8105 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8106 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 8107 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8108 | #ifdef FEATURE_WLAN_TDLS |
| 8109 | mutex_unlock(&pHddCtx->tdls_lock); |
| 8110 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 8111 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8112 | if( VOS_STATUS_SUCCESS != status ) |
| 8113 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8114 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 8115 | * This is the right place to enable back bmps_imps() |
| 8116 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 8117 | if (pHddCtx->hdd_wlan_suspended) |
| 8118 | { |
| 8119 | hdd_set_pwrparams(pHddCtx); |
| 8120 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8121 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8122 | goto done; |
| 8123 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8124 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8125 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8126 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 8127 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8128 | goto done; |
| 8129 | default: |
| 8130 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 8131 | __func__); |
| 8132 | return -EOPNOTSUPP; |
| 8133 | |
| 8134 | } |
| 8135 | |
| 8136 | } |
| 8137 | else |
| 8138 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8139 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 8140 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8141 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8142 | return -EOPNOTSUPP; |
| 8143 | } |
| 8144 | |
| 8145 | |
| 8146 | if(pRoamProfile) |
| 8147 | { |
| 8148 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 8149 | { |
| 8150 | /*interface type changed update in wiphy structure*/ |
| 8151 | wdev->iftype = type; |
| 8152 | |
| 8153 | /*the BSS mode changed, We need to issue disconnect |
| 8154 | if connected or in IBSS disconnect state*/ |
| 8155 | if ( hdd_connGetConnectedBssType( |
| 8156 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 8157 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 8158 | { |
| 8159 | /*need to issue a disconnect to CSR.*/ |
| 8160 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 8161 | if( eHAL_STATUS_SUCCESS == |
| 8162 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8163 | pAdapter->sessionId, |
| 8164 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 8165 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8166 | ret = wait_for_completion_interruptible_timeout( |
| 8167 | &pAdapter->disconnect_comp_var, |
| 8168 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 8169 | if (ret <= 0) |
| 8170 | { |
| 8171 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8172 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 8173 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8174 | } |
| 8175 | } |
| 8176 | } |
| 8177 | } |
| 8178 | |
| 8179 | done: |
| 8180 | /*set bitmask based on updated value*/ |
| 8181 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 8182 | |
| 8183 | /* Only STA mode support TM now |
| 8184 | * all other mode, TM feature should be disabled */ |
| 8185 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 8186 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 8187 | { |
| 8188 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 8189 | } |
| 8190 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8191 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8192 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 8193 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8194 | { |
| 8195 | //we are ok to do AMP |
| 8196 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 8197 | } |
| 8198 | #endif //WLAN_BTAMP_FEATURE |
| 8199 | EXIT(); |
| 8200 | return 0; |
| 8201 | } |
| 8202 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 8203 | /* |
| 8204 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 8205 | * wrapper function to protect the actual implementation from SSR. |
| 8206 | */ |
| 8207 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 8208 | struct net_device *ndev, |
| 8209 | enum nl80211_iftype type, |
| 8210 | u32 *flags, |
| 8211 | struct vif_params *params |
| 8212 | ) |
| 8213 | { |
| 8214 | int ret; |
| 8215 | |
| 8216 | vos_ssr_protect(__func__); |
| 8217 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 8218 | vos_ssr_unprotect(__func__); |
| 8219 | |
| 8220 | return ret; |
| 8221 | } |
| 8222 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8223 | #ifdef FEATURE_WLAN_TDLS |
| 8224 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
| 8225 | struct net_device *dev, u8 *mac, bool update, tCsrStaParams *StaParams) |
| 8226 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8227 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8228 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8229 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8230 | tANI_U16 numCurrTdlsPeers; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 8231 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8232 | |
| 8233 | ENTER(); |
| 8234 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 8235 | if (!dev) { |
| 8236 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 8237 | return -EINVAL; |
| 8238 | } |
| 8239 | |
| 8240 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8241 | if (!pAdapter) { |
| 8242 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 8243 | return -EINVAL; |
| 8244 | } |
| 8245 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8246 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8247 | { |
| 8248 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8249 | "Invalid arguments"); |
| 8250 | return -EINVAL; |
| 8251 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8252 | |
| 8253 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 8254 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 8255 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8256 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 8257 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 8258 | MAC_ADDRESS_STR " Request declined.", |
| 8259 | __func__, MAC_ADDR_ARRAY(mac)); |
| 8260 | return -ENOTSUPP; |
| 8261 | } |
| 8262 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8263 | if (pHddCtx->isLogpInProgress) |
| 8264 | { |
| 8265 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8266 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8267 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8268 | mac, |
| 8269 | eTDLS_LINK_IDLE, |
| 8270 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8271 | return -EBUSY; |
| 8272 | } |
| 8273 | |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 8274 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8275 | |
| 8276 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8277 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8278 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 8279 | __func__, MAC_ADDR_ARRAY(mac), update); |
| 8280 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8281 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8282 | |
| 8283 | /* in add station, we accept existing valid staId if there is */ |
| 8284 | if ((0 == update) && |
| 8285 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 8286 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8287 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8288 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8289 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8290 | " link_status %d. staId %d. add station ignored.", |
| 8291 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
| 8292 | return 0; |
| 8293 | } |
| 8294 | /* in change station, we accept only when staId is valid */ |
| 8295 | if ((1 == update) && |
| 8296 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 8297 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 8298 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8299 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8300 | "%s: " MAC_ADDRESS_STR |
| 8301 | " link status %d. staId %d. change station %s.", |
| 8302 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId, |
| 8303 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? "ignored" : "declined"); |
| 8304 | return (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8305 | } |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8306 | |
| 8307 | /* when others are on-going, we want to change link_status to idle */ |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8308 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8309 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8310 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8311 | "%s: " MAC_ADDRESS_STR |
| 8312 | " TDLS setup is ongoing. Request declined.", |
| 8313 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8314 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8315 | } |
| 8316 | |
| 8317 | /* first to check if we reached to maximum supported TDLS peer. |
| 8318 | TODO: for now, return -EPERM looks working fine, |
| 8319 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8320 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 8321 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8322 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8323 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8324 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 8325 | " TDLS Max peer already connected. Request declined." |
| 8326 | " Num of peers (%d), Max allowed (%d).", |
| 8327 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 8328 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8329 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8330 | } |
| 8331 | else |
| 8332 | { |
| 8333 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 8334 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8335 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8336 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8337 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8338 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 8339 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8340 | return -EPERM; |
| 8341 | } |
| 8342 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8343 | if (0 == update) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8344 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8345 | mac, |
| 8346 | eTDLS_LINK_CONNECTING, |
| 8347 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8348 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 8349 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8350 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8351 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8352 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8353 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8354 | if(StaParams->htcap_present) |
| 8355 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8356 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8357 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8358 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8359 | "ht_capa->extended_capabilities: %0x", |
| 8360 | StaParams->HTCap.extendedHtCapInfo); |
| 8361 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8362 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8363 | "params->capability: %0x",StaParams->capability); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8364 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8365 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8366 | if(StaParams->vhtcap_present) |
| 8367 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8368 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8369 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 8370 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 8371 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 8372 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8373 | { |
| 8374 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8375 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8376 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 8377 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8378 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 8379 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 8380 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 8381 | else if ((1 == update) && (NULL == StaParams)) |
| 8382 | { |
| 8383 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8384 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 8385 | return -EPERM; |
| 8386 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8387 | |
| 8388 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 8389 | |
| 8390 | if (!update) |
| 8391 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8392 | ret = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8393 | pAdapter->sessionId, mac); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8394 | if (ret != eHAL_STATUS_SUCCESS) { |
| 8395 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to add TDLS peer STA")); |
| 8396 | return -EPERM; |
| 8397 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8398 | } |
| 8399 | else |
| 8400 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8401 | ret = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8402 | pAdapter->sessionId, mac, StaParams); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 8403 | if (ret != eHAL_STATUS_SUCCESS) { |
| 8404 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to change TDLS peer STA params")); |
| 8405 | return -EPERM; |
| 8406 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8407 | } |
| 8408 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8409 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8410 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 8411 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8412 | if (ret <= 0) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8413 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8414 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8415 | "%s: timeout waiting for tdls add station indication %ld", |
| 8416 | __func__, ret); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8417 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8418 | } |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8419 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8420 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 8421 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 8422 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8423 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 8424 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8425 | } |
| 8426 | |
| 8427 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8428 | |
| 8429 | error: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8430 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 8431 | mac, |
| 8432 | eTDLS_LINK_IDLE, |
| 8433 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 8434 | return -EPERM; |
| 8435 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8436 | } |
| 8437 | #endif |
| 8438 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8439 | static int __wlan_hdd_change_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8440 | struct net_device *dev, |
| 8441 | u8 *mac, |
| 8442 | struct station_parameters *params) |
| 8443 | { |
| 8444 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8445 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8446 | hdd_context_t *pHddCtx; |
| 8447 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8448 | v_MACADDR_t STAMacAddress; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8449 | int ret = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8450 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8451 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8452 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8453 | tANI_U8 isOffChannelSupported = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8454 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8455 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8456 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8457 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 8458 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8459 | if ((NULL == pAdapter)) |
| 8460 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8461 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8462 | "invalid adapter "); |
| 8463 | return -EINVAL; |
| 8464 | } |
| 8465 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8466 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8467 | TRACE_CODE_HDD_CHANGE_STATION, |
| 8468 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8469 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8470 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8471 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8472 | if (0 != ret) |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8473 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8474 | return ret; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8475 | } |
| 8476 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8477 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8478 | |
| 8479 | if (NULL == pHddStaCtx) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8480 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 8481 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8482 | "invalid HDD station context"); |
| 8483 | return -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8484 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8485 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 8486 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8487 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 8488 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8489 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8490 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8491 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8492 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8493 | WLANTL_STA_AUTHENTICATED); |
| 8494 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8495 | if (status != VOS_STATUS_SUCCESS) |
| 8496 | { |
| 8497 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8498 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 8499 | return -EINVAL; |
| 8500 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8501 | } |
| 8502 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 8503 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 8504 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8505 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8506 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 8507 | StaParams.capability = params->capability; |
| 8508 | StaParams.uapsd_queues = params->uapsd_queues; |
| 8509 | StaParams.max_sp = params->max_sp; |
| 8510 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8511 | /* Convert (first channel , number of channels) tuple to |
| 8512 | * the total list of channels. This goes with the assumption |
| 8513 | * that if the first channel is < 14, then the next channels |
| 8514 | * are an incremental of 1 else an incremental of 4 till the number |
| 8515 | * of channels. |
| 8516 | */ |
| 8517 | if (0 != params->supported_channels_len) { |
| 8518 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 8519 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 8520 | { |
| 8521 | int wifi_chan_index; |
| 8522 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 8523 | wifi_chan_index = |
| 8524 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 8525 | no_of_channels = params->supported_channels[i+1]; |
| 8526 | for(k=1; k <= no_of_channels; k++) |
| 8527 | { |
| 8528 | StaParams.supported_channels[j+1] = |
| 8529 | StaParams.supported_channels[j] + wifi_chan_index; |
| 8530 | j+=1; |
| 8531 | } |
| 8532 | } |
| 8533 | StaParams.supported_channels_len = j; |
| 8534 | } |
| 8535 | vos_mem_copy(StaParams.supported_oper_classes, |
| 8536 | params->supported_oper_classes, |
| 8537 | params->supported_oper_classes_len); |
| 8538 | StaParams.supported_oper_classes_len = |
| 8539 | params->supported_oper_classes_len; |
| 8540 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8541 | if (0 != params->ext_capab_len) |
| 8542 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 8543 | sizeof(StaParams.extn_capability)); |
| 8544 | |
| 8545 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8546 | { |
| 8547 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8548 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8549 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8550 | |
| 8551 | StaParams.supported_rates_len = params->supported_rates_len; |
| 8552 | |
| 8553 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 8554 | * The supported_rates array , for all the structures propogating till Add Sta |
| 8555 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 8556 | * modified to send more rates. |
| 8557 | */ |
| 8558 | |
| 8559 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 8560 | */ |
| 8561 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 8562 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 8563 | |
| 8564 | if (0 != StaParams.supported_rates_len) { |
| 8565 | int i = 0; |
| 8566 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 8567 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8568 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8569 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 8570 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 8571 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8572 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 8573 | } |
| 8574 | |
| 8575 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8576 | { |
| 8577 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8578 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 8579 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 8580 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8581 | if (0 != params->ext_capab_len ) { |
| 8582 | /*Define A Macro : TODO Sunil*/ |
| 8583 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 8584 | isBufSta = 1; |
| 8585 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8586 | /* TDLS Channel Switching Support */ |
| 8587 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 8588 | isOffChannelSupported = 1; |
| 8589 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8590 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 8591 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 8592 | &StaParams, isBufSta, |
| 8593 | isOffChannelSupported); |
| 8594 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 8595 | if (VOS_STATUS_SUCCESS != status) { |
| 8596 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8597 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 8598 | return -EINVAL; |
| 8599 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 8600 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 8601 | |
| 8602 | if (VOS_STATUS_SUCCESS != status) { |
| 8603 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8604 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 8605 | return -EINVAL; |
| 8606 | } |
| 8607 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 8608 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 8609 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8610 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8611 | return status; |
| 8612 | } |
| 8613 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8614 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 8615 | struct net_device *dev, |
| 8616 | u8 *mac, |
| 8617 | struct station_parameters *params) |
| 8618 | { |
| 8619 | int ret; |
| 8620 | |
| 8621 | vos_ssr_protect(__func__); |
| 8622 | ret = __wlan_hdd_change_station(wiphy, dev, mac, params); |
| 8623 | vos_ssr_unprotect(__func__); |
| 8624 | |
| 8625 | return ret; |
| 8626 | } |
| 8627 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8628 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8629 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8630 | * This function is used to initialize the key information |
| 8631 | */ |
| 8632 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8633 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8634 | struct net_device *ndev, |
| 8635 | u8 key_index, bool pairwise, |
| 8636 | const u8 *mac_addr, |
| 8637 | struct key_params *params |
| 8638 | ) |
| 8639 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 8640 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8641 | struct net_device *ndev, |
| 8642 | u8 key_index, const u8 *mac_addr, |
| 8643 | struct key_params *params |
| 8644 | ) |
| 8645 | #endif |
| 8646 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8647 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8648 | tCsrRoamSetKey setKey; |
| 8649 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8650 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8651 | v_U32_t roamId= 0xFF; |
| 8652 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8653 | hdd_hostapd_state_t *pHostapdState; |
| 8654 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8655 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8656 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8657 | |
| 8658 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8659 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8660 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8661 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 8662 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8663 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8664 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8665 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8666 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8667 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8668 | } |
| 8669 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8670 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 8671 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8672 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8673 | |
| 8674 | if (CSR_MAX_NUM_KEY <= key_index) |
| 8675 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8676 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8677 | key_index); |
| 8678 | |
| 8679 | return -EINVAL; |
| 8680 | } |
| 8681 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8682 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 8683 | { |
| 8684 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 8685 | params->key_len); |
| 8686 | |
| 8687 | return -EINVAL; |
| 8688 | } |
| 8689 | |
| 8690 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8691 | "%s: called with key index = %d & key length %d", |
| 8692 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8693 | |
| 8694 | /*extract key idx, key len and key*/ |
| 8695 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8696 | setKey.keyId = key_index; |
| 8697 | setKey.keyLength = params->key_len; |
| 8698 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 8699 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8700 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8701 | { |
| 8702 | case WLAN_CIPHER_SUITE_WEP40: |
| 8703 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 8704 | break; |
| 8705 | |
| 8706 | case WLAN_CIPHER_SUITE_WEP104: |
| 8707 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 8708 | break; |
| 8709 | |
| 8710 | case WLAN_CIPHER_SUITE_TKIP: |
| 8711 | { |
| 8712 | u8 *pKey = &setKey.Key[0]; |
| 8713 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 8714 | |
| 8715 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 8716 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8717 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8718 | |
| 8719 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8720 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8721 | |--------------|----------|----------| |
| 8722 | <---16bytes---><--8bytes--><--8bytes--> |
| 8723 | |
| 8724 | */ |
| 8725 | /*Sme expects the 32 bytes key to be in the below order |
| 8726 | |
| 8727 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8728 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8729 | |--------------|----------|----------| |
| 8730 | <---16bytes---><--8bytes--><--8bytes--> |
| 8731 | */ |
| 8732 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8733 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8734 | |
| 8735 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8736 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8737 | |
| 8738 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8739 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8740 | |
| 8741 | |
| 8742 | break; |
| 8743 | } |
| 8744 | |
| 8745 | case WLAN_CIPHER_SUITE_CCMP: |
| 8746 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 8747 | break; |
| 8748 | |
| 8749 | #ifdef FEATURE_WLAN_WAPI |
| 8750 | case WLAN_CIPHER_SUITE_SMS4: |
| 8751 | { |
| 8752 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 8753 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 8754 | params->key, params->key_len); |
| 8755 | return 0; |
| 8756 | } |
| 8757 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8758 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8759 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8760 | case WLAN_CIPHER_SUITE_KRK: |
| 8761 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 8762 | break; |
| 8763 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8764 | |
| 8765 | #ifdef WLAN_FEATURE_11W |
| 8766 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 8767 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 8768 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8769 | #endif |
| 8770 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8771 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8772 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8773 | __func__, params->cipher); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8774 | status = -EOPNOTSUPP; |
| 8775 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8776 | } |
| 8777 | |
| 8778 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 8779 | __func__, setKey.encType); |
| 8780 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8781 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8782 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8783 | (!pairwise) |
| 8784 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8785 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8786 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8787 | ) |
| 8788 | { |
| 8789 | /* set group key*/ |
| 8790 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8791 | "%s- %d: setting Broadcast key", |
| 8792 | __func__, __LINE__); |
| 8793 | setKey.keyDirection = eSIR_RX_ONLY; |
| 8794 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 8795 | } |
| 8796 | else |
| 8797 | { |
| 8798 | /* set pairwise key*/ |
| 8799 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8800 | "%s- %d: setting pairwise key", |
| 8801 | __func__, __LINE__); |
| 8802 | setKey.keyDirection = eSIR_TX_RX; |
| 8803 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 8804 | } |
| 8805 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 8806 | { |
| 8807 | setKey.keyDirection = eSIR_TX_RX; |
| 8808 | /*Set the group key*/ |
| 8809 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8810 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8811 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8812 | if ( 0 != status ) |
| 8813 | { |
| 8814 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8815 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8816 | status = -EINVAL; |
| 8817 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8818 | } |
| 8819 | /*Save the keys here and call sme_RoamSetKey for setting |
| 8820 | the PTK after peer joins the IBSS network*/ |
| 8821 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 8822 | &setKey, sizeof(tCsrRoamSetKey)); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8823 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 8824 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 8825 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 8826 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 8827 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8828 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8829 | if( pHostapdState->bssState == BSS_START ) |
| 8830 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8831 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 8832 | |
| 8833 | if ( status != eHAL_STATUS_SUCCESS ) |
| 8834 | { |
| 8835 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8836 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 8837 | __LINE__, status ); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8838 | status = -EINVAL; |
| 8839 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8840 | } |
| 8841 | } |
| 8842 | |
| 8843 | /* Saving WEP keys */ |
| 8844 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 8845 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 8846 | { |
| 8847 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 8848 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 8849 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 8850 | } |
| 8851 | else |
| 8852 | { |
| 8853 | //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] | 8854 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8855 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 8856 | } |
| 8857 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8858 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 8859 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8860 | { |
| 8861 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 8862 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8863 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8864 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 8865 | if (!pairwise) |
| 8866 | #else |
| 8867 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 8868 | #endif |
| 8869 | { |
| 8870 | /* set group key*/ |
| 8871 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 8872 | { |
| 8873 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8874 | "%s- %d: Perform Set key Complete", |
| 8875 | __func__, __LINE__); |
| 8876 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 8877 | } |
| 8878 | } |
| 8879 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8880 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 8881 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 8882 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 8883 | |
| 8884 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 8885 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8886 | params->key, params->key_len); |
| 8887 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8888 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8889 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 8890 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8891 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8892 | "%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] | 8893 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 8894 | setKey.peerMac[2], setKey.peerMac[3], |
| 8895 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8896 | setKey.keyDirection); |
| 8897 | |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 8898 | /* Wait for EAPOL M4 before setting key. |
| 8899 | * No need to consider Dynamic WEP as we will receive M8. |
| 8900 | */ |
| 8901 | if ( (setKey.encType == eCSR_ENCRYPT_TYPE_AES || |
| 8902 | setKey.encType == eCSR_ENCRYPT_TYPE_TKIP) && |
| 8903 | ( 1 |
| 8904 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 8905 | && pHddStaCtx->conn_info.authType != eCSR_AUTH_TYPE_FT_RSN |
| 8906 | && pHddStaCtx->conn_info.authType != eCSR_AUTH_TYPE_FT_RSN_PSK |
| 8907 | #endif |
| 8908 | #ifdef FEATURE_WLAN_ESE |
| 8909 | && pHddStaCtx->conn_info.authType != eCSR_AUTH_TYPE_CCKM_WPA |
| 8910 | && pHddStaCtx->conn_info.authType != eCSR_AUTH_TYPE_CCKM_RSN |
| 8911 | #endif |
| 8912 | )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8913 | { |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 8914 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 8915 | |
| 8916 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 8917 | { |
| 8918 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8919 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 8920 | __LINE__, vos_status ); |
| 8921 | |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 8922 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8923 | |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 8924 | status = -EINVAL; |
| 8925 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8926 | |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 8927 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8928 | } |
| 8929 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8930 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8931 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 8932 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 8933 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8934 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8935 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8936 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8937 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 8938 | "%s: Update PreAuth Key success", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8939 | status = 0; |
| 8940 | goto end; |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 8941 | } |
| 8942 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 8943 | { |
| 8944 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8945 | "%s: Update PreAuth Key failed", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8946 | status = -EINVAL; |
| 8947 | goto end; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 8948 | } |
| 8949 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8950 | |
| 8951 | /* issue set key request to SME*/ |
| 8952 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8953 | pAdapter->sessionId, &setKey, &roamId ); |
| 8954 | |
| 8955 | if ( 0 != status ) |
| 8956 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8957 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8958 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 8959 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8960 | status = -EINVAL; |
| 8961 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8962 | } |
| 8963 | |
| 8964 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8965 | /* in case of IBSS as there was no information available about WEP keys during |
| 8966 | * 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] | 8967 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8968 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 8969 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 8970 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8971 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 8972 | ) |
| 8973 | && |
| 8974 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 8975 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 8976 | ) |
| 8977 | ) |
| 8978 | { |
| 8979 | setKey.keyDirection = eSIR_RX_ONLY; |
| 8980 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 8981 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8982 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8983 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8984 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 8985 | setKey.peerMac[2], setKey.peerMac[3], |
| 8986 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8987 | setKey.keyDirection); |
| 8988 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8989 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8990 | pAdapter->sessionId, &setKey, &roamId ); |
| 8991 | |
| 8992 | if ( 0 != status ) |
| 8993 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8994 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8995 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8996 | __func__, status); |
| 8997 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8998 | status = -EINVAL; |
| 8999 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9000 | } |
| 9001 | } |
| 9002 | } |
| 9003 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9004 | end: |
| 9005 | /* Need to clear any trace of key value in the memory. |
| 9006 | * Thus zero out the memory even though it is local |
| 9007 | * variable. |
| 9008 | */ |
| 9009 | vos_mem_zero(&setKey, sizeof(setKey)); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9010 | EXIT(); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9011 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9012 | } |
| 9013 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9014 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9015 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 9016 | struct net_device *ndev, |
| 9017 | u8 key_index, bool pairwise, |
| 9018 | const u8 *mac_addr, |
| 9019 | struct key_params *params |
| 9020 | ) |
| 9021 | #else |
| 9022 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 9023 | struct net_device *ndev, |
| 9024 | u8 key_index, const u8 *mac_addr, |
| 9025 | struct key_params *params |
| 9026 | ) |
| 9027 | #endif |
| 9028 | { |
| 9029 | int ret; |
| 9030 | vos_ssr_protect(__func__); |
| 9031 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9032 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 9033 | mac_addr, params); |
| 9034 | #else |
| 9035 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 9036 | params); |
| 9037 | #endif |
| 9038 | vos_ssr_unprotect(__func__); |
| 9039 | |
| 9040 | return ret; |
| 9041 | } |
| 9042 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9043 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9044 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9045 | * This function is used to get the key information |
| 9046 | */ |
| 9047 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9048 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9049 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9050 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9051 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9052 | const u8 *mac_addr, void *cookie, |
| 9053 | void (*callback)(void *cookie, struct key_params*) |
| 9054 | ) |
| 9055 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9056 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9057 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9058 | struct net_device *ndev, |
| 9059 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 9060 | void (*callback)(void *cookie, struct key_params*) |
| 9061 | ) |
| 9062 | #endif |
| 9063 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9064 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9065 | hdd_wext_state_t *pWextState = NULL; |
| 9066 | tCsrRoamProfile *pRoamProfile = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9067 | struct key_params params; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9068 | hdd_context_t *pHddCtx; |
| 9069 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9070 | |
| 9071 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9072 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9073 | if (NULL == pAdapter) |
| 9074 | { |
| 9075 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9076 | "%s: HDD adapter is Null", __func__); |
| 9077 | return -ENODEV; |
| 9078 | } |
| 9079 | |
| 9080 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9081 | ret = wlan_hdd_validate_context(pHddCtx); |
| 9082 | if (0 != ret) |
| 9083 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 9084 | return ret; |
| 9085 | } |
| 9086 | |
| 9087 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9088 | pRoamProfile = &(pWextState->roamProfile); |
| 9089 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9090 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 9091 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9092 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9093 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9094 | memset(¶ms, 0, sizeof(params)); |
| 9095 | |
| 9096 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9097 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9098 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9099 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9100 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9101 | |
| 9102 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 9103 | { |
| 9104 | case eCSR_ENCRYPT_TYPE_NONE: |
| 9105 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 9106 | break; |
| 9107 | |
| 9108 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 9109 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 9110 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 9111 | break; |
| 9112 | |
| 9113 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 9114 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 9115 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 9116 | break; |
| 9117 | |
| 9118 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 9119 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 9120 | break; |
| 9121 | |
| 9122 | case eCSR_ENCRYPT_TYPE_AES: |
| 9123 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 9124 | break; |
| 9125 | |
| 9126 | default: |
| 9127 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 9128 | break; |
| 9129 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9130 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 9131 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9132 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 9133 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9134 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9135 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 9136 | params.seq_len = 0; |
| 9137 | params.seq = NULL; |
| 9138 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 9139 | callback(cookie, ¶ms); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9140 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9141 | return 0; |
| 9142 | } |
| 9143 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9144 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9145 | static int wlan_hdd_cfg80211_get_key( |
| 9146 | struct wiphy *wiphy, |
| 9147 | struct net_device *ndev, |
| 9148 | u8 key_index, bool pairwise, |
| 9149 | const u8 *mac_addr, void *cookie, |
| 9150 | void (*callback)(void *cookie, struct key_params*) |
| 9151 | ) |
| 9152 | #else |
| 9153 | static int wlan_hdd_cfg80211_get_key( |
| 9154 | struct wiphy *wiphy, |
| 9155 | struct net_device *ndev, |
| 9156 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 9157 | void (*callback)(void *cookie, struct key_params*) |
| 9158 | ) |
| 9159 | #endif |
| 9160 | { |
| 9161 | int ret; |
| 9162 | |
| 9163 | vos_ssr_protect(__func__); |
| 9164 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9165 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 9166 | mac_addr, cookie, callback); |
| 9167 | #else |
| 9168 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 9169 | callback); |
| 9170 | #endif |
| 9171 | vos_ssr_unprotect(__func__); |
| 9172 | |
| 9173 | return ret; |
| 9174 | } |
| 9175 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9176 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9177 | * FUNCTION: __wlan_hdd_cfg80211_del_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9178 | * This function is used to delete the key information |
| 9179 | */ |
| 9180 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9181 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9182 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9183 | u8 key_index, |
| 9184 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9185 | const u8 *mac_addr |
| 9186 | ) |
| 9187 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9188 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9189 | struct net_device *ndev, |
| 9190 | u8 key_index, |
| 9191 | const u8 *mac_addr |
| 9192 | ) |
| 9193 | #endif |
| 9194 | { |
| 9195 | int status = 0; |
| 9196 | |
| 9197 | //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] | 9198 | //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] | 9199 | //it is observed that this is invalidating peer |
| 9200 | //key index whenever re-key is done. This is affecting data link. |
| 9201 | //It should be ok to ignore del_key. |
| 9202 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9203 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 9204 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9205 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 9206 | tCsrRoamSetKey setKey; |
| 9207 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9208 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9209 | ENTER(); |
| 9210 | |
| 9211 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 9212 | __func__,pAdapter->device_mode); |
| 9213 | |
| 9214 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9215 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9216 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9217 | key_index); |
| 9218 | |
| 9219 | return -EINVAL; |
| 9220 | } |
| 9221 | |
| 9222 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9223 | setKey.keyId = key_index; |
| 9224 | |
| 9225 | if (mac_addr) |
| 9226 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 9227 | else |
| 9228 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 9229 | |
| 9230 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 9231 | |
| 9232 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9233 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9234 | ) |
| 9235 | { |
| 9236 | |
| 9237 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9238 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 9239 | if( pHostapdState->bssState == BSS_START) |
| 9240 | { |
| 9241 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9242 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9243 | if ( status != eHAL_STATUS_SUCCESS ) |
| 9244 | { |
| 9245 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9246 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 9247 | __LINE__, status ); |
| 9248 | } |
| 9249 | } |
| 9250 | } |
| 9251 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9252 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9253 | ) |
| 9254 | { |
| 9255 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9256 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9257 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 9258 | |
| 9259 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9260 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9261 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 9262 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9263 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9264 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 9265 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9266 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9267 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9268 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9269 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9270 | if ( 0 != status ) |
| 9271 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9272 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9273 | "%s: sme_RoamSetKey failure, returned %d", |
| 9274 | __func__, status); |
| 9275 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 9276 | return -EINVAL; |
| 9277 | } |
| 9278 | } |
| 9279 | } |
| 9280 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9281 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9282 | return status; |
| 9283 | } |
| 9284 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9285 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9286 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 9287 | struct net_device *ndev, |
| 9288 | u8 key_index, |
| 9289 | bool pairwise, |
| 9290 | const u8 *mac_addr |
| 9291 | ) |
| 9292 | #else |
| 9293 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 9294 | struct net_device *ndev, |
| 9295 | u8 key_index, |
| 9296 | const u8 *mac_addr |
| 9297 | ) |
| 9298 | #endif |
| 9299 | { |
| 9300 | int ret; |
| 9301 | |
| 9302 | vos_ssr_protect(__func__); |
| 9303 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9304 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, pairwise, |
| 9305 | mac_addr); |
| 9306 | #else |
| 9307 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, mac_addr); |
| 9308 | #endif |
| 9309 | vos_ssr_unprotect(__func__); |
| 9310 | |
| 9311 | return ret; |
| 9312 | } |
| 9313 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9314 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9315 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9316 | * This function is used to set the default tx key index |
| 9317 | */ |
| 9318 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9319 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9320 | struct net_device *ndev, |
| 9321 | u8 key_index, |
| 9322 | bool unicast, bool multicast) |
| 9323 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9324 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9325 | struct net_device *ndev, |
| 9326 | u8 key_index) |
| 9327 | #endif |
| 9328 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9329 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9330 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9331 | hdd_wext_state_t *pWextState; |
| 9332 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9333 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9334 | |
| 9335 | ENTER(); |
| 9336 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9337 | if ((NULL == pAdapter)) |
| 9338 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9339 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9340 | "invalid adapter"); |
| 9341 | return -EINVAL; |
| 9342 | } |
| 9343 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9344 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9345 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 9346 | pAdapter->sessionId, key_index)); |
| 9347 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9348 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9349 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9350 | |
| 9351 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 9352 | { |
| 9353 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9354 | "invalid Wext state or HDD context"); |
| 9355 | return -EINVAL; |
| 9356 | } |
| 9357 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9358 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9359 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9360 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9361 | if (CSR_MAX_NUM_KEY <= key_index) |
| 9362 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9363 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9364 | key_index); |
| 9365 | |
| 9366 | return -EINVAL; |
| 9367 | } |
| 9368 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9369 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9370 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9371 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9372 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9373 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9374 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9375 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9376 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9377 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9378 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9379 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9380 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 9381 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9382 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 9383 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9384 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9385 | { |
| 9386 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9387 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9388 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9389 | tCsrRoamSetKey setKey; |
| 9390 | v_U32_t roamId= 0xFF; |
| 9391 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9392 | |
| 9393 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9394 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9395 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9396 | Keys->defaultIndex = (u8)key_index; |
| 9397 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 9398 | setKey.keyId = key_index; |
| 9399 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9400 | |
| 9401 | vos_mem_copy(&setKey.Key[0], |
| 9402 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9403 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9404 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9405 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9406 | |
| 9407 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9408 | &pHddStaCtx->conn_info.bssId[0], |
| 9409 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9410 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 9411 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 9412 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 9413 | eCSR_ENCRYPT_TYPE_WEP104) |
| 9414 | { |
| 9415 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 9416 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 9417 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 9418 | type(104) and switching encryption type to 40*/ |
| 9419 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 9420 | eCSR_ENCRYPT_TYPE_WEP40; |
| 9421 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 9422 | eCSR_ENCRYPT_TYPE_WEP40; |
| 9423 | } |
| 9424 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9425 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9426 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9427 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9428 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9429 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9430 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9431 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9432 | if ( 0 != status ) |
| 9433 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9434 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9435 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9436 | status); |
| 9437 | return -EINVAL; |
| 9438 | } |
| 9439 | } |
| 9440 | } |
| 9441 | |
| 9442 | /* In SoftAp mode setting key direction for default mode */ |
| 9443 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 9444 | { |
| 9445 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 9446 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 9447 | (eCSR_ENCRYPT_TYPE_AES != |
| 9448 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 9449 | ) |
| 9450 | { |
| 9451 | /* Saving key direction for default key index to TX default */ |
| 9452 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 9453 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 9454 | } |
| 9455 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9456 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9457 | return status; |
| 9458 | } |
| 9459 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 9460 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9461 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 9462 | struct net_device *ndev, |
| 9463 | u8 key_index, |
| 9464 | bool unicast, bool multicast) |
| 9465 | #else |
| 9466 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 9467 | struct net_device *ndev, |
| 9468 | u8 key_index) |
| 9469 | #endif |
| 9470 | { |
| 9471 | int ret; |
| 9472 | vos_ssr_protect(__func__); |
| 9473 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 9474 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 9475 | multicast); |
| 9476 | #else |
| 9477 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 9478 | #endif |
| 9479 | vos_ssr_unprotect(__func__); |
| 9480 | |
| 9481 | return ret; |
| 9482 | } |
| 9483 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9484 | /* |
| 9485 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 9486 | * This function is used to inform the BSS details to nl80211 interface. |
| 9487 | */ |
| 9488 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 9489 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 9490 | { |
| 9491 | struct net_device *dev = pAdapter->dev; |
| 9492 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 9493 | struct wiphy *wiphy = wdev->wiphy; |
| 9494 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 9495 | int chan_no; |
| 9496 | int ie_length; |
| 9497 | const char *ie; |
| 9498 | unsigned int freq; |
| 9499 | struct ieee80211_channel *chan; |
| 9500 | int rssi = 0; |
| 9501 | struct cfg80211_bss *bss = NULL; |
| 9502 | |
| 9503 | ENTER(); |
| 9504 | |
| 9505 | if( NULL == pBssDesc ) |
| 9506 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9507 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9508 | return bss; |
| 9509 | } |
| 9510 | |
| 9511 | chan_no = pBssDesc->channelId; |
| 9512 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 9513 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 9514 | |
| 9515 | if( NULL == ie ) |
| 9516 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9517 | 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] | 9518 | return bss; |
| 9519 | } |
| 9520 | |
| 9521 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 9522 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 9523 | { |
| 9524 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9525 | } |
| 9526 | else |
| 9527 | { |
| 9528 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9529 | } |
| 9530 | #else |
| 9531 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9532 | #endif |
| 9533 | |
| 9534 | chan = __ieee80211_get_channel(wiphy, freq); |
| 9535 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 9536 | if (!chan) { |
| 9537 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 9538 | return NULL; |
| 9539 | } |
| 9540 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9541 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9542 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9543 | return cfg80211_inform_bss(wiphy, chan, pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9544 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9545 | pBssDesc->capabilityInfo, |
| 9546 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 9547 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9548 | } |
| 9549 | |
| 9550 | |
| 9551 | |
| 9552 | /* |
| 9553 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 9554 | * This function is used to inform the BSS details to nl80211 interface. |
| 9555 | */ |
| 9556 | struct cfg80211_bss* |
| 9557 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 9558 | tSirBssDescription *bss_desc |
| 9559 | ) |
| 9560 | { |
| 9561 | /* |
| 9562 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 9563 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 9564 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 9565 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 9566 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 9567 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 9568 | cfg80211_inform_bss_frame. |
| 9569 | */ |
| 9570 | struct net_device *dev = pAdapter->dev; |
| 9571 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 9572 | struct wiphy *wiphy = wdev->wiphy; |
| 9573 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 9574 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 9575 | qcom_ie_age *qie_age = NULL; |
| 9576 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 9577 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9578 | 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] | 9579 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9580 | const char *ie = |
| 9581 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 9582 | unsigned int freq; |
| 9583 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 9584 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9585 | struct cfg80211_bss *bss_status = NULL; |
| 9586 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 9587 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9588 | hdd_context_t *pHddCtx; |
| 9589 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9590 | #ifdef WLAN_OPEN_SOURCE |
| 9591 | struct timespec ts; |
| 9592 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9593 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9594 | ENTER(); |
| 9595 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9596 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9597 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9598 | if (0 != status) |
| 9599 | { |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 9600 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9601 | } |
| 9602 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 9603 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9604 | if (!mgmt) |
| 9605 | { |
| 9606 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9607 | "%s: memory allocation failed ", __func__); |
| 9608 | return NULL; |
| 9609 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 9610 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9611 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9612 | |
| 9613 | #ifdef WLAN_OPEN_SOURCE |
| 9614 | /* Android does not want the timestamp from the frame. |
| 9615 | Instead it wants a monotonic increasing value */ |
| 9616 | get_monotonic_boottime(&ts); |
| 9617 | mgmt->u.probe_resp.timestamp = |
| 9618 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 9619 | #else |
| 9620 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9621 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 9622 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9623 | |
| 9624 | #endif |
| 9625 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9626 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 9627 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 9628 | |
| 9629 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 9630 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 9631 | /* Assuming this is the last IE, copy at the end */ |
| 9632 | ie_length -=sizeof(qcom_ie_age); |
| 9633 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 9634 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 9635 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 9636 | qie_age->oui_1 = QCOM_OUI1; |
| 9637 | qie_age->oui_2 = QCOM_OUI2; |
| 9638 | qie_age->oui_3 = QCOM_OUI3; |
| 9639 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 9640 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 9641 | #endif |
| 9642 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9643 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 9644 | if (bss_desc->fProbeRsp) |
| 9645 | { |
| 9646 | mgmt->frame_control |= |
| 9647 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 9648 | } |
| 9649 | else |
| 9650 | { |
| 9651 | mgmt->frame_control |= |
| 9652 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 9653 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9654 | |
| 9655 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9656 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9657 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 9658 | { |
| 9659 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 9660 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9661 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9662 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 9663 | |
| 9664 | { |
| 9665 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 9666 | } |
| 9667 | else |
| 9668 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9669 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 9670 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9671 | kfree(mgmt); |
| 9672 | return NULL; |
| 9673 | } |
| 9674 | #else |
| 9675 | freq = ieee80211_channel_to_frequency(chan_no); |
| 9676 | #endif |
| 9677 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 9678 | /*when the band is changed on the fly using the GUI, three things are done |
| 9679 | * 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) |
| 9680 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 9681 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 9682 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 9683 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 9684 | * 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 |
| 9685 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 9686 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 9687 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 9688 | * So drop the bss and continue to next bss. |
| 9689 | */ |
| 9690 | if(chan == NULL) |
| 9691 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9692 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 9693 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 9694 | return NULL; |
| 9695 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9696 | /*To keep the rssi icon of the connected AP in the scan window |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9697 | *and the rssi icon of the wireless networks in sync |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9698 | * */ |
| 9699 | if (( eConnectionState_Associated == |
| 9700 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 9701 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 9702 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 9703 | WNI_CFG_BSSID_LEN))) |
| 9704 | { |
| 9705 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 9706 | rssi = (pAdapter->rssi * 100); |
| 9707 | } |
| 9708 | else |
| 9709 | { |
| 9710 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 9711 | } |
| 9712 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9713 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
| 9714 | "RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 9715 | chan->center_freq, (int)(rssi/100)); |
| 9716 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9717 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 9718 | frame_len, rssi, GFP_KERNEL); |
| 9719 | kfree(mgmt); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9720 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9721 | return bss_status; |
| 9722 | } |
| 9723 | |
| 9724 | /* |
| 9725 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 9726 | * This function is used to update the BSS data base of CFG8011 |
| 9727 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9728 | 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] | 9729 | tCsrRoamInfo *pRoamInfo |
| 9730 | ) |
| 9731 | { |
| 9732 | tCsrRoamConnectedProfile roamProfile; |
| 9733 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9734 | struct cfg80211_bss *bss = NULL; |
| 9735 | |
| 9736 | ENTER(); |
| 9737 | |
| 9738 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 9739 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 9740 | |
| 9741 | if (NULL != roamProfile.pBssDesc) |
| 9742 | { |
Girish Gowli | f4b6802 | 2014-08-28 23:18:57 +0530 | [diff] [blame] | 9743 | bss = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 9744 | roamProfile.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9745 | |
| 9746 | if (NULL == bss) |
| 9747 | { |
| 9748 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 9749 | __func__); |
| 9750 | } |
| 9751 | |
| 9752 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 9753 | } |
| 9754 | else |
| 9755 | { |
| 9756 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 9757 | __func__); |
| 9758 | } |
| 9759 | return bss; |
| 9760 | } |
| 9761 | |
| 9762 | /* |
| 9763 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 9764 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9765 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 9766 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9767 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9768 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9769 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9770 | tCsrScanResultInfo *pScanResult; |
| 9771 | eHalStatus status = 0; |
| 9772 | tScanResultHandle pResult; |
| 9773 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9774 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9775 | |
| 9776 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9777 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9778 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9779 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 9780 | NO_SESSION, pAdapter->sessionId)); |
| 9781 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9782 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9783 | |
| 9784 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9785 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9786 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9787 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 9788 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9789 | } |
| 9790 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9791 | |
| 9792 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 9793 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 9794 | { |
| 9795 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9796 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 9797 | return VOS_STATUS_E_PERM; |
| 9798 | } |
| 9799 | |
| 9800 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9801 | /* |
| 9802 | * start getting scan results and populate cgf80211 BSS database |
| 9803 | */ |
| 9804 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 9805 | |
| 9806 | /* no scan results */ |
| 9807 | if (NULL == pResult) |
| 9808 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 9809 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 9810 | __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9811 | return status; |
| 9812 | } |
| 9813 | |
| 9814 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 9815 | |
| 9816 | while (pScanResult) |
| 9817 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9818 | /* |
| 9819 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 9820 | * entry already exists in bss data base of cfg80211 for that |
| 9821 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 9822 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 9823 | * mgmt packet as input. As of now there is no possibility to get |
| 9824 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9825 | * ieee80211_mgmt(probe response) and passing to c |
| 9826 | * fg80211_inform_bss_frame. |
| 9827 | * */ |
| 9828 | |
| 9829 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 9830 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9831 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9832 | |
| 9833 | if (NULL == bss_status) |
| 9834 | { |
| 9835 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9836 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9837 | } |
| 9838 | else |
| 9839 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 9840 | cfg80211_put_bss( |
| 9841 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 9842 | wiphy, |
| 9843 | #endif |
| 9844 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9845 | } |
| 9846 | |
| 9847 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 9848 | } |
| 9849 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9850 | sme_ScanResultPurge(hHal, pResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9851 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9852 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9853 | } |
| 9854 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9855 | void |
| 9856 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 9857 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9858 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 9859 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9860 | } /****** end hddPrintMacAddr() ******/ |
| 9861 | |
| 9862 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 9863 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9864 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9865 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9866 | "%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] | 9867 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 9868 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 9869 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9870 | } /****** end hddPrintPmkId() ******/ |
| 9871 | |
| 9872 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 9873 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 9874 | |
| 9875 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 9876 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 9877 | |
| 9878 | #define dump_bssid(bssid) \ |
| 9879 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9880 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 9881 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9882 | } |
| 9883 | |
| 9884 | #define dump_pmkid(pMac, pmkid) \ |
| 9885 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9886 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 9887 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9888 | } |
| 9889 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 9890 | #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] | 9891 | /* |
| 9892 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 9893 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 9894 | */ |
| 9895 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9896 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9897 | int index, bool preauth ) |
| 9898 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9899 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9900 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 9901 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9902 | |
| 9903 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9904 | 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] | 9905 | |
| 9906 | if( NULL == pRoamInfo ) |
| 9907 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9908 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9909 | return -EINVAL; |
| 9910 | } |
| 9911 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 9912 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 9913 | { |
| 9914 | dump_bssid(pRoamInfo->bssid); |
| 9915 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9916 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 9917 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9918 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9919 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9920 | } |
| 9921 | #endif //FEATURE_WLAN_LFR |
| 9922 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 9923 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 9924 | /* |
| 9925 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 9926 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 9927 | * |
| 9928 | */ |
| 9929 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 9930 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 9931 | tCsrRoamInfo *pRoamInfo) |
| 9932 | { |
| 9933 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 9934 | union iwreq_data wrqu; |
| 9935 | |
| 9936 | ENTER(); |
| 9937 | |
| 9938 | if (NULL == pAdapter) |
| 9939 | { |
| 9940 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 9941 | return VOS_STATUS_E_FAILURE; |
| 9942 | } |
| 9943 | |
| 9944 | /* create the event */ |
| 9945 | memset(&wrqu, 0, sizeof(wrqu)); |
| 9946 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 9947 | |
| 9948 | wrqu.data.pointer = metrics_notification; |
| 9949 | wrqu.data.length = scnprintf(metrics_notification, |
| 9950 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 9951 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 9952 | |
| 9953 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 9954 | |
| 9955 | EXIT(); |
| 9956 | |
| 9957 | return VOS_STATUS_SUCCESS; |
| 9958 | } |
| 9959 | |
| 9960 | /* |
| 9961 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 9962 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 9963 | * or failure |
| 9964 | */ |
| 9965 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 9966 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 9967 | { |
| 9968 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 9969 | union iwreq_data wrqu; |
| 9970 | |
| 9971 | ENTER(); |
| 9972 | |
| 9973 | if (NULL == pAdapter) |
| 9974 | { |
| 9975 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 9976 | return VOS_STATUS_E_FAILURE; |
| 9977 | } |
| 9978 | |
| 9979 | /* create the event */ |
| 9980 | memset(&wrqu, 0, sizeof(wrqu)); |
| 9981 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 9982 | |
| 9983 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 9984 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 9985 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 9986 | |
| 9987 | if (1 == preauth_status) |
| 9988 | strncat(metrics_notification, " TRUE", 5); |
| 9989 | else |
| 9990 | strncat(metrics_notification, " FALSE", 6); |
| 9991 | |
| 9992 | wrqu.data.pointer = metrics_notification; |
| 9993 | wrqu.data.length = strlen(metrics_notification); |
| 9994 | |
| 9995 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 9996 | |
| 9997 | EXIT(); |
| 9998 | |
| 9999 | return VOS_STATUS_SUCCESS; |
| 10000 | } |
| 10001 | |
| 10002 | /* |
| 10003 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 10004 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 10005 | * |
| 10006 | */ |
| 10007 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 10008 | tCsrRoamInfo *pRoamInfo) |
| 10009 | { |
| 10010 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 10011 | union iwreq_data wrqu; |
| 10012 | |
| 10013 | ENTER(); |
| 10014 | |
| 10015 | if (NULL == pAdapter) |
| 10016 | { |
| 10017 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 10018 | return VOS_STATUS_E_FAILURE; |
| 10019 | } |
| 10020 | |
| 10021 | /* create the event */ |
| 10022 | memset(&wrqu, 0, sizeof(wrqu)); |
| 10023 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 10024 | |
| 10025 | wrqu.data.pointer = metrics_notification; |
| 10026 | wrqu.data.length = scnprintf(metrics_notification, |
| 10027 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 10028 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 10029 | |
| 10030 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 10031 | |
| 10032 | EXIT(); |
| 10033 | |
| 10034 | return VOS_STATUS_SUCCESS; |
| 10035 | } |
| 10036 | #endif |
| 10037 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10038 | /* |
| 10039 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 10040 | * scanning callback function, called after finishing scan |
| 10041 | * |
| 10042 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10043 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10044 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 10045 | { |
| 10046 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10047 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10048 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10049 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10050 | struct cfg80211_scan_request *req = NULL; |
| 10051 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10052 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10053 | long waitRet = 0; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10054 | tANI_U8 i; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10055 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10056 | |
| 10057 | ENTER(); |
| 10058 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10059 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10060 | if (0 != wlan_hdd_validate_context(pHddCtx)) { |
| 10061 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
| 10062 | goto allow_suspend; |
| 10063 | } |
| 10064 | |
| 10065 | pScanInfo = &pHddCtx->scan_info; |
| 10066 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10067 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10068 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10069 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10070 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 10071 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10072 | pScanInfo->mScanPendingCounter = 0; |
| 10073 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10074 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10075 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10076 | &pScanInfo->scan_req_completion_event, |
| 10077 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10078 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10079 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10080 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10081 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10082 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10083 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10084 | } |
| 10085 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 10086 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10087 | { |
| 10088 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10089 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10090 | } |
| 10091 | |
| 10092 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10093 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10094 | { |
| 10095 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10096 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10097 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10098 | (int) scanId); |
| 10099 | } |
| 10100 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10101 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10102 | pAdapter); |
| 10103 | |
| 10104 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10105 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10106 | |
| 10107 | |
| 10108 | /* If any client wait scan result through WEXT |
| 10109 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10110 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10111 | { |
| 10112 | /* The other scan request waiting for current scan finish |
| 10113 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10114 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10115 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10116 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10117 | } |
| 10118 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10119 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10120 | { |
| 10121 | struct net_device *dev = pAdapter->dev; |
| 10122 | union iwreq_data wrqu; |
| 10123 | int we_event; |
| 10124 | char *msg; |
| 10125 | |
| 10126 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 10127 | we_event = SIOCGIWSCAN; |
| 10128 | msg = NULL; |
| 10129 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 10130 | } |
| 10131 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10132 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10133 | |
| 10134 | /* Get the Scan Req */ |
| 10135 | req = pAdapter->request; |
| 10136 | |
| 10137 | if (!req) |
| 10138 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10139 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10140 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10141 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10142 | } |
| 10143 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10144 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10145 | /* Scan is no longer pending */ |
| 10146 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10147 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10148 | /* last_scan_timestamp is used to decide if new scan |
| 10149 | * is needed or not on station interface. If last station |
| 10150 | * scan time and new station scan time is less then |
| 10151 | * last_scan_timestamp ; driver will return cached scan. |
| 10152 | */ |
| 10153 | if (req->no_cck == FALSE && status == eCSR_SCAN_SUCCESS) // no_cck will be set during p2p find |
| 10154 | { |
| 10155 | pScanInfo->last_scan_timestamp = vos_timer_get_system_time(); |
| 10156 | |
| 10157 | if ( req->n_channels ) |
| 10158 | { |
| 10159 | for (i = 0; i < req->n_channels ; i++ ) |
| 10160 | { |
| 10161 | pHddCtx->scan_info.last_scan_channelList[i] = req->channels[i]->hw_value; |
| 10162 | } |
| 10163 | /* store no of channel scanned */ |
| 10164 | pHddCtx->scan_info.last_scan_numChannels= req->n_channels; |
| 10165 | } |
| 10166 | |
| 10167 | } |
| 10168 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 10169 | /* |
| 10170 | * cfg80211_scan_done informing NL80211 about completion |
| 10171 | * of scanning |
| 10172 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 10173 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 10174 | { |
| 10175 | aborted = true; |
| 10176 | } |
| 10177 | cfg80211_scan_done(req, aborted); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 10178 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10179 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10180 | if (pHddCtx->spoofMacAddr.isEnabled || pHddCtx->spoofMacAddr.isReqDeferred) { |
| 10181 | /* Generate new random mac addr for next scan */ |
| 10182 | hddLog(VOS_TRACE_LEVEL_INFO, "scan completed - generate new spoof mac addr"); |
| 10183 | hdd_processSpoofMacAddrRequest(pHddCtx); |
| 10184 | } |
| 10185 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10186 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10187 | /* release the wake lock at the end of the scan*/ |
| 10188 | hdd_allow_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10189 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 10190 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 10191 | * immediatly after the driver gets connect request(i.e after scan) |
| 10192 | * from supplicant, this result in app's is suspending and not able |
| 10193 | * to process the connect request to AP */ |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 10194 | hdd_prevent_suspend_timeout(1000); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 10195 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 10196 | #ifdef FEATURE_WLAN_TDLS |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10197 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 10198 | #endif |
| 10199 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10200 | EXIT(); |
| 10201 | return 0; |
| 10202 | } |
| 10203 | |
| 10204 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10205 | * FUNCTION: hdd_isConnectionInProgress |
| 10206 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10207 | * |
| 10208 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10209 | v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10210 | { |
| 10211 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 10212 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 10213 | hdd_adapter_t *pAdapter = NULL; |
| 10214 | VOS_STATUS status = 0; |
| 10215 | v_U8_t staId = 0; |
| 10216 | v_U8_t *staMac = NULL; |
| 10217 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 10218 | if (TRUE == pHddCtx->btCoexModeSet) |
| 10219 | { |
| 10220 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10221 | FL("BTCoex Mode operation in progress")); |
| 10222 | return VOS_TRUE; |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 10223 | } |
| 10224 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10225 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 10226 | |
| 10227 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 10228 | { |
| 10229 | pAdapter = pAdapterNode->pAdapter; |
| 10230 | |
| 10231 | if( pAdapter ) |
| 10232 | { |
| 10233 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10234 | "%s: Adapter with device mode %s (%d) exists", |
| 10235 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10236 | pAdapter->device_mode); |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10237 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10238 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10239 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 10240 | (eConnectionState_Connecting == |
| 10241 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 10242 | { |
| 10243 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10244 | "%s: %p(%d) Connection is in progress", __func__, |
| 10245 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 10246 | return VOS_TRUE; |
| 10247 | } |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10248 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Padma, Santhosh Kumar | 3b9657d | 2015-02-04 19:37:32 +0530 | [diff] [blame] | 10249 | smeNeighborMiddleOfRoaming(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10250 | { |
| 10251 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10252 | "%s: %p(%d) Reassociation is in progress", __func__, |
| 10253 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 10254 | return VOS_TRUE; |
| 10255 | } |
| 10256 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10257 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10258 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10259 | { |
| 10260 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10261 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10262 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10263 | { |
| 10264 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 10265 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10266 | "%s: client " MAC_ADDRESS_STR |
| 10267 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 10268 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10269 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10270 | } |
| 10271 | } |
| 10272 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 10273 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 10274 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10275 | v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 10276 | ptSapContext pSapCtx = NULL; |
| 10277 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 10278 | if(pSapCtx == NULL){ |
| 10279 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10280 | FL("psapCtx is NULL")); |
| 10281 | return VOS_FALSE; |
| 10282 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10283 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 10284 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10285 | if ((pSapCtx->aStaInfo[staId].isUsed) && |
| 10286 | (WLANTL_STA_CONNECTED == pSapCtx->aStaInfo[staId].tlSTAState)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10287 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 10288 | staMac = (v_U8_t *) &(pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10289 | |
| 10290 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10291 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 10292 | "middle of WPS/EAPOL exchange.", __func__, |
| 10293 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10294 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10295 | } |
| 10296 | } |
| 10297 | } |
| 10298 | } |
| 10299 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 10300 | pAdapterNode = pNext; |
| 10301 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 10302 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10303 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10304 | |
| 10305 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10306 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10307 | * this scan respond to scan trigger and update cfg80211 scan database |
| 10308 | * later, scan dump command can be used to recieve scan results |
| 10309 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10310 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 10311 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10312 | struct net_device *dev, |
| 10313 | #endif |
| 10314 | struct cfg80211_scan_request *request) |
| 10315 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10316 | hdd_adapter_t *pAdapter = NULL; |
| 10317 | hdd_context_t *pHddCtx = NULL; |
| 10318 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10319 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10320 | tCsrScanRequest scanRequest; |
| 10321 | tANI_U8 *channelList = NULL, i; |
| 10322 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10323 | int status; |
| 10324 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10325 | v_U8_t* pP2pIe = NULL; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10326 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10327 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10328 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 10329 | struct net_device *dev = NULL; |
| 10330 | if (NULL == request) |
| 10331 | { |
| 10332 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10333 | "%s: scan req param null", __func__); |
| 10334 | return -EINVAL; |
| 10335 | } |
| 10336 | dev = request->wdev->netdev; |
| 10337 | #endif |
| 10338 | |
| 10339 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 10340 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 10341 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10342 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10343 | ENTER(); |
| 10344 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10345 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 10346 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10347 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10348 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10349 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10350 | if (0 != status) |
| 10351 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10352 | return status; |
| 10353 | } |
| 10354 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10355 | if (NULL == pwextBuf) |
| 10356 | { |
| 10357 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 10358 | __func__); |
| 10359 | return -EIO; |
| 10360 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10361 | cfg_param = pHddCtx->cfg_ini; |
| 10362 | pScanInfo = &pHddCtx->scan_info; |
| 10363 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10364 | #ifdef WLAN_BTAMP_FEATURE |
| 10365 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10366 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10367 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 10368 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10369 | "%s: No scanning when AMP is on", __func__); |
| 10370 | return -EOPNOTSUPP; |
| 10371 | } |
| 10372 | #endif |
| 10373 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10374 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10375 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10376 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10377 | "%s: Not scanning on device_mode = %s (%d)", |
| 10378 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10379 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10380 | return -EOPNOTSUPP; |
| 10381 | } |
| 10382 | |
| 10383 | if (TRUE == pScanInfo->mScanPending) |
| 10384 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10385 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 10386 | { |
| 10387 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 10388 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10389 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10390 | } |
| 10391 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10392 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10393 | //Channel and action frame is pending |
| 10394 | //Otherwise Cancel Remain On Channel and allow Scan |
| 10395 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10396 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10397 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 10398 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10399 | return -EBUSY; |
| 10400 | } |
| 10401 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10402 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 10403 | { |
| 10404 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 10405 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10406 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10407 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10408 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 10409 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10410 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10411 | "%s: MAX TM Level Scan not allowed", __func__); |
| 10412 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10413 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10414 | } |
| 10415 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 10416 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10417 | /* Check if scan is allowed at this point of time. |
| 10418 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 10419 | if (hdd_isConnectionInProgress(pHddCtx)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 10420 | { |
| 10421 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 10422 | return -EBUSY; |
| 10423 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10424 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10425 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 10426 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10427 | hddLog(VOS_TRACE_LEVEL_INFO, "scan request for ssid = %d", |
| 10428 | (int)request->n_ssids); |
| 10429 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10430 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10431 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 10432 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 10433 | * is not aging out the scan results. |
| 10434 | */ |
| 10435 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10436 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10437 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10438 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10439 | |
| 10440 | if ((request->ssids) && (0 < request->n_ssids)) |
| 10441 | { |
| 10442 | tCsrSSIDInfo *SsidInfo; |
| 10443 | int j; |
| 10444 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 10445 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 10446 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 10447 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 10448 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 10449 | |
| 10450 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 10451 | { |
| 10452 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10453 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 10454 | return -ENOMEM; |
| 10455 | } |
| 10456 | |
| 10457 | /* copy all the ssid's and their length */ |
| 10458 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 10459 | { |
| 10460 | /* get the ssid length */ |
| 10461 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 10462 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 10463 | SsidInfo->SSID.length); |
| 10464 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 10465 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 10466 | j, SsidInfo->SSID.ssId); |
| 10467 | } |
| 10468 | /* set the scan type to active */ |
| 10469 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 10470 | } |
| 10471 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10472 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 10473 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10474 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 10475 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10476 | /* set the scan type to active */ |
| 10477 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10478 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10479 | else |
| 10480 | { |
| 10481 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 10482 | scanRequest.scanType = pScanInfo->scan_mode; |
| 10483 | } |
| 10484 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 10485 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10486 | |
| 10487 | /* set BSSType to default type */ |
| 10488 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 10489 | |
| 10490 | /*TODO: scan the requested channels only*/ |
| 10491 | |
| 10492 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10493 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10494 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10495 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10496 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 10497 | request->n_channels = MAX_CHANNEL; |
| 10498 | } |
| 10499 | |
| 10500 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10501 | "No of Scan Channels: %d", request->n_channels); |
| 10502 | |
| 10503 | |
| 10504 | if( request->n_channels ) |
| 10505 | { |
| 10506 | char chList [(request->n_channels*5)+1]; |
| 10507 | int len; |
| 10508 | channelList = vos_mem_malloc( request->n_channels ); |
| 10509 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10510 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10511 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10512 | "%s: memory alloc failed channelList", __func__); |
| 10513 | status = -ENOMEM; |
| 10514 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10515 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10516 | |
| 10517 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 10518 | { |
| 10519 | channelList[i] = request->channels[i]->hw_value; |
| 10520 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 10521 | } |
| 10522 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10523 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10524 | "Channel-List: %s ", chList); |
| 10525 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 10526 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10527 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 10528 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 10529 | |
| 10530 | /* set requestType to full scan */ |
| 10531 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 10532 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10533 | /* if there is back to back scan happening in driver with in |
| 10534 | * nDeferScanTimeInterval interval driver should defer new scan request |
| 10535 | * and should provide last cached scan results instead of new channel list. |
| 10536 | * This rule is not applicable if scan is p2p scan. |
| 10537 | * This condition will work only in case when last request no of channels |
| 10538 | * and channels are exactly same as new request. |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10539 | * This should be done only in connected state |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10540 | */ |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10541 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10542 | if ((VOS_STATUS_SUCCESS == hdd_is_any_session_connected(pHddCtx))) |
| 10543 | { |
| 10544 | if ( pScanInfo->last_scan_timestamp !=0 && |
| 10545 | ((vos_timer_get_system_time() - pScanInfo->last_scan_timestamp ) < pHddCtx->cfg_ini->nDeferScanTimeInterval)) |
| 10546 | { |
| 10547 | if ( request->no_cck == FALSE && scanRequest.ChannelInfo.numOfChannels != 1 && |
| 10548 | (pScanInfo->last_scan_numChannels == scanRequest.ChannelInfo.numOfChannels) && |
| 10549 | vos_mem_compare(pScanInfo->last_scan_channelList, |
| 10550 | channelList, pScanInfo->last_scan_numChannels)) |
| 10551 | { |
| 10552 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10553 | " New and old station scan time differ is less then %u", |
| 10554 | pHddCtx->cfg_ini->nDeferScanTimeInterval); |
| 10555 | |
| 10556 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10557 | pAdapter); |
| 10558 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10559 | hddLog(VOS_TRACE_LEVEL_WARN, |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 10560 | "Return old cached scan as all channels and no of channels are same"); |
| 10561 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10562 | if (0 > ret) |
| 10563 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10564 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10565 | cfg80211_scan_done(request, eCSR_SCAN_SUCCESS); |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 10566 | |
| 10567 | status = eHAL_STATUS_SUCCESS; |
| 10568 | goto free_mem; |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 10569 | } |
| 10570 | } |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 10571 | } |
| 10572 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10573 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 10574 | * search (Flush on both full scan and social scan but not on single |
| 10575 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 10576 | */ |
| 10577 | |
| 10578 | /* Supplicant does single channel scan after 8-way handshake |
| 10579 | * and in that case driver shoudnt flush scan results. If |
| 10580 | * driver flushes the scan results here and unfortunately if |
| 10581 | * the AP doesnt respond to our probe req then association |
| 10582 | * fails which is not desired |
| 10583 | */ |
| 10584 | |
| 10585 | if( request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN ) |
| 10586 | { |
| 10587 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 10588 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10589 | pAdapter->sessionId ); |
| 10590 | } |
| 10591 | |
| 10592 | if( request->ie_len ) |
| 10593 | { |
| 10594 | /* save this for future association (join requires this) */ |
| 10595 | /*TODO: Array needs to be converted to dynamic allocation, |
| 10596 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 10597 | * CR 597966 |
| 10598 | */ |
| 10599 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 10600 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 10601 | pScanInfo->scanAddIE.length = request->ie_len; |
| 10602 | |
| 10603 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 10604 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 10605 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10606 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10607 | if ( request->ie_len <= SIR_MAC_MAX_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10608 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10609 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 10610 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 10611 | request->ie, request->ie_len); |
| 10612 | } |
| 10613 | else |
| 10614 | { |
| 10615 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 10616 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10617 | } |
| 10618 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10619 | } |
| 10620 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 10621 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 10622 | |
| 10623 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 10624 | request->ie_len); |
| 10625 | if (pP2pIe != NULL) |
| 10626 | { |
| 10627 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 10628 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 10629 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 10630 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10631 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10632 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 10633 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 10634 | "Go nego completed to Connection is started"); |
| 10635 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 10636 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10637 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10638 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 10639 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10640 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10641 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 10642 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 10643 | "Disconnected state to Connection is started"); |
| 10644 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 10645 | "for 4way Handshake"); |
| 10646 | } |
| 10647 | #endif |
| 10648 | |
| 10649 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 10650 | if(TRUE == request->no_cck) |
| 10651 | { |
| 10652 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10653 | "%s: This is a P2P Search", __func__); |
| 10654 | scanRequest.p2pSearch = 1; |
| 10655 | |
| 10656 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10657 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10658 | /* set requestType to P2P Discovery */ |
| 10659 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 10660 | } |
| 10661 | |
| 10662 | /* |
| 10663 | Skip Dfs Channel in case of P2P Search |
| 10664 | if it is set in ini file |
| 10665 | */ |
| 10666 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 10667 | { |
| 10668 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10669 | } |
| 10670 | else |
| 10671 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 10672 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10673 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10674 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 10675 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10676 | } |
| 10677 | } |
| 10678 | |
| 10679 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 10680 | |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10681 | #ifdef FEATURE_WLAN_TDLS |
| 10682 | /* if tdls disagree scan right now, return immediately. |
| 10683 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 10684 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 10685 | */ |
| 10686 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 10687 | wiphy, |
| 10688 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10689 | dev, |
| 10690 | #endif |
| 10691 | request); |
| 10692 | if(status <= 0) |
| 10693 | { |
| 10694 | if(!status) |
| 10695 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 10696 | "scan rejected %d", __func__, status); |
| 10697 | else |
| 10698 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 10699 | __func__, status); |
| 10700 | |
| 10701 | return status; |
| 10702 | } |
| 10703 | #endif |
| 10704 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10705 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 10706 | * address the following issues. |
| 10707 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 10708 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 10709 | * for long time, this result in apps running at full power for long time. |
| 10710 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 10711 | * be stuck in full power because of resume BMPS |
| 10712 | */ |
| 10713 | hdd_prevent_suspend(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10714 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10715 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 10716 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10717 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 10718 | scanRequest.requestType, scanRequest.scanType, |
| 10719 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10720 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 10721 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 10722 | if (pHddCtx->spoofMacAddr.isEnabled) |
| 10723 | { |
| 10724 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10725 | "%s: MAC Spoofing enabled for current scan", __func__); |
| 10726 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 10727 | * to fill TxBds for probe request during current scan |
| 10728 | */ |
| 10729 | WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
| 10730 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
| 10731 | } |
| 10732 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10733 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10734 | pAdapter->sessionId, &scanRequest, &scanId, |
| 10735 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10736 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10737 | if (eHAL_STATUS_SUCCESS != status) |
| 10738 | { |
| 10739 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10740 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 10741 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 10742 | if(eHAL_STATUS_RESOURCES == status) |
| 10743 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 10744 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 10745 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 10746 | status = -EBUSY; |
| 10747 | } else { |
| 10748 | status = -EIO; |
| 10749 | } |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 10750 | hdd_allow_suspend(); |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 10751 | |
| 10752 | #ifdef FEATURE_WLAN_TDLS |
| 10753 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 10754 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10755 | goto free_mem; |
| 10756 | } |
| 10757 | |
| 10758 | pScanInfo->mScanPending = TRUE; |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 10759 | pScanInfo->sessionId = pAdapter->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10760 | pAdapter->request = request; |
| 10761 | pScanInfo->scanId = scanId; |
| 10762 | |
| 10763 | complete(&pScanInfo->scan_req_completion_event); |
| 10764 | |
| 10765 | free_mem: |
| 10766 | if( scanRequest.SSIDs.SSIDList ) |
| 10767 | { |
| 10768 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 10769 | } |
| 10770 | |
| 10771 | if( channelList ) |
| 10772 | vos_mem_free( channelList ); |
| 10773 | |
| 10774 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10775 | return status; |
| 10776 | } |
| 10777 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 10778 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 10779 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10780 | struct net_device *dev, |
| 10781 | #endif |
| 10782 | struct cfg80211_scan_request *request) |
| 10783 | { |
| 10784 | int ret; |
| 10785 | |
| 10786 | vos_ssr_protect(__func__); |
| 10787 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 10788 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 10789 | dev, |
| 10790 | #endif |
| 10791 | request); |
| 10792 | vos_ssr_unprotect(__func__); |
| 10793 | |
| 10794 | return ret; |
| 10795 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10796 | |
| 10797 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 10798 | { |
| 10799 | v_U8_t iniDot11Mode = |
| 10800 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 10801 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 10802 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10803 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 10804 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10805 | switch ( iniDot11Mode ) |
| 10806 | { |
| 10807 | case eHDD_DOT11_MODE_AUTO: |
| 10808 | case eHDD_DOT11_MODE_11ac: |
| 10809 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 10810 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 4b1d235 | 2014-08-01 21:59:28 +0530 | [diff] [blame] | 10811 | if ( sme_IsFeatureSupportedByDriver(DOT11AC) && |
| 10812 | sme_IsFeatureSupportedByFW(DOT11AC) ) |
| 10813 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 10814 | else |
| 10815 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10816 | #else |
| 10817 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 10818 | #endif |
| 10819 | break; |
| 10820 | case eHDD_DOT11_MODE_11n: |
| 10821 | case eHDD_DOT11_MODE_11n_ONLY: |
| 10822 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 10823 | break; |
| 10824 | default: |
| 10825 | hddDot11Mode = iniDot11Mode; |
| 10826 | break; |
| 10827 | } |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 10828 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 10829 | if (operationChannel > SIR_11B_CHANNEL_END) |
| 10830 | #endif |
| 10831 | { |
| 10832 | /* This call decides required channel bonding mode */ |
| 10833 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10834 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 10835 | operationChannel); |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 10836 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10837 | } |
| 10838 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10839 | /* |
| 10840 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10841 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10842 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10843 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10844 | const u8 *ssid, size_t ssid_len, const u8 *bssid, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10845 | { |
| 10846 | int status = 0; |
| 10847 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 10848 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10849 | v_U32_t roamId; |
| 10850 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10851 | eCsrAuthType RSNAuthType; |
| 10852 | |
| 10853 | ENTER(); |
| 10854 | |
| 10855 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 10856 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10857 | |
| 10858 | status = wlan_hdd_validate_context(pHddCtx); |
| 10859 | if (status) |
| 10860 | { |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 10861 | return status; |
| 10862 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10863 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10864 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 10865 | { |
| 10866 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 10867 | return -EINVAL; |
| 10868 | } |
| 10869 | |
| 10870 | pRoamProfile = &pWextState->roamProfile; |
| 10871 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10872 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10873 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10874 | hdd_station_ctx_t *pHddStaCtx; |
| 10875 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10876 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10877 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10878 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 10879 | { |
| 10880 | /*QoS not enabled in cfg file*/ |
| 10881 | pRoamProfile->uapsd_mask = 0; |
| 10882 | } |
| 10883 | else |
| 10884 | { |
| 10885 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10886 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10887 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 10888 | } |
| 10889 | |
| 10890 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 10891 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 10892 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10893 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10894 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 10895 | ssid, ssid_len); |
| 10896 | |
| 10897 | if (bssid) |
| 10898 | { |
| 10899 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
| 10900 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), bssid, |
| 10901 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10902 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 10903 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10904 | case of join failure we should send valid BSSID to supplicant |
| 10905 | */ |
| 10906 | vos_mem_copy((void *)(pWextState->req_bssId), bssid, |
| 10907 | WNI_CFG_BSSID_LEN); |
| 10908 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 10909 | else |
| 10910 | { |
| 10911 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 10912 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10913 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10914 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 10915 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10916 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 10917 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10918 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10919 | /*set gen ie*/ |
| 10920 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 10921 | /*set auth*/ |
| 10922 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 10923 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10924 | #ifdef FEATURE_WLAN_WAPI |
| 10925 | if (pAdapter->wapi_info.nWapiMode) |
| 10926 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10927 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10928 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 10929 | { |
| 10930 | case WAPI_AUTH_MODE_PSK: |
| 10931 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10932 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10933 | pAdapter->wapi_info.wapiAuthMode); |
| 10934 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 10935 | break; |
| 10936 | } |
| 10937 | case WAPI_AUTH_MODE_CERT: |
| 10938 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10939 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10940 | pAdapter->wapi_info.wapiAuthMode); |
| 10941 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 10942 | break; |
| 10943 | } |
| 10944 | } // End of switch |
| 10945 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 10946 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 10947 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10948 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10949 | pRoamProfile->AuthType.numEntries = 1; |
| 10950 | pRoamProfile->EncryptionType.numEntries = 1; |
| 10951 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 10952 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 10953 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 10954 | } |
| 10955 | } |
| 10956 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 10957 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 10958 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 10959 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 10960 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 10961 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 10962 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 10963 | sizeof (tSirGtkOffloadParams)); |
| 10964 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 10965 | } |
| 10966 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10967 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 10968 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10969 | if( operatingChannel ) |
| 10970 | { |
| 10971 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 10972 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 10973 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 10974 | else |
| 10975 | { |
| 10976 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 10977 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 10978 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 10979 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 10980 | { |
| 10981 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 10982 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 10983 | |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 10984 | /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect() |
| 10985 | * has a direct path to call hdd_smeRoamCallback(), which will change the conn_state |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10986 | * If direct path, conn_state will be accordingly changed to NotConnected or Associated |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 10987 | * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback() |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 10988 | * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. |
| 10989 | */ |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 10990 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 10991 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 10992 | { |
| 10993 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10994 | "%s: Set HDD connState to eConnectionState_Connecting", |
| 10995 | __func__); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 10996 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 10997 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 10998 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10999 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11000 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 11001 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 11002 | if ((eHAL_STATUS_SUCCESS != status) && |
| 11003 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 11004 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11005 | |
| 11006 | { |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11007 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with " |
| 11008 | "status %d. -> NotConnected", __func__, pAdapter->sessionId, status); |
| 11009 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11010 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 11011 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 11012 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 11013 | |
| 11014 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 11015 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 11016 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11017 | } |
| 11018 | else |
| 11019 | { |
| 11020 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 11021 | return -EINVAL; |
| 11022 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 11023 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11024 | return status; |
| 11025 | } |
| 11026 | |
| 11027 | /* |
| 11028 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 11029 | * This function is used to set the authentication type (OPEN/SHARED). |
| 11030 | * |
| 11031 | */ |
| 11032 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 11033 | enum nl80211_auth_type auth_type) |
| 11034 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11035 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11036 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11037 | |
| 11038 | ENTER(); |
| 11039 | |
| 11040 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11041 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11042 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11043 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11044 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11045 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 11046 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 11047 | break; |
| 11048 | |
| 11049 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11050 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11051 | case NL80211_AUTHTYPE_FT: |
| 11052 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11053 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11054 | "%s: set authentication type to OPEN", __func__); |
| 11055 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 11056 | break; |
| 11057 | |
| 11058 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11059 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11060 | "%s: set authentication type to SHARED", __func__); |
| 11061 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 11062 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11063 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11064 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11065 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11066 | "%s: set authentication type to CCKM WPA", __func__); |
| 11067 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 11068 | break; |
| 11069 | #endif |
| 11070 | |
| 11071 | |
| 11072 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11073 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11074 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11075 | auth_type); |
| 11076 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 11077 | return -EINVAL; |
| 11078 | } |
| 11079 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11080 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11081 | pHddStaCtx->conn_info.authType; |
| 11082 | return 0; |
| 11083 | } |
| 11084 | |
| 11085 | /* |
| 11086 | * FUNCTION: wlan_hdd_set_akm_suite |
| 11087 | * This function is used to set the key mgmt type(PSK/8021x). |
| 11088 | * |
| 11089 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11090 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11091 | u32 key_mgmt |
| 11092 | ) |
| 11093 | { |
| 11094 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11095 | ENTER(); |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11096 | /* Should be in ieee802_11_defs.h */ |
| 11097 | #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05 |
| 11098 | #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11099 | /*set key mgmt type*/ |
| 11100 | switch(key_mgmt) |
| 11101 | { |
| 11102 | case WLAN_AKM_SUITE_PSK: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11103 | case WLAN_AKM_SUITE_PSK_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 11104 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11105 | case WLAN_AKM_SUITE_FT_PSK: |
| 11106 | #endif |
| 11107 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11108 | __func__); |
| 11109 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 11110 | break; |
| 11111 | |
| 11112 | case WLAN_AKM_SUITE_8021X: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 11113 | case WLAN_AKM_SUITE_8021X_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 11114 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11115 | case WLAN_AKM_SUITE_FT_8021X: |
| 11116 | #endif |
| 11117 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11118 | __func__); |
| 11119 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 11120 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11121 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11122 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 11123 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 11124 | case WLAN_AKM_SUITE_CCKM: |
| 11125 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 11126 | __func__); |
| 11127 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 11128 | break; |
| 11129 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 11130 | #ifndef WLAN_AKM_SUITE_OSEN |
| 11131 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 11132 | case WLAN_AKM_SUITE_OSEN: |
| 11133 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 11134 | __func__); |
| 11135 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 11136 | break; |
| 11137 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11138 | |
| 11139 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11140 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11141 | __func__, key_mgmt); |
| 11142 | return -EINVAL; |
| 11143 | |
| 11144 | } |
| 11145 | return 0; |
| 11146 | } |
| 11147 | |
| 11148 | /* |
| 11149 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11150 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11151 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 11152 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11153 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 11154 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11155 | bool ucast |
| 11156 | ) |
| 11157 | { |
| 11158 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11159 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11160 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11161 | |
| 11162 | ENTER(); |
| 11163 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11164 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11165 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11166 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11167 | __func__, cipher); |
| 11168 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11169 | } |
| 11170 | else |
| 11171 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11172 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11173 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11174 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11175 | { |
| 11176 | case IW_AUTH_CIPHER_NONE: |
| 11177 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 11178 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11179 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11180 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11181 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11182 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11183 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11184 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11185 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11186 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11187 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11188 | case WLAN_CIPHER_SUITE_TKIP: |
| 11189 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 11190 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11191 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11192 | case WLAN_CIPHER_SUITE_CCMP: |
| 11193 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 11194 | break; |
| 11195 | #ifdef FEATURE_WLAN_WAPI |
| 11196 | case WLAN_CIPHER_SUITE_SMS4: |
| 11197 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 11198 | break; |
| 11199 | #endif |
| 11200 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11201 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11202 | case WLAN_CIPHER_SUITE_KRK: |
| 11203 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 11204 | break; |
| 11205 | #endif |
| 11206 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11207 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11208 | __func__, cipher); |
| 11209 | return -EOPNOTSUPP; |
| 11210 | } |
| 11211 | } |
| 11212 | |
| 11213 | if (ucast) |
| 11214 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11215 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11216 | __func__, encryptionType); |
| 11217 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 11218 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11219 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11220 | encryptionType; |
| 11221 | } |
| 11222 | else |
| 11223 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11224 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11225 | __func__, encryptionType); |
| 11226 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 11227 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 11228 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 11229 | } |
| 11230 | |
| 11231 | return 0; |
| 11232 | } |
| 11233 | |
| 11234 | |
| 11235 | /* |
| 11236 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 11237 | * This function is used to parse WPA/RSN IE's. |
| 11238 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11239 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
| 11240 | u8 *ie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11241 | size_t ie_len |
| 11242 | ) |
| 11243 | { |
| 11244 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11245 | u8 *genie = ie; |
| 11246 | v_U16_t remLen = ie_len; |
| 11247 | #ifdef FEATURE_WLAN_WAPI |
| 11248 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 11249 | u16 *tmp; |
| 11250 | v_U16_t akmsuiteCount; |
| 11251 | int *akmlist; |
| 11252 | #endif |
| 11253 | ENTER(); |
| 11254 | |
| 11255 | /* clear previous assocAddIE */ |
| 11256 | pWextState->assocAddIE.length = 0; |
| 11257 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11258 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11259 | |
| 11260 | while (remLen >= 2) |
| 11261 | { |
| 11262 | v_U16_t eLen = 0; |
| 11263 | v_U8_t elementId; |
| 11264 | elementId = *genie++; |
| 11265 | eLen = *genie++; |
| 11266 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11267 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11268 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11269 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11270 | |
| 11271 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11272 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11273 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11274 | 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] | 11275 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11276 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11277 | "%s: Invalid WPA IE", __func__); |
| 11278 | return -EINVAL; |
| 11279 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11280 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11281 | { |
| 11282 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11283 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11284 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11286 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 11287 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11288 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 11289 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11290 | VOS_ASSERT(0); |
| 11291 | return -ENOMEM; |
| 11292 | } |
| 11293 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 11294 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11295 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11296 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11297 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 11298 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11299 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11300 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11301 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 11302 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11303 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 11304 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 11305 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 11306 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 11307 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 11308 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11309 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 11310 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11311 | { |
| 11312 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11313 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11314 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11315 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11316 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 11317 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11318 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11319 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11320 | VOS_ASSERT(0); |
| 11321 | return -ENOMEM; |
| 11322 | } |
| 11323 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 11324 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11325 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11326 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11327 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11328 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11329 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11330 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11331 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 11332 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11333 | /*Consider WFD IE, only for P2P Client */ |
| 11334 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 11335 | { |
| 11336 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11337 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11338 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11339 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11340 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 11341 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11342 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11343 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11344 | VOS_ASSERT(0); |
| 11345 | return -ENOMEM; |
| 11346 | } |
| 11347 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 11348 | // WPS IE + P2P IE + WFD IE |
| 11349 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11350 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11351 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11352 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11353 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11354 | } |
| 11355 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11356 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11357 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11358 | HS20_OUI_TYPE_SIZE)) ) |
| 11359 | { |
| 11360 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11361 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11362 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11363 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11364 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 11365 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11366 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11367 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11368 | VOS_ASSERT(0); |
| 11369 | return -ENOMEM; |
| 11370 | } |
| 11371 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11372 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11373 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 11374 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11375 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11376 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11377 | /* Appending OSEN Information Element in Assiciation Request */ |
| 11378 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 11379 | OSEN_OUI_TYPE_SIZE)) ) |
| 11380 | { |
| 11381 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 11382 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 11383 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11384 | |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 11385 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 11386 | { |
| 11387 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11388 | "Need bigger buffer space"); |
| 11389 | VOS_ASSERT(0); |
| 11390 | return -ENOMEM; |
| 11391 | } |
| 11392 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11393 | pWextState->assocAddIE.length += eLen + 2; |
| 11394 | |
| 11395 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 11396 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11397 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11398 | } |
| 11399 | |
| 11400 | break; |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 11401 | if (WLAN_HDD_IBSS == pAdapter->device_mode) { |
| 11402 | |
| 11403 | /* populating as ADDIE in beacon frames */ |
| 11404 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11405 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie - 2, eLen + 2, |
| 11406 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 11407 | { |
| 11408 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11409 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 11410 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 11411 | { |
| 11412 | hddLog(LOGE, |
| 11413 | "Coldn't pass " |
| 11414 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 11415 | } |
| 11416 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 11417 | else |
| 11418 | hddLog(LOGE, |
| 11419 | "Could not pass on " |
| 11420 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 11421 | |
| 11422 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 11423 | beaconIE's need to be populated in probe response frames */ |
| 11424 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 11425 | { |
| 11426 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 11427 | u8 probe_rsp_ie_len[3] = {0}; |
| 11428 | u8 counter = 0; |
| 11429 | |
| 11430 | /* Check Probe Resp Length if it is greater then 255 then |
| 11431 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 11432 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 11433 | not able Store More then 255 bytes into One Variable */ |
| 11434 | |
| 11435 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 11436 | { |
| 11437 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 11438 | { |
| 11439 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 11440 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 11441 | } |
| 11442 | else |
| 11443 | { |
| 11444 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 11445 | rem_probe_resp_ie_len = 0; |
| 11446 | } |
| 11447 | } |
| 11448 | |
| 11449 | rem_probe_resp_ie_len = 0; |
| 11450 | |
| 11451 | if (probe_rsp_ie_len[0] > 0) |
| 11452 | { |
| 11453 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11454 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 11455 | (tANI_U8*)(genie - 2), |
| 11456 | probe_rsp_ie_len[0], NULL, |
| 11457 | eANI_BOOLEAN_FALSE) |
| 11458 | == eHAL_STATUS_FAILURE) |
| 11459 | { |
| 11460 | hddLog(LOGE, |
| 11461 | "Could not pass" |
| 11462 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 11463 | } |
| 11464 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 11465 | } |
| 11466 | |
| 11467 | if (probe_rsp_ie_len[1] > 0) |
| 11468 | { |
| 11469 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11470 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 11471 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 11472 | probe_rsp_ie_len[1], NULL, |
| 11473 | eANI_BOOLEAN_FALSE) |
| 11474 | == eHAL_STATUS_FAILURE) |
| 11475 | { |
| 11476 | hddLog(LOGE, |
| 11477 | "Could not pass" |
| 11478 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 11479 | } |
| 11480 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 11481 | } |
| 11482 | |
| 11483 | if (probe_rsp_ie_len[2] > 0) |
| 11484 | { |
| 11485 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11486 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 11487 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 11488 | probe_rsp_ie_len[2], NULL, |
| 11489 | eANI_BOOLEAN_FALSE) |
| 11490 | == eHAL_STATUS_FAILURE) |
| 11491 | { |
| 11492 | hddLog(LOGE, |
| 11493 | "Could not pass" |
| 11494 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 11495 | } |
| 11496 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 11497 | } |
| 11498 | |
| 11499 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11500 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 11501 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 11502 | { |
| 11503 | hddLog(LOGE, |
| 11504 | "Could not pass" |
| 11505 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 11506 | } |
| 11507 | } |
| 11508 | else |
| 11509 | { |
| 11510 | // Reset WNI_CFG_PROBE_RSP Flags |
| 11511 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 11512 | |
| 11513 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11514 | "%s: No Probe Response IE received in set beacon", |
| 11515 | __func__); |
| 11516 | } |
| 11517 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11518 | break; |
| 11519 | case DOT11F_EID_RSN: |
| 11520 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 11521 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 11522 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 11523 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 11524 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 11525 | break; |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 11526 | |
| 11527 | /* Appending Extended Capabilities with Interworking bit set |
| 11528 | * in Assoc Req. |
| 11529 | * |
| 11530 | * In assoc req this EXT Cap will only be taken into account if |
| 11531 | * interworkingService bit is set to 1. Currently |
| 11532 | * driver is only interested in interworkingService capability |
| 11533 | * from supplicant. If in future any other EXT Cap info is |
| 11534 | * required from supplicat, it needs to be handled while |
| 11535 | * sending Assoc Req in LIM. |
| 11536 | */ |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11537 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11538 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11539 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11540 | 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] | 11541 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11542 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11543 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
| 11544 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 11545 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 11546 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11547 | VOS_ASSERT(0); |
| 11548 | return -ENOMEM; |
| 11549 | } |
| 11550 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 11551 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11552 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11553 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 11554 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 11555 | break; |
| 11556 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11557 | #ifdef FEATURE_WLAN_WAPI |
| 11558 | case WLAN_EID_WAPI: |
| 11559 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 11560 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11561 | pAdapter->wapi_info.nWapiMode); |
| 11562 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11563 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11564 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 11565 | tmp = tmp + 1; |
| 11566 | akmlist = (int *)(tmp); |
| 11567 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 11568 | { |
| 11569 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 11570 | } |
| 11571 | else |
| 11572 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11573 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11574 | VOS_ASSERT(0); |
| 11575 | return -EINVAL; |
| 11576 | } |
| 11577 | |
| 11578 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 11579 | { |
| 11580 | 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] | 11581 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11582 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11583 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11584 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11585 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11586 | 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] | 11587 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11588 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 11589 | } |
| 11590 | break; |
| 11591 | #endif |
| 11592 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11593 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11594 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 11595 | /* when Unknown IE is received we should break and continue |
| 11596 | * to the next IE in the buffer instead we were returning |
| 11597 | * so changing this to break */ |
| 11598 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11599 | } |
| 11600 | genie += eLen; |
| 11601 | remLen -= eLen; |
| 11602 | } |
| 11603 | EXIT(); |
| 11604 | return 0; |
| 11605 | } |
| 11606 | |
| 11607 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 11608 | * FUNCTION: hdd_isWPAIEPresent |
| 11609 | * Parse the received IE to find the WPA IE |
| 11610 | * |
| 11611 | */ |
| 11612 | static bool hdd_isWPAIEPresent(u8 *ie, u8 ie_len) |
| 11613 | { |
| 11614 | v_U8_t eLen = 0; |
| 11615 | v_U16_t remLen = ie_len; |
| 11616 | v_U8_t elementId = 0; |
| 11617 | |
| 11618 | while (remLen >= 2) |
| 11619 | { |
| 11620 | elementId = *ie++; |
| 11621 | eLen = *ie++; |
| 11622 | remLen -= 2; |
| 11623 | if (eLen > remLen) |
| 11624 | { |
| 11625 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11626 | "%s: IE length is wrong %d", __func__, eLen); |
| 11627 | return FALSE; |
| 11628 | } |
| 11629 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 11630 | { |
| 11631 | /* OUI - 0x00 0X50 0XF2 |
| 11632 | WPA Information Element - 0x01 |
| 11633 | WPA version - 0x01*/ |
| 11634 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 11635 | return TRUE; |
| 11636 | } |
| 11637 | ie += eLen; |
| 11638 | remLen -= eLen; |
| 11639 | } |
| 11640 | return FALSE; |
| 11641 | } |
| 11642 | |
| 11643 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11644 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11645 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11646 | * parameters during connect operation. |
| 11647 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11648 | int wlan_hdd_cfg80211_set_privacy( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11649 | struct cfg80211_connect_params *req |
| 11650 | ) |
| 11651 | { |
| 11652 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11653 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11654 | ENTER(); |
| 11655 | |
| 11656 | /*set wpa version*/ |
| 11657 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 11658 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11659 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11660 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 11661 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11662 | { |
| 11663 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 11664 | } |
| 11665 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 11666 | { |
| 11667 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 11668 | } |
| 11669 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11670 | |
| 11671 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11672 | pWextState->wpaVersion); |
| 11673 | |
| 11674 | /*set authentication type*/ |
| 11675 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 11676 | |
| 11677 | if (0 > status) |
| 11678 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11679 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11680 | "%s: failed to set authentication type ", __func__); |
| 11681 | return status; |
| 11682 | } |
| 11683 | |
| 11684 | /*set key mgmt type*/ |
| 11685 | if (req->crypto.n_akm_suites) |
| 11686 | { |
| 11687 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 11688 | if (0 > status) |
| 11689 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11690 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11691 | __func__); |
| 11692 | return status; |
| 11693 | } |
| 11694 | } |
| 11695 | |
| 11696 | /*set pairwise cipher type*/ |
| 11697 | if (req->crypto.n_ciphers_pairwise) |
| 11698 | { |
| 11699 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 11700 | req->crypto.ciphers_pairwise[0], true); |
| 11701 | if (0 > status) |
| 11702 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11703 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11704 | "%s: failed to set unicast cipher type", __func__); |
| 11705 | return status; |
| 11706 | } |
| 11707 | } |
| 11708 | else |
| 11709 | { |
| 11710 | /*Reset previous cipher suite to none*/ |
| 11711 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 11712 | if (0 > status) |
| 11713 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11714 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11715 | "%s: failed to set unicast cipher type", __func__); |
| 11716 | return status; |
| 11717 | } |
| 11718 | } |
| 11719 | |
| 11720 | /*set group cipher type*/ |
| 11721 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 11722 | false); |
| 11723 | |
| 11724 | if (0 > status) |
| 11725 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11726 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11727 | __func__); |
| 11728 | return status; |
| 11729 | } |
| 11730 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11731 | #ifdef WLAN_FEATURE_11W |
| 11732 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 11733 | #endif |
| 11734 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11735 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 11736 | if (req->ie_len) |
| 11737 | { |
| 11738 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 11739 | if ( 0 > status) |
| 11740 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11741 | 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] | 11742 | __func__); |
| 11743 | return status; |
| 11744 | } |
| 11745 | } |
| 11746 | |
| 11747 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11748 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11749 | { |
| 11750 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 11751 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 11752 | ) |
| 11753 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11754 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11755 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 11756 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11757 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11758 | __func__); |
| 11759 | return -EOPNOTSUPP; |
| 11760 | } |
| 11761 | else |
| 11762 | { |
| 11763 | u8 key_len = req->key_len; |
| 11764 | u8 key_idx = req->key_idx; |
| 11765 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11766 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11767 | && (CSR_MAX_NUM_KEY > key_idx) |
| 11768 | ) |
| 11769 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11770 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11771 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11772 | __func__, key_idx, key_len); |
| 11773 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11774 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11775 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11776 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11777 | (u8)key_len; |
| 11778 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 11779 | } |
| 11780 | } |
| 11781 | } |
| 11782 | } |
| 11783 | |
| 11784 | return status; |
| 11785 | } |
| 11786 | |
| 11787 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 11788 | * FUNCTION: wlan_hdd_try_disconnect |
| 11789 | * This function is used to disconnect from previous |
| 11790 | * connection |
| 11791 | */ |
| 11792 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 11793 | { |
| 11794 | long ret = 0; |
| 11795 | hdd_station_ctx_t *pHddStaCtx; |
| 11796 | eMib_dot11DesiredBssType connectedBssType; |
| 11797 | |
| 11798 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11799 | |
| 11800 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 11801 | |
| 11802 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 11803 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 11804 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 11805 | { |
| 11806 | /* Issue disconnect to CSR */ |
| 11807 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 11808 | if( eHAL_STATUS_SUCCESS == |
| 11809 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11810 | pAdapter->sessionId, |
| 11811 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 11812 | { |
| 11813 | ret = wait_for_completion_interruptible_timeout( |
| 11814 | &pAdapter->disconnect_comp_var, |
| 11815 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 11816 | if (0 >= ret) |
| 11817 | { |
| 11818 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 11819 | return -EALREADY; |
| 11820 | } |
| 11821 | } |
| 11822 | } |
| 11823 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 11824 | { |
| 11825 | ret = wait_for_completion_interruptible_timeout( |
| 11826 | &pAdapter->disconnect_comp_var, |
| 11827 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 11828 | if (0 >= ret) |
| 11829 | { |
| 11830 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 11831 | return -EALREADY; |
| 11832 | } |
| 11833 | } |
| 11834 | |
| 11835 | return 0; |
| 11836 | } |
| 11837 | |
| 11838 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11839 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 11840 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11841 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11842 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11843 | struct net_device *ndev, |
| 11844 | struct cfg80211_connect_params *req |
| 11845 | ) |
| 11846 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11847 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11848 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11849 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 11850 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11851 | |
| 11852 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11853 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11854 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11855 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 11856 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11857 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11858 | "%s: device_mode = %s (%d)", __func__, |
| 11859 | hdd_device_modetoString(pAdapter->device_mode), |
| 11860 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11861 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11862 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 11863 | if (!pHddCtx) |
| 11864 | { |
| 11865 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11866 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11867 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 11868 | } |
| 11869 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11870 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11871 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11872 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11873 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11874 | } |
| 11875 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11876 | if (vos_max_concurrent_connections_reached()) { |
| 11877 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 11878 | return -ECONNREFUSED; |
| 11879 | } |
| 11880 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11881 | #ifdef WLAN_BTAMP_FEATURE |
| 11882 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11883 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11884 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11885 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11886 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 11887 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11888 | } |
| 11889 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 11890 | |
| 11891 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 11892 | //P2P Mode will be taken care in Open/close adapter |
| 11893 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11894 | (vos_concurrent_open_sessions_running())) { |
| 11895 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 11896 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 11897 | } |
| 11898 | |
| 11899 | /*Try disconnecting if already in connected state*/ |
| 11900 | status = wlan_hdd_try_disconnect(pAdapter); |
| 11901 | if ( 0 > status) |
| 11902 | { |
| 11903 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 11904 | " connection")); |
| 11905 | return -EALREADY; |
| 11906 | } |
| 11907 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11908 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11909 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11910 | |
| 11911 | if ( 0 > status) |
| 11912 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11913 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11914 | __func__); |
| 11915 | return status; |
| 11916 | } |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 11917 | if ( req->channel ) |
| 11918 | { |
| 11919 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 11920 | req->ssid_len, req->bssid, |
| 11921 | req->channel->hw_value); |
| 11922 | } |
| 11923 | else |
| 11924 | { |
| 11925 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11926 | req->ssid_len, req->bssid, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 11927 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11928 | |
Sushant Kaushik | d708398 | 2015-03-18 14:33:24 +0530 | [diff] [blame] | 11929 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11930 | { |
| 11931 | //ReEnable BMPS if disabled |
| 11932 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 11933 | (NULL != pHddCtx)) |
| 11934 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 11935 | if (pHddCtx->hdd_wlan_suspended) |
| 11936 | { |
| 11937 | hdd_set_pwrparams(pHddCtx); |
| 11938 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11939 | //ReEnable Bmps and Imps back |
| 11940 | hdd_enable_bmps_imps(pHddCtx); |
| 11941 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11942 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11943 | return status; |
| 11944 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11945 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11946 | EXIT(); |
| 11947 | return status; |
| 11948 | } |
| 11949 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 11950 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 11951 | struct net_device *ndev, |
| 11952 | struct cfg80211_connect_params *req) |
| 11953 | { |
| 11954 | int ret; |
| 11955 | vos_ssr_protect(__func__); |
| 11956 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 11957 | vos_ssr_unprotect(__func__); |
| 11958 | |
| 11959 | return ret; |
| 11960 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11961 | |
| 11962 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11963 | * FUNCTION: wlan_hdd_disconnect |
| 11964 | * This function is used to issue a disconnect request to SME |
| 11965 | */ |
| 11966 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 11967 | { |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 11968 | int status, result = 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11969 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11970 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 11971 | long ret; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11972 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 11973 | ENTER(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11974 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 11975 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11976 | if (0 != status) |
| 11977 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11978 | return status; |
| 11979 | } |
| 11980 | |
| 11981 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 11982 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 11983 | /* Need to apply spin lock before decreasing active sessions |
| 11984 | * as there can be chance for double decrement if context switch |
| 11985 | * Calls hdd_DisConnectHandler. |
| 11986 | */ |
| 11987 | |
| 11988 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 11989 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 11990 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 11991 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 11992 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 11993 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 11994 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 11995 | |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 11996 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 11997 | FL( "Set HDD connState to eConnectionState_Disconnecting" )); |
| 11998 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 11999 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12000 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12001 | /* |
| 12002 | * stop tx queues before deleting STA/BSS context from the firmware. |
| 12003 | * tx has to be disabled because the firmware can get busy dropping |
| 12004 | * the tx frames after BSS/STA has been deleted and will not send |
| 12005 | * back a response resulting in WDI timeout |
| 12006 | */ |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 12007 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12008 | netif_tx_disable(pAdapter->dev); |
| 12009 | netif_carrier_off(pAdapter->dev); |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 12010 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 12011 | /*issue disconnect*/ |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12012 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12013 | pAdapter->sessionId, reason); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12014 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
| 12015 | { |
| 12016 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12017 | FL("status = %d, already disconnected"), |
| 12018 | (int)status ); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12019 | |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12020 | } |
| 12021 | else if ( 0 != status ) |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12022 | { |
| 12023 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12024 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12025 | __func__, (int)status ); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12026 | result = -EINVAL; |
| 12027 | goto disconnected; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12028 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12029 | ret = wait_for_completion_interruptible_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12030 | &pAdapter->disconnect_comp_var, |
| 12031 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12032 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status )) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12033 | { |
| 12034 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12035 | "%s: Failed to disconnect, timed out", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12036 | result = -ETIMEDOUT; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12037 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12038 | else if (ret == -ERESTARTSYS) |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12039 | { |
| 12040 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12041 | "%s: Failed to disconnect, wait interrupted", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12042 | result = -ERESTARTSYS; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12043 | } |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12044 | disconnected: |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 12045 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12046 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 12047 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 12048 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12049 | EXIT(); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 12050 | return result; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12051 | } |
| 12052 | |
| 12053 | |
| 12054 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12055 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12056 | * This function is used to issue a disconnect request to SME |
| 12057 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12058 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12059 | struct net_device *dev, |
| 12060 | u16 reason |
| 12061 | ) |
| 12062 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12063 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12064 | int status; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12065 | tCsrRoamProfile *pRoamProfile; |
| 12066 | hdd_station_ctx_t *pHddStaCtx; |
| 12067 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12068 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12069 | tANI_U8 staIdx; |
| 12070 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12071 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12072 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12073 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12074 | if (!pAdapter) { |
| 12075 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 12076 | return -EINVAL; |
| 12077 | } |
| 12078 | |
| 12079 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12080 | if (!pHddStaCtx) { |
| 12081 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD STA context is NULL")); |
| 12082 | return -EINVAL; |
| 12083 | } |
| 12084 | |
| 12085 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12086 | status = wlan_hdd_validate_context(pHddCtx); |
| 12087 | if (0 != status) |
| 12088 | { |
| 12089 | return status; |
| 12090 | } |
| 12091 | |
| 12092 | pRoamProfile = &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
| 12093 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12094 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12095 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 12096 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12097 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 12098 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12099 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12100 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12101 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 12102 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12103 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12104 | if (NULL != pRoamProfile) |
| 12105 | { |
| 12106 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 12107 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 12108 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12109 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12110 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12111 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12112 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12113 | switch(reason) |
| 12114 | { |
| 12115 | case WLAN_REASON_MIC_FAILURE: |
| 12116 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 12117 | break; |
| 12118 | |
| 12119 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 12120 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 12121 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 12122 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 12123 | break; |
| 12124 | |
| 12125 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 12126 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 12127 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12128 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 12129 | break; |
| 12130 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12131 | default: |
| 12132 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 12133 | break; |
| 12134 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12135 | pScanInfo = &pHddCtx->scan_info; |
| 12136 | if (pScanInfo->mScanPending) |
| 12137 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 12138 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12139 | "Aborting Scan"); |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 12140 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 12141 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 12142 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12143 | |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12144 | #ifdef FEATURE_WLAN_TDLS |
| 12145 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12146 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12147 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12148 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 12149 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12150 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 12151 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12152 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12153 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12154 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 12155 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12156 | MAC_ADDR_ARRAY(mac)); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 12157 | status = sme_DeleteTdlsPeerSta( |
| 12158 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12159 | pAdapter->sessionId, |
| 12160 | mac); |
| 12161 | if (status != eHAL_STATUS_SUCCESS) { |
| 12162 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 12163 | return -EPERM; |
| 12164 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 12165 | } |
| 12166 | } |
| 12167 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 12168 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12169 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 12170 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12171 | { |
| 12172 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12173 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12174 | __func__, (int)status ); |
| 12175 | return -EINVAL; |
| 12176 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12177 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 12178 | else |
| 12179 | { |
| 12180 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 12181 | "called while in %d state", __func__, |
| 12182 | pHddStaCtx->conn_info.connState); |
| 12183 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12184 | } |
| 12185 | else |
| 12186 | { |
| 12187 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 12188 | } |
| 12189 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12190 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12191 | return status; |
| 12192 | } |
| 12193 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12194 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 12195 | struct net_device *dev, |
| 12196 | u16 reason |
| 12197 | ) |
| 12198 | { |
| 12199 | int ret; |
| 12200 | vos_ssr_protect(__func__); |
| 12201 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 12202 | vos_ssr_unprotect(__func__); |
| 12203 | |
| 12204 | return ret; |
| 12205 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 12206 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12207 | /* |
| 12208 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12209 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12210 | * settings in IBSS mode. |
| 12211 | */ |
| 12212 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12213 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12214 | struct cfg80211_ibss_params *params |
| 12215 | ) |
| 12216 | { |
| 12217 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12218 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12219 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 12220 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12221 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12222 | ENTER(); |
| 12223 | |
| 12224 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 12225 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12226 | |
| 12227 | if (params->ie_len && ( NULL != params->ie) ) |
| 12228 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12229 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 12230 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12231 | { |
| 12232 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 12233 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 12234 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12235 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12236 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12237 | tDot11fIEWPA dot11WPAIE; |
| 12238 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12239 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12240 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 12241 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12242 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 12243 | params->ie_len, DOT11F_EID_WPA); |
| 12244 | if ( NULL != ie ) |
| 12245 | { |
| 12246 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 12247 | // Unpack the WPA IE |
| 12248 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 12249 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 12250 | &ie[2+4], |
| 12251 | ie[1] - 4, |
| 12252 | &dot11WPAIE); |
| 12253 | /*Extract the multicast cipher, the encType for unicast |
| 12254 | cipher for wpa-none is none*/ |
| 12255 | encryptionType = |
| 12256 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 12257 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12258 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 12259 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12260 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 12261 | |
| 12262 | if (0 > status) |
| 12263 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12264 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12265 | __func__); |
| 12266 | return status; |
| 12267 | } |
| 12268 | } |
| 12269 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12270 | pWextState->roamProfile.AuthType.authType[0] = |
| 12271 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12272 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 12273 | |
| 12274 | if (params->privacy) |
| 12275 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12276 | /* Security enabled IBSS, At this time there is no information available |
| 12277 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12278 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12279 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12280 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12281 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12282 | *enable privacy bit in beacons */ |
| 12283 | |
| 12284 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 12285 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12286 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 12287 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12288 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 12289 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 12290 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12291 | return status; |
| 12292 | } |
| 12293 | |
| 12294 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12295 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12296 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12297 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12298 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12299 | struct net_device *dev, |
| 12300 | struct cfg80211_ibss_params *params |
| 12301 | ) |
| 12302 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12303 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12304 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12305 | tCsrRoamProfile *pRoamProfile; |
| 12306 | int status; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12307 | bool alloc_bssid = VOS_FALSE; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12308 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12309 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12310 | |
| 12311 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12312 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12313 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12314 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 12315 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12316 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12317 | "%s: device_mode = %s (%d)", __func__, |
| 12318 | hdd_device_modetoString(pAdapter->device_mode), |
| 12319 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12320 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12321 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12322 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12323 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12324 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12325 | } |
| 12326 | |
| 12327 | if (NULL == pWextState) |
| 12328 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12329 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12330 | __func__); |
| 12331 | return -EIO; |
| 12332 | } |
| 12333 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12334 | if (vos_max_concurrent_connections_reached()) { |
| 12335 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 12336 | return -ECONNREFUSED; |
| 12337 | } |
| 12338 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 12339 | /*Try disconnecting if already in connected state*/ |
| 12340 | status = wlan_hdd_try_disconnect(pAdapter); |
| 12341 | if ( 0 > status) |
| 12342 | { |
| 12343 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 12344 | " IBSS connection")); |
| 12345 | return -EALREADY; |
| 12346 | } |
| 12347 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12348 | pRoamProfile = &pWextState->roamProfile; |
| 12349 | |
| 12350 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 12351 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12352 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12353 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12354 | return -EINVAL; |
| 12355 | } |
| 12356 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12357 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 12358 | if (NULL != params->bssid) { |
| 12359 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 12360 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 12361 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12362 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 12363 | return -EIO; |
| 12364 | } |
| 12365 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12366 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 12367 | { |
| 12368 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 12369 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 12370 | { |
| 12371 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12372 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 12373 | return -EIO; |
| 12374 | } |
Sachin Ahuja | 46ff491 | 2015-03-23 22:48:43 +0530 | [diff] [blame] | 12375 | params->bssid = vos_mem_malloc(VOS_MAC_ADDR_SIZE); |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12376 | if (!params->bssid) |
| 12377 | { |
| 12378 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 12379 | "%s:Failed memory allocation", __func__); |
| 12380 | return -EIO; |
| 12381 | } |
| 12382 | vos_mem_copy((v_U8_t *)params->bssid, |
| 12383 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
| 12384 | VOS_MAC_ADDR_SIZE); |
| 12385 | alloc_bssid = VOS_TRUE; |
| 12386 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 12387 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12388 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12389 | if (NULL != |
| 12390 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 12391 | params->chandef.chan) |
| 12392 | #else |
| 12393 | params->channel) |
| 12394 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12395 | { |
| 12396 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12397 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 12398 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 12399 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12400 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12401 | |
| 12402 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12403 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12404 | ieee80211_frequency_to_channel( |
| 12405 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 12406 | params->chandef.chan->center_freq); |
| 12407 | #else |
| 12408 | params->channel->center_freq); |
| 12409 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12410 | |
| 12411 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 12412 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12413 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12414 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 12415 | __func__); |
| 12416 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12417 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12418 | |
| 12419 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12420 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12421 | if (channelNum == validChan[indx]) |
| 12422 | { |
| 12423 | break; |
| 12424 | } |
| 12425 | } |
| 12426 | if (indx >= numChans) |
| 12427 | { |
| 12428 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12429 | __func__, channelNum); |
| 12430 | return -EINVAL; |
| 12431 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12432 | /* Set the Operational Channel */ |
| 12433 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 12434 | channelNum); |
| 12435 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 12436 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 12437 | pRoamProfile->ChannelInfo.ChannelList = |
| 12438 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12439 | } |
| 12440 | |
| 12441 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12442 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12443 | if (status < 0) |
| 12444 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12445 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12446 | __func__); |
| 12447 | return status; |
| 12448 | } |
| 12449 | |
| 12450 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12451 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 12452 | params->ssid_len, params->bssid, |
| 12453 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12454 | |
| 12455 | if (0 > status) |
| 12456 | { |
| 12457 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
| 12458 | return status; |
| 12459 | } |
| 12460 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 12461 | if (NULL != params->bssid && |
| 12462 | pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0 && |
| 12463 | alloc_bssid == VOS_TRUE) |
| 12464 | { |
| 12465 | vos_mem_free(params->bssid); |
| 12466 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12467 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12468 | return 0; |
| 12469 | } |
| 12470 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12471 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 12472 | struct net_device *dev, |
| 12473 | struct cfg80211_ibss_params *params |
| 12474 | ) |
| 12475 | { |
| 12476 | int ret = 0; |
| 12477 | |
| 12478 | vos_ssr_protect(__func__); |
| 12479 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 12480 | vos_ssr_unprotect(__func__); |
| 12481 | |
| 12482 | return ret; |
| 12483 | } |
| 12484 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12485 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12486 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12487 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12488 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12489 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12490 | struct net_device *dev |
| 12491 | ) |
| 12492 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12493 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12494 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12495 | tCsrRoamProfile *pRoamProfile; |
| 12496 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12497 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12498 | |
| 12499 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12500 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12501 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12502 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 12503 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12504 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12505 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12506 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12507 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12508 | } |
| 12509 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12510 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 12511 | hdd_device_modetoString(pAdapter->device_mode), |
| 12512 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12513 | if (NULL == pWextState) |
| 12514 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12515 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12516 | __func__); |
| 12517 | return -EIO; |
| 12518 | } |
| 12519 | |
| 12520 | pRoamProfile = &pWextState->roamProfile; |
| 12521 | |
| 12522 | /* Issue disconnect only if interface type is set to IBSS */ |
| 12523 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 12524 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12525 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s: BSS Type is not set to IBSS", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12526 | __func__); |
| 12527 | return -EINVAL; |
| 12528 | } |
| 12529 | |
| 12530 | /* Issue Disconnect request */ |
| 12531 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 12532 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 12533 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 12534 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12535 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12536 | return 0; |
| 12537 | } |
| 12538 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12539 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 12540 | struct net_device *dev |
| 12541 | ) |
| 12542 | { |
| 12543 | int ret = 0; |
| 12544 | |
| 12545 | vos_ssr_protect(__func__); |
| 12546 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 12547 | vos_ssr_unprotect(__func__); |
| 12548 | |
| 12549 | return ret; |
| 12550 | } |
| 12551 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12552 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12553 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12554 | * This function is used to set the phy parameters |
| 12555 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 12556 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12557 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12558 | u32 changed) |
| 12559 | { |
| 12560 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 12561 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12562 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12563 | |
| 12564 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12565 | |
| 12566 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12567 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 12568 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12569 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12570 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12571 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12572 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12573 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12574 | } |
| 12575 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12576 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 12577 | { |
| 12578 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 12579 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 12580 | wiphy->rts_threshold; |
| 12581 | |
| 12582 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12583 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12584 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12585 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12586 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12587 | __func__, rts_threshold); |
| 12588 | return -EINVAL; |
| 12589 | } |
| 12590 | |
| 12591 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 12592 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12593 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12594 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12595 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12596 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12597 | __func__, rts_threshold); |
| 12598 | return -EIO; |
| 12599 | } |
| 12600 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12601 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12602 | rts_threshold); |
| 12603 | } |
| 12604 | |
| 12605 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 12606 | { |
| 12607 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 12608 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 12609 | wiphy->frag_threshold; |
| 12610 | |
| 12611 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12612 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12613 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12614 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12615 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12616 | frag_threshold); |
| 12617 | return -EINVAL; |
| 12618 | } |
| 12619 | |
| 12620 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 12621 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12622 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12623 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12624 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12625 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12626 | __func__, frag_threshold); |
| 12627 | return -EIO; |
| 12628 | } |
| 12629 | |
| 12630 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 12631 | frag_threshold); |
| 12632 | } |
| 12633 | |
| 12634 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 12635 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 12636 | { |
| 12637 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 12638 | wiphy->retry_short : |
| 12639 | wiphy->retry_long; |
| 12640 | |
| 12641 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 12642 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 12643 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12644 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12645 | __func__, retry_value); |
| 12646 | return -EINVAL; |
| 12647 | } |
| 12648 | |
| 12649 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 12650 | { |
| 12651 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 12652 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12653 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12654 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12655 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12656 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12657 | __func__, retry_value); |
| 12658 | return -EIO; |
| 12659 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12660 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12661 | __func__, retry_value); |
| 12662 | } |
| 12663 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 12664 | { |
| 12665 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 12666 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12667 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12668 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12669 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12670 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12671 | __func__, retry_value); |
| 12672 | return -EIO; |
| 12673 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12674 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12675 | __func__, retry_value); |
| 12676 | } |
| 12677 | } |
| 12678 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12679 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12680 | return 0; |
| 12681 | } |
| 12682 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12683 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 12684 | u32 changed) |
| 12685 | { |
| 12686 | int ret; |
| 12687 | |
| 12688 | vos_ssr_protect(__func__); |
| 12689 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 12690 | vos_ssr_unprotect(__func__); |
| 12691 | |
| 12692 | return ret; |
| 12693 | } |
| 12694 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12695 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12696 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12697 | * This function is used to set the txpower |
| 12698 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12699 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12700 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12701 | struct wireless_dev *wdev, |
| 12702 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12703 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12704 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12705 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12706 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12707 | #endif |
| 12708 | int dbm) |
| 12709 | { |
| 12710 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12711 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12712 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 12713 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12714 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12715 | |
| 12716 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12717 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12718 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12719 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 12720 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12721 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12722 | if (0 != status) |
| 12723 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12724 | return status; |
| 12725 | } |
| 12726 | |
| 12727 | hHal = pHddCtx->hHal; |
| 12728 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12729 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 12730 | dbm, ccmCfgSetCallback, |
| 12731 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12732 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12733 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12734 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 12735 | return -EIO; |
| 12736 | } |
| 12737 | |
| 12738 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 12739 | dbm); |
| 12740 | |
| 12741 | switch(type) |
| 12742 | { |
| 12743 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 12744 | /* Fall through */ |
| 12745 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 12746 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 12747 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12748 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 12749 | __func__); |
| 12750 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12751 | } |
| 12752 | break; |
| 12753 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12754 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12755 | __func__); |
| 12756 | return -EOPNOTSUPP; |
| 12757 | break; |
| 12758 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12759 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 12760 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12761 | return -EIO; |
| 12762 | } |
| 12763 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12764 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12765 | return 0; |
| 12766 | } |
| 12767 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12768 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 12769 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12770 | struct wireless_dev *wdev, |
| 12771 | #endif |
| 12772 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 12773 | enum tx_power_setting type, |
| 12774 | #else |
| 12775 | enum nl80211_tx_power_setting type, |
| 12776 | #endif |
| 12777 | int dbm) |
| 12778 | { |
| 12779 | int ret; |
| 12780 | vos_ssr_protect(__func__); |
| 12781 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 12782 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12783 | wdev, |
| 12784 | #endif |
| 12785 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 12786 | type, |
| 12787 | #else |
| 12788 | type, |
| 12789 | #endif |
| 12790 | dbm); |
| 12791 | vos_ssr_unprotect(__func__); |
| 12792 | |
| 12793 | return ret; |
| 12794 | } |
| 12795 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12796 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12797 | * FUNCTION: __wlan_hdd_cfg80211_get_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12798 | * This function is used to read the txpower |
| 12799 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12800 | static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12801 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12802 | struct wireless_dev *wdev, |
| 12803 | #endif |
| 12804 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12805 | { |
| 12806 | |
| 12807 | hdd_adapter_t *pAdapter; |
| 12808 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12809 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12810 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12811 | ENTER(); |
| 12812 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12813 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12814 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12815 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12816 | *dbm = 0; |
| 12817 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12818 | } |
| 12819 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12820 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 12821 | if (NULL == pAdapter) |
| 12822 | { |
| 12823 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 12824 | return -ENOENT; |
| 12825 | } |
| 12826 | |
| 12827 | wlan_hdd_get_classAstats(pAdapter); |
| 12828 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 12829 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12830 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12831 | return 0; |
| 12832 | } |
| 12833 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12834 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 12835 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12836 | struct wireless_dev *wdev, |
| 12837 | #endif |
| 12838 | int *dbm) |
| 12839 | { |
| 12840 | int ret; |
| 12841 | |
| 12842 | vos_ssr_protect(__func__); |
| 12843 | ret = __wlan_hdd_cfg80211_get_txpower(wiphy, |
| 12844 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 12845 | wdev, |
| 12846 | #endif |
| 12847 | dbm); |
| 12848 | vos_ssr_unprotect(__func__); |
| 12849 | |
| 12850 | return ret; |
| 12851 | } |
| 12852 | |
| 12853 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 12854 | static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12855 | u8* mac, struct station_info *sinfo) |
| 12856 | { |
| 12857 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 12858 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12859 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 12860 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12861 | |
| 12862 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 12863 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12864 | |
| 12865 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 12866 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 12867 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 12868 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 12869 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 12870 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 12871 | tANI_U16 maxRate = 0; |
| 12872 | tANI_U16 myRate; |
| 12873 | tANI_U16 currentRate = 0; |
| 12874 | tANI_U8 maxSpeedMCS = 0; |
| 12875 | tANI_U8 maxMCSIdx = 0; |
| 12876 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12877 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 12878 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12879 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12880 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12881 | #ifdef WLAN_FEATURE_11AC |
| 12882 | tANI_U32 vht_mcs_map; |
| 12883 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 12884 | #endif /* WLAN_FEATURE_11AC */ |
| 12885 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12886 | ENTER(); |
| 12887 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12888 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 12889 | (0 == ssidlen)) |
| 12890 | { |
| 12891 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 12892 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 12893 | /*To keep GUI happy*/ |
| 12894 | return 0; |
| 12895 | } |
| 12896 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 12897 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 12898 | { |
| 12899 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12900 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 12901 | return 0; |
| 12902 | } |
| 12903 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12904 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12905 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12906 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12907 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12908 | } |
| 12909 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12910 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 12911 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 12912 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 12913 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 12914 | wlan_hdd_get_station_stats(pAdapter); |
| 12915 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
| 12916 | |
| 12917 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 12918 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 12919 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 12920 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 12921 | { |
| 12922 | rate_flags = pAdapter->maxRateFlags; |
| 12923 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 12924 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12925 | //convert to the UI units of 100kbps |
| 12926 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 12927 | |
| 12928 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12929 | 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] | 12930 | sinfo->signal, |
| 12931 | pCfg->reportMaxLinkSpeed, |
| 12932 | myRate, |
| 12933 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 12934 | (int) pCfg->linkSpeedRssiMid, |
| 12935 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 12936 | (int) rate_flags, |
| 12937 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12938 | #endif //LINKSPEED_DEBUG_ENABLED |
| 12939 | |
| 12940 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 12941 | { |
| 12942 | // we do not want to necessarily report the current speed |
| 12943 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 12944 | { |
| 12945 | // report the max possible speed |
| 12946 | rssidx = 0; |
| 12947 | } |
| 12948 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 12949 | { |
| 12950 | // report the max possible speed with RSSI scaling |
| 12951 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 12952 | { |
| 12953 | // report the max possible speed |
| 12954 | rssidx = 0; |
| 12955 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 12956 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12957 | { |
| 12958 | // report middle speed |
| 12959 | rssidx = 1; |
| 12960 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 12961 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 12962 | { |
| 12963 | // report middle speed |
| 12964 | rssidx = 2; |
| 12965 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12966 | else |
| 12967 | { |
| 12968 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 12969 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12970 | } |
| 12971 | } |
| 12972 | else |
| 12973 | { |
| 12974 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 12975 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12976 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 12977 | __func__, pCfg->reportMaxLinkSpeed); |
| 12978 | rssidx = 0; |
| 12979 | } |
| 12980 | |
| 12981 | maxRate = 0; |
| 12982 | |
| 12983 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 12984 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 12985 | OperationalRates, &ORLeng)) |
| 12986 | { |
| 12987 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 12988 | /*To keep GUI happy*/ |
| 12989 | return 0; |
| 12990 | } |
| 12991 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12992 | for (i = 0; i < ORLeng; i++) |
| 12993 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12994 | 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] | 12995 | { |
| 12996 | /* Validate Rate Set */ |
| 12997 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 12998 | { |
| 12999 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 13000 | break; |
| 13001 | } |
| 13002 | } |
| 13003 | /* Update MAX rate */ |
| 13004 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 13005 | } |
| 13006 | |
| 13007 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13008 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 13009 | ExtendedRates, &ERLeng)) |
| 13010 | { |
| 13011 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13012 | /*To keep GUI happy*/ |
| 13013 | return 0; |
| 13014 | } |
| 13015 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13016 | for (i = 0; i < ERLeng; i++) |
| 13017 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13018 | 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] | 13019 | { |
| 13020 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 13021 | { |
| 13022 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 13023 | break; |
| 13024 | } |
| 13025 | } |
| 13026 | /* Update MAX rate */ |
| 13027 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 13028 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13029 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 13030 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 13031 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 13032 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13033 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13034 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13035 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13036 | mode = 2; |
| 13037 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 13038 | mode = 1; |
| 13039 | else |
| 13040 | mode = 0; |
| 13041 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 13042 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 13043 | MCSRates, &MCSLeng)) |
| 13044 | { |
| 13045 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 13046 | /*To keep GUI happy*/ |
| 13047 | return 0; |
| 13048 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13049 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13050 | #ifdef WLAN_FEATURE_11AC |
| 13051 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13052 | 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] | 13053 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13054 | 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] | 13055 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13056 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13057 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13058 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13059 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13060 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13061 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13062 | maxMCSIdx = 7; |
| 13063 | } |
| 13064 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 13065 | { |
| 13066 | maxMCSIdx = 8; |
| 13067 | } |
| 13068 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 13069 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13070 | //VHT20 is supporting 0~8 |
| 13071 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13072 | maxMCSIdx = 8; |
| 13073 | else |
| 13074 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13075 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13076 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13077 | if (0 != rssidx)/*check for scaled */ |
| 13078 | { |
| 13079 | //get middle rate MCS index if rssi=1/2 |
| 13080 | for (i=0; i <= maxMCSIdx; i++) |
| 13081 | { |
| 13082 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 13083 | { |
| 13084 | maxMCSIdx = i; |
| 13085 | break; |
| 13086 | } |
| 13087 | } |
| 13088 | } |
| 13089 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13090 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13091 | { |
| 13092 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 13093 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 13094 | } |
| 13095 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 13096 | { |
| 13097 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 13098 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 13099 | } |
| 13100 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13101 | { |
| 13102 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 13103 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 13104 | } |
| 13105 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13106 | maxSpeedMCS = 1; |
| 13107 | if (currentRate > maxRate) |
| 13108 | { |
| 13109 | maxRate = currentRate; |
| 13110 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13111 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13112 | } |
| 13113 | else |
| 13114 | #endif /* WLAN_FEATURE_11AC */ |
| 13115 | { |
| 13116 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13117 | { |
| 13118 | rateFlag |= 1; |
| 13119 | } |
| 13120 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13121 | { |
| 13122 | rateFlag |= 2; |
| 13123 | } |
| 13124 | |
Girish Gowli | 01abcee | 2014-07-31 20:18:55 +0530 | [diff] [blame] | 13125 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13126 | if (rssidx == 1 || rssidx == 2) |
| 13127 | { |
| 13128 | //get middle rate MCS index if rssi=1/2 |
| 13129 | for (i=0; i <= 7; i++) |
| 13130 | { |
| 13131 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 13132 | { |
| 13133 | temp = i+1; |
| 13134 | break; |
| 13135 | } |
| 13136 | } |
| 13137 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 13138 | |
| 13139 | for (i = 0; i < MCSLeng; i++) |
| 13140 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13141 | for (j = 0; j < temp; j++) |
| 13142 | { |
| 13143 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 13144 | { |
| 13145 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
| 13146 | break; |
| 13147 | } |
| 13148 | } |
| 13149 | if ((j < temp) && (currentRate > maxRate)) |
| 13150 | { |
| 13151 | maxRate = currentRate; |
| 13152 | maxSpeedMCS = 1; |
| 13153 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
| 13154 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13155 | } |
| 13156 | } |
| 13157 | } |
| 13158 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13159 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 13160 | { |
| 13161 | maxRate = myRate; |
| 13162 | maxSpeedMCS = 1; |
| 13163 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 13164 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13165 | // 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] | 13166 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13167 | { |
| 13168 | maxRate = myRate; |
| 13169 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 13170 | { |
| 13171 | maxSpeedMCS = 0; |
| 13172 | } |
| 13173 | else |
| 13174 | { |
| 13175 | maxSpeedMCS = 1; |
| 13176 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 13177 | } |
| 13178 | } |
| 13179 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13180 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13181 | { |
| 13182 | sinfo->txrate.legacy = maxRate; |
| 13183 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13184 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 13185 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13186 | } |
| 13187 | else |
| 13188 | { |
| 13189 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13190 | #ifdef WLAN_FEATURE_11AC |
| 13191 | sinfo->txrate.nss = 1; |
| 13192 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13193 | { |
| 13194 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13195 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13196 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13197 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13198 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13199 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13200 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13201 | } |
| 13202 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 13203 | { |
| 13204 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13205 | } |
| 13206 | #endif /* WLAN_FEATURE_11AC */ |
| 13207 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 13208 | { |
| 13209 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 13210 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13211 | { |
| 13212 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13213 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13214 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13215 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13216 | { |
| 13217 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 13218 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 13219 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13220 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13221 | pr_info("Reporting MCS rate %d flags %x\n", |
| 13222 | sinfo->txrate.mcs, |
| 13223 | sinfo->txrate.flags ); |
| 13224 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13225 | } |
| 13226 | } |
| 13227 | else |
| 13228 | { |
| 13229 | // report current rate instead of max rate |
| 13230 | |
| 13231 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 13232 | { |
| 13233 | //provide to the UI in units of 100kbps |
| 13234 | sinfo->txrate.legacy = myRate; |
| 13235 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13236 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 13237 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13238 | } |
| 13239 | else |
| 13240 | { |
| 13241 | //must be MCS |
| 13242 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13243 | #ifdef WLAN_FEATURE_11AC |
| 13244 | sinfo->txrate.nss = 1; |
| 13245 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13246 | { |
| 13247 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 13248 | } |
| 13249 | else |
| 13250 | #endif /* WLAN_FEATURE_11AC */ |
| 13251 | { |
| 13252 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 13253 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13254 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 13255 | { |
| 13256 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 13257 | } |
| 13258 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 13259 | { |
| 13260 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 13261 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 13262 | #ifdef WLAN_FEATURE_11AC |
| 13263 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 13264 | { |
| 13265 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 13266 | } |
| 13267 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13268 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 13269 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 13270 | sinfo->txrate.mcs, |
| 13271 | sinfo->txrate.flags ); |
| 13272 | #endif //LINKSPEED_DEBUG_ENABLED |
| 13273 | } |
| 13274 | } |
| 13275 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 13276 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 13277 | sinfo->tx_packets = |
| 13278 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 13279 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 13280 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 13281 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 13282 | |
| 13283 | sinfo->tx_retries = |
| 13284 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 13285 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 13286 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 13287 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 13288 | |
| 13289 | sinfo->tx_failed = |
| 13290 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 13291 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 13292 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 13293 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 13294 | |
| 13295 | sinfo->filled |= |
| 13296 | STATION_INFO_TX_PACKETS | |
| 13297 | STATION_INFO_TX_RETRIES | |
| 13298 | STATION_INFO_TX_FAILED; |
| 13299 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13300 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13301 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 13302 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 13303 | EXIT(); |
| 13304 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13305 | } |
| 13306 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13307 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 13308 | u8* mac, struct station_info *sinfo) |
| 13309 | { |
| 13310 | int ret; |
| 13311 | |
| 13312 | vos_ssr_protect(__func__); |
| 13313 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 13314 | vos_ssr_unprotect(__func__); |
| 13315 | |
| 13316 | return ret; |
| 13317 | } |
| 13318 | |
| 13319 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 13320 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13321 | { |
| 13322 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13323 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13324 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13325 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13326 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13327 | ENTER(); |
| 13328 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13329 | if (NULL == pAdapter) |
| 13330 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13331 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13332 | return -ENODEV; |
| 13333 | } |
| 13334 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13335 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13336 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 13337 | pAdapter->sessionId, timeout)); |
| 13338 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13339 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13340 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13341 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13342 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13343 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13344 | } |
| 13345 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13346 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 13347 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 13348 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 13349 | (eConnectionState_Associated == |
| 13350 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 13351 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 13352 | |
| 13353 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13354 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 13355 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13356 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13357 | { |
| 13358 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13359 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 13360 | __func__, vos_status); |
| 13361 | } |
| 13362 | } |
| 13363 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13364 | /**The get power cmd from the supplicant gets updated by the nl only |
| 13365 | *on successful execution of the function call |
| 13366 | *we are oppositely mapped w.r.t mode in the driver |
| 13367 | **/ |
| 13368 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 13369 | |
| 13370 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 13371 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13372 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13373 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13374 | return -EINVAL; |
| 13375 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13376 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13377 | return 0; |
| 13378 | } |
| 13379 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13380 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 13381 | struct net_device *dev, bool mode, int timeout) |
| 13382 | { |
| 13383 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13384 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13385 | vos_ssr_protect(__func__); |
| 13386 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 13387 | vos_ssr_unprotect(__func__); |
| 13388 | |
| 13389 | return ret; |
| 13390 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13391 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13392 | static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 13393 | struct net_device *netdev, |
| 13394 | u8 key_index) |
| 13395 | { |
| 13396 | ENTER(); |
| 13397 | return 0; |
| 13398 | } |
| 13399 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13400 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13401 | struct net_device *netdev, |
| 13402 | u8 key_index) |
| 13403 | { |
| 13404 | int ret; |
| 13405 | vos_ssr_protect(__func__); |
| 13406 | ret = __wlan_hdd_set_default_mgmt_key(wiphy, netdev, key_index); |
| 13407 | vos_ssr_unprotect(__func__); |
| 13408 | return ret; |
| 13409 | } |
| 13410 | #endif //LINUX_VERSION_CODE |
| 13411 | |
| 13412 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 13413 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13414 | struct net_device *dev, |
| 13415 | struct ieee80211_txq_params *params) |
| 13416 | { |
| 13417 | ENTER(); |
| 13418 | return 0; |
| 13419 | } |
| 13420 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13421 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13422 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13423 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13424 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13425 | return 0; |
| 13426 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13427 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13428 | |
| 13429 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 13430 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13431 | struct net_device *dev, |
| 13432 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13433 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13434 | int ret; |
| 13435 | |
| 13436 | vos_ssr_protect(__func__); |
| 13437 | ret = __wlan_hdd_set_txq_params(wiphy, dev, params); |
| 13438 | vos_ssr_unprotect(__func__); |
| 13439 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13440 | } |
| 13441 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13442 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 13443 | struct ieee80211_txq_params *params) |
| 13444 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13445 | int ret; |
| 13446 | |
| 13447 | vos_ssr_protect(__func__); |
| 13448 | ret = __wlan_hdd_set_txq_params(wiphy, params); |
| 13449 | vos_ssr_unprotect(__func__); |
| 13450 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13451 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13452 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13453 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13454 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13455 | struct net_device *dev, |
| 13456 | struct tagCsrDelStaParams *pDelStaParams) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13457 | { |
| 13458 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13459 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13460 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13461 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13462 | v_U8_t staId; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13463 | v_CONTEXT_t pVosContext = NULL; |
| 13464 | ptSapContext pSapCtx = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13465 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13466 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13467 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13468 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13469 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13470 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13471 | return -EINVAL; |
| 13472 | } |
| 13473 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13474 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13475 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 13476 | pAdapter->sessionId, pAdapter->device_mode)); |
| 13477 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13478 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13479 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13480 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13481 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13482 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13483 | } |
| 13484 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13485 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13486 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13487 | ) |
| 13488 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13489 | pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 13490 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 13491 | if(pSapCtx == NULL){ |
| 13492 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13493 | FL("psapCtx is NULL")); |
| 13494 | return -ENOENT; |
| 13495 | } |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13496 | if (vos_is_macaddr_broadcast((v_MACADDR_t *)pDelStaParams->peerMacAddr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13497 | { |
| 13498 | v_U16_t i; |
| 13499 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 13500 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13501 | if ((pSapCtx->aStaInfo[i].isUsed) && |
| 13502 | (!pSapCtx->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13503 | { |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13504 | vos_mem_copy(pDelStaParams->peerMacAddr, |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13505 | pSapCtx->aStaInfo[i].macAddrSTA.bytes, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13506 | ETHER_ADDR_LEN); |
| 13507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13508 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13509 | "%s: Delete STA with MAC::" |
| 13510 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13511 | __func__, |
| 13512 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
| 13513 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 13514 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13515 | pSapCtx->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13516 | } |
| 13517 | } |
| 13518 | } |
| 13519 | else |
| 13520 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13521 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13522 | vos_status = hdd_softap_GetStaId(pAdapter, |
| 13523 | (v_MACADDR_t *)pDelStaParams->peerMacAddr, &staId); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13524 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13525 | { |
| 13526 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13527 | "%s: Skip this DEL STA as this is not used::" |
| 13528 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13529 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13530 | return -ENOENT; |
| 13531 | } |
| 13532 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13533 | if( pSapCtx->aStaInfo[staId].isDeauthInProgress == TRUE) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13534 | { |
| 13535 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13536 | "%s: Skip this DEL STA as deauth is in progress::" |
| 13537 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13538 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13539 | return -ENOENT; |
| 13540 | } |
| 13541 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13542 | pSapCtx->aStaInfo[staId].isDeauthInProgress = TRUE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13543 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13544 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13545 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13546 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13547 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13548 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13549 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13550 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13551 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 13552 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13553 | pSapCtx->aStaInfo[staId].isDeauthInProgress = FALSE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13554 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13555 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13556 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13557 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13558 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 13559 | return -ENOENT; |
| 13560 | } |
| 13561 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13562 | } |
| 13563 | } |
| 13564 | |
| 13565 | EXIT(); |
| 13566 | |
| 13567 | return 0; |
| 13568 | } |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13569 | |
| 13570 | #ifdef CFG80211_DEL_STA_V2 |
| 13571 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 13572 | struct net_device *dev, |
| 13573 | struct station_del_parameters *param) |
| 13574 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13575 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 13576 | struct net_device *dev, u8 *mac) |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13577 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13578 | { |
| 13579 | int ret; |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13580 | struct tagCsrDelStaParams delStaParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13581 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13582 | vos_ssr_protect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13583 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13584 | #ifdef CFG80211_DEL_STA_V2 |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13585 | if (NULL == param) { |
| 13586 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid argumet passed", __func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13587 | vos_ssr_unprotect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13588 | return -EINVAL; |
| 13589 | } |
| 13590 | |
| 13591 | WLANSAP_PopulateDelStaParams(param->mac, param->reason_code, |
| 13592 | param->subtype, &delStaParams); |
| 13593 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13594 | #else |
Sushant Kaushik | 4cd28f6 | 2014-12-26 14:23:50 +0530 | [diff] [blame] | 13595 | WLANSAP_PopulateDelStaParams(mac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13596 | (SIR_MAC_MGMT_DEAUTH >> 4), &delStaParams); |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 13597 | #endif |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 13598 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, &delStaParams); |
| 13599 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13600 | vos_ssr_unprotect(__func__); |
| 13601 | |
| 13602 | return ret; |
| 13603 | } |
| 13604 | |
| 13605 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13606 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 13607 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13608 | hdd_adapter_t *pAdapter; |
| 13609 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13610 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13611 | #ifdef FEATURE_WLAN_TDLS |
| 13612 | u32 mask, set; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13613 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 13614 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13615 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13616 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13617 | if (NULL == pAdapter) |
| 13618 | { |
| 13619 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13620 | "%s: Adapter is NULL",__func__); |
| 13621 | return -EINVAL; |
| 13622 | } |
| 13623 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13624 | status = wlan_hdd_validate_context(pHddCtx); |
| 13625 | if (0 != status) |
| 13626 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13627 | return status; |
| 13628 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13629 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13630 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13631 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 13632 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13633 | mask = params->sta_flags_mask; |
| 13634 | |
| 13635 | set = params->sta_flags_set; |
| 13636 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 13637 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13638 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 13639 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13640 | |
| 13641 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 13642 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13643 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 13644 | } |
| 13645 | } |
| 13646 | #endif |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13647 | EXIT(); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 13648 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13649 | } |
| 13650 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13651 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 13652 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
| 13653 | { |
| 13654 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13655 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13656 | vos_ssr_protect(__func__); |
| 13657 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 13658 | vos_ssr_unprotect(__func__); |
| 13659 | |
| 13660 | return ret; |
| 13661 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13662 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13663 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13664 | 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] | 13665 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13666 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13667 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13668 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13669 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13670 | int status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13671 | hdd_context_t *pHddCtx; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13672 | tPmkidCacheInfo pmk_id; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13673 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13674 | ENTER(); |
| 13675 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13676 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13677 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13678 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13679 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13680 | return -EINVAL; |
| 13681 | } |
| 13682 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13683 | if (!pmksa) { |
| 13684 | hddLog(LOGE, FL("pmksa is NULL")); |
| 13685 | return -EINVAL; |
| 13686 | } |
| 13687 | |
| 13688 | if (!pmksa->bssid || !pmksa->pmkid) { |
| 13689 | hddLog(LOGE, FL("pmksa->bssid(%p) or pmksa->pmkid(%p) is NULL"), |
| 13690 | pmksa->bssid, pmksa->pmkid); |
| 13691 | return -EINVAL; |
| 13692 | } |
| 13693 | |
| 13694 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 13695 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13696 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13697 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13698 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13699 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13700 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13701 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13702 | } |
| 13703 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13704 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13705 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13706 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13707 | vos_mem_copy(pmk_id.BSSID, pmksa->bssid, ETHER_ADDR_LEN); |
| 13708 | vos_mem_copy(pmk_id.PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13709 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13710 | /* Add to the PMKSA ID Cache in CSR */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13711 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13712 | &pmk_id, 1, FALSE); |
| 13713 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13714 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13715 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 13716 | pAdapter->sessionId, result)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13717 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13718 | EXIT(); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13719 | return HAL_STATUS_SUCCESS(result) ? 0 : -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13720 | } |
| 13721 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13722 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 13723 | struct cfg80211_pmksa *pmksa) |
| 13724 | { |
| 13725 | int ret; |
| 13726 | |
| 13727 | vos_ssr_protect(__func__); |
| 13728 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 13729 | vos_ssr_unprotect(__func__); |
| 13730 | |
| 13731 | return ret; |
| 13732 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13733 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13734 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13735 | 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] | 13736 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13737 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13738 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13739 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13740 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13741 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13742 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13743 | ENTER(); |
| 13744 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13745 | /* Validate pAdapter */ |
| 13746 | if (NULL == pAdapter) |
| 13747 | { |
| 13748 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 13749 | return -EINVAL; |
| 13750 | } |
| 13751 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13752 | if (!pmksa) { |
| 13753 | hddLog(LOGE, FL("pmksa is NULL")); |
| 13754 | return -EINVAL; |
| 13755 | } |
| 13756 | |
| 13757 | if (!pmksa->bssid) { |
| 13758 | hddLog(LOGE, FL("pmksa->bssid is NULL")); |
| 13759 | return -EINVAL; |
| 13760 | } |
| 13761 | |
Kiet Lam | 98c46a1 | 2014-10-31 15:34:57 -0700 | [diff] [blame] | 13762 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 13763 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13764 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13765 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13766 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13767 | if (0 != status) |
| 13768 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13769 | return status; |
| 13770 | } |
| 13771 | |
| 13772 | /*Retrieve halHandle*/ |
| 13773 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13774 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13775 | /* Delete the PMKID CSR cache */ |
| 13776 | if (eHAL_STATUS_SUCCESS != |
| 13777 | sme_RoamDelPMKIDfromCache(halHandle, |
| 13778 | pAdapter->sessionId, pmksa->bssid, FALSE)) { |
| 13779 | hddLog(LOGE, FL("Failed to delete PMKSA for "MAC_ADDRESS_STR), |
| 13780 | MAC_ADDR_ARRAY(pmksa->bssid)); |
| 13781 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13782 | } |
| 13783 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13784 | EXIT(); |
| 13785 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13786 | } |
| 13787 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13788 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13789 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 13790 | struct cfg80211_pmksa *pmksa) |
| 13791 | { |
| 13792 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13793 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13794 | vos_ssr_protect(__func__); |
| 13795 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 13796 | vos_ssr_unprotect(__func__); |
| 13797 | |
| 13798 | return ret; |
| 13799 | |
| 13800 | } |
| 13801 | |
| 13802 | 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] | 13803 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13804 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13805 | tHalHandle halHandle; |
| 13806 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13807 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13808 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13809 | ENTER(); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13810 | |
| 13811 | /* Validate pAdapter */ |
| 13812 | if (NULL == pAdapter) |
| 13813 | { |
| 13814 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13815 | "%s: Invalid Adapter" ,__func__); |
| 13816 | return -EINVAL; |
| 13817 | } |
| 13818 | |
| 13819 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13820 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13821 | if (0 != status) |
| 13822 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13823 | return status; |
| 13824 | } |
| 13825 | |
| 13826 | /*Retrieve halHandle*/ |
| 13827 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13828 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 13829 | /* Flush the PMKID cache in CSR */ |
| 13830 | if (eHAL_STATUS_SUCCESS != |
| 13831 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, NULL, TRUE)) { |
| 13832 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Cannot flush PMKIDCache")); |
| 13833 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 13834 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13835 | EXIT(); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 13836 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13837 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 13838 | |
| 13839 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 13840 | { |
| 13841 | int ret; |
| 13842 | |
| 13843 | vos_ssr_protect(__func__); |
| 13844 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 13845 | vos_ssr_unprotect(__func__); |
| 13846 | |
| 13847 | return ret; |
| 13848 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13849 | #endif |
| 13850 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13851 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13852 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 13853 | struct net_device *dev, |
| 13854 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13855 | { |
| 13856 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 13857 | hdd_station_ctx_t *pHddStaCtx; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 13858 | hdd_context_t *pHddCtx; |
| 13859 | int ret = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13860 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13861 | ENTER(); |
| 13862 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13863 | if (NULL == pAdapter) |
| 13864 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13865 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13866 | return -ENODEV; |
| 13867 | } |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 13868 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13869 | ret = wlan_hdd_validate_context(pHddCtx); |
| 13870 | if (0 != ret) |
| 13871 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 13872 | return ret; |
| 13873 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13874 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13875 | if (NULL == pHddStaCtx) |
| 13876 | { |
| 13877 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: STA Context is NULL", __func__); |
| 13878 | return -EINVAL; |
| 13879 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13880 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13881 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13882 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 13883 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13884 | // Added for debug on reception of Re-assoc Req. |
| 13885 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 13886 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13887 | 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] | 13888 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13889 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13890 | } |
| 13891 | |
| 13892 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13893 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13894 | ftie->ie_len); |
| 13895 | #endif |
| 13896 | |
| 13897 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 13898 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 13899 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13900 | ftie->ie_len); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13901 | |
| 13902 | EXIT(); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13903 | return 0; |
| 13904 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 13905 | |
| 13906 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 13907 | struct net_device *dev, |
| 13908 | struct cfg80211_update_ft_ies_params *ftie) |
| 13909 | { |
| 13910 | int ret; |
| 13911 | |
| 13912 | vos_ssr_protect(__func__); |
| 13913 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 13914 | vos_ssr_unprotect(__func__); |
| 13915 | |
| 13916 | return ret; |
| 13917 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13918 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13919 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13920 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 13921 | |
| 13922 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 13923 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 13924 | { |
| 13925 | int ret; |
| 13926 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 13927 | hdd_context_t *pHddCtx; |
| 13928 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 13929 | ENTER(); |
| 13930 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13931 | if (NULL == pAdapter) |
| 13932 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 13933 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13934 | "%s: HDD adapter is Null", __func__); |
| 13935 | return ; |
| 13936 | } |
| 13937 | |
| 13938 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13939 | if (NULL == pHddCtx) |
| 13940 | { |
| 13941 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13942 | "%s: HDD context is Null!!!", __func__); |
| 13943 | return ; |
| 13944 | } |
| 13945 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13946 | spin_lock(&pHddCtx->schedScan_lock); |
| 13947 | if (TRUE == pHddCtx->isWiphySuspended) |
| 13948 | { |
| 13949 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 13950 | spin_unlock(&pHddCtx->schedScan_lock); |
| 13951 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13952 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 13953 | return ; |
| 13954 | } |
| 13955 | spin_unlock(&pHddCtx->schedScan_lock); |
| 13956 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13957 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 13958 | |
| 13959 | if (0 > ret) |
| 13960 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
| 13961 | |
| 13962 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 13963 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13964 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 13965 | } |
| 13966 | |
| 13967 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13968 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 13969 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13970 | */ |
| 13971 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 13972 | { |
| 13973 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 13974 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13975 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13976 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13977 | int status = 0; |
| 13978 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 13979 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 13980 | /* The current firmware design does not allow PNO during any |
| 13981 | * active sessions. Hence, determine the active sessions |
| 13982 | * and return a failure. |
| 13983 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13984 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 13985 | { |
| 13986 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13987 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13988 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13989 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 13990 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 13991 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 13992 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 13993 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
Siddharth Bhal | 63a19a7 | 2014-11-07 14:31:56 +0530 | [diff] [blame] | 13994 | || (WLAN_HDD_TM_LEVEL_4 == pHddCtx->tmInfo.currentTmLevel) |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13995 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13996 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 13997 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 13998 | } |
| 13999 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 14000 | pAdapterNode = pNext; |
| 14001 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14002 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14003 | } |
| 14004 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14005 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 14006 | { |
| 14007 | hdd_adapter_t *pAdapter = callbackContext; |
| 14008 | hdd_context_t *pHddCtx; |
| 14009 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14010 | ENTER(); |
| 14011 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14012 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 14013 | { |
| 14014 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14015 | FL("Invalid adapter or adapter has invalid magic")); |
| 14016 | return; |
| 14017 | } |
| 14018 | |
| 14019 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14020 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 14021 | { |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14022 | return; |
| 14023 | } |
| 14024 | |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 14025 | if (VOS_STATUS_SUCCESS != status) |
| 14026 | { |
| 14027 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14028 | FL("PNO enable response status = %d"), status); |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 14029 | pHddCtx->isPnoEnable = FALSE; |
| 14030 | } |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14031 | |
| 14032 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 14033 | complete(&pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14034 | EXIT(); |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14035 | } |
| 14036 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14037 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14038 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 14039 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14040 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14041 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14042 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 14043 | { |
| 14044 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14045 | tSirPNOScanReq pnoRequest = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14046 | hdd_context_t *pHddCtx; |
| 14047 | tHalHandle hHal; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14048 | v_U32_t i, indx, num_ch, tempInterval, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 14049 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 14050 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14051 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 14052 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14053 | int ret = 0; |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14054 | hdd_config_t *pConfig = NULL; |
| 14055 | v_U32_t num_ignore_dfs_ch = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14056 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14057 | ENTER(); |
| 14058 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14059 | if (NULL == pAdapter) |
| 14060 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14061 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14062 | "%s: HDD adapter is Null", __func__); |
| 14063 | return -ENODEV; |
| 14064 | } |
| 14065 | |
| 14066 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14067 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14068 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14069 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14070 | { |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14071 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14072 | } |
| 14073 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14074 | pConfig = pHddCtx->cfg_ini; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14075 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14076 | if (NULL == hHal) |
| 14077 | { |
| 14078 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14079 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14080 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14081 | } |
Sushant Kaushik | 2fe8993 | 2014-09-03 10:58:09 +0530 | [diff] [blame] | 14082 | sme_ScanFlushResult(hHal, pAdapter->sessionId); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 14083 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 14084 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 14085 | { |
| 14086 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14087 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 14088 | return -EBUSY; |
| 14089 | } |
| 14090 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14091 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14092 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 14093 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 14094 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 14095 | return -EBUSY; |
| 14096 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14097 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14098 | if (TRUE == pHddCtx->isPnoEnable) |
| 14099 | { |
| 14100 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 14101 | FL("already PNO is enabled")); |
| 14102 | return -EBUSY; |
| 14103 | } |
c_hpothu | 225aa7c | 2014-10-22 17:45:13 +0530 | [diff] [blame] | 14104 | |
| 14105 | if (VOS_STATUS_SUCCESS != wlan_hdd_cancel_remain_on_channel(pHddCtx)) |
| 14106 | { |
| 14107 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14108 | "%s: abort ROC failed ", __func__); |
| 14109 | return -EBUSY; |
| 14110 | } |
| 14111 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14112 | pHddCtx->isPnoEnable = TRUE; |
| 14113 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14114 | pnoRequest.enable = 1; /*Enable PNO */ |
| 14115 | pnoRequest.ucNetworksCount = request->n_match_sets; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14116 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14117 | if (( !pnoRequest.ucNetworksCount ) || |
| 14118 | ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14119 | { |
| 14120 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14121 | "%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] | 14122 | __func__, pnoRequest.ucNetworksCount, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14123 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14124 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14125 | goto error; |
| 14126 | } |
| 14127 | |
| 14128 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 14129 | { |
| 14130 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14131 | "%s: Incorrect number of channels %d", |
| 14132 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14133 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14134 | goto error; |
| 14135 | } |
| 14136 | |
| 14137 | /* Framework provides one set of channels(all) |
| 14138 | * common for all saved profile */ |
| 14139 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 14140 | channels_allowed, &num_channels_allowed)) |
| 14141 | { |
| 14142 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14143 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14144 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14145 | goto error; |
| 14146 | } |
| 14147 | /* Checking each channel against allowed channel list */ |
| 14148 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14149 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14150 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14151 | char chList [(request->n_channels*5)+1]; |
| 14152 | int len; |
| 14153 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14154 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14155 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14156 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14157 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 14158 | { |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14159 | if ((!pConfig->enableDFSPnoChnlScan) && |
| 14160 | (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channels_allowed[indx]))) |
| 14161 | { |
| 14162 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14163 | "%s : Dropping DFS channel : %d", |
| 14164 | __func__,channels_allowed[indx]); |
| 14165 | num_ignore_dfs_ch++; |
| 14166 | break; |
| 14167 | } |
| 14168 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14169 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 14170 | len += snprintf(chList+len, 5, "%d ", |
| 14171 | request->channels[i]->hw_value); |
| 14172 | break ; |
| 14173 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14174 | } |
| 14175 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14176 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14177 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 14178 | /*If all channels are DFS and dropped, then ignore the PNO request*/ |
| 14179 | if (num_ignore_dfs_ch == request->n_channels) |
| 14180 | { |
| 14181 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14182 | "%s : All requested channels are DFS channels", __func__); |
| 14183 | ret = -EINVAL; |
| 14184 | goto error; |
| 14185 | } |
| 14186 | } |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14187 | |
| 14188 | pnoRequest.aNetworks = |
| 14189 | vos_mem_malloc(sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14190 | if (pnoRequest.aNetworks == NULL) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14191 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14192 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14193 | FL("failed to allocate memory aNetworks %u"), |
| 14194 | (uint32)sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14195 | goto error; |
| 14196 | } |
| 14197 | vos_mem_zero(pnoRequest.aNetworks, |
| 14198 | sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 14199 | |
| 14200 | /* Filling per profile params */ |
| 14201 | for (i = 0; i < pnoRequest.ucNetworksCount; i++) |
| 14202 | { |
| 14203 | pnoRequest.aNetworks[i].ssId.length = |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14204 | request->match_sets[i].ssid.ssid_len; |
| 14205 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14206 | if (( 0 == pnoRequest.aNetworks[i].ssId.length ) || |
| 14207 | ( pnoRequest.aNetworks[i].ssId.length > 32 ) ) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14208 | { |
| 14209 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14210 | "%s: SSID Len %d is not correct for network %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14211 | __func__, pnoRequest.aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14212 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14213 | goto error; |
| 14214 | } |
| 14215 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14216 | memcpy(pnoRequest.aNetworks[i].ssId.ssId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14217 | request->match_sets[i].ssid.ssid, |
| 14218 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 14219 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14220 | "%s: SSID of network %d is %s ", __func__, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14221 | i, pnoRequest.aNetworks[i].ssId.ssId); |
| 14222 | pnoRequest.aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 14223 | pnoRequest.aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 14224 | pnoRequest.aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14225 | |
| 14226 | /*Copying list of valid channel into request */ |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14227 | memcpy(pnoRequest.aNetworks[i].aChannels, valid_ch, num_ch); |
| 14228 | pnoRequest.aNetworks[i].ucChannelCount = num_ch; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14229 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14230 | pnoRequest.aNetworks[i].rssiThreshold = 0; //Default value |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14231 | } |
| 14232 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14233 | for (i = 0; i < request->n_ssids; i++) |
| 14234 | { |
| 14235 | j = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14236 | while (j < pnoRequest.ucNetworksCount) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14237 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14238 | if ((pnoRequest.aNetworks[j].ssId.length == |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14239 | request->ssids[i].ssid_len) && |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14240 | (0 == memcmp(pnoRequest.aNetworks[j].ssId.ssId, |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14241 | request->ssids[i].ssid, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14242 | pnoRequest.aNetworks[j].ssId.length))) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14243 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14244 | pnoRequest.aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 14245 | break; |
| 14246 | } |
| 14247 | j++; |
| 14248 | } |
| 14249 | } |
| 14250 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14251 | "Number of hidden networks being Configured = %d", |
| 14252 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14253 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 14254 | "request->ie_len = %zu", request->ie_len); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14255 | |
| 14256 | pnoRequest.p24GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 14257 | if (pnoRequest.p24GProbeTemplate == NULL) |
| 14258 | { |
| 14259 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14260 | FL("failed to allocate memory p24GProbeTemplate %u"), |
| 14261 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 14262 | goto error; |
| 14263 | } |
| 14264 | |
| 14265 | pnoRequest.p5GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 14266 | if (pnoRequest.p5GProbeTemplate == NULL) |
| 14267 | { |
| 14268 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 14269 | FL("failed to allocate memory p5GProbeTemplate %u"), |
| 14270 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 14271 | goto error; |
| 14272 | } |
| 14273 | |
| 14274 | vos_mem_zero(pnoRequest.p24GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 14275 | vos_mem_zero(pnoRequest.p5GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 14276 | |
Hanumantha Reddy Pothula | 06e87b2 | 2015-03-02 18:02:23 +0530 | [diff] [blame] | 14277 | if ((0 < request->ie_len) && (request->ie_len <= SIR_PNO_MAX_PB_REQ_SIZE) && |
| 14278 | (NULL != request->ie)) |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14279 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14280 | pnoRequest.us24GProbeTemplateLen = request->ie_len; |
| 14281 | memcpy(pnoRequest.p24GProbeTemplate, request->ie, |
| 14282 | pnoRequest.us24GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14283 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14284 | pnoRequest.us5GProbeTemplateLen = request->ie_len; |
| 14285 | memcpy(pnoRequest.p5GProbeTemplate, request->ie, |
| 14286 | pnoRequest.us5GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 14287 | } |
| 14288 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14289 | /* Driver gets only one time interval which is hardcoded in |
| 14290 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 14291 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 14292 | * 80,160,320 secs. And number of scan cycle for each timer |
| 14293 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 14294 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 14295 | * will be repeated after each interval specified by supplicant |
| 14296 | * till PNO is disabled. |
| 14297 | */ |
| 14298 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14299 | pnoRequest.scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14300 | else |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14301 | pnoRequest.scanTimers.ucScanTimersCount = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14302 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 14303 | |
| 14304 | tempInterval = (request->interval)/1000; |
| 14305 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14306 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 14307 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14308 | for ( i = 0; i < pnoRequest.scanTimers.ucScanTimersCount; i++) |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14309 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14310 | pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14311 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14312 | pnoRequest.scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14313 | tempInterval *= 2; |
| 14314 | } |
| 14315 | //Repeat last timer until pno disabled. |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14316 | pnoRequest.scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 14317 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14318 | pnoRequest.modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14319 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14320 | INIT_COMPLETION(pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14321 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 14322 | pnoRequest.callbackContext = pAdapter; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14323 | pAdapter->pno_req_status = 0; |
| 14324 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14325 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14326 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14327 | pAdapter->sessionId, pnoRequest.enable, pnoRequest.modePNO, |
| 14328 | pnoRequest.scanTimers.ucScanTimersCount); |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14329 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14330 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14331 | &pnoRequest, pAdapter->sessionId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14332 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 14333 | if (eHAL_STATUS_SUCCESS != status) |
| 14334 | { |
| 14335 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 14336 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14337 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14338 | goto error; |
| 14339 | } |
| 14340 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14341 | ret = wait_for_completion_timeout( |
| 14342 | &pAdapter->pno_comp_var, |
| 14343 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 14344 | if (0 >= ret) |
| 14345 | { |
| 14346 | // Did not receive the response for PNO enable in time. |
| 14347 | // Assuming the PNO enable was success. |
| 14348 | // Returning error from here, because we timeout, results |
| 14349 | // in side effect of Wifi (Wifi Setting) not to work. |
| 14350 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14351 | FL("Timed out waiting for PNO to be Enabled")); |
| 14352 | ret = 0; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14353 | } |
| 14354 | |
| 14355 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14356 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14357 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14358 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14359 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14360 | FL("PNO scanRequest offloaded ret = %d"), ret); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14361 | pHddCtx->isPnoEnable = FALSE; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14362 | if (pnoRequest.aNetworks) |
| 14363 | vos_mem_free(pnoRequest.aNetworks); |
| 14364 | if (pnoRequest.p24GProbeTemplate) |
| 14365 | vos_mem_free(pnoRequest.p24GProbeTemplate); |
| 14366 | if (pnoRequest.p5GProbeTemplate) |
| 14367 | vos_mem_free(pnoRequest.p5GProbeTemplate); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14368 | |
| 14369 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14370 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14371 | } |
| 14372 | |
| 14373 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14374 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 14375 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14376 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14377 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 14378 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 14379 | { |
| 14380 | int ret; |
| 14381 | |
| 14382 | vos_ssr_protect(__func__); |
| 14383 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 14384 | vos_ssr_unprotect(__func__); |
| 14385 | |
| 14386 | return ret; |
| 14387 | } |
| 14388 | |
| 14389 | /* |
| 14390 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 14391 | * Function to disable PNO |
| 14392 | */ |
| 14393 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14394 | struct net_device *dev) |
| 14395 | { |
| 14396 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14397 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14398 | hdd_context_t *pHddCtx; |
| 14399 | tHalHandle hHal; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14400 | tSirPNOScanReq pnoRequest = {0}; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14401 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14402 | |
| 14403 | ENTER(); |
| 14404 | |
| 14405 | if (NULL == pAdapter) |
| 14406 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14407 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14408 | "%s: HDD adapter is Null", __func__); |
| 14409 | return -ENODEV; |
| 14410 | } |
| 14411 | |
| 14412 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14413 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14414 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14415 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 14416 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14417 | "%s: HDD context is Null", __func__); |
| 14418 | return -ENODEV; |
| 14419 | } |
| 14420 | |
| 14421 | /* The return 0 is intentional when isLogpInProgress and |
| 14422 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 14423 | * failure in sched_scan_stop , especially for a case where the unload |
| 14424 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 14425 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 14426 | * success. If it returns a failure , then its next invocation due to the |
| 14427 | * clean up of the second interface will have the dev pointer corresponding |
| 14428 | * to the first one leading to a crash. |
| 14429 | */ |
| 14430 | if (pHddCtx->isLogpInProgress) |
| 14431 | { |
| 14432 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14433 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14434 | return ret; |
| 14435 | } |
| 14436 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 14437 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14438 | { |
| 14439 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14440 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14441 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14442 | } |
| 14443 | |
| 14444 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14445 | if (NULL == hHal) |
| 14446 | { |
| 14447 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14448 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14449 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14450 | } |
| 14451 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14452 | pnoRequest.enable = 0; /* Disable PNO */ |
| 14453 | pnoRequest.ucNetworksCount = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14454 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 14455 | status = sme_SetPreferredNetworkList(hHal, &pnoRequest, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14456 | pAdapter->sessionId, |
| 14457 | NULL, pAdapter); |
| 14458 | if (eHAL_STATUS_SUCCESS != status) |
| 14459 | { |
| 14460 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14461 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14462 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14463 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14464 | } |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 14465 | pHddCtx->isPnoEnable = FALSE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14466 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14467 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 14468 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 14469 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14470 | |
| 14471 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 14472 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14473 | } |
| 14474 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 14475 | /* |
| 14476 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 14477 | * NL interface to disable PNO |
| 14478 | */ |
| 14479 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 14480 | struct net_device *dev) |
| 14481 | { |
| 14482 | int ret; |
| 14483 | |
| 14484 | vos_ssr_protect(__func__); |
| 14485 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 14486 | vos_ssr_unprotect(__func__); |
| 14487 | |
| 14488 | return ret; |
| 14489 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 14490 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 14491 | |
| 14492 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14493 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14494 | #if TDLS_MGMT_VERSION2 |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14495 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14496 | u8 *peer, u8 action_code, u8 dialog_token, |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14497 | u16 status_code, u32 peer_capability, const u8 *buf, size_t len) |
| 14498 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14499 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14500 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14501 | u16 status_code, const u8 *buf, size_t len) |
| 14502 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14503 | { |
| 14504 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14505 | hdd_adapter_t *pAdapter; |
| 14506 | hdd_context_t *pHddCtx; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14507 | u8 peerMac[6]; |
| 14508 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14509 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14510 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14511 | long rc; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14512 | int ret; |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 14513 | #if !(TDLS_MGMT_VERSION2) |
| 14514 | u32 peer_capability = 0; |
| 14515 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14516 | tANI_U16 numCurrTdlsPeers; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14517 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14518 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14519 | if (NULL == pAdapter) |
| 14520 | { |
| 14521 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14522 | "%s: Adapter is NULL",__func__); |
| 14523 | return -EINVAL; |
| 14524 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14525 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14526 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 14527 | pAdapter->sessionId, action_code)); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14528 | pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14529 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14530 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14531 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14532 | "Invalid arguments"); |
| 14533 | return -EINVAL; |
| 14534 | } |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14535 | if (pHddCtx->isLogpInProgress) |
| 14536 | { |
| 14537 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14538 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14539 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 14540 | peer, |
| 14541 | eTDLS_LINK_IDLE, |
| 14542 | eTDLS_LINK_UNSPECIFIED); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14543 | return -EBUSY; |
| 14544 | } |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 14545 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
| 14546 | { |
| 14547 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14548 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 14549 | return -EAGAIN; |
| 14550 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14551 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14552 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14553 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14554 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 14555 | MAC_ADDRESS_STR " action %d declined.", |
| 14556 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14557 | return -ENOTSUPP; |
| 14558 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14559 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14560 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 14561 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 14562 | { |
| 14563 | /* if tdls_mode is disabled to respond to peer's request */ |
| 14564 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 14565 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14566 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14567 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14568 | " TDLS mode is disabled. action %d declined.", |
| 14569 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14570 | |
| 14571 | return -ENOTSUPP; |
| 14572 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 14573 | |
| 14574 | if (vos_max_concurrent_connections_reached()) |
| 14575 | { |
| 14576 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 14577 | return -EINVAL; |
| 14578 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 14579 | } |
| 14580 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14581 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 14582 | { |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14583 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14584 | { |
| 14585 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14586 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14587 | " TDLS setup is ongoing. action %d declined.", |
| 14588 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 14589 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14590 | } |
| 14591 | } |
| 14592 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14593 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 14594 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14595 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14596 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 14597 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14598 | { |
| 14599 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 14600 | we return error code at 'add_station()'. Hence we have this |
| 14601 | check again in addtion to add_station(). |
| 14602 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14603 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14604 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14605 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14606 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14607 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 14608 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 14609 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 14610 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14611 | } |
| 14612 | else |
| 14613 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14614 | /* maximum reached. tweak to send error code to peer and return |
| 14615 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14616 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14617 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14618 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 14619 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 14620 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 14621 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14622 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14623 | /* fall through to send setup resp with failure status |
| 14624 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14625 | } |
| 14626 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14627 | else |
| 14628 | { |
| 14629 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14630 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 14631 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14632 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14633 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 14634 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 14635 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14636 | return -EPERM; |
| 14637 | } |
| 14638 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 14639 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14640 | vos_mem_copy(peerMac, peer, 6); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14641 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14642 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 14643 | "%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] | 14644 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 14645 | action_code, dialog_token, status_code, len); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14646 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14647 | /*Except teardown responder will not be used so just make 0*/ |
| 14648 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14649 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14650 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14651 | |
| 14652 | hddTdlsPeer_t *pTdlsPeer; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 14653 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peerMac, TRUE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14654 | |
| 14655 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 14656 | responder = pTdlsPeer->is_responder; |
| 14657 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14658 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 14659 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 14660 | "%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] | 14661 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 14662 | dialog_token, status_code, len); |
| 14663 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14664 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14665 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14666 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14667 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 14668 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14669 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14670 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 14671 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14672 | { |
| 14673 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 14674 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14675 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 14676 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14677 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 14678 | if (status != VOS_STATUS_SUCCESS) { |
| 14679 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
| 14680 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14681 | } |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14682 | if (SIR_MAC_TDLS_DIS_REQ != action_code) { |
| 14683 | if (0 != wlan_hdd_tdls_set_cap(pAdapter, peerMac, eTDLS_CAP_SUPPORTED)) { |
| 14684 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS capabilities")); |
| 14685 | } |
| 14686 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14687 | } |
| 14688 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14689 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 14690 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 14691 | { |
| 14692 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14693 | "%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] | 14694 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14695 | ret = -EBUSY; |
| 14696 | goto tx_failed; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14697 | } |
| 14698 | |
| 14699 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14700 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 14701 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14702 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
Pradeep Reddy POTTETI | ca171f8 | 2014-03-21 14:17:35 +0530 | [diff] [blame] | 14703 | peerMac, action_code, dialog_token, status_code, peer_capability, (tANI_U8 *)buf, len, responder); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14704 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14705 | if (VOS_STATUS_SUCCESS != status) |
| 14706 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14707 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14708 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14709 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14710 | ret = -EINVAL; |
| 14711 | goto tx_failed; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14712 | } |
| 14713 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14714 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 14715 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 14716 | |
| 14717 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14718 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14719 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 14720 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 14721 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14722 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 14723 | |
| 14724 | if (pHddCtx->isLogpInProgress) |
| 14725 | { |
| 14726 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14727 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 14728 | return -EAGAIN; |
| 14729 | } |
| 14730 | |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14731 | ret = -EINVAL; |
| 14732 | goto tx_failed; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14733 | } |
| 14734 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 14735 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14736 | { |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14737 | ret = max_sta_failed; |
| 14738 | goto tx_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 14739 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14740 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14741 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 14742 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14743 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peerMac, TRUE)) { |
| 14744 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 14745 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14746 | } |
| 14747 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 14748 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14749 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peerMac, FALSE)) { |
| 14750 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 14751 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 14752 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14753 | |
| 14754 | return 0; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 14755 | |
| 14756 | tx_failed: |
| 14757 | /* add_station will be called before sending TDLS_SETUP_REQ and |
| 14758 | * TDLS_SETUP_RSP and as part of add_station driver will enable |
| 14759 | * BMPS. NL80211_TDLS_DISABLE_LINK will be called if the tx of |
| 14760 | * TDLS_SETUP_REQ or TDLS_SETUP_RSP fails. BMPS will be enabled |
| 14761 | * as part of processing NL80211_TDLS_DISABLE_LINK. So need to |
| 14762 | * enable BMPS for TDLS_SETUP_REQ and TDLS_SETUP_RSP if tx fails. |
| 14763 | */ |
| 14764 | |
| 14765 | if ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 14766 | (SIR_MAC_TDLS_SETUP_RSP == action_code)) |
| 14767 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 14768 | return ret; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14769 | } |
| 14770 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 14771 | #if TDLS_MGMT_VERSION2 |
| 14772 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 14773 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14774 | u16 status_code, u32 peer_capability, |
| 14775 | const u8 *buf, size_t len) |
| 14776 | #else |
| 14777 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 14778 | u8 *peer, u8 action_code, u8 dialog_token, |
| 14779 | u16 status_code, const u8 *buf, size_t len) |
| 14780 | #endif |
| 14781 | { |
| 14782 | int ret; |
| 14783 | |
| 14784 | vos_ssr_protect(__func__); |
| 14785 | #if TDLS_MGMT_VERSION2 |
| 14786 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token, |
| 14787 | status_code, peer_capability, buf, len); |
| 14788 | #else |
| 14789 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, dialog_token, |
| 14790 | status_code, buf, len); |
| 14791 | #endif |
| 14792 | vos_ssr_unprotect(__func__); |
| 14793 | |
| 14794 | return ret; |
| 14795 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14796 | |
| 14797 | int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter, |
| 14798 | u8 *peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14799 | tdls_req_params_t *tdls_peer_params, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14800 | cfg80211_exttdls_callback callback) |
| 14801 | { |
| 14802 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14803 | hddTdlsPeer_t *pTdlsPeer = NULL; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14804 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 14805 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14806 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14807 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 14808 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14809 | |
| 14810 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 14811 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 14812 | |
| 14813 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14814 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 14815 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 14816 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14817 | return -ENOTSUPP; |
| 14818 | } |
| 14819 | |
| 14820 | /* To cater the requirement of establishing the TDLS link |
| 14821 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 14822 | */ |
| 14823 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 14824 | if (pTdlsPeer == NULL) { |
| 14825 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14826 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 14827 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14828 | return -EINVAL; |
| 14829 | } |
| 14830 | |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 14831 | /* check FW TDLS Off Channel capability */ |
| 14832 | if ((TRUE == sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)) && |
| 14833 | (NULL != tdls_peer_params)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14834 | { |
| 14835 | pTdlsPeer->peerParams.channel = tdls_peer_params->channel; |
| 14836 | pTdlsPeer->peerParams.global_operating_class = |
| 14837 | tdls_peer_params->global_operating_class; |
| 14838 | pTdlsPeer->peerParams.max_latency_ms = tdls_peer_params->max_latency_ms; |
| 14839 | pTdlsPeer->peerParams.min_bandwidth_kbps = |
| 14840 | tdls_peer_params->min_bandwidth_kbps; |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 14841 | /* check configured channel is valid, non dfs and |
| 14842 | * not current operating channel */ |
| 14843 | if ((sme_IsTdlsOffChannelValid(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14844 | tdls_peer_params->channel)) && |
| 14845 | (pHddStaCtx) && |
| 14846 | (tdls_peer_params->channel != |
| 14847 | pHddStaCtx->conn_info.operationChannel)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14848 | { |
| 14849 | pTdlsPeer->isOffChannelConfigured = TRUE; |
| 14850 | } |
| 14851 | else |
| 14852 | { |
| 14853 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 14854 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14855 | "%s: Configured Tdls Off Channel is not valid", __func__); |
| 14856 | |
| 14857 | } |
| 14858 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 14859 | "%s: tdls_off_channel %d isOffChannelConfigured %d " |
| 14860 | "current operating channel %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14861 | __func__, pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 14862 | pTdlsPeer->isOffChannelConfigured, |
| 14863 | (pHddStaCtx ? pHddStaCtx->conn_info.operationChannel : 0)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14864 | } |
| 14865 | else |
| 14866 | { |
| 14867 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 14868 | "%s: TDLS off channel FW capability %d or " |
| 14869 | "Invalid TDLS Peer Params", __func__, |
| 14870 | sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14871 | } |
| 14872 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14873 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 14874 | |
| 14875 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14876 | " %s TDLS Add Force Peer Failed", |
| 14877 | __func__); |
| 14878 | return -EINVAL; |
| 14879 | } |
| 14880 | /*EXT TDLS*/ |
| 14881 | |
| 14882 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) { |
| 14883 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14884 | " %s TDLS set callback Failed", |
| 14885 | __func__); |
| 14886 | return -EINVAL; |
| 14887 | } |
| 14888 | |
| 14889 | return(0); |
| 14890 | |
| 14891 | } |
| 14892 | |
| 14893 | int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, u8 *peer) |
| 14894 | { |
| 14895 | |
| 14896 | hddTdlsPeer_t *pTdlsPeer; |
| 14897 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14898 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14899 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 14900 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14901 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 14902 | if (0 != wlan_hdd_validate_context(pHddCtx)) { |
| 14903 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is NULL")); |
| 14904 | return -EINVAL; |
| 14905 | } |
| 14906 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14907 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 14908 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 14909 | |
| 14910 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14911 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 14912 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 14913 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14914 | return -ENOTSUPP; |
| 14915 | } |
| 14916 | |
| 14917 | |
| 14918 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 14919 | |
| 14920 | if ( NULL == pTdlsPeer ) { |
| 14921 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
| 14922 | " peer not exsting", |
| 14923 | __func__, MAC_ADDR_ARRAY(peer)); |
| 14924 | return -EINVAL; |
| 14925 | } |
| 14926 | else { |
| 14927 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 14928 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 14929 | /* if channel switch is configured, reset |
| 14930 | the channel for this peer */ |
| 14931 | if (TRUE == pTdlsPeer->isOffChannelConfigured) |
| 14932 | { |
| 14933 | pTdlsPeer->peerParams.channel = 0; |
| 14934 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 14935 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14936 | } |
| 14937 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14938 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) { |
| 14939 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set force peer")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14940 | return -EINVAL; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14941 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 14942 | |
| 14943 | /*EXT TDLS*/ |
| 14944 | |
| 14945 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) { |
| 14946 | |
| 14947 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14948 | " %s TDLS set callback Failed", |
| 14949 | __func__); |
| 14950 | return -EINVAL; |
| 14951 | } |
| 14952 | return(0); |
| 14953 | |
| 14954 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14955 | static int __wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14956 | u8 *peer, enum nl80211_tdls_operation oper) |
| 14957 | { |
| 14958 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 14959 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14960 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 14961 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14962 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14963 | ENTER(); |
| 14964 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 14965 | if (!pAdapter) { |
| 14966 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 14967 | return -EINVAL; |
| 14968 | } |
| 14969 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14970 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14971 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 14972 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14973 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14974 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 14975 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 14976 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14977 | return -EINVAL; |
| 14978 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 14979 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14980 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14981 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14982 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14983 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 14984 | } |
| 14985 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14986 | |
| 14987 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 14988 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14989 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 14990 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14991 | "TDLS Disabled in INI (%d) OR not enabled in FW (%d) " |
| 14992 | "Cannot process TDLS commands", |
| 14993 | pHddCtx->cfg_ini->fEnableTDLSSupport, |
| 14994 | sme_IsFeatureSupportedByFW(TDLS)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 14995 | return -ENOTSUPP; |
| 14996 | } |
| 14997 | |
| 14998 | switch (oper) { |
| 14999 | case NL80211_TDLS_ENABLE_LINK: |
| 15000 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15001 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15002 | long ret; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15003 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15004 | WLAN_STADescType staDesc; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15005 | tANI_U16 numCurrTdlsPeers = 0; |
| 15006 | hddTdlsPeer_t *connPeer = NULL; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15007 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15008 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15009 | memset(&staDesc, 0, sizeof(staDesc)); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15010 | if ( NULL == pTdlsPeer ) { |
| 15011 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 15012 | " (oper %d) not exsting. ignored", |
| 15013 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 15014 | return -EINVAL; |
| 15015 | } |
| 15016 | |
| 15017 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15018 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 15019 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 15020 | "NL80211_TDLS_ENABLE_LINK"); |
| 15021 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 15022 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 15023 | { |
| 15024 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 15025 | MAC_ADDRESS_STR " failed", |
| 15026 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 15027 | return -EINVAL; |
| 15028 | } |
| 15029 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15030 | /* TDLS Off Channel, Disable tdls channel switch, |
| 15031 | when there are more than one tdls link */ |
| 15032 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15033 | if (numCurrTdlsPeers == 1) |
| 15034 | { |
| 15035 | /* get connected peer and send disable tdls off chan */ |
| 15036 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
| 15037 | if (connPeer && (connPeer->isOffChannelConfigured == TRUE)) |
| 15038 | { |
| 15039 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15040 | "%s: More then one peer connected, Disable " |
| 15041 | "TDLS channel switch", __func__); |
| 15042 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15043 | ret = sme_SendTdlsChanSwitchReq( |
| 15044 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15045 | pAdapter->sessionId, |
| 15046 | connPeer->peerMac, |
| 15047 | connPeer->peerParams.channel, |
| 15048 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15049 | TDLS_CHANNEL_SWITCH_DISABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15050 | if (ret != VOS_STATUS_SUCCESS) { |
| 15051 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel request")); |
| 15052 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15053 | } |
| 15054 | else |
| 15055 | { |
| 15056 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15057 | "%s: No TDLS Connected Peer or " |
| 15058 | "isOffChannelConfigured %d", |
| 15059 | __func__, |
| 15060 | (connPeer ? connPeer->isOffChannelConfigured : -1)); |
| 15061 | } |
| 15062 | } |
| 15063 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15064 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15065 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15066 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 15067 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15068 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 15069 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15070 | 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] | 15071 | return -EINVAL; |
| 15072 | } |
| 15073 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15074 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15075 | ret = sme_SendTdlsLinkEstablishParams( |
| 15076 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15077 | pAdapter->sessionId, peer, |
| 15078 | &tdlsLinkEstablishParams); |
| 15079 | if (ret != VOS_STATUS_SUCCESS) { |
| 15080 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send link establishment params")); |
| 15081 | } |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 15082 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 15083 | * register with the TL on after the response for this operation |
| 15084 | * is received . |
| 15085 | */ |
| 15086 | ret = wait_for_completion_interruptible_timeout( |
| 15087 | &pAdapter->tdls_link_establish_req_comp, |
| 15088 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 15089 | if (ret <= 0) |
| 15090 | { |
| 15091 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15092 | "%s: Link Establish Request Faled Status %ld", |
| 15093 | __func__, ret); |
| 15094 | return -EINVAL; |
| 15095 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15096 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15097 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 15098 | eTDLS_LINK_CONNECTED, |
| 15099 | eTDLS_LINK_SUCCESS); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15100 | staDesc.ucSTAId = pTdlsPeer->staId; |
| 15101 | staDesc.ucQosEnabled = tdlsLinkEstablishParams.qos; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15102 | ret = WLANTL_UpdateTdlsSTAClient( |
| 15103 | pHddCtx->pvosContext, |
| 15104 | &staDesc); |
| 15105 | if (ret != VOS_STATUS_SUCCESS) { |
| 15106 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to update TDLS STA params")); |
| 15107 | } |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 15108 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 15109 | /* Mark TDLS client Authenticated .*/ |
| 15110 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 15111 | pTdlsPeer->staId, |
| 15112 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 15113 | if (VOS_STATUS_SUCCESS == status) |
| 15114 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15115 | if (pTdlsPeer->is_responder == 0) |
| 15116 | { |
| 15117 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
| 15118 | |
| 15119 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 15120 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 15121 | WAIT_TIME_TDLS_INITIATOR); |
| 15122 | /* suspend initiator TX until it receives direct packet from the |
| 15123 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15124 | ret = WLANTL_SuspendDataTx( |
| 15125 | (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 15126 | &staId, NULL); |
| 15127 | if (ret != VOS_STATUS_SUCCESS) { |
| 15128 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to suspend data tx")); |
| 15129 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 15130 | } |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 15131 | wlan_hdd_tdls_increment_peer_count(pAdapter); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15132 | |
| 15133 | /* TDLS Off Channel, Enable tdls channel switch, |
| 15134 | when their is only one tdls link and it supports */ |
| 15135 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15136 | if ((numCurrTdlsPeers == 1) && |
| 15137 | (TRUE == pTdlsPeer->isOffChannelSupported) && |
| 15138 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
| 15139 | { |
| 15140 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15141 | "%s: Send TDLS channel switch request for channel %d", |
| 15142 | __func__, pTdlsPeer->peerParams.channel); |
| 15143 | ret = sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15144 | pAdapter->sessionId, |
| 15145 | pTdlsPeer->peerMac, |
| 15146 | pTdlsPeer->peerParams.channel, |
| 15147 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15148 | TDLS_CHANNEL_SWITCH_ENABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15149 | if (ret != VOS_STATUS_SUCCESS) { |
| 15150 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS offchannel: Failed to send TDLS switch channel req")); |
| 15151 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15152 | } |
| 15153 | else |
| 15154 | { |
| 15155 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15156 | "%s: TDLS channel switch request not sent" |
| 15157 | " numCurrTdlsPeers %d " |
| 15158 | "isOffChannelSupported %d " |
| 15159 | "isOffChannelConfigured %d", |
| 15160 | __func__, numCurrTdlsPeers, |
| 15161 | pTdlsPeer->isOffChannelSupported, |
| 15162 | pTdlsPeer->isOffChannelConfigured); |
| 15163 | } |
| 15164 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 15165 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15166 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15167 | |
| 15168 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15169 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 15170 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15171 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15172 | int ac; |
| 15173 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 15174 | WLANTL_AC_VI, |
| 15175 | WLANTL_AC_BK, |
| 15176 | WLANTL_AC_BE }; |
| 15177 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 15178 | for(ac=0; ac < 4; ac++) |
| 15179 | { |
| 15180 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 15181 | pTdlsPeer->staId, ucAc[ac], |
| 15182 | tlTid[ac], tlTid[ac], 0, 0, |
| 15183 | WLANTL_BI_DIR ); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15184 | if (status != VOS_STATUS_SUCCESS) { |
| 15185 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to enable UAPSD for AC")); |
| 15186 | } |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 15187 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 15188 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15189 | } |
| 15190 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15191 | } |
| 15192 | break; |
| 15193 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15194 | { |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15195 | tANI_U16 numCurrTdlsPeers = 0; |
| 15196 | hddTdlsPeer_t *connPeer = NULL; |
| 15197 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15198 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
| 15199 | |
| 15200 | if ( NULL == pTdlsPeer ) { |
| 15201 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 15202 | " (oper %d) not exsting. ignored", |
| 15203 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 15204 | return -EINVAL; |
| 15205 | } |
| 15206 | |
| 15207 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15208 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 15209 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 15210 | "NL80211_TDLS_DISABLE_LINK"); |
| 15211 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 15212 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15213 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15214 | long status; |
| 15215 | |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 15216 | |
| 15217 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 15218 | eTDLS_LINK_TEARING, |
| 15219 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 15220 | eTDLS_LINK_UNSPECIFIED: |
| 15221 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15222 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 15223 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15224 | status = sme_DeleteTdlsPeerSta( |
| 15225 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15226 | pAdapter->sessionId, peer ); |
| 15227 | if (status != VOS_STATUS_SUCCESS) { |
| 15228 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 15229 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15230 | |
| 15231 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 15232 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 15233 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
Atul Mittal | 454664b | 2014-10-10 11:03:46 +0530 | [diff] [blame] | 15234 | eTDLS_LINK_IDLE, |
| 15235 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15236 | if (status <= 0) |
| 15237 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 15238 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15239 | "%s: Del station failed status %ld", |
| 15240 | __func__, status); |
| 15241 | return -EPERM; |
| 15242 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15243 | |
| 15244 | /* TDLS Off Channel, Enable tdls channel switch, |
| 15245 | when their is only one tdls link and it supports */ |
| 15246 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 15247 | if (numCurrTdlsPeers == 1) |
| 15248 | { |
| 15249 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
| 15250 | if ((connPeer) && |
| 15251 | (connPeer->isOffChannelSupported == TRUE) && |
| 15252 | (connPeer->isOffChannelConfigured == TRUE)) |
| 15253 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15254 | status = sme_SendTdlsChanSwitchReq( |
| 15255 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15256 | pAdapter->sessionId, |
| 15257 | connPeer->peerMac, |
| 15258 | connPeer->peerParams.channel, |
| 15259 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 15260 | TDLS_CHANNEL_SWITCH_ENABLE); |
| 15261 | if (status != VOS_STATUS_SUCCESS) { |
| 15262 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel req")); |
| 15263 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15264 | } |
| 15265 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15266 | "%s: TDLS channel switch " |
| 15267 | "isOffChannelSupported %d " |
| 15268 | "isOffChannelConfigured %d", |
| 15269 | __func__, |
| 15270 | (connPeer ? connPeer->isOffChannelSupported : -1), |
| 15271 | (connPeer ? connPeer->isOffChannelConfigured : -1)); |
| 15272 | } |
| 15273 | else |
| 15274 | { |
| 15275 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15276 | "%s: TDLS channel switch request not sent " |
| 15277 | "numCurrTdlsPeers %d ", |
| 15278 | __func__, numCurrTdlsPeers); |
| 15279 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15280 | } |
| 15281 | else |
| 15282 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15283 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15284 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15285 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 15286 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15287 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15288 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15289 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15290 | status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15291 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15292 | if (0 != status) |
| 15293 | { |
| 15294 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15295 | "%s: Error in TDLS Teardown", __func__); |
| 15296 | return status; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15297 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15298 | break; |
| 15299 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15300 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15301 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15302 | status = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 15303 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 15304 | NULL, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15305 | NULL); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15306 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 15307 | if (0 != status) |
| 15308 | { |
| 15309 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15310 | "%s: Error in TDLS Setup", __func__); |
| 15311 | return status; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 15312 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 15313 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 15314 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15315 | case NL80211_TDLS_DISCOVERY_REQ: |
| 15316 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15317 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 15318 | "%s: We don't support in-driver setup/teardown/discovery " |
| 15319 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15320 | return -ENOTSUPP; |
| 15321 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15322 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15323 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15324 | return -ENOTSUPP; |
| 15325 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15326 | |
| 15327 | EXIT(); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15328 | return 0; |
| 15329 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15330 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15331 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
| 15332 | u8 *peer, enum nl80211_tdls_operation oper) |
| 15333 | { |
| 15334 | int ret; |
| 15335 | |
| 15336 | vos_ssr_protect(__func__); |
| 15337 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 15338 | vos_ssr_unprotect(__func__); |
| 15339 | |
| 15340 | return ret; |
| 15341 | } |
| 15342 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15343 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 15344 | struct net_device *dev, u8 *peer) |
| 15345 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 15346 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 15347 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 15348 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15349 | |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15350 | #if TDLS_MGMT_VERSION2 |
| 15351 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 15352 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 15353 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15354 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 15355 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 15356 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 15357 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 15358 | #endif |
| 15359 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15360 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 15361 | /* |
| 15362 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 15363 | * Callback rountine called upon receiving response for |
| 15364 | * get offload info |
| 15365 | */ |
| 15366 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 15367 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 15368 | { |
| 15369 | |
| 15370 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15371 | tANI_U8 tempReplayCounter[8]; |
| 15372 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15373 | |
| 15374 | ENTER(); |
| 15375 | |
| 15376 | if (NULL == pAdapter) |
| 15377 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 15378 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15379 | "%s: HDD adapter is Null", __func__); |
| 15380 | return ; |
| 15381 | } |
| 15382 | |
| 15383 | if (NULL == pGtkOffloadGetInfoRsp) |
| 15384 | { |
| 15385 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15386 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 15387 | return ; |
| 15388 | } |
| 15389 | |
| 15390 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 15391 | { |
| 15392 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15393 | "%s: wlan Failed to get replay counter value", |
| 15394 | __func__); |
| 15395 | return ; |
| 15396 | } |
| 15397 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15398 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15399 | /* Update replay counter */ |
| 15400 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 15401 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 15402 | |
| 15403 | { |
| 15404 | /* changing from little to big endian since supplicant |
| 15405 | * works on big endian format |
| 15406 | */ |
| 15407 | int i; |
| 15408 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 15409 | |
| 15410 | for (i = 0; i < 8; i++) |
| 15411 | { |
| 15412 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 15413 | } |
| 15414 | } |
| 15415 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15416 | /* Update replay counter to NL */ |
| 15417 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15418 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15419 | } |
| 15420 | |
| 15421 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15422 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15423 | * This function is used to offload GTK rekeying job to the firmware. |
| 15424 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15425 | 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] | 15426 | struct cfg80211_gtk_rekey_data *data) |
| 15427 | { |
| 15428 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15429 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 15430 | hdd_station_ctx_t *pHddStaCtx; |
| 15431 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15432 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15433 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15434 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 15435 | |
| 15436 | ENTER(); |
| 15437 | |
| 15438 | if (NULL == pAdapter) |
| 15439 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15440 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15441 | "%s: HDD adapter is Null", __func__); |
| 15442 | return -ENODEV; |
| 15443 | } |
| 15444 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15445 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15446 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 15447 | pAdapter->sessionId, pAdapter->device_mode)); |
| 15448 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15449 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15450 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15451 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15452 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15453 | } |
| 15454 | |
| 15455 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15456 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 15457 | if (NULL == hHal) |
| 15458 | { |
| 15459 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15460 | "%s: HAL context is Null!!!", __func__); |
| 15461 | return -EAGAIN; |
| 15462 | } |
| 15463 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15464 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 15465 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 15466 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 15467 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15468 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15469 | { |
| 15470 | /* changing from big to little endian since driver |
| 15471 | * works on little endian format |
| 15472 | */ |
| 15473 | tANI_U8 *p = |
| 15474 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 15475 | int i; |
| 15476 | |
| 15477 | for (i = 0; i < 8; i++) |
| 15478 | { |
| 15479 | p[7-i] = data->replay_ctr[i]; |
| 15480 | } |
| 15481 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15482 | |
| 15483 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 15484 | { |
| 15485 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15486 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 15487 | sizeof (tSirGtkOffloadParams)); |
| 15488 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15489 | pAdapter->sessionId); |
| 15490 | |
| 15491 | if (eHAL_STATUS_SUCCESS != status) |
| 15492 | { |
| 15493 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15494 | "%s: sme_SetGTKOffload failed, returned %d", |
| 15495 | __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 15496 | |
| 15497 | /* Need to clear any trace of key value in the memory. |
| 15498 | * Thus zero out the memory even though it is local |
| 15499 | * variable. |
| 15500 | */ |
| 15501 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 15502 | sizeof(hddGtkOffloadReqParams)); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15503 | return status; |
| 15504 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15505 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15506 | "%s: sme_SetGTKOffload successfull", __func__); |
| 15507 | } |
| 15508 | else |
| 15509 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15510 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15511 | "%s: wlan not suspended GTKOffload request is stored", |
| 15512 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15513 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15514 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 15515 | /* Need to clear any trace of key value in the memory. |
| 15516 | * Thus zero out the memory even though it is local |
| 15517 | * variable. |
| 15518 | */ |
| 15519 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 15520 | sizeof(hddGtkOffloadReqParams)); |
| 15521 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15522 | EXIT(); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 15523 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15524 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 15525 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15526 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 15527 | struct cfg80211_gtk_rekey_data *data) |
| 15528 | { |
| 15529 | int ret; |
| 15530 | |
| 15531 | vos_ssr_protect(__func__); |
| 15532 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 15533 | vos_ssr_unprotect(__func__); |
| 15534 | |
| 15535 | return ret; |
| 15536 | } |
| 15537 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15538 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15539 | * FUNCTION: __wlan_hdd_cfg80211_set_mac_acl |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15540 | * This function is used to set access control policy |
| 15541 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15542 | static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 15543 | struct net_device *dev, |
| 15544 | const struct cfg80211_acl_data *params) |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15545 | { |
| 15546 | int i; |
| 15547 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15548 | hdd_hostapd_state_t *pHostapdState; |
| 15549 | tsap_Config_t *pConfig; |
| 15550 | v_CONTEXT_t pVosContext = NULL; |
| 15551 | hdd_context_t *pHddCtx; |
| 15552 | int status; |
| 15553 | |
| 15554 | ENTER(); |
| 15555 | |
| 15556 | if (NULL == pAdapter) |
| 15557 | { |
| 15558 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15559 | "%s: HDD adapter is Null", __func__); |
| 15560 | return -ENODEV; |
| 15561 | } |
| 15562 | |
| 15563 | if (NULL == params) |
| 15564 | { |
| 15565 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15566 | "%s: params is Null", __func__); |
| 15567 | return -EINVAL; |
| 15568 | } |
| 15569 | |
| 15570 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15571 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15572 | if (0 != status) |
| 15573 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15574 | return status; |
| 15575 | } |
| 15576 | |
| 15577 | pVosContext = pHddCtx->pvosContext; |
| 15578 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 15579 | |
| 15580 | if (NULL == pHostapdState) |
| 15581 | { |
| 15582 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15583 | "%s: pHostapdState is Null", __func__); |
| 15584 | return -EINVAL; |
| 15585 | } |
| 15586 | |
| 15587 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 15588 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
| 15589 | |
| 15590 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 15591 | { |
| 15592 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 15593 | |
| 15594 | /* default value */ |
| 15595 | pConfig->num_accept_mac = 0; |
| 15596 | pConfig->num_deny_mac = 0; |
| 15597 | |
| 15598 | /** |
| 15599 | * access control policy |
| 15600 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 15601 | * listed in hostapd.deny file. |
| 15602 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 15603 | * listed in hostapd.accept file. |
| 15604 | */ |
| 15605 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 15606 | { |
| 15607 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 15608 | } |
| 15609 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 15610 | { |
| 15611 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 15612 | } |
| 15613 | else |
| 15614 | { |
| 15615 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15616 | "%s:Acl Policy : %d is not supported", |
| 15617 | __func__, params->acl_policy); |
| 15618 | return -ENOTSUPP; |
| 15619 | } |
| 15620 | |
| 15621 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 15622 | { |
| 15623 | pConfig->num_accept_mac = params->n_acl_entries; |
| 15624 | for (i = 0; i < params->n_acl_entries; i++) |
| 15625 | { |
| 15626 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15627 | "** Add ACL MAC entry %i in WhiletList :" |
| 15628 | MAC_ADDRESS_STR, i, |
| 15629 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 15630 | |
| 15631 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 15632 | sizeof(qcmacaddr)); |
| 15633 | } |
| 15634 | } |
| 15635 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 15636 | { |
| 15637 | pConfig->num_deny_mac = params->n_acl_entries; |
| 15638 | for (i = 0; i < params->n_acl_entries; i++) |
| 15639 | { |
| 15640 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15641 | "** Add ACL MAC entry %i in BlackList :" |
| 15642 | MAC_ADDRESS_STR, i, |
| 15643 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 15644 | |
| 15645 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 15646 | sizeof(qcmacaddr)); |
| 15647 | } |
| 15648 | } |
| 15649 | |
| 15650 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 15651 | { |
| 15652 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15653 | "%s: SAP Set Mac Acl fail", __func__); |
| 15654 | return -EINVAL; |
| 15655 | } |
| 15656 | } |
| 15657 | else |
| 15658 | { |
| 15659 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15660 | "%s: Invalid device_mode = %s (%d)", |
| 15661 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 15662 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15663 | return -EINVAL; |
| 15664 | } |
| 15665 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15666 | EXIT(); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 15667 | return 0; |
| 15668 | } |
| 15669 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15670 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 15671 | struct net_device *dev, |
| 15672 | const struct cfg80211_acl_data *params) |
| 15673 | { |
| 15674 | int ret; |
| 15675 | vos_ssr_protect(__func__); |
| 15676 | ret = __wlan_hdd_cfg80211_set_mac_acl(wiphy, dev, params); |
| 15677 | vos_ssr_unprotect(__func__); |
| 15678 | |
| 15679 | return ret; |
| 15680 | } |
| 15681 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15682 | #ifdef WLAN_NL80211_TESTMODE |
| 15683 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15684 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15685 | ( |
| 15686 | void *pAdapter, |
| 15687 | void *indCont |
| 15688 | ) |
| 15689 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15690 | tSirLPHBInd *lphbInd; |
| 15691 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15692 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15693 | |
| 15694 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15695 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15696 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15697 | if (pAdapter == NULL) |
| 15698 | { |
| 15699 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15700 | "%s: pAdapter is NULL\n",__func__); |
| 15701 | return; |
| 15702 | } |
| 15703 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15704 | if (NULL == indCont) |
| 15705 | { |
| 15706 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15707 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15708 | return; |
| 15709 | } |
| 15710 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15711 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15712 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15713 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 15714 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15715 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15716 | GFP_ATOMIC); |
| 15717 | if (!skb) |
| 15718 | { |
| 15719 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15720 | "LPHB timeout, NL buffer alloc fail"); |
| 15721 | return; |
| 15722 | } |
| 15723 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15724 | 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] | 15725 | { |
| 15726 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15727 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 15728 | goto nla_put_failure; |
| 15729 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15730 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15731 | { |
| 15732 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15733 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 15734 | goto nla_put_failure; |
| 15735 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 15736 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15737 | sizeof(tSirLPHBInd), lphbInd)) |
| 15738 | { |
| 15739 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15740 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 15741 | goto nla_put_failure; |
| 15742 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15743 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 15744 | return; |
| 15745 | |
| 15746 | nla_put_failure: |
| 15747 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15748 | "NLA Put fail"); |
| 15749 | kfree_skb(skb); |
| 15750 | |
| 15751 | return; |
| 15752 | } |
| 15753 | #endif /* FEATURE_WLAN_LPHB */ |
| 15754 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15755 | 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] | 15756 | { |
| 15757 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 15758 | int err = 0; |
| 15759 | #ifdef FEATURE_WLAN_LPHB |
| 15760 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15761 | eHalStatus smeStatus; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15762 | |
| 15763 | ENTER(); |
| 15764 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 15765 | err = wlan_hdd_validate_context(pHddCtx); |
| 15766 | if (0 != err) |
| 15767 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 15768 | return err; |
| 15769 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15770 | #endif /* FEATURE_WLAN_LPHB */ |
| 15771 | |
| 15772 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 15773 | if (err) |
| 15774 | { |
| 15775 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15776 | "%s Testmode INV ATTR", __func__); |
| 15777 | return err; |
| 15778 | } |
| 15779 | |
| 15780 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 15781 | { |
| 15782 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15783 | "%s Testmode INV CMD", __func__); |
| 15784 | return -EINVAL; |
| 15785 | } |
| 15786 | |
| 15787 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 15788 | { |
| 15789 | #ifdef FEATURE_WLAN_LPHB |
| 15790 | /* Low Power Heartbeat configuration request */ |
| 15791 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 15792 | { |
| 15793 | int buf_len; |
| 15794 | void *buf; |
| 15795 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 15796 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15797 | |
| 15798 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 15799 | { |
| 15800 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15801 | "%s Testmode INV DATA", __func__); |
| 15802 | return -EINVAL; |
| 15803 | } |
| 15804 | |
| 15805 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 15806 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 15807 | |
| 15808 | hb_params_temp =(tSirLPHBReq *)buf; |
| 15809 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 15810 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 15811 | return -EINVAL; |
| 15812 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15813 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 15814 | if (NULL == hb_params) |
| 15815 | { |
| 15816 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15817 | "%s Request Buffer Alloc Fail", __func__); |
| 15818 | return -EINVAL; |
| 15819 | } |
| 15820 | |
| 15821 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15822 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 15823 | hb_params, |
| 15824 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 15825 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15826 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 15827 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15828 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15829 | vos_mem_free(hb_params); |
| 15830 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15831 | return 0; |
| 15832 | } |
| 15833 | #endif /* FEATURE_WLAN_LPHB */ |
| 15834 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15835 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15836 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15837 | return -EOPNOTSUPP; |
| 15838 | } |
| 15839 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15840 | EXIT(); |
| 15841 | return err; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15842 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15843 | |
| 15844 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) |
| 15845 | { |
| 15846 | int ret; |
| 15847 | |
| 15848 | vos_ssr_protect(__func__); |
| 15849 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 15850 | vos_ssr_unprotect(__func__); |
| 15851 | |
| 15852 | return ret; |
| 15853 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 15854 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 15855 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15856 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15857 | struct net_device *dev, |
| 15858 | int idx, struct survey_info *survey) |
| 15859 | { |
| 15860 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 15861 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 15862 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15863 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 15864 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15865 | v_S7_t snr,rssi; |
| 15866 | int status, i, j, filled = 0; |
| 15867 | |
| 15868 | ENTER(); |
| 15869 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15870 | if (NULL == pAdapter) |
| 15871 | { |
| 15872 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15873 | "%s: HDD adapter is Null", __func__); |
| 15874 | return -ENODEV; |
| 15875 | } |
| 15876 | |
| 15877 | if (NULL == wiphy) |
| 15878 | { |
| 15879 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 15880 | "%s: wiphy is Null", __func__); |
| 15881 | return -ENODEV; |
| 15882 | } |
| 15883 | |
| 15884 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15885 | status = wlan_hdd_validate_context(pHddCtx); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15886 | if (0 != status) |
| 15887 | { |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15888 | return status; |
| 15889 | } |
| 15890 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 15891 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15892 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15893 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 15894 | 0 != pAdapter->survey_idx || |
| 15895 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15896 | { |
| 15897 | /* The survey dump ops when implemented completely is expected to |
| 15898 | * return a survey of all channels and the ops is called by the |
| 15899 | * kernel with incremental values of the argument 'idx' till it |
| 15900 | * returns -ENONET. But we can only support the survey for the |
| 15901 | * operating channel for now. survey_idx is used to track |
| 15902 | * that the ops is called only once and then return -ENONET for |
| 15903 | * the next iteration |
| 15904 | */ |
| 15905 | pAdapter->survey_idx = 0; |
| 15906 | return -ENONET; |
| 15907 | } |
| 15908 | |
| 15909 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 15910 | |
| 15911 | wlan_hdd_get_snr(pAdapter, &snr); |
| 15912 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 15913 | |
| 15914 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 15915 | hdd_wlan_get_freq(channel, &freq); |
| 15916 | |
| 15917 | |
| 15918 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 15919 | { |
| 15920 | if (NULL == wiphy->bands[i]) |
| 15921 | { |
| 15922 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 15923 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 15924 | continue; |
| 15925 | } |
| 15926 | |
| 15927 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 15928 | { |
| 15929 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 15930 | |
| 15931 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 15932 | { |
| 15933 | survey->channel = &band->channels[j]; |
| 15934 | /* The Rx BDs contain SNR values in dB for the received frames |
| 15935 | * while the supplicant expects noise. So we calculate and |
| 15936 | * return the value of noise (dBm) |
| 15937 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 15938 | */ |
| 15939 | survey->noise = rssi - snr; |
| 15940 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 15941 | filled = 1; |
| 15942 | } |
| 15943 | } |
| 15944 | } |
| 15945 | |
| 15946 | if (filled) |
| 15947 | pAdapter->survey_idx = 1; |
| 15948 | else |
| 15949 | { |
| 15950 | pAdapter->survey_idx = 0; |
| 15951 | return -ENONET; |
| 15952 | } |
| 15953 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15954 | EXIT(); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15955 | return 0; |
| 15956 | } |
| 15957 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15958 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 15959 | struct net_device *dev, |
| 15960 | int idx, struct survey_info *survey) |
| 15961 | { |
| 15962 | int ret; |
| 15963 | |
| 15964 | vos_ssr_protect(__func__); |
| 15965 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 15966 | vos_ssr_unprotect(__func__); |
| 15967 | |
| 15968 | return ret; |
| 15969 | } |
| 15970 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15971 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 15972 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15973 | * this is called when cfg80211 driver resume |
| 15974 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 15975 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 15976 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15977 | { |
| 15978 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 15979 | hdd_adapter_t *pAdapter; |
| 15980 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 15981 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 15982 | |
| 15983 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15984 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 15985 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15986 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 15987 | return 0; |
| 15988 | } |
| 15989 | |
| 15990 | spin_lock(&pHddCtx->schedScan_lock); |
| 15991 | pHddCtx->isWiphySuspended = FALSE; |
| 15992 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 15993 | { |
| 15994 | spin_unlock(&pHddCtx->schedScan_lock); |
| 15995 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15996 | "%s: Return resume is not due to PNO indication", __func__); |
| 15997 | return 0; |
| 15998 | } |
| 15999 | // Reset flag to avoid updatating cfg80211 data old results again |
| 16000 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 16001 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16002 | |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16003 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16004 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 16005 | |
| 16006 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 16007 | { |
| 16008 | pAdapter = pAdapterNode->pAdapter; |
| 16009 | if ( (NULL != pAdapter) && |
| 16010 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 16011 | { |
| 16012 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16013 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16014 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 16015 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16016 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16017 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16018 | { |
| 16019 | /* Acquire wakelock to handle the case where APP's tries to |
| 16020 | * suspend immediately after updating the scan results. Whis |
| 16021 | * results in app's is in suspended state and not able to |
| 16022 | * process the connect request to AP |
| 16023 | */ |
| 16024 | hdd_prevent_suspend_timeout(2000); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16025 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 16026 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16027 | |
| 16028 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16029 | "%s : cfg80211 scan result database updated", __func__); |
| 16030 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16031 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16032 | return 0; |
| 16033 | |
| 16034 | } |
| 16035 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 16036 | pAdapterNode = pNext; |
| 16037 | } |
| 16038 | |
| 16039 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16040 | "%s: Failed to find Adapter", __func__); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16041 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16042 | return 0; |
| 16043 | } |
| 16044 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16045 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 16046 | { |
| 16047 | int ret; |
| 16048 | |
| 16049 | vos_ssr_protect(__func__); |
| 16050 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 16051 | vos_ssr_unprotect(__func__); |
| 16052 | |
| 16053 | return ret; |
| 16054 | } |
| 16055 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16056 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16057 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16058 | * this is called when cfg80211 driver suspends |
| 16059 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16060 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16061 | struct cfg80211_wowlan *wow) |
| 16062 | { |
| 16063 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16064 | int ret = 0; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16065 | |
| 16066 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16067 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16068 | ret = wlan_hdd_validate_context(pHddCtx); |
| 16069 | if (0 != ret) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16070 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16071 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16072 | } |
| 16073 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16074 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16075 | pHddCtx->isWiphySuspended = TRUE; |
| 16076 | |
| 16077 | EXIT(); |
| 16078 | |
| 16079 | return 0; |
| 16080 | } |
| 16081 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 16082 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 16083 | struct cfg80211_wowlan *wow) |
| 16084 | { |
| 16085 | int ret; |
| 16086 | |
| 16087 | vos_ssr_protect(__func__); |
| 16088 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 16089 | vos_ssr_unprotect(__func__); |
| 16090 | |
| 16091 | return ret; |
| 16092 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16093 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16094 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16095 | { |
| 16096 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 16097 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 16098 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 16099 | .change_station = wlan_hdd_change_station, |
| 16100 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 16101 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 16102 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 16103 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16104 | #else |
| 16105 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 16106 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 16107 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16108 | #endif |
| 16109 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 16110 | .add_key = wlan_hdd_cfg80211_add_key, |
| 16111 | .get_key = wlan_hdd_cfg80211_get_key, |
| 16112 | .del_key = wlan_hdd_cfg80211_del_key, |
| 16113 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 16114 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16115 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 16116 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16117 | .scan = wlan_hdd_cfg80211_scan, |
| 16118 | .connect = wlan_hdd_cfg80211_connect, |
| 16119 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 16120 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 16121 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 16122 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 16123 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 16124 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16125 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 16126 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 16127 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16128 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 16129 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 16130 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 16131 | .set_txq_params = wlan_hdd_set_txq_params, |
| 16132 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16133 | .get_station = wlan_hdd_cfg80211_get_station, |
| 16134 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 16135 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16136 | .add_station = wlan_hdd_cfg80211_add_station, |
| 16137 | #ifdef FEATURE_WLAN_LFR |
| 16138 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 16139 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 16140 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 16141 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16142 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 16143 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 16144 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16145 | #ifdef FEATURE_WLAN_TDLS |
| 16146 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 16147 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 16148 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16149 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 16150 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 16151 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16152 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 16153 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 16154 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 16155 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16156 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 16157 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16158 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 16159 | #ifdef WLAN_NL80211_TESTMODE |
| 16160 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 16161 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 16162 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16163 | }; |
| 16164 | |