Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 26 | * |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame] | 27 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 28 | |
| 29 | |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 30 | |
| 31 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 32 | /**======================================================================== |
| 33 | |
| 34 | \file wlan_hdd_cfg80211.c |
| 35 | |
| 36 | \brief WLAN Host Device Driver implementation |
| 37 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 38 | ========================================================================*/ |
| 39 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 40 | /**========================================================================= |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 41 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 42 | EDIT HISTORY FOR FILE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 43 | |
| 44 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 45 | This section contains comments describing changes made to the module. |
| 46 | Notice that changes are listed in reverse chronological order. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 47 | |
| 48 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 49 | $Header:$ $DateTime: $ $Author: $ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 50 | |
| 51 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 52 | when who what, where, why |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 53 | -------- --- -------------------------------------------------------- |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 54 | 21/12/09 Ashwani Created module. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 55 | |
| 56 | 07/06/10 Kumar Deepak Implemented cfg80211 callbacks for ANDROID |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 57 | Ganesh K |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 58 | ==========================================================================*/ |
| 59 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 60 | |
| 61 | #include <linux/version.h> |
| 62 | #include <linux/module.h> |
| 63 | #include <linux/kernel.h> |
| 64 | #include <linux/init.h> |
| 65 | #include <linux/wireless.h> |
| 66 | #include <wlan_hdd_includes.h> |
| 67 | #include <net/arp.h> |
| 68 | #include <net/cfg80211.h> |
| 69 | #include <linux/wireless.h> |
| 70 | #include <wlan_hdd_wowl.h> |
| 71 | #include <aniGlobal.h> |
| 72 | #include "ccmApi.h" |
| 73 | #include "sirParams.h" |
| 74 | #include "dot11f.h" |
| 75 | #include "wlan_hdd_assoc.h" |
| 76 | #include "wlan_hdd_wext.h" |
| 77 | #include "sme_Api.h" |
| 78 | #include "wlan_hdd_p2p.h" |
| 79 | #include "wlan_hdd_cfg80211.h" |
| 80 | #include "wlan_hdd_hostapd.h" |
| 81 | #include "sapInternal.h" |
| 82 | #include "wlan_hdd_softap_tx_rx.h" |
| 83 | #include "wlan_hdd_main.h" |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 84 | #include "wlan_hdd_assoc.h" |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 85 | #include "wlan_hdd_power.h" |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 86 | #include "wlan_hdd_trace.h" |
| 87 | #include "vos_types.h" |
| 88 | #include "vos_trace.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 89 | #ifdef WLAN_BTAMP_FEATURE |
| 90 | #include "bap_hdd_misc.h" |
| 91 | #endif |
| 92 | #include <qc_sap_ioctl.h> |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 93 | #include "wlan_hdd_tdls.h" |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 94 | #include "wlan_hdd_wmm.h" |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 95 | #include "wlan_qct_wda.h" |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 96 | #include "wlan_nv.h" |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 97 | #include "wlan_hdd_dev_pwr.h" |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 98 | #include "qwlan_version.h" |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 99 | #include "wlan_logging_sock_svc.h" |
Agrawal Ashish | cfe8328 | 2016-09-29 13:03:45 +0530 | [diff] [blame] | 100 | #include "wlan_hdd_misc.h" |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 101 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 102 | |
| 103 | #define g_mode_rates_size (12) |
| 104 | #define a_mode_rates_size (8) |
| 105 | #define FREQ_BASE_80211G (2407) |
| 106 | #define FREQ_BAND_DIFF_80211G (5) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 107 | #define MAX_SCAN_SSID 9 |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 108 | #define MAX_PENDING_LOG 5 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 109 | #define GET_IE_LEN_IN_BSS_DESC(lenInBss) ( lenInBss + sizeof(lenInBss) - \ |
krunal soni | 2a6a906 | 2014-02-11 14:14:23 -0800 | [diff] [blame] | 110 | ((uintptr_t)OFFSET_OF( tSirBssDescription, ieFields))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 111 | |
| 112 | #define HDD2GHZCHAN(freq, chan, flag) { \ |
| 113 | .band = IEEE80211_BAND_2GHZ, \ |
| 114 | .center_freq = (freq), \ |
| 115 | .hw_value = (chan),\ |
| 116 | .flags = (flag), \ |
| 117 | .max_antenna_gain = 0 ,\ |
| 118 | .max_power = 30, \ |
| 119 | } |
| 120 | |
| 121 | #define HDD5GHZCHAN(freq, chan, flag) { \ |
| 122 | .band = IEEE80211_BAND_5GHZ, \ |
| 123 | .center_freq = (freq), \ |
| 124 | .hw_value = (chan),\ |
| 125 | .flags = (flag), \ |
| 126 | .max_antenna_gain = 0 ,\ |
| 127 | .max_power = 30, \ |
| 128 | } |
| 129 | |
| 130 | #define HDD_G_MODE_RATETAB(rate, rate_id, flag)\ |
| 131 | {\ |
| 132 | .bitrate = rate, \ |
| 133 | .hw_value = rate_id, \ |
| 134 | .flags = flag, \ |
| 135 | } |
| 136 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 137 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 138 | #define WLAN_AKM_SUITE_FT_8021X 0x000FAC03 |
| 139 | #define WLAN_AKM_SUITE_FT_PSK 0x000FAC04 |
| 140 | #endif |
| 141 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 142 | #define HDD_CHANNEL_14 14 |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 143 | #define WLAN_HDD_MAX_FEATURE_SET 8 |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 144 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 145 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 146 | /* |
| 147 | * Used to allocate the size of 4096 for the link layer stats. |
| 148 | * The size of 4096 is considered assuming that all data per |
| 149 | * respective event fit with in the limit.Please take a call |
| 150 | * on the limit based on the data requirements on link layer |
| 151 | * statistics. |
| 152 | */ |
| 153 | #define LL_STATS_EVENT_BUF_SIZE 4096 |
| 154 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 155 | #ifdef WLAN_FEATURE_EXTSCAN |
| 156 | /* |
| 157 | * Used to allocate the size of 4096 for the EXTScan NL data. |
| 158 | * The size of 4096 is considered assuming that all data per |
| 159 | * respective event fit with in the limit.Please take a call |
| 160 | * on the limit based on the data requirements. |
| 161 | */ |
| 162 | |
| 163 | #define EXTSCAN_EVENT_BUF_SIZE 4096 |
| 164 | #define EXTSCAN_MAX_CACHED_RESULTS_PER_IND 32 |
| 165 | #endif |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 166 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 167 | /*EXT TDLS*/ |
| 168 | /* |
| 169 | * Used to allocate the size of 4096 for the TDLS. |
| 170 | * The size of 4096 is considered assuming that all data per |
| 171 | * respective event fit with in the limit.Please take a call |
| 172 | * on the limit based on the data requirements on link layer |
| 173 | * statistics. |
| 174 | */ |
| 175 | #define EXTTDLS_EVENT_BUF_SIZE 4096 |
| 176 | |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 177 | /* |
| 178 | * Values for Mac spoofing feature |
| 179 | * |
| 180 | */ |
| 181 | #define MAC_ADDR_SPOOFING_FW_HOST_DISABLE 0 |
| 182 | #define MAC_ADDR_SPOOFING_FW_HOST_ENABLE 1 |
| 183 | #define MAC_ADDR_SPOOFING_FW_ENABLE_HOST_DISABLE 2 |
Padma, Santhosh Kumar | db2d75b | 2015-11-17 12:18:10 +0530 | [diff] [blame] | 184 | #define MAC_ADDR_SPOOFING_DEFER_INTERVAL 10 //in ms |
| 185 | |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 186 | /* |
| 187 | * max_sched_scan_plans defined to 10 |
| 188 | */ |
| 189 | #define MAX_SCHED_SCAN_PLANS 10 |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 190 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 191 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 192 | { |
| 193 | WLAN_CIPHER_SUITE_WEP40, |
| 194 | WLAN_CIPHER_SUITE_WEP104, |
| 195 | WLAN_CIPHER_SUITE_TKIP, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 196 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 197 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 198 | WLAN_CIPHER_SUITE_KRK, |
| 199 | WLAN_CIPHER_SUITE_CCMP, |
| 200 | #else |
| 201 | WLAN_CIPHER_SUITE_CCMP, |
| 202 | #endif |
| 203 | #ifdef FEATURE_WLAN_WAPI |
| 204 | WLAN_CIPHER_SUITE_SMS4, |
| 205 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 206 | #ifdef WLAN_FEATURE_11W |
| 207 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 208 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 209 | }; |
| 210 | |
| 211 | static inline int is_broadcast_ether_addr(const u8 *addr) |
| 212 | { |
| 213 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && |
| 214 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 215 | } |
| 216 | |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 217 | const static struct ieee80211_channel hdd_channels_2_4_GHZ[] = |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 218 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 219 | HDD2GHZCHAN(2412, 1, 0) , |
| 220 | HDD2GHZCHAN(2417, 2, 0) , |
| 221 | HDD2GHZCHAN(2422, 3, 0) , |
| 222 | HDD2GHZCHAN(2427, 4, 0) , |
| 223 | HDD2GHZCHAN(2432, 5, 0) , |
| 224 | HDD2GHZCHAN(2437, 6, 0) , |
| 225 | HDD2GHZCHAN(2442, 7, 0) , |
| 226 | HDD2GHZCHAN(2447, 8, 0) , |
| 227 | HDD2GHZCHAN(2452, 9, 0) , |
| 228 | HDD2GHZCHAN(2457, 10, 0) , |
| 229 | HDD2GHZCHAN(2462, 11, 0) , |
| 230 | HDD2GHZCHAN(2467, 12, 0) , |
| 231 | HDD2GHZCHAN(2472, 13, 0) , |
| 232 | HDD2GHZCHAN(2484, 14, 0) , |
| 233 | }; |
| 234 | |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 235 | const static struct ieee80211_channel hdd_channels_5_GHZ[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 236 | { |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 237 | HDD5GHZCHAN(4920, 240, 0) , |
| 238 | HDD5GHZCHAN(4940, 244, 0) , |
| 239 | HDD5GHZCHAN(4960, 248, 0) , |
| 240 | HDD5GHZCHAN(4980, 252, 0) , |
| 241 | HDD5GHZCHAN(5040, 208, 0) , |
| 242 | HDD5GHZCHAN(5060, 212, 0) , |
| 243 | HDD5GHZCHAN(5080, 216, 0) , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 244 | HDD5GHZCHAN(5180, 36, 0) , |
| 245 | HDD5GHZCHAN(5200, 40, 0) , |
| 246 | HDD5GHZCHAN(5220, 44, 0) , |
| 247 | HDD5GHZCHAN(5240, 48, 0) , |
| 248 | HDD5GHZCHAN(5260, 52, 0) , |
| 249 | HDD5GHZCHAN(5280, 56, 0) , |
| 250 | HDD5GHZCHAN(5300, 60, 0) , |
| 251 | HDD5GHZCHAN(5320, 64, 0) , |
| 252 | HDD5GHZCHAN(5500,100, 0) , |
| 253 | HDD5GHZCHAN(5520,104, 0) , |
| 254 | HDD5GHZCHAN(5540,108, 0) , |
| 255 | HDD5GHZCHAN(5560,112, 0) , |
| 256 | HDD5GHZCHAN(5580,116, 0) , |
| 257 | HDD5GHZCHAN(5600,120, 0) , |
| 258 | HDD5GHZCHAN(5620,124, 0) , |
| 259 | HDD5GHZCHAN(5640,128, 0) , |
| 260 | HDD5GHZCHAN(5660,132, 0) , |
| 261 | HDD5GHZCHAN(5680,136, 0) , |
| 262 | HDD5GHZCHAN(5700,140, 0) , |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 263 | #ifdef FEATURE_WLAN_CH144 |
| 264 | HDD5GHZCHAN(5720,144, 0) , |
| 265 | #endif /* FEATURE_WLAN_CH144 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 266 | HDD5GHZCHAN(5745,149, 0) , |
| 267 | HDD5GHZCHAN(5765,153, 0) , |
| 268 | HDD5GHZCHAN(5785,157, 0) , |
| 269 | HDD5GHZCHAN(5805,161, 0) , |
| 270 | HDD5GHZCHAN(5825,165, 0) , |
| 271 | }; |
| 272 | |
| 273 | static struct ieee80211_rate g_mode_rates[] = |
| 274 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 275 | HDD_G_MODE_RATETAB(10, 0x1, 0), |
| 276 | HDD_G_MODE_RATETAB(20, 0x2, 0), |
| 277 | HDD_G_MODE_RATETAB(55, 0x4, 0), |
| 278 | HDD_G_MODE_RATETAB(110, 0x8, 0), |
| 279 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 280 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 281 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 282 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 283 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 284 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 285 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 286 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 287 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 288 | |
| 289 | static struct ieee80211_rate a_mode_rates[] = |
| 290 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 291 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 292 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 293 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 294 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 295 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 296 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 297 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 298 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
| 299 | }; |
| 300 | |
| 301 | static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ = |
| 302 | { |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 303 | .channels = NULL, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 304 | .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ), |
| 305 | .band = IEEE80211_BAND_2GHZ, |
| 306 | .bitrates = g_mode_rates, |
| 307 | .n_bitrates = g_mode_rates_size, |
| 308 | .ht_cap.ht_supported = 1, |
| 309 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 310 | | IEEE80211_HT_CAP_GRN_FLD |
| 311 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 312 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 313 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 314 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 315 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 316 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 317 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 318 | }; |
| 319 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 320 | static struct ieee80211_supported_band wlan_hdd_band_5_GHZ = |
| 321 | { |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 322 | .channels = NULL, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 323 | .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ), |
| 324 | .band = IEEE80211_BAND_5GHZ, |
| 325 | .bitrates = a_mode_rates, |
| 326 | .n_bitrates = a_mode_rates_size, |
| 327 | .ht_cap.ht_supported = 1, |
| 328 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 329 | | IEEE80211_HT_CAP_GRN_FLD |
| 330 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 331 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT |
| 332 | | IEEE80211_HT_CAP_SGI_40 |
| 333 | | IEEE80211_HT_CAP_SUP_WIDTH_20_40, |
| 334 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 335 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 336 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 337 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 338 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 339 | }; |
| 340 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 341 | /* This structure contain information what kind of frame are expected in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 342 | TX/RX direction for each kind of interface */ |
| 343 | static const struct ieee80211_txrx_stypes |
| 344 | wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = { |
| 345 | [NL80211_IFTYPE_STATION] = { |
| 346 | .tx = 0xffff, |
| 347 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 348 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 349 | }, |
| 350 | [NL80211_IFTYPE_AP] = { |
| 351 | .tx = 0xffff, |
| 352 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 353 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 354 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 355 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 356 | BIT(SIR_MAC_MGMT_AUTH) | |
| 357 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 358 | BIT(SIR_MAC_MGMT_ACTION), |
| 359 | }, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 360 | [NL80211_IFTYPE_ADHOC] = { |
| 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 | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 370 | [NL80211_IFTYPE_P2P_CLIENT] = { |
| 371 | .tx = 0xffff, |
| 372 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 373 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 374 | }, |
| 375 | [NL80211_IFTYPE_P2P_GO] = { |
| 376 | /* This is also same as for SoftAP */ |
| 377 | .tx = 0xffff, |
| 378 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 379 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 380 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 381 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 382 | BIT(SIR_MAC_MGMT_AUTH) | |
| 383 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 384 | BIT(SIR_MAC_MGMT_ACTION), |
| 385 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 386 | }; |
| 387 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 388 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 389 | static const struct ieee80211_iface_limit |
| 390 | wlan_hdd_iface_limit[] = { |
| 391 | { |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 392 | /* max = 3 ; Our driver create two interfaces during driver init |
| 393 | * wlan0 and p2p0 interfaces. p2p0 is considered as station |
| 394 | * interface until a group is formed. In JB architecture, once the |
| 395 | * group is formed, interface type of p2p0 is changed to P2P GO or |
| 396 | * Client. |
| 397 | * When supplicant remove the group, it first issue a set interface |
| 398 | * cmd to change the mode back to Station. In JB this works fine as |
| 399 | * we advertize two station type interface during driver init. |
| 400 | * Some vendors create separate interface for P2P GO/Client, |
| 401 | * after group formation(Third one). But while group remove |
| 402 | * supplicant first tries to change the mode(3rd interface) to STATION |
| 403 | * But as we advertized only two sta type interfaces nl80211 was |
| 404 | * returning error for the third one which was leading to failure in |
| 405 | * delete interface. Ideally while removing the group, supplicant |
| 406 | * should not try to change the 3rd interface mode to Station type. |
| 407 | * Till we get a fix in wpa_supplicant, we advertize max STA |
| 408 | * interface type to 3 |
| 409 | */ |
| 410 | .max = 3, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 411 | .types = BIT(NL80211_IFTYPE_STATION), |
| 412 | }, |
| 413 | { |
| 414 | .max = 1, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 415 | .types = BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP), |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 416 | }, |
| 417 | { |
| 418 | .max = 1, |
| 419 | .types = BIT(NL80211_IFTYPE_P2P_GO) | |
| 420 | BIT(NL80211_IFTYPE_P2P_CLIENT), |
| 421 | }, |
| 422 | }; |
| 423 | |
| 424 | /* By default, only single channel concurrency is allowed */ |
| 425 | static struct ieee80211_iface_combination |
| 426 | wlan_hdd_iface_combination = { |
| 427 | .limits = wlan_hdd_iface_limit, |
| 428 | .num_different_channels = 1, |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 429 | /* |
| 430 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 431 | * and p2p0 interfaces during driver init |
| 432 | * Some vendors create separate interface for P2P operations. |
| 433 | * wlan0: STA interface |
| 434 | * p2p0: P2P Device interface, action frames goes |
| 435 | * through this interface. |
| 436 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 437 | * created for p2p operations(GO/CLIENT interface). |
| 438 | */ |
| 439 | .max_interfaces = WLAN_MAX_INTERFACES, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 440 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 441 | .beacon_int_infra_match = false, |
| 442 | }; |
| 443 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 444 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 445 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 446 | |
| 447 | /* Data rate 100KBPS based on IE Index */ |
| 448 | struct index_data_rate_type |
| 449 | { |
| 450 | v_U8_t beacon_rate_index; |
| 451 | v_U16_t supported_rate[4]; |
| 452 | }; |
| 453 | |
| 454 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 455 | The IDX field is the rate index |
| 456 | The HI field is the rate when RSSI is strong or being ignored |
| 457 | (in this case we report actual rate) |
| 458 | The MID field is the rate when RSSI is moderate |
| 459 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 460 | The LO field is the rate when RSSI is low |
| 461 | (in this case we don't report rates, actual current rate used) |
| 462 | */ |
| 463 | static const struct |
| 464 | { |
| 465 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 466 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 467 | } supported_data_rate[] = |
| 468 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 469 | /* IDX HI HM LM LO (RSSI-based index */ |
| 470 | {2, { 10, 10, 10, 0}}, |
| 471 | {4, { 20, 20, 10, 0}}, |
| 472 | {11, { 55, 20, 10, 0}}, |
| 473 | {12, { 60, 55, 20, 0}}, |
| 474 | {18, { 90, 55, 20, 0}}, |
| 475 | {22, {110, 55, 20, 0}}, |
| 476 | {24, {120, 90, 60, 0}}, |
| 477 | {36, {180, 120, 60, 0}}, |
| 478 | {44, {220, 180, 60, 0}}, |
| 479 | {48, {240, 180, 90, 0}}, |
| 480 | {66, {330, 180, 90, 0}}, |
| 481 | {72, {360, 240, 90, 0}}, |
| 482 | {96, {480, 240, 120, 0}}, |
| 483 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 484 | }; |
| 485 | |
| 486 | /* MCS Based rate table */ |
| 487 | static struct index_data_rate_type supported_mcs_rate[] = |
| 488 | { |
| 489 | /* MCS L20 L40 S20 S40 */ |
| 490 | {0, {65, 135, 72, 150}}, |
| 491 | {1, {130, 270, 144, 300}}, |
| 492 | {2, {195, 405, 217, 450}}, |
| 493 | {3, {260, 540, 289, 600}}, |
| 494 | {4, {390, 810, 433, 900}}, |
| 495 | {5, {520, 1080, 578, 1200}}, |
| 496 | {6, {585, 1215, 650, 1350}}, |
| 497 | {7, {650, 1350, 722, 1500}} |
| 498 | }; |
| 499 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 500 | #ifdef WLAN_FEATURE_11AC |
| 501 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 502 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 503 | |
| 504 | struct index_vht_data_rate_type |
| 505 | { |
| 506 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 507 | v_U16_t supported_VHT80_rate[2]; |
| 508 | v_U16_t supported_VHT40_rate[2]; |
| 509 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 510 | }; |
| 511 | |
| 512 | typedef enum |
| 513 | { |
| 514 | DATA_RATE_11AC_MAX_MCS_7, |
| 515 | DATA_RATE_11AC_MAX_MCS_8, |
| 516 | DATA_RATE_11AC_MAX_MCS_9, |
| 517 | DATA_RATE_11AC_MAX_MCS_NA |
| 518 | } eDataRate11ACMaxMcs; |
| 519 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 520 | /* SSID broadcast type */ |
| 521 | typedef enum eSSIDBcastType |
| 522 | { |
| 523 | eBCAST_UNKNOWN = 0, |
| 524 | eBCAST_NORMAL = 1, |
| 525 | eBCAST_HIDDEN = 2, |
| 526 | } tSSIDBcastType; |
| 527 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 528 | /* MCS Based VHT rate table */ |
| 529 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 530 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 531 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 532 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 533 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 534 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 535 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 536 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 537 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 538 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 539 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 540 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 541 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 542 | }; |
| 543 | #endif /* WLAN_FEATURE_11AC */ |
| 544 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 545 | /*array index points to MCS and array value points respective rssi*/ |
| 546 | static int rssiMcsTbl[][10] = |
| 547 | { |
| 548 | /*MCS 0 1 2 3 4 5 6 7 8 9*/ |
| 549 | {-82, -79, -77, -74, -70, -66, -65, -64, -59, -57}, //20 |
| 550 | {-79, -76, -74, -71, -67, -63, -62, -61, -56, -54}, //40 |
| 551 | {-76, -73, -71, -68, -64, -60, -59, -58, -53, -51} //80 |
| 552 | }; |
| 553 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 554 | extern struct net_device_ops net_ops_struct; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 555 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 556 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter); |
| 557 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 558 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 559 | #ifdef WLAN_NL80211_TESTMODE |
| 560 | enum wlan_hdd_tm_attr |
| 561 | { |
| 562 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 563 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 564 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 565 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 566 | /* keep last */ |
| 567 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 568 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 569 | }; |
| 570 | |
| 571 | enum wlan_hdd_tm_cmd |
| 572 | { |
| 573 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 574 | }; |
| 575 | |
| 576 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 577 | |
| 578 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 579 | { |
| 580 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 581 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 582 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 583 | }; |
| 584 | #endif /* WLAN_NL80211_TESTMODE */ |
| 585 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 586 | #ifdef FEATURE_WLAN_CH_AVOID |
| 587 | /* |
| 588 | * FUNCTION: wlan_hdd_send_avoid_freq_event |
| 589 | * This is called when wlan driver needs to send vendor specific |
| 590 | * avoid frequency range event to userspace |
| 591 | */ |
| 592 | int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx, |
| 593 | tHddAvoidFreqList *pAvoidFreqList) |
| 594 | { |
| 595 | struct sk_buff *vendor_event; |
| 596 | |
| 597 | ENTER(); |
| 598 | |
| 599 | if (!pHddCtx) |
| 600 | { |
| 601 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 602 | "%s: HDD context is null", __func__); |
| 603 | return -1; |
| 604 | } |
| 605 | |
| 606 | if (!pAvoidFreqList) |
| 607 | { |
| 608 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 609 | "%s: pAvoidFreqList is null", __func__); |
| 610 | return -1; |
| 611 | } |
| 612 | |
| 613 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 614 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 615 | NULL, |
| 616 | #endif |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 617 | sizeof(tHddAvoidFreqList), |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 618 | QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 619 | GFP_KERNEL); |
| 620 | if (!vendor_event) |
| 621 | { |
| 622 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 623 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 624 | return -1; |
| 625 | } |
| 626 | |
| 627 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 628 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 629 | |
| 630 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 631 | |
| 632 | EXIT(); |
| 633 | return 0; |
| 634 | } |
| 635 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 636 | |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 637 | /* |
| 638 | * FUNCTION: __wlan_hdd_cfg80211_nan_request |
| 639 | * This is called when wlan driver needs to send vendor specific |
| 640 | * nan request event. |
| 641 | */ |
| 642 | static int __wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 643 | struct wireless_dev *wdev, |
| 644 | const void *data, int data_len) |
| 645 | { |
| 646 | tNanRequestReq nan_req; |
| 647 | VOS_STATUS status; |
| 648 | int ret_val = -1; |
Srinivas Dasari | a3f11c0 | 2015-03-20 13:15:20 +0530 | [diff] [blame] | 649 | struct net_device *dev = wdev->netdev; |
| 650 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 651 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 652 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 653 | |
| 654 | if (0 == data_len) |
| 655 | { |
| 656 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 657 | FL("NAN - Invalid Request, length = 0")); |
| 658 | return ret_val; |
| 659 | } |
| 660 | |
| 661 | if (NULL == data) |
| 662 | { |
| 663 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 664 | FL("NAN - Invalid Request, data is NULL")); |
| 665 | return ret_val; |
| 666 | } |
| 667 | |
| 668 | status = wlan_hdd_validate_context(pHddCtx); |
| 669 | if (0 != status) |
| 670 | { |
| 671 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 672 | FL("HDD context is not valid")); |
| 673 | return -EINVAL; |
| 674 | } |
| 675 | |
| 676 | hddLog(LOG1, FL("Received NAN command")); |
| 677 | vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 678 | (tANI_U8 *)data, data_len); |
| 679 | |
| 680 | /* check the NAN Capability */ |
| 681 | if (TRUE != sme_IsFeatureSupportedByFW(NAN)) |
| 682 | { |
| 683 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 684 | FL("NAN is not supported by Firmware")); |
| 685 | return -EINVAL; |
| 686 | } |
| 687 | |
| 688 | nan_req.request_data_len = data_len; |
| 689 | nan_req.request_data = data; |
| 690 | |
Srinivas Dasari | a3f11c0 | 2015-03-20 13:15:20 +0530 | [diff] [blame] | 691 | status = sme_NanRequest(hHal, &nan_req, pAdapter->sessionId); |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 692 | if (VOS_STATUS_SUCCESS == status) |
| 693 | { |
| 694 | ret_val = 0; |
| 695 | } |
| 696 | return ret_val; |
| 697 | } |
| 698 | |
| 699 | /* |
| 700 | * FUNCTION: wlan_hdd_cfg80211_nan_request |
| 701 | * Wrapper to protect the nan vendor command from ssr |
| 702 | */ |
| 703 | static int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 704 | struct wireless_dev *wdev, |
| 705 | const void *data, int data_len) |
| 706 | { |
| 707 | int ret; |
| 708 | |
| 709 | vos_ssr_protect(__func__); |
| 710 | ret = __wlan_hdd_cfg80211_nan_request(wiphy, wdev, data, data_len); |
| 711 | vos_ssr_unprotect(__func__); |
| 712 | |
| 713 | return ret; |
| 714 | } |
| 715 | |
| 716 | /* |
| 717 | * FUNCTION: wlan_hdd_cfg80211_nan_callback |
| 718 | * This is a callback function and it gets called |
| 719 | * when we need to report nan response event to |
| 720 | * upper layers. |
| 721 | */ |
| 722 | static void wlan_hdd_cfg80211_nan_callback(void* ctx, tSirNanEvent* msg) |
| 723 | { |
| 724 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 725 | struct sk_buff *vendor_event; |
| 726 | int status; |
| 727 | tSirNanEvent *data; |
| 728 | |
| 729 | ENTER(); |
| 730 | if (NULL == msg) |
| 731 | { |
| 732 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 733 | FL(" msg received here is null")); |
| 734 | return; |
| 735 | } |
| 736 | data = msg; |
| 737 | |
| 738 | status = wlan_hdd_validate_context(pHddCtx); |
| 739 | |
| 740 | if (0 != status) |
| 741 | { |
| 742 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 743 | FL("HDD context is not valid")); |
| 744 | return; |
| 745 | } |
| 746 | |
| 747 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 748 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 749 | NULL, |
| 750 | #endif |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 751 | data->event_data_len + |
| 752 | NLMSG_HDRLEN, |
| 753 | QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX, |
| 754 | GFP_KERNEL); |
| 755 | |
| 756 | if (!vendor_event) |
| 757 | { |
| 758 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 759 | FL("cfg80211_vendor_event_alloc failed")); |
| 760 | return; |
| 761 | } |
| 762 | if (nla_put(vendor_event, QCA_WLAN_VENDOR_ATTR_NAN, |
| 763 | data->event_data_len, data->event_data)) |
| 764 | { |
| 765 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 766 | FL("QCA_WLAN_VENDOR_ATTR_NAN put fail")); |
| 767 | kfree_skb(vendor_event); |
| 768 | return; |
| 769 | } |
| 770 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 771 | EXIT(); |
| 772 | } |
| 773 | |
| 774 | /* |
| 775 | * FUNCTION: wlan_hdd_cfg80211_nan_init |
| 776 | * This function is called to register the callback to sme layer |
| 777 | */ |
| 778 | inline void wlan_hdd_cfg80211_nan_init(hdd_context_t *pHddCtx) |
| 779 | { |
| 780 | sme_NanRegisterCallback(pHddCtx->hHal, wlan_hdd_cfg80211_nan_callback); |
| 781 | } |
| 782 | |
| 783 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 784 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 785 | |
| 786 | static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats, |
| 787 | struct sk_buff *vendor_event) |
| 788 | { |
| 789 | if (nla_put_u8(vendor_event, |
| 790 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_PREAMBLE, |
| 791 | stats->rate.preamble) || |
| 792 | nla_put_u8(vendor_event, |
| 793 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_NSS, |
| 794 | stats->rate.nss) || |
| 795 | nla_put_u8(vendor_event, |
| 796 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BW, |
| 797 | stats->rate.bw) || |
| 798 | nla_put_u8(vendor_event, |
| 799 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX, |
| 800 | stats->rate.rateMcsIdx) || |
| 801 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE, |
| 802 | stats->rate.bitrate ) || |
| 803 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU, |
| 804 | stats->txMpdu ) || |
| 805 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU, |
| 806 | stats->rxMpdu ) || |
| 807 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST, |
| 808 | stats->mpduLost ) || |
| 809 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES, |
| 810 | stats->retries) || |
| 811 | nla_put_u32(vendor_event, |
| 812 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT, |
| 813 | stats->retriesShort ) || |
| 814 | nla_put_u32(vendor_event, |
| 815 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG, |
| 816 | stats->retriesLong)) |
| 817 | { |
| 818 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 819 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 820 | return FALSE; |
| 821 | } |
| 822 | return TRUE; |
| 823 | } |
| 824 | |
| 825 | static v_BOOL_t put_wifi_peer_info( tpSirWifiPeerInfo stats, |
| 826 | struct sk_buff *vendor_event) |
| 827 | { |
| 828 | u32 i = 0; |
| 829 | struct nlattr *rateInfo; |
| 830 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE, |
| 831 | stats->type) || |
| 832 | nla_put(vendor_event, |
| 833 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS, |
| 834 | VOS_MAC_ADDR_SIZE, &stats->peerMacAddress[0]) || |
| 835 | nla_put_u32(vendor_event, |
| 836 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES, |
| 837 | stats->capabilities) || |
| 838 | nla_put_u32(vendor_event, |
| 839 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES, |
| 840 | stats->numRate)) |
| 841 | { |
| 842 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 843 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 844 | goto error; |
| 845 | } |
| 846 | |
| 847 | rateInfo = nla_nest_start(vendor_event, |
| 848 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 849 | if(!rateInfo) |
| 850 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 851 | for (i = 0; i < stats->numRate; i++) |
| 852 | { |
| 853 | struct nlattr *rates; |
| 854 | tpSirWifiRateStat pRateStats = (tpSirWifiRateStat )((uint8 *) |
| 855 | stats->rateStats + |
| 856 | (i * sizeof(tSirWifiRateStat))); |
| 857 | rates = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 858 | if(!rates) |
| 859 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 860 | |
| 861 | if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event)) |
| 862 | { |
| 863 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 864 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 865 | return FALSE; |
| 866 | } |
| 867 | nla_nest_end(vendor_event, rates); |
| 868 | } |
| 869 | nla_nest_end(vendor_event, rateInfo); |
| 870 | |
| 871 | return TRUE; |
| 872 | error: |
| 873 | return FALSE; |
| 874 | } |
| 875 | |
| 876 | static v_BOOL_t put_wifi_wmm_ac_stat( tpSirWifiWmmAcStat stats, |
| 877 | struct sk_buff *vendor_event) |
| 878 | { |
| 879 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_AC, |
| 880 | stats->ac ) || |
| 881 | nla_put_u32(vendor_event, |
| 882 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MPDU, |
| 883 | stats->txMpdu ) || |
| 884 | nla_put_u32(vendor_event, |
| 885 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MPDU, |
| 886 | stats->rxMpdu ) || |
| 887 | nla_put_u32(vendor_event, |
| 888 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MCAST, |
| 889 | stats->txMcast ) || |
| 890 | nla_put_u32(vendor_event, |
| 891 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MCAST, |
| 892 | stats->rxMcast ) || |
| 893 | nla_put_u32(vendor_event, |
| 894 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_AMPDU, |
| 895 | stats->rxAmpdu ) || |
| 896 | nla_put_u32(vendor_event, |
| 897 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_AMPDU, |
| 898 | stats->txAmpdu ) || |
| 899 | nla_put_u32(vendor_event, |
| 900 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_MPDU_LOST, |
| 901 | stats->mpduLost )|| |
| 902 | nla_put_u32(vendor_event, |
| 903 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES, |
| 904 | stats->retries ) || |
| 905 | nla_put_u32(vendor_event, |
| 906 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_SHORT, |
| 907 | stats->retriesShort ) || |
| 908 | nla_put_u32(vendor_event, |
| 909 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_LONG, |
| 910 | stats->retriesLong ) || |
| 911 | nla_put_u32(vendor_event, |
| 912 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MIN, |
| 913 | stats->contentionTimeMin ) || |
| 914 | nla_put_u32(vendor_event, |
| 915 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MAX, |
| 916 | stats->contentionTimeMax ) || |
| 917 | nla_put_u32(vendor_event, |
| 918 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_AVG, |
| 919 | stats->contentionTimeAvg ) || |
| 920 | nla_put_u32(vendor_event, |
| 921 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_NUM_SAMPLES, |
| 922 | stats->contentionNumSamples )) |
| 923 | { |
| 924 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 925 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 926 | return FALSE; |
| 927 | } |
| 928 | return TRUE; |
| 929 | } |
| 930 | |
| 931 | static v_BOOL_t put_wifi_interface_info(tpSirWifiInterfaceInfo stats, |
| 932 | struct sk_buff *vendor_event) |
| 933 | { |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 934 | if (nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 935 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE, stats->mode ) || |
| 936 | nla_put(vendor_event, |
| 937 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MAC_ADDR, |
| 938 | VOS_MAC_ADDR_SIZE, stats->macAddr) || |
| 939 | nla_put_u32(vendor_event, |
| 940 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_STATE, |
| 941 | stats->state ) || |
| 942 | nla_put_u32(vendor_event, |
| 943 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_ROAMING, |
| 944 | stats->roaming ) || |
| 945 | nla_put_u32(vendor_event, |
| 946 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_CAPABILITIES, |
| 947 | stats->capabilities ) || |
| 948 | nla_put(vendor_event, |
| 949 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_SSID, |
| 950 | strlen(stats->ssid), stats->ssid) || |
| 951 | nla_put(vendor_event, |
| 952 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_BSSID, |
| 953 | WNI_CFG_BSSID_LEN, stats->bssid) || |
| 954 | nla_put(vendor_event, |
| 955 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_AP_COUNTRY_STR, |
| 956 | WNI_CFG_COUNTRY_CODE_LEN, stats->apCountryStr) || |
| 957 | nla_put(vendor_event, |
| 958 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_COUNTRY_STR, |
| 959 | WNI_CFG_COUNTRY_CODE_LEN, stats->countryStr) |
| 960 | ) |
| 961 | { |
| 962 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 963 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 964 | return FALSE; |
| 965 | } |
| 966 | return TRUE; |
| 967 | } |
| 968 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 969 | static v_BOOL_t put_wifi_iface_stats(hdd_adapter_t *pAdapter, |
| 970 | tpSirWifiIfaceStat pWifiIfaceStat, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 971 | struct sk_buff *vendor_event) |
| 972 | { |
| 973 | int i = 0; |
| 974 | struct nlattr *wmmInfo; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 975 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 976 | WLANTL_InterfaceStatsType *pWifiIfaceStatTL = NULL; |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 977 | tSirWifiWmmAcStat accessclassStats; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 978 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 979 | if (FALSE == put_wifi_interface_info( |
| 980 | &pWifiIfaceStat->info, |
| 981 | vendor_event)) |
| 982 | { |
| 983 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 984 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 985 | return FALSE; |
| 986 | |
| 987 | } |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 988 | pWifiIfaceStatTL = (WLANTL_InterfaceStatsType *) |
| 989 | vos_mem_malloc(sizeof(WLANTL_InterfaceStatsType)); |
| 990 | if (NULL == pWifiIfaceStatTL) |
| 991 | { |
| 992 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 993 | return FALSE; |
| 994 | } |
| 995 | |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 996 | accessclassStats = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK]; |
| 997 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK] = |
| 998 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE]; |
| 999 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE] = accessclassStats; |
| 1000 | |
| 1001 | accessclassStats.ac = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac; |
| 1002 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac = |
| 1003 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac; |
| 1004 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac = accessclassStats.ac; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1005 | |
| 1006 | if ( pWifiIfaceStat->info.state == WIFI_ASSOCIATED) |
| 1007 | { |
| 1008 | if (VOS_STATUS_SUCCESS == |
| 1009 | WLANTL_CollectInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1010 | pHddStaCtx->conn_info.staId[0], pWifiIfaceStatTL)) |
| 1011 | { |
| 1012 | /* mgmtRx, MgmtActionRx, rxMcast, rxMpdu, rxAmpdu, rssiData are |
| 1013 | * obtained from TL structure |
| 1014 | */ |
| 1015 | |
| 1016 | pWifiIfaceStat->mgmtRx = pWifiIfaceStat->beaconRx + |
| 1017 | pWifiIfaceStatTL->mgmtRx; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1018 | pWifiIfaceStat->rssiData = pWifiIfaceStatTL->rssiData; |
| 1019 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1020 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMcast |
| 1021 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMcast; |
| 1022 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMcast |
| 1023 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMcast; |
| 1024 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMcast |
| 1025 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMcast; |
| 1026 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMcast |
| 1027 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMcast; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1028 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1029 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMpdu |
| 1030 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMpdu; |
| 1031 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMpdu |
| 1032 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMpdu; |
| 1033 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMpdu |
| 1034 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMpdu; |
| 1035 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMpdu |
| 1036 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1037 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1038 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxAmpdu |
| 1039 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxAmpdu; |
| 1040 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxAmpdu |
| 1041 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxAmpdu; |
| 1042 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxAmpdu |
| 1043 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxAmpdu; |
| 1044 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxAmpdu |
| 1045 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxAmpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1046 | } |
| 1047 | else |
| 1048 | { |
| 1049 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in getting stats from TL")); |
| 1050 | } |
| 1051 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1052 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].txMcast = |
| 1053 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO]; |
| 1054 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].txMcast = |
| 1055 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI]; |
| 1056 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].txMcast = |
| 1057 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE]; |
| 1058 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].txMcast = |
| 1059 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK]; |
| 1060 | } |
| 1061 | else |
| 1062 | { |
| 1063 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Interface not Associated")); |
| 1064 | } |
| 1065 | |
| 1066 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1067 | |
| 1068 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1069 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 1070 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_IFACE) || |
| 1071 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1072 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX, |
| 1073 | pWifiIfaceStat->beaconRx) || |
| 1074 | nla_put_u32(vendor_event, |
| 1075 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_RX, |
| 1076 | pWifiIfaceStat->mgmtRx) || |
| 1077 | nla_put_u32(vendor_event, |
| 1078 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_RX, |
| 1079 | pWifiIfaceStat->mgmtActionRx) || |
| 1080 | nla_put_u32(vendor_event, |
| 1081 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_TX, |
| 1082 | pWifiIfaceStat->mgmtActionTx) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1083 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1084 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_MGMT, |
| 1085 | pWifiIfaceStat->rssiMgmt) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1086 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1087 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_DATA, |
| 1088 | pWifiIfaceStat->rssiData) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1089 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1090 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_ACK, |
| 1091 | pWifiIfaceStat->rssiAck)) |
| 1092 | { |
| 1093 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mukul Sharma | f1bd932 | 2015-10-20 16:03:42 +0530 | [diff] [blame] | 1094 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1095 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1096 | return FALSE; |
| 1097 | } |
| 1098 | |
Mukul Sharma | f1bd932 | 2015-10-20 16:03:42 +0530 | [diff] [blame] | 1099 | #ifdef FEATURE_EXT_LL_STAT |
| 1100 | /* |
| 1101 | * Ensure when EXT_LL_STAT is supported by both host and fwr, |
| 1102 | * then host should send Leaky AP stats to upper layer, |
| 1103 | * otherwise no need to send these stats. |
| 1104 | */ |
| 1105 | if(sme_IsFeatureSupportedByFW(EXT_LL_STAT) && |
| 1106 | sme_IsFeatureSupportedByDriver(EXT_LL_STAT) |
| 1107 | ) |
| 1108 | { |
| 1109 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1110 | FL("EXT_LL_STAT is supported by fwr and host %u %u %u %llu"), |
| 1111 | pWifiIfaceStat->leakyApStat.is_leaky_ap, |
| 1112 | pWifiIfaceStat->leakyApStat.avg_rx_frms_leaked, |
| 1113 | pWifiIfaceStat->leakyApStat.rx_leak_window, |
| 1114 | pWifiIfaceStat->leakyApStat.avg_bcn_spread); |
| 1115 | if (nla_put_u32(vendor_event, |
| 1116 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_DETECTED, |
| 1117 | pWifiIfaceStat->leakyApStat.is_leaky_ap) || |
| 1118 | nla_put_u32(vendor_event, |
| 1119 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_AVG_NUM_FRAMES_LEAKED, |
| 1120 | pWifiIfaceStat->leakyApStat.avg_rx_frms_leaked) || |
| 1121 | nla_put_u32(vendor_event, |
| 1122 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_GUARD_TIME, |
| 1123 | pWifiIfaceStat->leakyApStat.rx_leak_window) || |
| 1124 | nla_put_u64(vendor_event, |
| 1125 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_AVERAGE_TSF_OFFSET, |
| 1126 | pWifiIfaceStat->leakyApStat.avg_bcn_spread)) |
| 1127 | { |
| 1128 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1129 | FL("EXT_LL_STAT put fail")); |
| 1130 | vos_mem_free(pWifiIfaceStatTL); |
| 1131 | return FALSE; |
| 1132 | } |
| 1133 | } |
| 1134 | #endif |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1135 | wmmInfo = nla_nest_start(vendor_event, |
| 1136 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1137 | if(!wmmInfo) |
| 1138 | { |
| 1139 | vos_mem_free(pWifiIfaceStatTL); |
| 1140 | return FALSE; |
| 1141 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1142 | for (i = 0; i < WIFI_AC_MAX; i++) |
| 1143 | { |
| 1144 | struct nlattr *wmmStats; |
| 1145 | wmmStats = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1146 | if(!wmmStats) |
| 1147 | { |
| 1148 | vos_mem_free(pWifiIfaceStatTL); |
| 1149 | return FALSE; |
| 1150 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1151 | if (FALSE == put_wifi_wmm_ac_stat( |
| 1152 | &pWifiIfaceStat->AccessclassStats[i], |
| 1153 | vendor_event)) |
| 1154 | { |
| 1155 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1156 | FL("QCA_WLAN_VENDOR_ATTR put Fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1157 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1158 | return FALSE; |
| 1159 | } |
| 1160 | |
| 1161 | nla_nest_end(vendor_event, wmmStats); |
| 1162 | } |
| 1163 | nla_nest_end(vendor_event, wmmInfo); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1164 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1165 | return TRUE; |
| 1166 | } |
| 1167 | |
| 1168 | static tSirWifiInterfaceMode |
| 1169 | hdd_map_device_to_ll_iface_mode ( int deviceMode ) |
| 1170 | { |
| 1171 | switch (deviceMode) |
| 1172 | { |
| 1173 | case WLAN_HDD_INFRA_STATION: |
| 1174 | return WIFI_INTERFACE_STA; |
| 1175 | case WLAN_HDD_SOFTAP: |
| 1176 | return WIFI_INTERFACE_SOFTAP; |
| 1177 | case WLAN_HDD_P2P_CLIENT: |
| 1178 | return WIFI_INTERFACE_P2P_CLIENT; |
| 1179 | case WLAN_HDD_P2P_GO: |
| 1180 | return WIFI_INTERFACE_P2P_GO; |
| 1181 | case WLAN_HDD_IBSS: |
| 1182 | return WIFI_INTERFACE_IBSS; |
| 1183 | default: |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 1184 | return WIFI_INTERFACE_UNKNOWN; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1185 | } |
| 1186 | } |
| 1187 | |
| 1188 | static v_BOOL_t hdd_get_interface_info(hdd_adapter_t *pAdapter, |
| 1189 | tpSirWifiInterfaceInfo pInfo) |
| 1190 | { |
| 1191 | v_U8_t *staMac = NULL; |
| 1192 | hdd_station_ctx_t *pHddStaCtx; |
| 1193 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1194 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1195 | |
| 1196 | pInfo->mode = hdd_map_device_to_ll_iface_mode(pAdapter->device_mode); |
| 1197 | |
| 1198 | vos_mem_copy(pInfo->macAddr, |
| 1199 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 1200 | |
| 1201 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1202 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 1203 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))) |
| 1204 | { |
| 1205 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1206 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) |
| 1207 | { |
| 1208 | pInfo->state = WIFI_DISCONNECTED; |
| 1209 | } |
| 1210 | if (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) |
| 1211 | { |
| 1212 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1213 | "%s: Session ID %d, Connection is in progress", __func__, |
| 1214 | pAdapter->sessionId); |
| 1215 | pInfo->state = WIFI_ASSOCIATING; |
| 1216 | } |
| 1217 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 1218 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 1219 | { |
| 1220 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 1221 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1222 | "%s: client " MAC_ADDRESS_STR |
| 1223 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 1224 | MAC_ADDR_ARRAY(staMac)); |
| 1225 | pInfo->state = WIFI_AUTHENTICATING; |
| 1226 | } |
| 1227 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 1228 | { |
| 1229 | pInfo->state = WIFI_ASSOCIATED; |
| 1230 | vos_mem_copy(pInfo->bssid, |
| 1231 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 1232 | vos_mem_copy(pInfo->ssid, |
| 1233 | pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 1234 | pHddStaCtx->conn_info.SSID.SSID.length); |
| 1235 | //NULL Terminate the string. |
| 1236 | pInfo->ssid[pHddStaCtx->conn_info.SSID.SSID.length] = 0; |
| 1237 | } |
| 1238 | } |
| 1239 | vos_mem_copy(pInfo->countryStr, |
| 1240 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1241 | |
| 1242 | vos_mem_copy(pInfo->apCountryStr, |
| 1243 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1244 | |
| 1245 | return TRUE; |
| 1246 | } |
| 1247 | |
| 1248 | /* |
| 1249 | * hdd_link_layer_process_peer_stats () - This function is called after |
| 1250 | * receiving Link Layer Peer statistics from FW.This function converts |
| 1251 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1252 | * layers. |
| 1253 | */ |
| 1254 | static v_VOID_t hdd_link_layer_process_peer_stats(hdd_adapter_t *pAdapter, |
| 1255 | v_VOID_t *pData) |
| 1256 | { |
| 1257 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1258 | tpSirWifiPeerStat pWifiPeerStat; |
| 1259 | tpSirWifiPeerInfo pWifiPeerInfo; |
| 1260 | struct nlattr *peerInfo; |
| 1261 | struct sk_buff *vendor_event; |
| 1262 | int status, i; |
| 1263 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1264 | ENTER(); |
| 1265 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1266 | status = wlan_hdd_validate_context(pHddCtx); |
| 1267 | if (0 != status) |
| 1268 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1269 | return; |
| 1270 | } |
| 1271 | |
| 1272 | pWifiPeerStat = (tpSirWifiPeerStat) pData; |
| 1273 | |
| 1274 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1275 | "LL_STATS_PEER_ALL : numPeers %u", |
| 1276 | pWifiPeerStat->numPeers); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1277 | /* |
| 1278 | * Allocate a size of 4096 for the peer stats comprising |
| 1279 | * each of size = sizeof (tSirWifiPeerInfo) + numRate * |
| 1280 | * sizeof (tSirWifiRateStat).Each field is put with an |
| 1281 | * NL attribute.The size of 4096 is considered assuming |
| 1282 | * that number of rates shall not exceed beyond 50 with |
| 1283 | * the sizeof (tSirWifiRateStat) being 32. |
| 1284 | */ |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1285 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 1286 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1287 | if (!vendor_event) |
| 1288 | { |
| 1289 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1290 | "%s: cfg80211_vendor_cmd_alloc_reply_skb failed", |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1291 | __func__); |
| 1292 | return; |
| 1293 | } |
| 1294 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1295 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 1296 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_PEER) || |
| 1297 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1298 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS, |
| 1299 | pWifiPeerStat->numPeers)) |
| 1300 | { |
| 1301 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1302 | "%s: QCA_WLAN_VENDOR_ATTR put fail", __func__); |
| 1303 | kfree_skb(vendor_event); |
| 1304 | return; |
| 1305 | } |
| 1306 | |
| 1307 | peerInfo = nla_nest_start(vendor_event, |
| 1308 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1309 | if(!peerInfo) |
| 1310 | { |
| 1311 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1312 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO put fail", |
| 1313 | __func__); |
| 1314 | kfree_skb(vendor_event); |
| 1315 | return; |
| 1316 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1317 | |
| 1318 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1319 | pWifiPeerStat->peerInfo); |
| 1320 | |
| 1321 | for (i = 1; i <= pWifiPeerStat->numPeers; i++) |
| 1322 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1323 | int numRate = pWifiPeerInfo->numRate; |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1324 | struct nlattr *peers = nla_nest_start(vendor_event, i); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1325 | |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1326 | if(!peers) |
| 1327 | { |
| 1328 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1329 | "%s: peer stats put fail", |
| 1330 | __func__); |
| 1331 | kfree_skb(vendor_event); |
| 1332 | return; |
| 1333 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1334 | if (FALSE == put_wifi_peer_info( |
| 1335 | pWifiPeerInfo, vendor_event)) |
| 1336 | { |
| 1337 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1338 | "%s: put_wifi_peer_info put fail", __func__); |
| 1339 | kfree_skb(vendor_event); |
| 1340 | return; |
| 1341 | } |
| 1342 | |
| 1343 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1344 | pWifiPeerStat->peerInfo + |
| 1345 | (i * sizeof(tSirWifiPeerInfo)) + |
| 1346 | (numRate * sizeof (tSirWifiRateStat))); |
| 1347 | nla_nest_end(vendor_event, peers); |
| 1348 | } |
| 1349 | nla_nest_end(vendor_event, peerInfo); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1350 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1351 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1352 | } |
| 1353 | |
| 1354 | /* |
| 1355 | * hdd_link_layer_process_iface_stats () - This function is called after |
| 1356 | * receiving Link Layer Interface statistics from FW.This function converts |
| 1357 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1358 | * layers. |
| 1359 | */ |
| 1360 | static v_VOID_t hdd_link_layer_process_iface_stats(hdd_adapter_t *pAdapter, |
| 1361 | v_VOID_t *pData) |
| 1362 | { |
| 1363 | tpSirWifiIfaceStat pWifiIfaceStat; |
| 1364 | struct sk_buff *vendor_event; |
| 1365 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1366 | int status; |
| 1367 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1368 | ENTER(); |
| 1369 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1370 | status = wlan_hdd_validate_context(pHddCtx); |
| 1371 | if (0 != status) |
| 1372 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1373 | return; |
| 1374 | } |
| 1375 | /* |
| 1376 | * Allocate a size of 4096 for the interface stats comprising |
| 1377 | * sizeof (tpSirWifiIfaceStat).The size of 4096 is considered |
| 1378 | * assuming that all these fit with in the limit.Please take |
| 1379 | * a call on the limit based on the data requirements on |
| 1380 | * interface statistics. |
| 1381 | */ |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1382 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 1383 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1384 | if (!vendor_event) |
| 1385 | { |
| 1386 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1387 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed") ); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1388 | return; |
| 1389 | } |
| 1390 | |
| 1391 | pWifiIfaceStat = (tpSirWifiIfaceStat) pData; |
| 1392 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1393 | |
| 1394 | if (FALSE == hdd_get_interface_info( pAdapter, |
| 1395 | &pWifiIfaceStat->info)) |
| 1396 | { |
| 1397 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1398 | FL("hdd_get_interface_info get fail") ); |
| 1399 | kfree_skb(vendor_event); |
| 1400 | return; |
| 1401 | } |
| 1402 | |
| 1403 | if (FALSE == put_wifi_iface_stats( pAdapter, pWifiIfaceStat, |
| 1404 | vendor_event)) |
| 1405 | { |
| 1406 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1407 | FL("put_wifi_iface_stats fail") ); |
| 1408 | kfree_skb(vendor_event); |
| 1409 | return; |
| 1410 | } |
| 1411 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1412 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1413 | "WMI_LINK_STATS_IFACE Data"); |
| 1414 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1415 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1416 | |
| 1417 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1418 | } |
| 1419 | |
| 1420 | /* |
| 1421 | * hdd_link_layer_process_radio_stats () - This function is called after |
| 1422 | * receiving Link Layer Radio statistics from FW.This function converts |
| 1423 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1424 | * layers. |
| 1425 | */ |
| 1426 | static v_VOID_t hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, |
| 1427 | v_VOID_t *pData) |
| 1428 | { |
| 1429 | int status, i; |
| 1430 | tpSirWifiRadioStat pWifiRadioStat; |
| 1431 | tpSirWifiChannelStats pWifiChannelStats; |
| 1432 | struct sk_buff *vendor_event; |
| 1433 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1434 | struct nlattr *chList; |
| 1435 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1436 | ENTER(); |
| 1437 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1438 | status = wlan_hdd_validate_context(pHddCtx); |
| 1439 | if (0 != status) |
| 1440 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1441 | return; |
| 1442 | } |
| 1443 | pWifiRadioStat = (tpSirWifiRadioStat) pData; |
| 1444 | |
| 1445 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1446 | "LL_STATS_RADIO" |
Ravi Kumar Bokka | 9306592 | 2016-10-27 13:52:34 +0530 | [diff] [blame] | 1447 | " number of radios = %u" |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1448 | " radio is %d onTime is %u " |
| 1449 | " txTime is %u rxTime is %u " |
| 1450 | " onTimeScan is %u onTimeNbd is %u " |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1451 | " onTimeEXTScan is %u onTimeRoamScan is %u " |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1452 | " onTimePnoScan is %u onTimeHs20 is %u " |
| 1453 | " numChannels is %u", |
Ravi Kumar Bokka | 9306592 | 2016-10-27 13:52:34 +0530 | [diff] [blame] | 1454 | NUM_RADIOS, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1455 | pWifiRadioStat->radio, pWifiRadioStat->onTime, |
| 1456 | pWifiRadioStat->txTime, pWifiRadioStat->rxTime, |
| 1457 | pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1458 | pWifiRadioStat->onTimeEXTScan, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1459 | pWifiRadioStat->onTimeRoamScan, |
| 1460 | pWifiRadioStat->onTimePnoScan, |
| 1461 | pWifiRadioStat->onTimeHs20, |
| 1462 | pWifiRadioStat->numChannels); |
| 1463 | /* |
| 1464 | * Allocate a size of 4096 for the Radio stats comprising |
| 1465 | * sizeof (tSirWifiRadioStat) + numChannels * sizeof |
| 1466 | * (tSirWifiChannelStats).Each channel data is put with an |
| 1467 | * NL attribute.The size of 4096 is considered assuming that |
| 1468 | * number of channels shall not exceed beyond 60 with the |
| 1469 | * sizeof (tSirWifiChannelStats) being 24 bytes. |
| 1470 | */ |
| 1471 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1472 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 1473 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1474 | if (!vendor_event) |
| 1475 | { |
| 1476 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1477 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed") ); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1478 | return; |
| 1479 | } |
| 1480 | |
| 1481 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1482 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 1483 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_RADIO) || |
| 1484 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1485 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID, |
| 1486 | pWifiRadioStat->radio) || |
| 1487 | nla_put_u32(vendor_event, |
Ravi Kumar Bokka | 9306592 | 2016-10-27 13:52:34 +0530 | [diff] [blame] | 1488 | QCA_WLAN_VENDOR_ATTR_LL_STATS_NUM_RADIOS, |
| 1489 | NUM_RADIOS) || |
| 1490 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1491 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME, |
| 1492 | pWifiRadioStat->onTime) || |
| 1493 | nla_put_u32(vendor_event, |
| 1494 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME, |
| 1495 | pWifiRadioStat->txTime) || |
| 1496 | nla_put_u32(vendor_event, |
| 1497 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME, |
| 1498 | pWifiRadioStat->rxTime) || |
| 1499 | nla_put_u32(vendor_event, |
| 1500 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN, |
| 1501 | pWifiRadioStat->onTimeScan) || |
| 1502 | nla_put_u32(vendor_event, |
| 1503 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD, |
| 1504 | pWifiRadioStat->onTimeNbd) || |
| 1505 | nla_put_u32(vendor_event, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1506 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_EXTSCAN, |
| 1507 | pWifiRadioStat->onTimeEXTScan)|| |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1508 | nla_put_u32(vendor_event, |
| 1509 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN, |
| 1510 | pWifiRadioStat->onTimeRoamScan) || |
| 1511 | nla_put_u32(vendor_event, |
| 1512 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN, |
| 1513 | pWifiRadioStat->onTimePnoScan) || |
| 1514 | nla_put_u32(vendor_event, |
| 1515 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20, |
| 1516 | pWifiRadioStat->onTimeHs20) || |
| 1517 | nla_put_u32(vendor_event, |
| 1518 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS, |
| 1519 | pWifiRadioStat->numChannels)) |
| 1520 | { |
| 1521 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1522 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1523 | kfree_skb(vendor_event); |
| 1524 | return ; |
| 1525 | } |
| 1526 | |
| 1527 | chList = nla_nest_start(vendor_event, |
| 1528 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1529 | if(!chList) |
| 1530 | { |
| 1531 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1532 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO put fail", |
| 1533 | __func__); |
| 1534 | kfree_skb(vendor_event); |
| 1535 | return; |
| 1536 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1537 | for (i = 0; i < pWifiRadioStat->numChannels; i++) |
| 1538 | { |
| 1539 | struct nlattr *chInfo; |
| 1540 | |
| 1541 | pWifiChannelStats = (tpSirWifiChannelStats) ((uint8*) |
| 1542 | pWifiRadioStat->channels + |
| 1543 | (i * sizeof(tSirWifiChannelStats))); |
| 1544 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1545 | chInfo = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1546 | if(!chInfo) |
| 1547 | { |
| 1548 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1549 | "%s: failed to put chInfo", |
| 1550 | __func__); |
| 1551 | kfree_skb(vendor_event); |
| 1552 | return; |
| 1553 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1554 | |
| 1555 | if (nla_put_u32(vendor_event, |
| 1556 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH, |
| 1557 | pWifiChannelStats->channel.width) || |
| 1558 | nla_put_u32(vendor_event, |
| 1559 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ, |
| 1560 | pWifiChannelStats->channel.centerFreq) || |
| 1561 | nla_put_u32(vendor_event, |
| 1562 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ0, |
| 1563 | pWifiChannelStats->channel.centerFreq0) || |
| 1564 | nla_put_u32(vendor_event, |
| 1565 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ1, |
| 1566 | pWifiChannelStats->channel.centerFreq1) || |
| 1567 | nla_put_u32(vendor_event, |
| 1568 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME, |
| 1569 | pWifiChannelStats->onTime) || |
| 1570 | nla_put_u32(vendor_event, |
| 1571 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME, |
| 1572 | pWifiChannelStats->ccaBusyTime)) |
| 1573 | { |
| 1574 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1575 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1576 | kfree_skb(vendor_event); |
| 1577 | return ; |
| 1578 | } |
| 1579 | nla_nest_end(vendor_event, chInfo); |
| 1580 | } |
| 1581 | nla_nest_end(vendor_event, chList); |
| 1582 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1583 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1584 | |
| 1585 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1586 | return; |
| 1587 | } |
| 1588 | |
| 1589 | /* |
| 1590 | * hdd_link_layer_stats_ind_callback () - This function is called after |
| 1591 | * receiving Link Layer indications from FW.This callback converts the firmware |
| 1592 | * data to the NL data and send the same to the kernel/upper layers. |
| 1593 | */ |
| 1594 | static void hdd_link_layer_stats_ind_callback ( void *pCtx, |
| 1595 | int indType, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1596 | void *pRsp, u8 *macAddr) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1597 | { |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1598 | hdd_context_t *pHddCtx = (hdd_context_t *)pCtx; |
| 1599 | hdd_adapter_t *pAdapter = NULL; |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1600 | struct hdd_ll_stats_context *context; |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1601 | tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults)pRsp; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1602 | int status; |
| 1603 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1604 | ENTER(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1605 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1606 | status = wlan_hdd_validate_context(pHddCtx); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1607 | if (0 != status) |
| 1608 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1609 | return; |
| 1610 | } |
| 1611 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1612 | pAdapter = hdd_get_adapter_by_macaddr(pHddCtx, macAddr); |
| 1613 | if (NULL == pAdapter) |
| 1614 | { |
| 1615 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1616 | FL(" MAC address %pM does not exist with host"), |
| 1617 | macAddr); |
| 1618 | return; |
| 1619 | } |
| 1620 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1621 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1622 | "%s: Interface: %s LLStats indType: %d", __func__, |
| 1623 | pAdapter->dev->name, indType); |
| 1624 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1625 | switch (indType) |
| 1626 | { |
| 1627 | case SIR_HAL_LL_STATS_RESULTS_RSP: |
| 1628 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1629 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 1630 | "LL_STATS RESP paramID = 0x%x, ifaceId = %u MAC: %pM " |
| 1631 | "respId = %u, moreResultToFollow = %u", |
| 1632 | linkLayerStatsResults->paramId, linkLayerStatsResults->ifaceId, |
| 1633 | macAddr, linkLayerStatsResults->respId, |
| 1634 | linkLayerStatsResults->moreResultToFollow); |
| 1635 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1636 | spin_lock(&hdd_context_lock); |
| 1637 | context = &pHddCtx->ll_stats_context; |
| 1638 | /* validate response received from target */ |
| 1639 | if ((context->request_id != linkLayerStatsResults->respId) || |
| 1640 | !(context->request_bitmap & linkLayerStatsResults->paramId)) |
| 1641 | { |
| 1642 | spin_unlock(&hdd_context_lock); |
| 1643 | hddLog(LOGE, |
| 1644 | FL("Error : Request id %d response id %d request bitmap 0x%x" |
| 1645 | "response bitmap 0x%x"), |
| 1646 | context->request_id, linkLayerStatsResults->respId, |
| 1647 | context->request_bitmap, linkLayerStatsResults->paramId); |
| 1648 | return; |
| 1649 | } |
| 1650 | spin_unlock(&hdd_context_lock); |
| 1651 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1652 | if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO ) |
| 1653 | { |
| 1654 | hdd_link_layer_process_radio_stats(pAdapter, |
| 1655 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1656 | spin_lock(&hdd_context_lock); |
| 1657 | context->request_bitmap &= ~(WMI_LINK_STATS_RADIO); |
| 1658 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1659 | } |
| 1660 | else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE ) |
| 1661 | { |
| 1662 | hdd_link_layer_process_iface_stats(pAdapter, |
| 1663 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1664 | spin_lock(&hdd_context_lock); |
| 1665 | context->request_bitmap &= ~(WMI_LINK_STATS_IFACE); |
| 1666 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1667 | } |
| 1668 | else if ( linkLayerStatsResults->paramId & |
| 1669 | WMI_LINK_STATS_ALL_PEER ) |
| 1670 | { |
| 1671 | hdd_link_layer_process_peer_stats(pAdapter, |
| 1672 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1673 | spin_lock(&hdd_context_lock); |
| 1674 | context->request_bitmap &= ~(WMI_LINK_STATS_ALL_PEER); |
| 1675 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1676 | } /* WMI_LINK_STATS_ALL_PEER */ |
| 1677 | else |
| 1678 | { |
| 1679 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1680 | FL("INVALID LL_STATS_NOTIFY RESPONSE ***********")); |
| 1681 | } |
| 1682 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1683 | spin_lock(&hdd_context_lock); |
| 1684 | /* complete response event if all requests are completed */ |
| 1685 | if (0 == context->request_bitmap) |
| 1686 | complete(&context->response_event); |
| 1687 | spin_unlock(&hdd_context_lock); |
| 1688 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1689 | break; |
| 1690 | } |
| 1691 | default: |
| 1692 | hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType); |
| 1693 | break; |
| 1694 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1695 | |
| 1696 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1697 | return; |
| 1698 | } |
| 1699 | |
| 1700 | const struct |
| 1701 | nla_policy |
| 1702 | qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX +1] = |
| 1703 | { |
| 1704 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = |
| 1705 | { .type = NLA_U32 }, |
| 1706 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = |
| 1707 | { .type = NLA_U32 }, |
| 1708 | }; |
| 1709 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1710 | static int __wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1711 | struct wireless_dev *wdev, |
| 1712 | const void *data, |
| 1713 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1714 | { |
| 1715 | int status; |
| 1716 | 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] | 1717 | tSirLLStatsSetReq linkLayerStatsSetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1718 | struct net_device *dev = wdev->netdev; |
| 1719 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1720 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1721 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1722 | ENTER(); |
| 1723 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1724 | status = wlan_hdd_validate_context(pHddCtx); |
| 1725 | if (0 != status) |
| 1726 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1727 | return -EINVAL; |
| 1728 | } |
| 1729 | |
| 1730 | if (NULL == pAdapter) |
| 1731 | { |
| 1732 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1733 | FL("HDD adapter is Null")); |
| 1734 | return -ENODEV; |
| 1735 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1736 | /* check the LLStats Capability */ |
| 1737 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1738 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1739 | { |
Anurag Chouhan | 65ea6dc | 2016-10-25 19:59:14 +0530 | [diff] [blame] | 1740 | hddLog(VOS_TRACE_LEVEL_WARN, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1741 | FL("Link Layer Statistics not supported by Firmware")); |
| 1742 | return -EINVAL; |
| 1743 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1744 | |
| 1745 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, |
| 1746 | (struct nlattr *)data, |
| 1747 | data_len, qca_wlan_vendor_ll_set_policy)) |
| 1748 | { |
| 1749 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1750 | return -EINVAL; |
| 1751 | } |
| 1752 | if (!tb_vendor |
| 1753 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]) |
| 1754 | { |
| 1755 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MPDU size Not present")); |
| 1756 | return -EINVAL; |
| 1757 | } |
| 1758 | if (!tb_vendor[ |
| 1759 | QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]) |
| 1760 | { |
| 1761 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Stats Gathering Not Present")); |
| 1762 | return -EINVAL; |
| 1763 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1764 | // 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] | 1765 | linkLayerStatsSetReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1766 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1767 | linkLayerStatsSetReq.mpduSizeThreshold = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1768 | nla_get_u32( |
| 1769 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]); |
| 1770 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1771 | linkLayerStatsSetReq.aggressiveStatisticsGathering = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1772 | nla_get_u32( |
| 1773 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]); |
| 1774 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1775 | vos_mem_copy(linkLayerStatsSetReq.macAddr, |
| 1776 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1777 | |
| 1778 | |
| 1779 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 1780 | "LL_STATS_SET reqId = %d, MAC = %pM, mpduSizeThreshold = %d " |
| 1781 | "Statistics Gathering = %d ", |
| 1782 | linkLayerStatsSetReq.reqId, linkLayerStatsSetReq.macAddr, |
| 1783 | linkLayerStatsSetReq.mpduSizeThreshold, |
| 1784 | linkLayerStatsSetReq.aggressiveStatisticsGathering); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1785 | |
| 1786 | if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB( |
| 1787 | pHddCtx->hHal, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1788 | hdd_link_layer_stats_ind_callback)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1789 | { |
| 1790 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1791 | "sme_SetLinkLayerStatsIndCB Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1792 | return -EINVAL; |
| 1793 | |
| 1794 | } |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1795 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1796 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1797 | &linkLayerStatsSetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1798 | { |
| 1799 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1800 | "sme_LLStatsSetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1801 | return -EINVAL; |
| 1802 | } |
| 1803 | |
| 1804 | pAdapter->isLinkLayerStatsSet = 1; |
| 1805 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1806 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1807 | return 0; |
| 1808 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1809 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1810 | struct wireless_dev *wdev, |
| 1811 | const void *data, |
| 1812 | int data_len) |
| 1813 | { |
| 1814 | int ret = 0; |
| 1815 | |
| 1816 | vos_ssr_protect(__func__); |
| 1817 | ret = __wlan_hdd_cfg80211_ll_stats_set(wiphy, wdev, data, data_len); |
| 1818 | vos_ssr_unprotect(__func__); |
| 1819 | |
| 1820 | return ret; |
| 1821 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1822 | |
| 1823 | const struct |
| 1824 | nla_policy |
| 1825 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 1826 | { |
| 1827 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 1828 | * command. When reporting |
| 1829 | * the stats results, the driver uses the same value to indicate |
| 1830 | * which GET request the results |
| 1831 | * correspond to. |
| 1832 | */ |
| 1833 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 1834 | |
| 1835 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 1836 | requested for retrieval */ |
| 1837 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 1838 | }; |
| 1839 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1840 | static int __wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1841 | struct wireless_dev *wdev, |
| 1842 | const void *data, |
| 1843 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1844 | { |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1845 | unsigned long rc; |
| 1846 | struct hdd_ll_stats_context *context; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1847 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1848 | 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] | 1849 | tSirLLStatsGetReq linkLayerStatsGetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1850 | struct net_device *dev = wdev->netdev; |
| 1851 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 1852 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1853 | int status; |
| 1854 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1855 | ENTER(); |
| 1856 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1857 | status = wlan_hdd_validate_context(pHddCtx); |
| 1858 | if (0 != status) |
| 1859 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1860 | return -EINVAL ; |
| 1861 | } |
| 1862 | |
| 1863 | if (NULL == pAdapter) |
| 1864 | { |
| 1865 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1866 | "%s: HDD adapter is Null", __func__); |
| 1867 | return -ENODEV; |
| 1868 | } |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 1869 | |
| 1870 | if (pHddStaCtx == NULL) |
| 1871 | { |
| 1872 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1873 | "%s: HddStaCtx is Null", __func__); |
| 1874 | return -ENODEV; |
| 1875 | } |
| 1876 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1877 | /* check the LLStats Capability */ |
| 1878 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1879 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1880 | { |
| 1881 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1882 | FL("Link Layer Statistics not supported by Firmware")); |
| 1883 | return -EINVAL; |
| 1884 | } |
| 1885 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1886 | |
| 1887 | if (!pAdapter->isLinkLayerStatsSet) |
| 1888 | { |
Sushant Kaushik | dc3184b | 2015-10-09 12:00:21 +0530 | [diff] [blame] | 1889 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1890 | "%s: isLinkLayerStatsSet : %d", |
| 1891 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1892 | return -EINVAL; |
| 1893 | } |
| 1894 | |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 1895 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 1896 | { |
| 1897 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1898 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 1899 | return -EBUSY; |
| 1900 | } |
| 1901 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1902 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 1903 | (struct nlattr *)data, |
| 1904 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 1905 | { |
| 1906 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1907 | return -EINVAL; |
| 1908 | } |
| 1909 | |
| 1910 | if (!tb_vendor |
| 1911 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 1912 | { |
| 1913 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 1914 | return -EINVAL; |
| 1915 | } |
| 1916 | |
| 1917 | if (!tb_vendor |
| 1918 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 1919 | { |
| 1920 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 1921 | return -EINVAL; |
| 1922 | } |
| 1923 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1924 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1925 | linkLayerStatsGetReq.reqId = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1926 | nla_get_u32( tb_vendor[ |
| 1927 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1928 | linkLayerStatsGetReq.paramIdMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1929 | nla_get_u32( tb_vendor[ |
| 1930 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 1931 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1932 | vos_mem_copy(linkLayerStatsGetReq.macAddr, |
| 1933 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1934 | |
| 1935 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 1936 | "LL_STATS_GET reqId = %d, MAC = %pM, paramIdMask = %d", |
| 1937 | linkLayerStatsGetReq.reqId, linkLayerStatsGetReq.macAddr, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1938 | linkLayerStatsGetReq.paramIdMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1939 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1940 | spin_lock(&hdd_context_lock); |
| 1941 | context = &pHddCtx->ll_stats_context; |
| 1942 | context->request_id = linkLayerStatsGetReq.reqId; |
| 1943 | context->request_bitmap = linkLayerStatsGetReq.paramIdMask; |
| 1944 | INIT_COMPLETION(context->response_event); |
| 1945 | spin_unlock(&hdd_context_lock); |
| 1946 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1947 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1948 | &linkLayerStatsGetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1949 | { |
| 1950 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1951 | "sme_LLStatsGetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1952 | return -EINVAL; |
| 1953 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1954 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1955 | rc = wait_for_completion_timeout(&context->response_event, |
| 1956 | msecs_to_jiffies(WLAN_WAIT_TIME_LL_STATS)); |
| 1957 | if (!rc) |
| 1958 | { |
| 1959 | hddLog(LOGE, |
| 1960 | FL("Target response timed out request id %d request bitmap 0x%x"), |
| 1961 | context->request_id, context->request_bitmap); |
| 1962 | return -ETIMEDOUT; |
| 1963 | } |
| 1964 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1965 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1966 | return 0; |
| 1967 | } |
| 1968 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1969 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1970 | struct wireless_dev *wdev, |
| 1971 | const void *data, |
| 1972 | int data_len) |
| 1973 | { |
| 1974 | int ret = 0; |
| 1975 | |
| 1976 | vos_ssr_protect(__func__); |
| 1977 | ret = __wlan_hdd_cfg80211_ll_stats_get(wiphy, wdev, data, data_len); |
| 1978 | vos_ssr_unprotect(__func__); |
| 1979 | |
| 1980 | return ret; |
| 1981 | } |
| 1982 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1983 | const struct |
| 1984 | nla_policy |
| 1985 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 1986 | { |
| 1987 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 1988 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 1989 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 1990 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 1991 | }; |
| 1992 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1993 | static int __wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 1994 | struct wireless_dev *wdev, |
| 1995 | const void *data, |
| 1996 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1997 | { |
| 1998 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1999 | 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] | 2000 | tSirLLStatsClearReq linkLayerStatsClearReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2001 | struct net_device *dev = wdev->netdev; |
| 2002 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2003 | u32 statsClearReqMask; |
| 2004 | u8 stopReq; |
| 2005 | int status; |
| 2006 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2007 | ENTER(); |
| 2008 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2009 | status = wlan_hdd_validate_context(pHddCtx); |
| 2010 | if (0 != status) |
| 2011 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2012 | return -EINVAL; |
| 2013 | } |
| 2014 | |
| 2015 | if (NULL == pAdapter) |
| 2016 | { |
| 2017 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2018 | "%s: HDD adapter is Null", __func__); |
| 2019 | return -ENODEV; |
| 2020 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2021 | /* check the LLStats Capability */ |
| 2022 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 2023 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 2024 | { |
| 2025 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2026 | FL("Enable LLStats Capability")); |
| 2027 | return -EINVAL; |
| 2028 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2029 | |
| 2030 | if (!pAdapter->isLinkLayerStatsSet) |
| 2031 | { |
| 2032 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2033 | "%s: isLinkLayerStatsSet : %d", |
| 2034 | __func__, pAdapter->isLinkLayerStatsSet); |
| 2035 | return -EINVAL; |
| 2036 | } |
| 2037 | |
| 2038 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 2039 | (struct nlattr *)data, |
| 2040 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 2041 | { |
| 2042 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 2043 | return -EINVAL; |
| 2044 | } |
| 2045 | |
| 2046 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 2047 | |
| 2048 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 2049 | { |
| 2050 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 2051 | return -EINVAL; |
| 2052 | |
| 2053 | } |
| 2054 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2055 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2056 | statsClearReqMask = linkLayerStatsClearReq.statsClearReqMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2057 | nla_get_u32( |
| 2058 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 2059 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2060 | stopReq = linkLayerStatsClearReq.stopReq = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2061 | nla_get_u8( |
| 2062 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 2063 | |
| 2064 | // 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] | 2065 | linkLayerStatsClearReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2066 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2067 | vos_mem_copy(linkLayerStatsClearReq.macAddr, |
| 2068 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2069 | |
| 2070 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 2071 | "LL_STATS_CLEAR reqId = %d, MAC = %pM," |
| 2072 | "statsClearReqMask = 0x%X, stopReq = %d", |
| 2073 | linkLayerStatsClearReq.reqId, |
| 2074 | linkLayerStatsClearReq.macAddr, |
| 2075 | linkLayerStatsClearReq.statsClearReqMask, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2076 | linkLayerStatsClearReq.stopReq); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2077 | |
| 2078 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2079 | &linkLayerStatsClearReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2080 | { |
| 2081 | struct sk_buff *temp_skbuff; |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 2082 | hdd_station_ctx_t *pHddStaCtx; |
| 2083 | |
| 2084 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2085 | if (VOS_STATUS_SUCCESS != |
| 2086 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 2087 | pHddStaCtx->conn_info.staId[0], statsClearReqMask)) |
| 2088 | { |
| 2089 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2090 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 2091 | return -EINVAL; |
| 2092 | } |
| 2093 | if ((statsClearReqMask & WIFI_STATS_IFACE_AC) || |
| 2094 | (statsClearReqMask & WIFI_STATS_IFACE)) { |
| 2095 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 2096 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 2097 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 2098 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 2099 | } |
| 2100 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2101 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 2102 | 2 * sizeof(u32) + |
| 2103 | NLMSG_HDRLEN); |
| 2104 | |
| 2105 | if (temp_skbuff != NULL) |
| 2106 | { |
| 2107 | |
| 2108 | if (nla_put_u32(temp_skbuff, |
| 2109 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 2110 | statsClearReqMask) || |
| 2111 | nla_put_u32(temp_skbuff, |
| 2112 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 2113 | stopReq)) |
| 2114 | { |
| 2115 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 2116 | kfree_skb(temp_skbuff); |
| 2117 | return -EINVAL; |
| 2118 | } |
| 2119 | /* If the ask is to stop the stats collection as part of clear |
| 2120 | * (stopReq = 1) , ensure that no further requests of get |
| 2121 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 2122 | * However it the stopReq as part of the clear request is 0 , |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2123 | * the request to get the statistics are honoured as in this |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2124 | * case the firmware is just asked to clear the statistics. |
| 2125 | */ |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2126 | if (linkLayerStatsClearReq.stopReq == 1) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2127 | pAdapter->isLinkLayerStatsSet = 0; |
| 2128 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 2129 | } |
| 2130 | return -ENOMEM; |
| 2131 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2132 | |
| 2133 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2134 | return -EINVAL; |
| 2135 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2136 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 2137 | struct wireless_dev *wdev, |
| 2138 | const void *data, |
| 2139 | int data_len) |
| 2140 | { |
| 2141 | int ret = 0; |
| 2142 | |
| 2143 | vos_ssr_protect(__func__); |
| 2144 | ret = __wlan_hdd_cfg80211_ll_stats_clear(wiphy, wdev, data, data_len); |
| 2145 | vos_ssr_unprotect(__func__); |
| 2146 | |
| 2147 | return ret; |
| 2148 | |
| 2149 | |
| 2150 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2151 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 2152 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2153 | #ifdef WLAN_FEATURE_EXTSCAN |
| 2154 | static const struct nla_policy |
| 2155 | wlan_hdd_extscan_config_policy |
| 2156 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = |
| 2157 | { |
| 2158 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = |
| 2159 | { .type = NLA_U32 }, |
| 2160 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = |
| 2161 | { .type = NLA_U32 }, |
| 2162 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 }, |
| 2163 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = |
| 2164 | { .type = NLA_U32 }, |
| 2165 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = { .type = NLA_U8 }, |
| 2166 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = { .type = NLA_U8 }, |
| 2167 | |
| 2168 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = { .type = NLA_U8 }, |
| 2169 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = { .type = NLA_U8 }, |
| 2170 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 }, |
| 2171 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = |
| 2172 | { .type = NLA_U8 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2173 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD] = |
| 2174 | { .type = NLA_U32 }, |
| 2175 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT] = |
| 2176 | { .type = NLA_U32 }, |
| 2177 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT] = |
| 2178 | { .type = NLA_U32 }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2179 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = |
| 2180 | { .type = NLA_U32 }, |
| 2181 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = |
| 2182 | { .type = NLA_U32 }, |
| 2183 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = |
| 2184 | { .type = NLA_U32 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2185 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT] = |
| 2186 | { .type = NLA_U8 }, |
| 2187 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS] = |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2188 | { .type = NLA_U8 }, |
| 2189 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = |
| 2190 | { .type = NLA_U8 }, |
| 2191 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = |
| 2192 | { .type = NLA_U8 }, |
| 2193 | |
| 2194 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = |
| 2195 | { .type = NLA_U32 }, |
| 2196 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = |
| 2197 | { .type = NLA_UNSPEC }, |
| 2198 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = |
| 2199 | { .type = NLA_S32 }, |
| 2200 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = |
| 2201 | { .type = NLA_S32 }, |
| 2202 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = |
| 2203 | { .type = NLA_U32 }, |
| 2204 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = |
| 2205 | { .type = NLA_U32 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2206 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE] = |
| 2207 | { .type = NLA_U32 }, |
| 2208 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_SSID] = |
| 2209 | { .type = NLA_BINARY, |
| 2210 | .len = IEEE80211_MAX_SSID_LEN + 1 }, |
| 2211 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_LOST_SSID_SAMPLE_SIZE] = |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2212 | { .type = NLA_U32 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2213 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_NUM_SSID] = |
| 2214 | { .type = NLA_U32 }, |
| 2215 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_BAND] = |
| 2216 | { .type = NLA_U8 }, |
| 2217 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_LOW] = |
| 2218 | { .type = NLA_S32 }, |
| 2219 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_HIGH] = |
| 2220 | { .type = NLA_S32 }, |
| 2221 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CONFIGURATION_FLAGS] = |
| 2222 | { .type = NLA_U32 }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2223 | }; |
| 2224 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2225 | /** |
| 2226 | * wlan_hdd_cfg80211_extscan_get_capabilities_rsp() - response from target |
| 2227 | * @ctx: hdd global context |
| 2228 | * @data: capabilities data |
| 2229 | * |
| 2230 | * Return: none |
| 2231 | */ |
| 2232 | static void |
| 2233 | wlan_hdd_cfg80211_extscan_get_capabilities_rsp(void *ctx, void *pMsg) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2234 | { |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2235 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2236 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2237 | tSirEXTScanCapabilitiesEvent *data = |
| 2238 | (tSirEXTScanCapabilitiesEvent *) pMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2239 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2240 | ENTER(); |
| 2241 | |
| 2242 | if (wlan_hdd_validate_context(pHddCtx)) |
| 2243 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2244 | return; |
| 2245 | } |
| 2246 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2247 | if (!pMsg) |
| 2248 | { |
| 2249 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2250 | return; |
| 2251 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2252 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2253 | vos_spin_lock_acquire(&hdd_context_lock); |
| 2254 | |
| 2255 | context = &pHddCtx->ext_scan_context; |
| 2256 | /* validate response received from target*/ |
| 2257 | if (context->request_id != data->requestId) |
| 2258 | { |
| 2259 | vos_spin_lock_release(&hdd_context_lock); |
| 2260 | hddLog(LOGE, |
| 2261 | FL("Target response id did not match: request_id %d resposne_id %d"), |
| 2262 | context->request_id, data->requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2263 | return; |
| 2264 | } |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2265 | else |
| 2266 | { |
| 2267 | context->capability_response = *data; |
| 2268 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2269 | } |
| 2270 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2271 | vos_spin_lock_release(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2272 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2273 | return; |
| 2274 | } |
| 2275 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2276 | /* |
| 2277 | * define short names for the global vendor params |
| 2278 | * used by wlan_hdd_send_ext_scan_capability() |
| 2279 | */ |
| 2280 | #define PARAM_REQUEST_ID \ |
| 2281 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID |
| 2282 | #define PARAM_STATUS \ |
| 2283 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS |
| 2284 | #define MAX_SCAN_CACHE_SIZE \ |
| 2285 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE |
| 2286 | #define MAX_SCAN_BUCKETS \ |
| 2287 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS |
| 2288 | #define MAX_AP_CACHE_PER_SCAN \ |
| 2289 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN |
| 2290 | #define MAX_RSSI_SAMPLE_SIZE \ |
| 2291 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE |
| 2292 | #define MAX_SCAN_RPT_THRHOLD \ |
| 2293 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD |
| 2294 | #define MAX_HOTLIST_BSSIDS \ |
| 2295 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_BSSIDS |
| 2296 | #define MAX_BSSID_HISTORY_ENTRIES \ |
| 2297 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES |
| 2298 | #define MAX_HOTLIST_SSIDS \ |
| 2299 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_SSIDS |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2300 | #define MAX_SIGNIFICANT_WIFI_CHANGE_APS \ |
| 2301 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SIGNIFICANT_WIFI_CHANGE_APS |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2302 | |
| 2303 | static int wlan_hdd_send_ext_scan_capability(void *ctx) |
| 2304 | { |
| 2305 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2306 | struct sk_buff *skb = NULL; |
| 2307 | int ret; |
| 2308 | tSirEXTScanCapabilitiesEvent *data; |
| 2309 | tANI_U32 nl_buf_len; |
| 2310 | |
| 2311 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2312 | if (0 != ret) |
| 2313 | { |
| 2314 | return ret; |
| 2315 | } |
| 2316 | |
| 2317 | data = &(pHddCtx->ext_scan_context.capability_response); |
| 2318 | |
| 2319 | nl_buf_len = NLMSG_HDRLEN; |
| 2320 | nl_buf_len += (sizeof(data->requestId) + NLA_HDRLEN) + |
| 2321 | (sizeof(data->status) + NLA_HDRLEN) + |
| 2322 | (sizeof(data->scanCacheSize) + NLA_HDRLEN) + |
| 2323 | (sizeof(data->scanBuckets) + NLA_HDRLEN) + |
| 2324 | (sizeof(data->maxApPerScan) + NLA_HDRLEN) + |
| 2325 | (sizeof(data->maxRssiSampleSize) + NLA_HDRLEN) + |
| 2326 | (sizeof(data->maxScanReportingThreshold) + NLA_HDRLEN) + |
| 2327 | (sizeof(data->maxHotlistAPs) + NLA_HDRLEN) + |
| 2328 | (sizeof(data->maxBsidHistoryEntries) + NLA_HDRLEN) + |
| 2329 | (sizeof(data->maxHotlistSSIDs) + NLA_HDRLEN); |
| 2330 | |
| 2331 | skb = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, nl_buf_len); |
| 2332 | |
| 2333 | if (!skb) |
| 2334 | { |
| 2335 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 2336 | return -ENOMEM; |
| 2337 | } |
| 2338 | |
| 2339 | hddLog(LOG1, "Req Id (%u) Status (%u)", data->requestId, data->status); |
| 2340 | hddLog(LOG1, "Scan cache size (%u) Scan buckets (%u) Max AP per scan (%u)", |
| 2341 | data->scanCacheSize, data->scanBuckets, data->maxApPerScan); |
| 2342 | hddLog(LOG1, "max_rssi_sample_size (%u) max_scan_reporting_threshold (%u)", |
| 2343 | data->maxRssiSampleSize, data->maxScanReportingThreshold); |
| 2344 | hddLog(LOG1, "max_hotlist_bssids (%u) max_bssid_history_entries (%u)" |
| 2345 | "max_hotlist_ssids (%u)", data->maxHotlistAPs, |
| 2346 | data->maxBsidHistoryEntries, data->maxHotlistSSIDs); |
| 2347 | |
| 2348 | if (nla_put_u32(skb, PARAM_REQUEST_ID, data->requestId) || |
| 2349 | nla_put_u32(skb, PARAM_STATUS, data->status) || |
| 2350 | nla_put_u32(skb, MAX_SCAN_CACHE_SIZE, data->scanCacheSize) || |
| 2351 | nla_put_u32(skb, MAX_SCAN_BUCKETS, data->scanBuckets) || |
| 2352 | nla_put_u32(skb, MAX_AP_CACHE_PER_SCAN, |
| 2353 | data->maxApPerScan) || |
| 2354 | nla_put_u32(skb, MAX_RSSI_SAMPLE_SIZE, |
| 2355 | data->maxRssiSampleSize) || |
| 2356 | nla_put_u32(skb, MAX_SCAN_RPT_THRHOLD, |
| 2357 | data->maxScanReportingThreshold) || |
| 2358 | nla_put_u32(skb, MAX_HOTLIST_BSSIDS, data->maxHotlistAPs) || |
| 2359 | nla_put_u32(skb, MAX_BSSID_HISTORY_ENTRIES, |
| 2360 | data->maxBsidHistoryEntries) || |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2361 | nla_put_u32(skb, MAX_HOTLIST_SSIDS, data->maxHotlistSSIDs) || |
| 2362 | nla_put_u32(skb, MAX_SIGNIFICANT_WIFI_CHANGE_APS, 0)) |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2363 | { |
| 2364 | hddLog(LOGE, FL("nla put fail")); |
| 2365 | goto nla_put_failure; |
| 2366 | } |
| 2367 | |
| 2368 | cfg80211_vendor_cmd_reply(skb); |
| 2369 | return 0; |
| 2370 | |
| 2371 | nla_put_failure: |
| 2372 | kfree_skb(skb); |
| 2373 | return -EINVAL;; |
| 2374 | } |
| 2375 | |
| 2376 | /* |
| 2377 | * done with short names for the global vendor params |
| 2378 | * used by wlan_hdd_send_ext_scan_capability() |
| 2379 | */ |
| 2380 | #undef PARAM_REQUEST_ID |
| 2381 | #undef PARAM_STATUS |
| 2382 | #undef MAX_SCAN_CACHE_SIZE |
| 2383 | #undef MAX_SCAN_BUCKETS |
| 2384 | #undef MAX_AP_CACHE_PER_SCAN |
| 2385 | #undef MAX_RSSI_SAMPLE_SIZE |
| 2386 | #undef MAX_SCAN_RPT_THRHOLD |
| 2387 | #undef MAX_HOTLIST_BSSIDS |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2388 | #undef MAX_BSSID_HISTORY_ENTRIES |
| 2389 | #undef MAX_HOTLIST_SSIDS |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2390 | |
| 2391 | static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg) |
| 2392 | { |
| 2393 | tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg; |
| 2394 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2395 | tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal ); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2396 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2397 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2398 | ENTER(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2399 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2400 | if (wlan_hdd_validate_context(pHddCtx)) |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2401 | return; |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2402 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2403 | if (!pMsg) |
| 2404 | { |
| 2405 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2406 | return; |
| 2407 | } |
| 2408 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2409 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2410 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2411 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2412 | context = &pHddCtx->ext_scan_context; |
| 2413 | spin_lock(&hdd_context_lock); |
| 2414 | if (context->request_id == pData->requestId) { |
| 2415 | context->response_status = pData->status ? -EINVAL : 0; |
| 2416 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2417 | } |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2418 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2419 | |
| 2420 | /* |
| 2421 | * Store the Request ID for comparing with the requestID obtained |
| 2422 | * in other requests.HDD shall return a failure is the extscan_stop |
| 2423 | * request is issued with a different requestId as that of the |
| 2424 | * extscan_start request. Also, This requestId shall be used while |
| 2425 | * indicating the full scan results to the upper layers. |
| 2426 | * The requestId is stored with the assumption that the firmware |
| 2427 | * shall return the ext scan start request's requestId in ext scan |
| 2428 | * start response. |
| 2429 | */ |
| 2430 | if (pData->status == 0) |
| 2431 | pMac->sme.extScanStartReqId = pData->requestId; |
| 2432 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2433 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2434 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2435 | } |
| 2436 | |
| 2437 | |
| 2438 | static void wlan_hdd_cfg80211_extscan_stop_rsp(void *ctx, void *pMsg) |
| 2439 | { |
| 2440 | tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg; |
| 2441 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2442 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2443 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2444 | ENTER(); |
| 2445 | |
| 2446 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2447 | return; |
| 2448 | } |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2449 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2450 | if (!pMsg) |
| 2451 | { |
| 2452 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2453 | return; |
| 2454 | } |
| 2455 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2456 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2457 | pData->status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2458 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2459 | context = &pHddCtx->ext_scan_context; |
| 2460 | spin_lock(&hdd_context_lock); |
| 2461 | if (context->request_id == pData->requestId) { |
| 2462 | context->response_status = pData->status ? -EINVAL : 0; |
| 2463 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2464 | } |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2465 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2466 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2467 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2468 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2469 | } |
| 2470 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2471 | static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx, |
| 2472 | void *pMsg) |
| 2473 | { |
| 2474 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2475 | tpSirEXTScanSetBssidHotListRspParams pData = |
| 2476 | (tpSirEXTScanSetBssidHotListRspParams) pMsg; |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2477 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2478 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2479 | ENTER(); |
| 2480 | |
| 2481 | if (wlan_hdd_validate_context(pHddCtx)){ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2482 | return; |
| 2483 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2484 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2485 | if (!pMsg) |
| 2486 | { |
| 2487 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2488 | return; |
| 2489 | } |
| 2490 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2491 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2492 | pData->status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2493 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2494 | context = &pHddCtx->ext_scan_context; |
| 2495 | spin_lock(&hdd_context_lock); |
| 2496 | if (context->request_id == pData->requestId) { |
| 2497 | context->response_status = pData->status ? -EINVAL : 0; |
| 2498 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2499 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2500 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2501 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2502 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2503 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2504 | } |
| 2505 | |
| 2506 | static void wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(void *ctx, |
| 2507 | void *pMsg) |
| 2508 | { |
| 2509 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2510 | tpSirEXTScanResetBssidHotlistRspParams pData = |
| 2511 | (tpSirEXTScanResetBssidHotlistRspParams) pMsg; |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 2512 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2513 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2514 | ENTER(); |
| 2515 | |
| 2516 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2517 | return; |
| 2518 | } |
| 2519 | if (!pMsg) |
| 2520 | { |
| 2521 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2522 | return; |
| 2523 | } |
| 2524 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 2525 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2526 | pData->status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2527 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 2528 | context = &pHddCtx->ext_scan_context; |
| 2529 | spin_lock(&hdd_context_lock); |
| 2530 | if (context->request_id == pData->requestId) { |
| 2531 | context->response_status = pData->status ? -EINVAL : 0; |
| 2532 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2533 | } |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 2534 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2535 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2536 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2537 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2538 | } |
| 2539 | |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 2540 | static void wlan_hdd_cfg80211_extscan_set_ssid_hotlist_rsp(void *ctx, |
| 2541 | void *pMsg) |
| 2542 | { |
| 2543 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2544 | tpSirEXTScanSetSsidHotListRspParams pData = |
| 2545 | (tpSirEXTScanSetSsidHotListRspParams) pMsg; |
| 2546 | struct hdd_ext_scan_context *context; |
| 2547 | |
| 2548 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2549 | return; |
| 2550 | } |
| 2551 | |
| 2552 | if (!pMsg) |
| 2553 | { |
| 2554 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2555 | return; |
| 2556 | } |
| 2557 | |
| 2558 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2559 | pData->status); |
| 2560 | |
| 2561 | context = &pHddCtx->ext_scan_context; |
| 2562 | spin_lock(&hdd_context_lock); |
| 2563 | if (context->request_id == pData->requestId) { |
| 2564 | context->response_status = pData->status ? -EINVAL : 0; |
| 2565 | complete(&context->response_event); |
| 2566 | } |
| 2567 | spin_unlock(&hdd_context_lock); |
| 2568 | |
| 2569 | return; |
| 2570 | } |
| 2571 | |
| 2572 | static void wlan_hdd_cfg80211_extscan_reset_ssid_hotlist_rsp(void *ctx, |
| 2573 | void *pMsg) |
| 2574 | { |
| 2575 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2576 | tpSirEXTScanResetSsidHotlistRspParams pData = |
| 2577 | (tpSirEXTScanResetSsidHotlistRspParams) pMsg; |
| 2578 | struct hdd_ext_scan_context *context; |
| 2579 | |
| 2580 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2581 | return; |
| 2582 | } |
| 2583 | if (!pMsg) |
| 2584 | { |
| 2585 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2586 | return; |
| 2587 | } |
| 2588 | |
| 2589 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2590 | pData->status); |
| 2591 | |
| 2592 | context = &pHddCtx->ext_scan_context; |
| 2593 | spin_lock(&hdd_context_lock); |
| 2594 | if (context->request_id == pData->requestId) { |
| 2595 | context->response_status = pData->status ? -EINVAL : 0; |
| 2596 | complete(&context->response_event); |
| 2597 | } |
| 2598 | spin_unlock(&hdd_context_lock); |
| 2599 | |
| 2600 | return; |
| 2601 | } |
| 2602 | |
| 2603 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2604 | static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx, |
| 2605 | void *pMsg) |
| 2606 | { |
| 2607 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2608 | struct sk_buff *skb = NULL; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2609 | tANI_U32 i = 0, j, resultsPerEvent, scan_id_index; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2610 | tANI_S32 totalResults; |
| 2611 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2612 | tpSirWifiScanResult pSirWifiScanResult, head_ptr; |
| 2613 | struct hdd_ext_scan_context *context; |
| 2614 | bool ignore_cached_results = false; |
| 2615 | tExtscanCachedScanResult *result; |
| 2616 | struct nlattr *nla_results; |
| 2617 | tANI_U16 ieLength= 0; |
| 2618 | tANI_U8 *ie = NULL; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2619 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2620 | ENTER(); |
| 2621 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2622 | if (wlan_hdd_validate_context(pHddCtx)) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2623 | return; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2624 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2625 | if (!pMsg) |
| 2626 | { |
| 2627 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2628 | return; |
| 2629 | } |
| 2630 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2631 | spin_lock(&hdd_context_lock); |
| 2632 | context = &pHddCtx->ext_scan_context; |
| 2633 | ignore_cached_results = context->ignore_cached_results; |
| 2634 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2635 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2636 | if (ignore_cached_results) { |
| 2637 | hddLog(LOGE, |
| 2638 | FL("Ignore the cached results received after timeout")); |
| 2639 | return; |
| 2640 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2641 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2642 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u More Data %u No of scan ids %u", |
| 2643 | pData->requestId, pData->moreData, pData->scanResultSize); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2644 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2645 | result = (tExtscanCachedScanResult *)&(pData->result); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2646 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2647 | for (scan_id_index = 0; scan_id_index < pData->scanResultSize; |
| 2648 | scan_id_index++) { |
| 2649 | result+= scan_id_index; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2650 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2651 | totalResults = result->num_results; |
| 2652 | hddLog(VOS_TRACE_LEVEL_INFO, "scan_id %u flags %u Num results %u", |
| 2653 | result->scan_id, result->flags, totalResults); |
| 2654 | i = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2655 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2656 | do{ |
| 2657 | resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ? |
| 2658 | EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults); |
| 2659 | totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2660 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2661 | skb = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 2662 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN); |
| 2663 | |
| 2664 | if (!skb) { |
| 2665 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2666 | FL("cfg80211_vendor_event_alloc failed")); |
| 2667 | return; |
| 2668 | } |
| 2669 | |
| 2670 | hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent); |
| 2671 | |
| 2672 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2673 | pData->requestId) || |
| 2674 | nla_put_u32(skb, |
| 2675 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2676 | resultsPerEvent)) { |
| 2677 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2678 | goto fail; |
| 2679 | } |
| 2680 | if (nla_put_u8(skb, |
| 2681 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2682 | pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 ))) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2683 | { |
| 2684 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2685 | goto fail; |
| 2686 | } |
| 2687 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2688 | if (nla_put_u32(skb, |
| 2689 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_SCAN_ID, |
| 2690 | result->scan_id)) { |
| 2691 | hddLog(LOGE, FL("put fail")); |
| 2692 | goto fail; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2693 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2694 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2695 | nla_results = nla_nest_start(skb, |
| 2696 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_LIST); |
| 2697 | if (!nla_results) |
| 2698 | goto fail; |
| 2699 | |
| 2700 | if (resultsPerEvent) { |
| 2701 | struct nlattr *aps; |
| 2702 | struct nlattr *nla_result; |
| 2703 | |
| 2704 | nla_result = nla_nest_start(skb, scan_id_index); |
| 2705 | if(!nla_result) |
| 2706 | goto fail; |
| 2707 | |
| 2708 | if (nla_put_u32(skb, |
| 2709 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_SCAN_ID, |
| 2710 | result->scan_id) || |
| 2711 | nla_put_u32(skb, |
| 2712 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_FLAGS, |
| 2713 | result->flags) || |
| 2714 | nla_put_u32(skb, |
| 2715 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2716 | totalResults)) { |
| 2717 | hddLog(LOGE, FL("put fail")); |
| 2718 | goto fail; |
| 2719 | } |
| 2720 | |
| 2721 | aps = nla_nest_start(skb, |
| 2722 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2723 | if (!aps) |
| 2724 | { |
| 2725 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2726 | goto fail; |
| 2727 | } |
| 2728 | |
| 2729 | head_ptr = (tpSirWifiScanResult) &(result->ap); |
| 2730 | |
| 2731 | for (j = 0; j < resultsPerEvent; j++, i++) { |
| 2732 | struct nlattr *ap; |
| 2733 | pSirWifiScanResult = head_ptr + i; |
| 2734 | |
| 2735 | /* |
Srinivas Dasari | 91727c1 | 2016-03-23 17:59:06 +0530 | [diff] [blame] | 2736 | * Firmware returns timestamp from extscan_start till |
| 2737 | * BSSID was cached (in micro seconds). Add this with |
| 2738 | * time gap between system boot up to extscan_start |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2739 | * to derive the time since boot when the |
| 2740 | * BSSID was cached. |
| 2741 | */ |
Srinivas Dasari | 91727c1 | 2016-03-23 17:59:06 +0530 | [diff] [blame] | 2742 | pSirWifiScanResult->ts += |
| 2743 | pHddCtx->extscan_start_time_since_boot; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2744 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) " |
| 2745 | "Ssid (%s)" |
| 2746 | "Bssid: %pM " |
| 2747 | "Channel (%u)" |
| 2748 | "Rssi (%d)" |
| 2749 | "RTT (%u)" |
| 2750 | "RTT_SD (%u)" |
| 2751 | "Beacon Period %u" |
| 2752 | "Capability 0x%x " |
| 2753 | "Ie length %d", |
| 2754 | i, |
| 2755 | pSirWifiScanResult->ts, |
| 2756 | pSirWifiScanResult->ssid, |
| 2757 | pSirWifiScanResult->bssid, |
| 2758 | pSirWifiScanResult->channel, |
| 2759 | pSirWifiScanResult->rssi, |
| 2760 | pSirWifiScanResult->rtt, |
| 2761 | pSirWifiScanResult->rtt_sd, |
| 2762 | pSirWifiScanResult->beaconPeriod, |
| 2763 | pSirWifiScanResult->capability, |
| 2764 | ieLength); |
| 2765 | |
| 2766 | ap = nla_nest_start(skb, j + 1); |
| 2767 | if (!ap) |
| 2768 | { |
| 2769 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2770 | goto fail; |
| 2771 | } |
| 2772 | |
| 2773 | if (nla_put_u64(skb, |
| 2774 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2775 | pSirWifiScanResult->ts) ) |
| 2776 | { |
| 2777 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2778 | goto fail; |
| 2779 | } |
| 2780 | if (nla_put(skb, |
| 2781 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2782 | sizeof(pSirWifiScanResult->ssid), |
| 2783 | pSirWifiScanResult->ssid) ) |
| 2784 | { |
| 2785 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2786 | goto fail; |
| 2787 | } |
| 2788 | if (nla_put(skb, |
| 2789 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2790 | sizeof(pSirWifiScanResult->bssid), |
| 2791 | pSirWifiScanResult->bssid) ) |
| 2792 | { |
| 2793 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2794 | goto fail; |
| 2795 | } |
| 2796 | if (nla_put_u32(skb, |
| 2797 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2798 | pSirWifiScanResult->channel) ) |
| 2799 | { |
| 2800 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2801 | goto fail; |
| 2802 | } |
| 2803 | if (nla_put_s32(skb, |
| 2804 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2805 | pSirWifiScanResult->rssi) ) |
| 2806 | { |
| 2807 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2808 | goto fail; |
| 2809 | } |
| 2810 | if (nla_put_u32(skb, |
| 2811 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2812 | pSirWifiScanResult->rtt) ) |
| 2813 | { |
| 2814 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2815 | goto fail; |
| 2816 | } |
| 2817 | if (nla_put_u32(skb, |
| 2818 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2819 | pSirWifiScanResult->rtt_sd)) |
| 2820 | { |
| 2821 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2822 | goto fail; |
| 2823 | } |
| 2824 | if (nla_put_u32(skb, |
| 2825 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 2826 | pSirWifiScanResult->beaconPeriod)) |
| 2827 | { |
| 2828 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2829 | goto fail; |
| 2830 | } |
| 2831 | if (nla_put_u32(skb, |
| 2832 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 2833 | pSirWifiScanResult->capability)) |
| 2834 | { |
| 2835 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2836 | goto fail; |
| 2837 | } |
| 2838 | if (nla_put_u32(skb, |
| 2839 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
| 2840 | ieLength)) |
| 2841 | { |
| 2842 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2843 | goto fail; |
| 2844 | } |
| 2845 | |
| 2846 | if (ieLength) |
| 2847 | if (nla_put(skb, |
| 2848 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 2849 | ieLength, ie)) { |
| 2850 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2851 | goto fail; |
| 2852 | } |
| 2853 | |
| 2854 | nla_nest_end(skb, ap); |
| 2855 | } |
| 2856 | nla_nest_end(skb, aps); |
| 2857 | nla_nest_end(skb, nla_result); |
| 2858 | } |
| 2859 | |
| 2860 | nla_nest_end(skb, nla_results); |
| 2861 | |
| 2862 | cfg80211_vendor_cmd_reply(skb); |
| 2863 | |
| 2864 | } while (totalResults > 0); |
| 2865 | } |
| 2866 | |
| 2867 | if (!pData->moreData) { |
| 2868 | spin_lock(&hdd_context_lock); |
| 2869 | context->response_status = 0; |
| 2870 | complete(&context->response_event); |
| 2871 | spin_unlock(&hdd_context_lock); |
| 2872 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2873 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2874 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2875 | return; |
| 2876 | fail: |
| 2877 | kfree_skb(skb); |
| 2878 | return; |
| 2879 | } |
| 2880 | |
| 2881 | static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx, |
| 2882 | void *pMsg) |
| 2883 | { |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2884 | tpSirEXTScanHotlistMatch pData = (tpSirEXTScanHotlistMatch) pMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2885 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2886 | struct sk_buff *skb = NULL; |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2887 | tANI_U32 i, index; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2888 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2889 | ENTER(); |
| 2890 | |
| 2891 | if (wlan_hdd_validate_context(pHddCtx)) { |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2892 | hddLog(LOGE, |
| 2893 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2894 | return; |
| 2895 | } |
| 2896 | if (!pMsg) |
| 2897 | { |
| 2898 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2899 | return; |
| 2900 | } |
| 2901 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2902 | if (pData->bss_found) |
| 2903 | index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX; |
| 2904 | else |
| 2905 | index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST_INDEX; |
| 2906 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2907 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 2908 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 2909 | NULL, |
| 2910 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2911 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2912 | index, GFP_KERNEL); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2913 | |
| 2914 | if (!skb) { |
| 2915 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2916 | FL("cfg80211_vendor_event_alloc failed")); |
| 2917 | return; |
| 2918 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2919 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2920 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2921 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numHotlistBss); |
| 2922 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2923 | hddLog(VOS_TRACE_LEVEL_INFO, "ap_found %u", pData->bss_found); |
| 2924 | |
| 2925 | for (i = 0; i < pData->numHotlistBss; i++) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2926 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) " |
| 2927 | "Ssid (%s) " |
| 2928 | "Bssid (" MAC_ADDRESS_STR ") " |
| 2929 | "Channel (%u) " |
| 2930 | "Rssi (%d) " |
| 2931 | "RTT (%u) " |
| 2932 | "RTT_SD (%u) ", |
| 2933 | i, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2934 | pData->bssHotlist[i].ts, |
| 2935 | pData->bssHotlist[i].ssid, |
| 2936 | MAC_ADDR_ARRAY(pData->bssHotlist[i].bssid), |
| 2937 | pData->bssHotlist[i].channel, |
| 2938 | pData->bssHotlist[i].rssi, |
| 2939 | pData->bssHotlist[i].rtt, |
| 2940 | pData->bssHotlist[i].rtt_sd); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2941 | } |
| 2942 | |
| 2943 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2944 | pData->requestId) || |
| 2945 | nla_put_u32(skb, |
| 2946 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2947 | pData->numHotlistBss)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2948 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2949 | goto fail; |
| 2950 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2951 | if (pData->numHotlistBss) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2952 | struct nlattr *aps; |
| 2953 | |
| 2954 | aps = nla_nest_start(skb, |
| 2955 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2956 | if (!aps) |
| 2957 | goto fail; |
| 2958 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2959 | for (i = 0; i < pData->numHotlistBss; i++) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2960 | struct nlattr *ap; |
| 2961 | |
| 2962 | ap = nla_nest_start(skb, i + 1); |
| 2963 | if (!ap) |
| 2964 | goto fail; |
| 2965 | |
| 2966 | if (nla_put_u64(skb, |
| 2967 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2968 | pData->bssHotlist[i].ts) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2969 | nla_put(skb, |
| 2970 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2971 | sizeof(pData->bssHotlist[i].ssid), |
| 2972 | pData->bssHotlist[i].ssid) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2973 | nla_put(skb, |
| 2974 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2975 | sizeof(pData->bssHotlist[i].bssid), |
| 2976 | pData->bssHotlist[i].bssid) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2977 | nla_put_u32(skb, |
| 2978 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2979 | pData->bssHotlist[i].channel) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2980 | nla_put_s32(skb, |
| 2981 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2982 | pData->bssHotlist[i].rssi) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2983 | nla_put_u32(skb, |
| 2984 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2985 | pData->bssHotlist[i].rtt) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2986 | nla_put_u32(skb, |
| 2987 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2988 | pData->bssHotlist[i].rtt_sd)) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2989 | goto fail; |
| 2990 | |
| 2991 | nla_nest_end(skb, ap); |
| 2992 | } |
| 2993 | nla_nest_end(skb, aps); |
| 2994 | |
| 2995 | if (nla_put_u8(skb, |
| 2996 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2997 | pData->moreData)) |
| 2998 | goto fail; |
| 2999 | } |
| 3000 | |
| 3001 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3002 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3003 | return; |
| 3004 | |
| 3005 | fail: |
| 3006 | kfree_skb(skb); |
| 3007 | return; |
| 3008 | |
| 3009 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3010 | |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3011 | /** |
| 3012 | * wlan_hdd_cfg80211_extscan_hotlist_ssid_match_ind() - |
| 3013 | * Handle an SSID hotlist match event |
| 3014 | * @ctx: HDD context registered with SME |
| 3015 | * @event: The SSID hotlist match event |
| 3016 | * |
| 3017 | * This function will take an SSID match event that was generated by |
| 3018 | * firmware and will convert it into a cfg80211 vendor event which is |
| 3019 | * sent to userspace. |
| 3020 | * |
| 3021 | * Return: none |
| 3022 | */ |
| 3023 | static void |
| 3024 | wlan_hdd_cfg80211_extscan_hotlist_ssid_match_ind(void *ctx, |
| 3025 | void *pMsg) |
| 3026 | { |
| 3027 | hdd_context_t *hdd_ctx = ctx; |
| 3028 | struct sk_buff *skb; |
| 3029 | tANI_U32 i, index; |
| 3030 | tpSirEXTScanSsidHotlistMatch pData = (tpSirEXTScanSsidHotlistMatch) pMsg; |
| 3031 | |
| 3032 | ENTER(); |
| 3033 | |
| 3034 | if (wlan_hdd_validate_context(hdd_ctx)) { |
| 3035 | hddLog(LOGE, |
| 3036 | FL("HDD context is not valid or response")); |
| 3037 | return; |
| 3038 | } |
| 3039 | if (!pMsg) |
| 3040 | { |
| 3041 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 3042 | return; |
| 3043 | } |
| 3044 | |
| 3045 | if (pData->ssid_found) { |
| 3046 | index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND_INDEX; |
| 3047 | hddLog(LOG1, "SSID hotlist found"); |
| 3048 | } else { |
| 3049 | index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST_INDEX; |
| 3050 | hddLog(LOG1, "SSID hotlist lost"); |
| 3051 | } |
| 3052 | |
| 3053 | skb = cfg80211_vendor_event_alloc(hdd_ctx->wiphy, |
| 3054 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3055 | NULL, |
| 3056 | #endif |
| 3057 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3058 | index, GFP_KERNEL); |
| 3059 | |
| 3060 | if (!skb) { |
| 3061 | hddLog(LOGE, FL("cfg80211_vendor_event_alloc failed")); |
| 3062 | return; |
| 3063 | } |
| 3064 | hddLog(LOG1, "Req Id %u, Num of SSIDs %u, More Data (%u)", |
| 3065 | pData->requestId, pData->numHotlistSsid, pData->moreData); |
| 3066 | |
| 3067 | for (i = 0; i < pData->numHotlistSsid; i++) { |
| 3068 | hddLog(LOG1, "[i=%d] Timestamp %llu " |
| 3069 | "Ssid: %s " |
| 3070 | "Bssid (" MAC_ADDRESS_STR ") " |
| 3071 | "Channel %u " |
| 3072 | "Rssi %d " |
| 3073 | "RTT %u " |
| 3074 | "RTT_SD %u", |
| 3075 | i, |
| 3076 | pData->ssidHotlist[i].ts, |
| 3077 | pData->ssidHotlist[i].ssid, |
| 3078 | MAC_ADDR_ARRAY(pData->ssidHotlist[i].bssid), |
| 3079 | pData->ssidHotlist[i].channel, |
| 3080 | pData->ssidHotlist[i].rssi, |
| 3081 | pData->ssidHotlist[i].rtt, |
| 3082 | pData->ssidHotlist[i].rtt_sd); |
| 3083 | } |
| 3084 | |
| 3085 | if (nla_put_u32(skb, |
| 3086 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3087 | pData->requestId) || |
| 3088 | nla_put_u32(skb, |
| 3089 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3090 | pData->numHotlistSsid)) { |
| 3091 | hddLog(LOGE, FL("put fail")); |
| 3092 | goto fail; |
| 3093 | } |
| 3094 | |
| 3095 | if (pData->numHotlistSsid) { |
| 3096 | struct nlattr *aps; |
| 3097 | aps = nla_nest_start(skb, |
| 3098 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 3099 | if (!aps) { |
| 3100 | hddLog(LOGE, FL("nest fail")); |
| 3101 | goto fail; |
| 3102 | } |
| 3103 | |
| 3104 | for (i = 0; i < pData->numHotlistSsid; i++) { |
| 3105 | struct nlattr *ap; |
| 3106 | |
| 3107 | ap = nla_nest_start(skb, i); |
| 3108 | if (!ap) { |
| 3109 | hddLog(LOGE, FL("nest fail")); |
| 3110 | goto fail; |
| 3111 | } |
| 3112 | |
| 3113 | if (nla_put_u64(skb, |
| 3114 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 3115 | pData->ssidHotlist[i].ts) || |
| 3116 | nla_put(skb, |
| 3117 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 3118 | sizeof(pData->ssidHotlist[i].ssid), |
| 3119 | pData->ssidHotlist[i].ssid) || |
| 3120 | nla_put(skb, |
| 3121 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 3122 | sizeof(pData->ssidHotlist[i].bssid), |
| 3123 | pData->ssidHotlist[i].bssid) || |
| 3124 | nla_put_u32(skb, |
| 3125 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 3126 | pData->ssidHotlist[i].channel) || |
| 3127 | nla_put_s32(skb, |
| 3128 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 3129 | pData->ssidHotlist[i].rssi) || |
| 3130 | nla_put_u32(skb, |
| 3131 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 3132 | pData->ssidHotlist[i].rtt) || |
| 3133 | nla_put_u32(skb, |
| 3134 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 3135 | pData->ssidHotlist[i].rtt_sd)) { |
| 3136 | hddLog(LOGE, FL("put fail")); |
| 3137 | goto fail; |
| 3138 | } |
| 3139 | nla_nest_end(skb, ap); |
| 3140 | } |
| 3141 | nla_nest_end(skb, aps); |
| 3142 | |
| 3143 | if (nla_put_u8(skb, |
| 3144 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 3145 | pData->moreData)) { |
| 3146 | hddLog(LOGE, FL("put fail")); |
| 3147 | goto fail; |
| 3148 | } |
| 3149 | } |
| 3150 | |
| 3151 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 3152 | return; |
| 3153 | |
| 3154 | fail: |
| 3155 | kfree_skb(skb); |
| 3156 | return; |
| 3157 | |
| 3158 | } |
| 3159 | |
| 3160 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3161 | static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx, |
| 3162 | void *pMsg) |
| 3163 | { |
| 3164 | struct sk_buff *skb; |
| 3165 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3166 | tpSirWifiFullScanResultEvent pData = |
| 3167 | (tpSirWifiFullScanResultEvent) (pMsg); |
| 3168 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3169 | ENTER(); |
| 3170 | |
| 3171 | if (wlan_hdd_validate_context(pHddCtx)) { |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3172 | hddLog(LOGE, |
| 3173 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3174 | return; |
| 3175 | } |
| 3176 | if (!pMsg) |
| 3177 | { |
| 3178 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3179 | return; |
| 3180 | } |
| 3181 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3182 | /* |
| 3183 | * If the full scan result including IE data exceeds NL 4K size |
| 3184 | * limitation, drop that beacon/probe rsp frame. |
| 3185 | */ |
| 3186 | if ((sizeof(*pData) + pData->ieLength) >= EXTSCAN_EVENT_BUF_SIZE) { |
| 3187 | hddLog(LOGE, FL("Frame exceeded NL size limilation, drop it!")); |
| 3188 | return; |
| 3189 | } |
| 3190 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3191 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 3192 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3193 | NULL, |
| 3194 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3195 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3196 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX, |
| 3197 | GFP_KERNEL); |
| 3198 | |
| 3199 | if (!skb) { |
| 3200 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3201 | FL("cfg80211_vendor_event_alloc failed")); |
| 3202 | return; |
| 3203 | } |
| 3204 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3205 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId); |
| 3206 | hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData); |
| 3207 | hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) " |
| 3208 | "Ssid (%s)" |
| 3209 | "Bssid (" MAC_ADDRESS_STR ")" |
| 3210 | "Channel (%u)" |
| 3211 | "Rssi (%d)" |
| 3212 | "RTT (%u)" |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3213 | "RTT_SD (%u)" |
| 3214 | "Bcn Period %d" |
| 3215 | "Capability 0x%X "), |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3216 | pData->ap.ts, |
| 3217 | pData->ap.ssid, |
| 3218 | MAC_ADDR_ARRAY(pData->ap.bssid), |
| 3219 | pData->ap.channel, |
| 3220 | pData->ap.rssi, |
| 3221 | pData->ap.rtt, |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3222 | pData->ap.rtt_sd, |
| 3223 | pData->ap.beaconPeriod, |
| 3224 | pData->ap.capability); |
| 3225 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3226 | hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength); |
| 3227 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3228 | pData->requestId) || |
| 3229 | nla_put_u64(skb, |
| 3230 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 3231 | pData->ap.ts) || |
| 3232 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 3233 | sizeof(pData->ap.ssid), |
| 3234 | pData->ap.ssid) || |
| 3235 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 3236 | WNI_CFG_BSSID_LEN, |
| 3237 | pData->ap.bssid) || |
| 3238 | nla_put_u32(skb, |
| 3239 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 3240 | pData->ap.channel) || |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 3241 | 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] | 3242 | pData->ap.rssi) || |
| 3243 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 3244 | pData->ap.rtt) || |
| 3245 | nla_put_u32(skb, |
| 3246 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 3247 | pData->ap.rtt_sd) || |
| 3248 | nla_put_u16(skb, |
| 3249 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 3250 | pData->ap.beaconPeriod) || |
| 3251 | nla_put_u16(skb, |
| 3252 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 3253 | pData->ap.capability) || |
| 3254 | nla_put_u32(skb, |
| 3255 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3256 | pData->ieLength) || |
| 3257 | nla_put_u8(skb, |
| 3258 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 3259 | pData->moreData)) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3260 | { |
| 3261 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3262 | goto nla_put_failure; |
| 3263 | } |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3264 | |
| 3265 | if (pData->ieLength) { |
| 3266 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 3267 | pData->ieLength, |
| 3268 | pData->ie)) |
| 3269 | { |
| 3270 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3271 | goto nla_put_failure; |
| 3272 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3273 | } |
| 3274 | |
| 3275 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3276 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3277 | return; |
| 3278 | |
| 3279 | nla_put_failure: |
| 3280 | kfree_skb(skb); |
| 3281 | return; |
| 3282 | } |
| 3283 | |
| 3284 | static void wlan_hdd_cfg80211_extscan_scan_res_available_event(void *ctx, |
| 3285 | void *pMsg) |
| 3286 | { |
| 3287 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3288 | struct sk_buff *skb = NULL; |
| 3289 | tpSirEXTScanResultsAvailableIndParams pData = |
| 3290 | (tpSirEXTScanResultsAvailableIndParams) pMsg; |
| 3291 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3292 | ENTER(); |
| 3293 | |
| 3294 | if (wlan_hdd_validate_context(pHddCtx)){ |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3295 | hddLog(LOGE, |
| 3296 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3297 | return; |
| 3298 | } |
| 3299 | if (!pMsg) |
| 3300 | { |
| 3301 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3302 | return; |
| 3303 | } |
| 3304 | |
| 3305 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 3306 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3307 | NULL, |
| 3308 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3309 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3310 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX, |
| 3311 | GFP_KERNEL); |
| 3312 | |
| 3313 | if (!skb) { |
| 3314 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3315 | FL("cfg80211_vendor_event_alloc failed")); |
| 3316 | return; |
| 3317 | } |
| 3318 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3319 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 3320 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", |
| 3321 | pData->numResultsAvailable); |
| 3322 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3323 | pData->requestId) || |
| 3324 | nla_put_u32(skb, |
| 3325 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3326 | pData->numResultsAvailable)) { |
| 3327 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3328 | goto nla_put_failure; |
| 3329 | } |
| 3330 | |
| 3331 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3332 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3333 | return; |
| 3334 | |
| 3335 | nla_put_failure: |
| 3336 | kfree_skb(skb); |
| 3337 | return; |
| 3338 | } |
| 3339 | |
| 3340 | static void wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx, void *pMsg) |
| 3341 | { |
| 3342 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3343 | struct sk_buff *skb = NULL; |
| 3344 | tpSirEXTScanProgressIndParams pData = |
| 3345 | (tpSirEXTScanProgressIndParams) pMsg; |
| 3346 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3347 | ENTER(); |
| 3348 | |
| 3349 | if (wlan_hdd_validate_context(pHddCtx)){ |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3350 | hddLog(LOGE, |
| 3351 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3352 | return; |
| 3353 | } |
| 3354 | if (!pMsg) |
| 3355 | { |
| 3356 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3357 | return; |
| 3358 | } |
| 3359 | |
| 3360 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 3361 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3362 | NULL, |
| 3363 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3364 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3365 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX, |
| 3366 | GFP_KERNEL); |
| 3367 | |
| 3368 | if (!skb) { |
| 3369 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3370 | FL("cfg80211_vendor_event_alloc failed")); |
| 3371 | return; |
| 3372 | } |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3373 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Request Id (%u) "), pData->requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3374 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)", |
| 3375 | pData->extScanEventType); |
| 3376 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)", |
| 3377 | pData->status); |
| 3378 | |
| 3379 | if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE, |
| 3380 | pData->extScanEventType) || |
| 3381 | nla_put_u32(skb, |
Dasari Srinivas | 5a28865 | 2014-06-30 17:13:22 +0530 | [diff] [blame] | 3382 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3383 | pData->requestId) || |
| 3384 | nla_put_u32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3385 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS, |
| 3386 | pData->status)) { |
| 3387 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3388 | goto nla_put_failure; |
| 3389 | } |
| 3390 | |
| 3391 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3392 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3393 | return; |
| 3394 | |
| 3395 | nla_put_failure: |
| 3396 | kfree_skb(skb); |
| 3397 | return; |
| 3398 | } |
| 3399 | |
| 3400 | void wlan_hdd_cfg80211_extscan_callback(void *ctx, const tANI_U16 evType, |
| 3401 | void *pMsg) |
| 3402 | { |
| 3403 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3404 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3405 | ENTER(); |
| 3406 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3407 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3408 | return; |
| 3409 | } |
| 3410 | |
| 3411 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 3412 | |
| 3413 | |
| 3414 | switch(evType) { |
| 3415 | case SIR_HAL_EXTSCAN_START_RSP: |
| 3416 | wlan_hdd_cfg80211_extscan_start_rsp(ctx, pMsg); |
| 3417 | break; |
| 3418 | |
| 3419 | case SIR_HAL_EXTSCAN_STOP_RSP: |
| 3420 | wlan_hdd_cfg80211_extscan_stop_rsp(ctx, pMsg); |
| 3421 | break; |
| 3422 | case SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP: |
| 3423 | /* There is no need to send this response to upper layer |
| 3424 | Just log the message */ |
| 3425 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3426 | FL("Rcvd SIR_HAL_EXTSCAN_CACHED_RESULTS_RSP")); |
| 3427 | break; |
| 3428 | case SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP: |
| 3429 | wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(ctx, pMsg); |
| 3430 | break; |
| 3431 | |
| 3432 | case SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP: |
| 3433 | wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg); |
| 3434 | break; |
| 3435 | |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3436 | case SIR_HAL_EXTSCAN_SET_SSID_HOTLIST_RSP: |
| 3437 | wlan_hdd_cfg80211_extscan_set_ssid_hotlist_rsp(ctx, pMsg); |
| 3438 | break; |
| 3439 | |
| 3440 | case SIR_HAL_EXTSCAN_RESET_SSID_HOTLIST_RSP: |
| 3441 | wlan_hdd_cfg80211_extscan_reset_ssid_hotlist_rsp(ctx, pMsg); |
| 3442 | break; |
| 3443 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3444 | case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP: |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3445 | wlan_hdd_cfg80211_extscan_get_capabilities_rsp(ctx, pMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3446 | break; |
| 3447 | case SIR_HAL_EXTSCAN_PROGRESS_IND: |
| 3448 | wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg); |
| 3449 | break; |
| 3450 | case SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND: |
| 3451 | wlan_hdd_cfg80211_extscan_scan_res_available_event(ctx, pMsg); |
| 3452 | break; |
| 3453 | case SIR_HAL_EXTSCAN_SCAN_RESULT_IND: |
| 3454 | wlan_hdd_cfg80211_extscan_cached_results_ind(ctx, pMsg); |
| 3455 | break; |
| 3456 | case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND: |
| 3457 | wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg); |
| 3458 | break; |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3459 | case SIR_HAL_EXTSCAN_SSID_HOTLIST_MATCH_IND: |
| 3460 | wlan_hdd_cfg80211_extscan_hotlist_ssid_match_ind(ctx, pMsg); |
| 3461 | break; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3462 | case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 3463 | wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg); |
| 3464 | break; |
| 3465 | default: |
| 3466 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 3467 | break; |
| 3468 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3469 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3470 | } |
| 3471 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3472 | static int __wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3473 | struct wireless_dev *wdev, |
| 3474 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3475 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3476 | tSirGetEXTScanCapabilitiesReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3477 | struct net_device *dev = wdev->netdev; |
| 3478 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3479 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3480 | struct nlattr |
| 3481 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3482 | eHalStatus status; |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3483 | struct hdd_ext_scan_context *context; |
| 3484 | unsigned long rc; |
| 3485 | int ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3486 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3487 | ENTER(); |
| 3488 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3489 | status = wlan_hdd_validate_context(pHddCtx); |
| 3490 | if (0 != status) |
| 3491 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3492 | return -EINVAL; |
| 3493 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3494 | /* check the EXTScan Capability */ |
| 3495 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 3496 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 3497 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3498 | { |
| 3499 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3500 | FL("EXTScan not enabled/supported by Firmware")); |
| 3501 | return -EINVAL; |
| 3502 | } |
| 3503 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3504 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3505 | data, dataLen, |
| 3506 | wlan_hdd_extscan_config_policy)) { |
| 3507 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3508 | return -EINVAL; |
| 3509 | } |
| 3510 | |
| 3511 | /* Parse and fetch request Id */ |
| 3512 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3513 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3514 | return -EINVAL; |
| 3515 | } |
| 3516 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3517 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3518 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3519 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3520 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3521 | reqMsg.sessionId = pAdapter->sessionId; |
| 3522 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3523 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3524 | vos_spin_lock_acquire(&hdd_context_lock); |
| 3525 | context = &pHddCtx->ext_scan_context; |
| 3526 | context->request_id = reqMsg.requestId; |
| 3527 | INIT_COMPLETION(context->response_event); |
| 3528 | vos_spin_lock_release(&hdd_context_lock); |
| 3529 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3530 | status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3531 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3532 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3533 | FL("sme_EXTScanGetCapabilities failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3534 | return -EINVAL; |
| 3535 | } |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3536 | |
| 3537 | rc = wait_for_completion_timeout(&context->response_event, |
| 3538 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 3539 | if (!rc) { |
| 3540 | hddLog(LOGE, FL("Target response timed out")); |
| 3541 | return -ETIMEDOUT; |
| 3542 | } |
| 3543 | |
| 3544 | ret = wlan_hdd_send_ext_scan_capability(pHddCtx); |
| 3545 | if (ret) |
| 3546 | hddLog(LOGE, FL("Failed to send ext scan capability to user space")); |
| 3547 | |
| 3548 | return ret; |
| 3549 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3550 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3551 | return 0; |
| 3552 | } |
| 3553 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3554 | static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3555 | struct wireless_dev *wdev, |
| 3556 | const void *data, int dataLen) |
| 3557 | { |
| 3558 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3559 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3560 | vos_ssr_protect(__func__); |
| 3561 | ret = __wlan_hdd_cfg80211_extscan_get_capabilities(wiphy, wdev, data, dataLen); |
| 3562 | vos_ssr_unprotect(__func__); |
| 3563 | |
| 3564 | return ret; |
| 3565 | } |
| 3566 | |
| 3567 | static int __wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3568 | struct wireless_dev *wdev, |
| 3569 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3570 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3571 | tSirEXTScanGetCachedResultsReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3572 | struct net_device *dev = wdev->netdev; |
| 3573 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3574 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3575 | struct nlattr |
| 3576 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3577 | eHalStatus status; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3578 | struct hdd_ext_scan_context *context; |
| 3579 | unsigned long rc; |
| 3580 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3581 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3582 | ENTER(); |
| 3583 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3584 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 3585 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 3586 | return -EINVAL; |
| 3587 | } |
| 3588 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3589 | status = wlan_hdd_validate_context(pHddCtx); |
| 3590 | if (0 != status) |
| 3591 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3592 | return -EINVAL; |
| 3593 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3594 | /* check the EXTScan Capability */ |
| 3595 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 3596 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 3597 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3598 | { |
| 3599 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3600 | FL("EXTScan not enabled/supported by Firmware")); |
| 3601 | return -EINVAL; |
| 3602 | } |
| 3603 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3604 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3605 | data, dataLen, |
| 3606 | wlan_hdd_extscan_config_policy)) { |
| 3607 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3608 | return -EINVAL; |
| 3609 | } |
| 3610 | /* Parse and fetch request Id */ |
| 3611 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3612 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3613 | return -EINVAL; |
| 3614 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3615 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3616 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3617 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3618 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3619 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3620 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3621 | reqMsg.sessionId = pAdapter->sessionId; |
| 3622 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3623 | |
| 3624 | /* Parse and fetch flush parameter */ |
| 3625 | if (!tb |
| 3626 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]) |
| 3627 | { |
| 3628 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed")); |
| 3629 | goto failed; |
| 3630 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3631 | reqMsg.flush = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3632 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]); |
| 3633 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3634 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3635 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3636 | spin_lock(&hdd_context_lock); |
| 3637 | context = &pHddCtx->ext_scan_context; |
| 3638 | context->request_id = reqMsg.requestId; |
| 3639 | context->ignore_cached_results = false; |
| 3640 | INIT_COMPLETION(context->response_event); |
| 3641 | spin_unlock(&hdd_context_lock); |
| 3642 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3643 | status = sme_getCachedResults(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3644 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3645 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3646 | FL("sme_getCachedResults failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3647 | return -EINVAL; |
| 3648 | } |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3649 | |
| 3650 | rc = wait_for_completion_timeout(&context->response_event, |
| 3651 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 3652 | if (!rc) { |
| 3653 | hddLog(LOGE, FL("Target response timed out")); |
| 3654 | retval = -ETIMEDOUT; |
| 3655 | spin_lock(&hdd_context_lock); |
| 3656 | context->ignore_cached_results = true; |
| 3657 | spin_unlock(&hdd_context_lock); |
| 3658 | } else { |
| 3659 | spin_lock(&hdd_context_lock); |
| 3660 | retval = context->response_status; |
| 3661 | spin_unlock(&hdd_context_lock); |
| 3662 | } |
| 3663 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3664 | EXIT(); |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3665 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3666 | |
| 3667 | failed: |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3668 | return -EINVAL; |
| 3669 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3670 | static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3671 | struct wireless_dev *wdev, |
| 3672 | const void *data, int dataLen) |
| 3673 | { |
| 3674 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3675 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3676 | vos_ssr_protect(__func__); |
| 3677 | ret = __wlan_hdd_cfg80211_extscan_get_cached_results(wiphy, wdev, data, dataLen); |
| 3678 | vos_ssr_unprotect(__func__); |
| 3679 | |
| 3680 | return ret; |
| 3681 | } |
| 3682 | |
| 3683 | static int __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3684 | struct wireless_dev *wdev, |
Edhar, Mahesh Kumar | ed8631f | 2015-01-20 14:31:47 +0530 | [diff] [blame] | 3685 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3686 | { |
| 3687 | tpSirEXTScanSetBssidHotListReqParams pReqMsg = NULL; |
| 3688 | struct net_device *dev = wdev->netdev; |
| 3689 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3690 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3691 | struct nlattr |
| 3692 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3693 | struct nlattr |
| 3694 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3695 | struct nlattr *apTh; |
| 3696 | eHalStatus status; |
| 3697 | tANI_U8 i = 0; |
| 3698 | int rem; |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3699 | struct hdd_ext_scan_context *context; |
| 3700 | tANI_U32 request_id; |
| 3701 | unsigned long rc; |
| 3702 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3703 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3704 | ENTER(); |
| 3705 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3706 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 3707 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 3708 | return -EINVAL; |
| 3709 | } |
| 3710 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3711 | status = wlan_hdd_validate_context(pHddCtx); |
| 3712 | if (0 != status) |
| 3713 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3714 | return -EINVAL; |
| 3715 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3716 | /* check the EXTScan Capability */ |
| 3717 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 3718 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 3719 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3720 | { |
| 3721 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3722 | FL("EXTScan not enabled/supported by Firmware")); |
| 3723 | return -EINVAL; |
| 3724 | } |
| 3725 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3726 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3727 | data, dataLen, |
| 3728 | wlan_hdd_extscan_config_policy)) { |
| 3729 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3730 | return -EINVAL; |
| 3731 | } |
| 3732 | |
| 3733 | /* Parse and fetch request Id */ |
| 3734 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3735 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3736 | return -EINVAL; |
| 3737 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3738 | pReqMsg = (tpSirEXTScanSetBssidHotListReqParams) |
| 3739 | vos_mem_malloc(sizeof(*pReqMsg)); |
| 3740 | if (!pReqMsg) { |
| 3741 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3742 | return -ENOMEM; |
| 3743 | } |
| 3744 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3745 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3746 | pReqMsg->requestId = nla_get_u32( |
| 3747 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3748 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3749 | |
| 3750 | /* Parse and fetch number of APs */ |
| 3751 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]) { |
| 3752 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3753 | goto fail; |
| 3754 | } |
| 3755 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3756 | /* Parse and fetch lost ap sample size */ |
| 3757 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE]) { |
| 3758 | hddLog(LOGE, FL("attr lost ap sample size failed")); |
| 3759 | goto fail; |
| 3760 | } |
| 3761 | |
| 3762 | pReqMsg->lostBssidSampleSize = nla_get_u32( |
| 3763 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE]); |
| 3764 | hddLog(LOG1, FL("Lost ap sample size %d"), pReqMsg->lostBssidSampleSize); |
| 3765 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3766 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3767 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3768 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3769 | pReqMsg->numBssid = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3770 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]); |
Hanumanth Reddy Pothula | 8e18840 | 2017-01-27 16:43:45 +0530 | [diff] [blame] | 3771 | if (pReqMsg->numBssid > WLAN_EXTSCAN_MAX_HOTLIST_APS) { |
| 3772 | hddLog(LOGE, FL("Number of AP: %u exceeds max: %u"), |
| 3773 | pReqMsg->numBssid, WLAN_EXTSCAN_MAX_HOTLIST_APS); |
| 3774 | goto fail; |
| 3775 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3776 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numBssid); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3777 | |
| 3778 | nla_for_each_nested(apTh, |
| 3779 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
Hanumanth Reddy Pothula | 8e18840 | 2017-01-27 16:43:45 +0530 | [diff] [blame] | 3780 | if (i == pReqMsg->numBssid) { |
| 3781 | hddLog(LOGW, FL("Ignoring excess AP")); |
| 3782 | break; |
| 3783 | } |
| 3784 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3785 | if(nla_parse(tb2, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3786 | nla_data(apTh), nla_len(apTh), |
| 3787 | NULL)) { |
| 3788 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3789 | goto fail; |
| 3790 | } |
| 3791 | |
| 3792 | /* Parse and fetch MAC address */ |
| 3793 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3794 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3795 | goto fail; |
| 3796 | } |
| 3797 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3798 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3799 | sizeof(tSirMacAddr)); |
| 3800 | hddLog(VOS_TRACE_LEVEL_INFO, FL("BSSID: %pM "), pReqMsg->ap[i].bssid); |
| 3801 | |
| 3802 | /* Parse and fetch low RSSI */ |
| 3803 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3804 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3805 | goto fail; |
| 3806 | } |
| 3807 | pReqMsg->ap[i].low = nla_get_s32( |
| 3808 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3809 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3810 | |
| 3811 | /* Parse and fetch high RSSI */ |
| 3812 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3813 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3814 | goto fail; |
| 3815 | } |
| 3816 | pReqMsg->ap[i].high = nla_get_s32( |
| 3817 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3818 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"), |
| 3819 | pReqMsg->ap[i].high); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3820 | i++; |
| 3821 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3822 | |
Hanumanth Reddy Pothula | 8e18840 | 2017-01-27 16:43:45 +0530 | [diff] [blame] | 3823 | if (i < pReqMsg->numBssid) { |
| 3824 | hddLog(LOGW, FL("Number of AP %u less than expected %u"), |
| 3825 | i, pReqMsg->numBssid); |
| 3826 | pReqMsg->numBssid = i; |
| 3827 | } |
| 3828 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3829 | context = &pHddCtx->ext_scan_context; |
| 3830 | spin_lock(&hdd_context_lock); |
| 3831 | INIT_COMPLETION(context->response_event); |
| 3832 | context->request_id = request_id = pReqMsg->requestId; |
| 3833 | spin_unlock(&hdd_context_lock); |
| 3834 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3835 | status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg); |
| 3836 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3837 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3838 | FL("sme_SetBssHotlist failed(err=%d)"), status); |
| 3839 | vos_mem_free(pReqMsg); |
| 3840 | return -EINVAL; |
| 3841 | } |
| 3842 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3843 | /* request was sent -- wait for the response */ |
| 3844 | rc = wait_for_completion_timeout(&context->response_event, |
| 3845 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 3846 | |
| 3847 | if (!rc) { |
| 3848 | hddLog(LOGE, FL("sme_SetBssHotlist timed out")); |
| 3849 | retval = -ETIMEDOUT; |
| 3850 | } else { |
| 3851 | spin_lock(&hdd_context_lock); |
| 3852 | if (context->request_id == request_id) |
| 3853 | retval = context->response_status; |
| 3854 | else |
| 3855 | retval = -EINVAL; |
| 3856 | spin_unlock(&hdd_context_lock); |
| 3857 | } |
| 3858 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3859 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3860 | EXIT(); |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3861 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3862 | |
| 3863 | fail: |
| 3864 | vos_mem_free(pReqMsg); |
| 3865 | return -EINVAL; |
| 3866 | } |
| 3867 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3868 | static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
| 3869 | struct wireless_dev *wdev, |
| 3870 | const void *data, int dataLen) |
| 3871 | { |
| 3872 | int ret = 0; |
| 3873 | |
| 3874 | vos_ssr_protect(__func__); |
| 3875 | ret = __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(wiphy, wdev, data, |
| 3876 | dataLen); |
| 3877 | vos_ssr_unprotect(__func__); |
| 3878 | |
| 3879 | return ret; |
| 3880 | } |
| 3881 | |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3882 | /* |
| 3883 | * define short names for the global vendor params |
| 3884 | * used by wlan_hdd_cfg80211_extscan_set_ssid_hotlist() |
| 3885 | */ |
| 3886 | #define PARAM_MAX \ |
| 3887 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX |
| 3888 | #define PARAM_REQUEST_ID \ |
| 3889 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID |
| 3890 | #define PARAMS_LOST_SSID_SAMPLE_SIZE \ |
| 3891 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_LOST_SSID_SAMPLE_SIZE |
| 3892 | #define PARAMS_NUM_SSID \ |
| 3893 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_NUM_SSID |
| 3894 | #define THRESHOLD_PARAM \ |
| 3895 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM |
| 3896 | #define PARAM_SSID \ |
| 3897 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_SSID |
| 3898 | #define PARAM_BAND \ |
| 3899 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_BAND |
| 3900 | #define PARAM_RSSI_LOW \ |
| 3901 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_LOW |
| 3902 | #define PARAM_RSSI_HIGH \ |
| 3903 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_HIGH |
| 3904 | |
| 3905 | /** |
| 3906 | * __wlan_hdd_cfg80211_extscan_set_ssid_hotlist() - set ssid hot list |
| 3907 | * @wiphy: Pointer to wireless phy |
| 3908 | * @wdev: Pointer to wireless device |
| 3909 | * @data: Pointer to data |
| 3910 | * @data_len: Data length |
| 3911 | * |
| 3912 | * Return: 0 on success, negative errno on failure |
| 3913 | */ |
| 3914 | static int |
| 3915 | __wlan_hdd_cfg80211_extscan_set_ssid_hotlist(struct wiphy *wiphy, |
| 3916 | struct wireless_dev *wdev, |
| 3917 | const void *data, |
| 3918 | int data_len) |
| 3919 | { |
| 3920 | tSirEXTScanSetSsidHotListReqParams *request; |
| 3921 | struct net_device *dev = wdev->netdev; |
| 3922 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3923 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 3924 | struct nlattr *tb[PARAM_MAX + 1]; |
| 3925 | struct nlattr *tb2[PARAM_MAX + 1]; |
| 3926 | struct nlattr *ssids; |
| 3927 | struct hdd_ext_scan_context *context; |
| 3928 | uint32_t request_id; |
| 3929 | char ssid_string[SIR_MAC_MAX_SSID_LENGTH + 1] = {'\0'}; |
| 3930 | int ssid_len; |
Anurag Chouhan | d64d523 | 2016-08-29 17:01:38 +0530 | [diff] [blame] | 3931 | int ssid_length; |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3932 | eHalStatus status; |
| 3933 | int i, rem, retval; |
| 3934 | unsigned long rc; |
| 3935 | |
| 3936 | ENTER(); |
| 3937 | |
| 3938 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 3939 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 3940 | return -EINVAL; |
| 3941 | } |
| 3942 | |
| 3943 | retval = wlan_hdd_validate_context(hdd_ctx); |
| 3944 | if (0 != retval) { |
| 3945 | hddLog(LOGE, FL("HDD context is not valid")); |
| 3946 | return -EINVAL; |
| 3947 | } |
| 3948 | |
| 3949 | /* check the EXTScan Capability */ |
| 3950 | if ( (TRUE != hdd_ctx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 3951 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 3952 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3953 | { |
| 3954 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3955 | FL("EXTScan not enabled/supported by Firmware")); |
| 3956 | return -EINVAL; |
| 3957 | } |
| 3958 | |
| 3959 | if (nla_parse(tb, PARAM_MAX, |
| 3960 | data, data_len, |
| 3961 | wlan_hdd_extscan_config_policy)) { |
| 3962 | hddLog(LOGE, FL("Invalid ATTR")); |
| 3963 | return -EINVAL; |
| 3964 | } |
| 3965 | |
| 3966 | request = vos_mem_malloc(sizeof(*request)); |
| 3967 | if (!request) { |
| 3968 | hddLog(LOGE, FL("vos_mem_malloc failed")); |
| 3969 | return -ENOMEM; |
| 3970 | } |
| 3971 | |
| 3972 | /* Parse and fetch request Id */ |
| 3973 | if (!tb[PARAM_REQUEST_ID]) { |
| 3974 | hddLog(LOGE, FL("attr request id failed")); |
| 3975 | goto fail; |
| 3976 | } |
| 3977 | |
| 3978 | request->request_id = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 3979 | hddLog(LOG1, FL("Request Id %d"), request->request_id); |
| 3980 | |
| 3981 | /* Parse and fetch lost SSID sample size */ |
| 3982 | if (!tb[PARAMS_LOST_SSID_SAMPLE_SIZE]) { |
| 3983 | hddLog(LOGE, FL("attr number of Ssid failed")); |
| 3984 | goto fail; |
| 3985 | } |
| 3986 | request->lost_ssid_sample_size = |
| 3987 | nla_get_u32(tb[PARAMS_LOST_SSID_SAMPLE_SIZE]); |
| 3988 | hddLog(LOG1, FL("Lost SSID Sample Size %d"), |
| 3989 | request->lost_ssid_sample_size); |
| 3990 | |
| 3991 | /* Parse and fetch number of hotlist SSID */ |
| 3992 | if (!tb[PARAMS_NUM_SSID]) { |
| 3993 | hddLog(LOGE, FL("attr number of Ssid failed")); |
| 3994 | goto fail; |
| 3995 | } |
| 3996 | request->ssid_count = nla_get_u32(tb[PARAMS_NUM_SSID]); |
| 3997 | hddLog(LOG1, FL("Number of SSID %d"), request->ssid_count); |
| 3998 | |
| 3999 | request->session_id = adapter->sessionId; |
| 4000 | hddLog(LOG1, FL("Session Id (%d)"), request->session_id); |
| 4001 | |
| 4002 | i = 0; |
| 4003 | nla_for_each_nested(ssids, tb[THRESHOLD_PARAM], rem) { |
| 4004 | if (i >= WLAN_EXTSCAN_MAX_HOTLIST_SSIDS) { |
| 4005 | hddLog(LOGE, |
| 4006 | FL("Too Many SSIDs, %d exceeds %d"), |
| 4007 | i, WLAN_EXTSCAN_MAX_HOTLIST_SSIDS); |
| 4008 | break; |
| 4009 | } |
| 4010 | if (nla_parse(tb2, PARAM_MAX, |
| 4011 | nla_data(ssids), nla_len(ssids), |
| 4012 | wlan_hdd_extscan_config_policy)) { |
| 4013 | hddLog(LOGE, FL("nla_parse failed")); |
| 4014 | goto fail; |
| 4015 | } |
| 4016 | |
| 4017 | /* Parse and fetch SSID */ |
| 4018 | if (!tb2[PARAM_SSID]) { |
| 4019 | hddLog(LOGE, FL("attr ssid failed")); |
| 4020 | goto fail; |
| 4021 | } |
Anurag Chouhan | d64d523 | 2016-08-29 17:01:38 +0530 | [diff] [blame] | 4022 | ssid_length = nla_strlcpy(ssid_string, tb2[PARAM_SSID], |
| 4023 | sizeof(ssid_string)); |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 4024 | hddLog(LOG1, FL("SSID %s"), |
| 4025 | ssid_string); |
| 4026 | ssid_len = strlen(ssid_string); |
SaidiReddy Yenuga | e4f6f37 | 2016-12-06 16:11:39 +0530 | [diff] [blame] | 4027 | if (ssid_length >= SIR_MAC_MAX_SSID_LENGTH) { |
Anurag Chouhan | d64d523 | 2016-08-29 17:01:38 +0530 | [diff] [blame] | 4028 | hddLog(LOGE, FL("Invalid ssid length")); |
| 4029 | goto fail; |
| 4030 | } |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 4031 | memcpy(request->ssid[i].ssid.ssId, ssid_string, ssid_len); |
| 4032 | request->ssid[i].ssid.length = ssid_len; |
| 4033 | request->ssid[i].ssid.ssId[ssid_len] = '\0'; |
| 4034 | hddLog(LOG1, FL("After copying SSID %s"), |
| 4035 | request->ssid[i].ssid.ssId); |
| 4036 | hddLog(LOG1, FL("After copying length: %d"), |
| 4037 | ssid_len); |
| 4038 | |
| 4039 | /* Parse and fetch low RSSI */ |
| 4040 | if (!tb2[PARAM_BAND]) { |
| 4041 | hddLog(LOGE, FL("attr band failed")); |
| 4042 | goto fail; |
| 4043 | } |
| 4044 | request->ssid[i].band = nla_get_u8(tb2[PARAM_BAND]); |
| 4045 | hddLog(LOG1, FL("band %d"), request->ssid[i].band); |
| 4046 | |
| 4047 | /* Parse and fetch low RSSI */ |
| 4048 | if (!tb2[PARAM_RSSI_LOW]) { |
| 4049 | hddLog(LOGE, FL("attr low RSSI failed")); |
| 4050 | goto fail; |
| 4051 | } |
| 4052 | request->ssid[i].rssi_low = nla_get_s32(tb2[PARAM_RSSI_LOW]); |
| 4053 | hddLog(LOG1, FL("RSSI low %d"), request->ssid[i].rssi_low); |
| 4054 | |
| 4055 | /* Parse and fetch high RSSI */ |
| 4056 | if (!tb2[PARAM_RSSI_HIGH]) { |
| 4057 | hddLog(LOGE, FL("attr high RSSI failed")); |
| 4058 | goto fail; |
| 4059 | } |
| 4060 | request->ssid[i].rssi_high = nla_get_u32(tb2[PARAM_RSSI_HIGH]); |
| 4061 | hddLog(LOG1, FL("RSSI high %d"), request->ssid[i].rssi_high); |
| 4062 | i++; |
| 4063 | } |
| 4064 | |
| 4065 | context = &hdd_ctx->ext_scan_context; |
| 4066 | spin_lock(&hdd_context_lock); |
| 4067 | INIT_COMPLETION(context->response_event); |
| 4068 | context->request_id = request_id = request->request_id; |
| 4069 | spin_unlock(&hdd_context_lock); |
| 4070 | |
| 4071 | status = sme_set_ssid_hotlist(hdd_ctx->hHal, request); |
| 4072 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4073 | hddLog(LOGE, |
| 4074 | FL("sme_set_ssid_hotlist failed(err=%d)"), status); |
| 4075 | goto fail; |
| 4076 | } |
| 4077 | |
| 4078 | vos_mem_free(request); |
| 4079 | |
| 4080 | /* request was sent -- wait for the response */ |
| 4081 | rc = wait_for_completion_timeout(&context->response_event, |
| 4082 | msecs_to_jiffies |
| 4083 | (WLAN_WAIT_TIME_EXTSCAN)); |
| 4084 | if (!rc) { |
| 4085 | hddLog(LOGE, FL("sme_set_ssid_hotlist timed out")); |
| 4086 | retval = -ETIMEDOUT; |
| 4087 | } else { |
| 4088 | spin_lock(&hdd_context_lock); |
| 4089 | if (context->request_id == request_id) |
| 4090 | retval = context->response_status; |
| 4091 | else |
| 4092 | retval = -EINVAL; |
| 4093 | spin_unlock(&hdd_context_lock); |
| 4094 | } |
| 4095 | |
| 4096 | return retval; |
| 4097 | |
| 4098 | fail: |
| 4099 | vos_mem_free(request); |
| 4100 | return -EINVAL; |
| 4101 | } |
| 4102 | |
| 4103 | /* |
| 4104 | * done with short names for the global vendor params |
| 4105 | * used by wlan_hdd_cfg80211_extscan_set_ssid_hotlist() |
| 4106 | */ |
| 4107 | #undef PARAM_MAX |
| 4108 | #undef PARAM_REQUEST_ID |
| 4109 | #undef PARAMS_NUM_SSID |
| 4110 | #undef THRESHOLD_PARAM |
| 4111 | #undef PARAM_SSID |
| 4112 | #undef PARAM_BAND |
| 4113 | #undef PARAM_RSSI_LOW |
| 4114 | #undef PARAM_RSSI_HIGH |
| 4115 | |
| 4116 | static int wlan_hdd_cfg80211_extscan_set_ssid_hotlist(struct wiphy *wiphy, |
| 4117 | struct wireless_dev *wdev, |
| 4118 | const void *data, int dataLen) |
| 4119 | { |
| 4120 | int ret = 0; |
| 4121 | |
| 4122 | vos_ssr_protect(__func__); |
| 4123 | ret = __wlan_hdd_cfg80211_extscan_set_ssid_hotlist(wiphy, wdev, data, |
| 4124 | dataLen); |
| 4125 | vos_ssr_unprotect(__func__); |
| 4126 | |
| 4127 | return ret; |
| 4128 | } |
| 4129 | |
| 4130 | static int |
| 4131 | __wlan_hdd_cfg80211_extscan_reset_ssid_hotlist(struct wiphy *wiphy, |
| 4132 | struct wireless_dev *wdev, |
| 4133 | const void *data, |
| 4134 | int data_len) |
| 4135 | { |
| 4136 | tSirEXTScanResetSsidHotlistReqParams request; |
| 4137 | struct net_device *dev = wdev->netdev; |
| 4138 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4139 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 4140 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4141 | struct hdd_ext_scan_context *context; |
| 4142 | uint32_t request_id; |
| 4143 | eHalStatus status; |
| 4144 | int retval; |
| 4145 | unsigned long rc; |
| 4146 | |
| 4147 | ENTER(); |
| 4148 | |
| 4149 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 4150 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 4151 | return -EINVAL; |
| 4152 | } |
| 4153 | |
| 4154 | retval = wlan_hdd_validate_context(hdd_ctx); |
| 4155 | if (0 != retval) { |
| 4156 | hddLog(LOGE, FL("HDD context is not valid")); |
| 4157 | return -EINVAL; |
| 4158 | } |
| 4159 | |
| 4160 | /* check the EXTScan Capability */ |
| 4161 | if ( (TRUE != hdd_ctx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4162 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4163 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 4164 | { |
| 4165 | hddLog(LOGE, |
| 4166 | FL("EXTScan not enabled/supported by Firmware")); |
| 4167 | return -EINVAL; |
| 4168 | } |
| 4169 | |
| 4170 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4171 | data, data_len, |
| 4172 | wlan_hdd_extscan_config_policy)) { |
| 4173 | hddLog(LOGE, FL("Invalid ATTR")); |
| 4174 | return -EINVAL; |
| 4175 | } |
| 4176 | |
| 4177 | /* Parse and fetch request Id */ |
| 4178 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4179 | hddLog(LOGE, FL("attr request id failed")); |
| 4180 | return -EINVAL; |
| 4181 | } |
| 4182 | |
| 4183 | request.requestId = nla_get_u32( |
| 4184 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 4185 | request.sessionId = adapter->sessionId; |
| 4186 | hddLog(LOG1, FL("Request Id %d Session Id %d"), request.requestId, |
| 4187 | request.sessionId); |
| 4188 | |
| 4189 | context = &hdd_ctx->ext_scan_context; |
| 4190 | spin_lock(&hdd_context_lock); |
| 4191 | INIT_COMPLETION(context->response_event); |
| 4192 | context->request_id = request_id = request.requestId; |
| 4193 | spin_unlock(&hdd_context_lock); |
| 4194 | |
| 4195 | status = sme_reset_ssid_hotlist(hdd_ctx->hHal, &request); |
| 4196 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4197 | hddLog(LOGE, |
| 4198 | FL("sme_reset_ssid_hotlist failed(err=%d)"), status); |
| 4199 | return -EINVAL; |
| 4200 | } |
| 4201 | |
| 4202 | /* request was sent -- wait for the response */ |
| 4203 | rc = wait_for_completion_timeout(&context->response_event, |
| 4204 | msecs_to_jiffies |
| 4205 | (WLAN_WAIT_TIME_EXTSCAN)); |
| 4206 | if (!rc) { |
| 4207 | hddLog(LOGE, FL("sme_reset_ssid_hotlist timed out")); |
| 4208 | retval = -ETIMEDOUT; |
| 4209 | } else { |
| 4210 | spin_lock(&hdd_context_lock); |
| 4211 | if (context->request_id == request_id) |
| 4212 | retval = context->response_status; |
| 4213 | else |
| 4214 | retval = -EINVAL; |
| 4215 | spin_unlock(&hdd_context_lock); |
| 4216 | } |
| 4217 | |
| 4218 | return retval; |
| 4219 | } |
| 4220 | |
| 4221 | static int |
| 4222 | wlan_hdd_cfg80211_extscan_reset_ssid_hotlist(struct wiphy *wiphy, |
| 4223 | struct wireless_dev *wdev, |
| 4224 | const void *data, |
| 4225 | int data_len) |
| 4226 | { |
| 4227 | int ret; |
| 4228 | |
| 4229 | vos_ssr_protect(__func__); |
| 4230 | ret = __wlan_hdd_cfg80211_extscan_reset_ssid_hotlist(wiphy, wdev, |
| 4231 | data, data_len); |
| 4232 | vos_ssr_unprotect(__func__); |
| 4233 | |
| 4234 | return ret; |
| 4235 | } |
| 4236 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4237 | static int __wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4238 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4239 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4240 | { |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4241 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4242 | struct net_device *dev = wdev->netdev; |
| 4243 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4244 | uint32_t chan_list[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 4245 | uint8_t num_channels = 0; |
| 4246 | uint8_t num_chan_new = 0; |
| 4247 | uint8_t buf[256] = {0}; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4248 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
Padma, Santhosh Kumar | 387aa9c | 2015-06-19 15:39:37 +0530 | [diff] [blame] | 4249 | tANI_U32 requestId, maxChannels; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4250 | tWifiBand wifiBand; |
| 4251 | eHalStatus status; |
| 4252 | struct sk_buff *replySkb; |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4253 | tANI_U8 i,j,k; |
| 4254 | int ret,len = 0;; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4255 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4256 | ENTER(); |
| 4257 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4258 | status = wlan_hdd_validate_context(pHddCtx); |
| 4259 | if (0 != status) |
| 4260 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4261 | return -EINVAL; |
| 4262 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4263 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4264 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4265 | data, dataLen, |
| 4266 | wlan_hdd_extscan_config_policy)) { |
| 4267 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4268 | return -EINVAL; |
| 4269 | } |
| 4270 | |
| 4271 | /* Parse and fetch request Id */ |
| 4272 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4273 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4274 | return -EINVAL; |
| 4275 | } |
| 4276 | requestId = nla_get_u32( |
| 4277 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 4278 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); |
| 4279 | |
| 4280 | /* Parse and fetch wifi band */ |
| 4281 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) |
| 4282 | { |
| 4283 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 4284 | return -EINVAL; |
| 4285 | } |
| 4286 | wifiBand = nla_get_u32( |
| 4287 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); |
| 4288 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); |
| 4289 | |
Padma, Santhosh Kumar | 387aa9c | 2015-06-19 15:39:37 +0530 | [diff] [blame] | 4290 | /* Parse and fetch max channels */ |
| 4291 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS]) |
| 4292 | { |
| 4293 | hddLog(LOGE, FL("attr max channels failed")); |
| 4294 | return -EINVAL; |
| 4295 | } |
| 4296 | maxChannels = nla_get_u32( |
| 4297 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS]); |
| 4298 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max channels %d"), maxChannels); |
| 4299 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4300 | status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4301 | wifiBand, chan_list, |
| 4302 | &num_channels); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4303 | if (eHAL_STATUS_SUCCESS != status) { |
| 4304 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4305 | FL("sme_GetValidChannelsByBand failed (err=%d)"), status); |
| 4306 | return -EINVAL; |
| 4307 | } |
Padma, Santhosh Kumar | 387aa9c | 2015-06-19 15:39:37 +0530 | [diff] [blame] | 4308 | |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4309 | num_channels = VOS_MIN(num_channels, maxChannels); |
| 4310 | num_chan_new = num_channels; |
| 4311 | /* remove the indoor only channels if iface is SAP */ |
| 4312 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 4313 | { |
| 4314 | num_chan_new = 0; |
| 4315 | for (i = 0; i < num_channels; i++) |
| 4316 | for (j = 0; j < IEEE80211_NUM_BANDS; j++) { |
| 4317 | if (wiphy->bands[j] == NULL) |
| 4318 | continue; |
| 4319 | for (k = 0; k < wiphy->bands[j]->n_channels; k++) { |
| 4320 | if ((chan_list[i] == |
| 4321 | wiphy->bands[j]->channels[k].center_freq) && |
| 4322 | (!(wiphy->bands[j]->channels[k].flags & |
| 4323 | IEEE80211_CHAN_INDOOR_ONLY))) { |
| 4324 | chan_list[num_chan_new] = chan_list[i]; |
| 4325 | num_chan_new++; |
| 4326 | } |
| 4327 | } |
| 4328 | } |
| 4329 | } |
Padma, Santhosh Kumar | 387aa9c | 2015-06-19 15:39:37 +0530 | [diff] [blame] | 4330 | |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4331 | hddLog(LOG1, FL("Number of channels: %d"), num_chan_new); |
| 4332 | for (i = 0; i < num_chan_new; i++) |
| 4333 | len += scnprintf(buf + len, sizeof(buf) - len, "%u ", chan_list[i]); |
| 4334 | hddLog(LOG1, "Channels: %s", buf); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4335 | |
| 4336 | replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4337 | sizeof(u32) * num_chan_new + |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4338 | NLMSG_HDRLEN); |
| 4339 | |
| 4340 | if (!replySkb) { |
| 4341 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4342 | FL("valid channels: buffer alloc fail")); |
| 4343 | return -EINVAL; |
| 4344 | } |
| 4345 | if (nla_put_u32(replySkb, |
| 4346 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS, |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4347 | num_chan_new) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4348 | nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS, |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4349 | sizeof(u32) * num_chan_new, chan_list)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4350 | |
| 4351 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4352 | kfree_skb(replySkb); |
| 4353 | return -EINVAL; |
| 4354 | } |
| 4355 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4356 | ret = cfg80211_vendor_cmd_reply(replySkb); |
| 4357 | |
| 4358 | EXIT(); |
| 4359 | return ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4360 | } |
| 4361 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4362 | static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
| 4363 | struct wireless_dev *wdev, |
| 4364 | const void *data, int dataLen) |
| 4365 | { |
| 4366 | int ret = 0; |
| 4367 | |
| 4368 | vos_ssr_protect(__func__); |
| 4369 | ret = __wlan_hdd_cfg80211_extscan_get_valid_channels(wiphy, wdev, data, |
| 4370 | dataLen); |
| 4371 | vos_ssr_unprotect(__func__); |
| 4372 | |
| 4373 | return ret; |
| 4374 | } |
| 4375 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4376 | static int hdd_extscan_start_fill_bucket_channel_spec( |
| 4377 | hdd_context_t *pHddCtx, |
| 4378 | tpSirEXTScanStartReqParams pReqMsg, |
| 4379 | struct nlattr **tb) |
| 4380 | { |
| 4381 | struct nlattr *bucket[ |
| 4382 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4383 | struct nlattr *channel[ |
| 4384 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4385 | struct nlattr *buckets; |
| 4386 | struct nlattr *channels; |
| 4387 | int rem1, rem2; |
| 4388 | eHalStatus status; |
| 4389 | tANI_U8 bktIndex, j, numChannels; |
| 4390 | tANI_U32 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 4391 | tANI_U32 passive_max_chn_time, active_max_chn_time; |
| 4392 | |
| 4393 | bktIndex = 0; |
| 4394 | |
| 4395 | nla_for_each_nested(buckets, |
| 4396 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) { |
| 4397 | if (nla_parse(bucket, |
| 4398 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4399 | nla_data(buckets), nla_len(buckets), NULL)) { |
| 4400 | hddLog(LOGE, FL("nla_parse failed")); |
| 4401 | return -EINVAL; |
| 4402 | } |
| 4403 | |
| 4404 | /* Parse and fetch bucket spec */ |
| 4405 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) { |
| 4406 | hddLog(LOGE, FL("attr bucket index failed")); |
| 4407 | return -EINVAL; |
| 4408 | } |
| 4409 | pReqMsg->buckets[bktIndex].bucket = nla_get_u8( |
| 4410 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]); |
| 4411 | hddLog(LOG1, FL("Bucket spec Index %d"), |
| 4412 | pReqMsg->buckets[bktIndex].bucket); |
| 4413 | |
| 4414 | /* Parse and fetch wifi band */ |
| 4415 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) { |
| 4416 | hddLog(LOGE, FL("attr wifi band failed")); |
| 4417 | return -EINVAL; |
| 4418 | } |
| 4419 | pReqMsg->buckets[bktIndex].band = nla_get_u8( |
| 4420 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]); |
| 4421 | hddLog(LOG1, FL("Wifi band %d"), |
| 4422 | pReqMsg->buckets[bktIndex].band); |
| 4423 | |
| 4424 | /* Parse and fetch period */ |
| 4425 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) { |
| 4426 | hddLog(LOGE, FL("attr period failed")); |
| 4427 | return -EINVAL; |
| 4428 | } |
| 4429 | pReqMsg->buckets[bktIndex].period = nla_get_u32( |
| 4430 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]); |
| 4431 | hddLog(LOG1, FL("period %d"), |
| 4432 | pReqMsg->buckets[bktIndex].period); |
| 4433 | |
| 4434 | /* Parse and fetch report events */ |
| 4435 | if (!bucket[ |
| 4436 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) { |
| 4437 | hddLog(LOGE, FL("attr report events failed")); |
| 4438 | return -EINVAL; |
| 4439 | } |
| 4440 | pReqMsg->buckets[bktIndex].reportEvents = nla_get_u8( |
| 4441 | bucket[ |
| 4442 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]); |
| 4443 | hddLog(LOG1, FL("report events %d"), |
| 4444 | pReqMsg->buckets[bktIndex].reportEvents); |
| 4445 | |
| 4446 | /* Parse and fetch max period */ |
| 4447 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD]) { |
| 4448 | hddLog(LOGE, FL("attr max period failed")); |
| 4449 | return -EINVAL; |
| 4450 | } |
| 4451 | pReqMsg->buckets[bktIndex].max_period = nla_get_u32( |
| 4452 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD]); |
| 4453 | hddLog(LOG1, FL("max period %u"), |
| 4454 | pReqMsg->buckets[bktIndex].max_period); |
| 4455 | |
| 4456 | /* Parse and fetch exponent */ |
| 4457 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT]) { |
| 4458 | hddLog(LOGE, FL("attr exponent failed")); |
| 4459 | return -EINVAL; |
| 4460 | } |
| 4461 | pReqMsg->buckets[bktIndex].exponent = nla_get_u32( |
| 4462 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT]); |
| 4463 | hddLog(LOG1, FL("exponent %u"), |
| 4464 | pReqMsg->buckets[bktIndex].exponent); |
| 4465 | |
| 4466 | /* Parse and fetch step count */ |
| 4467 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT]) { |
| 4468 | hddLog(LOGE, FL("attr step count failed")); |
| 4469 | return -EINVAL; |
| 4470 | } |
| 4471 | pReqMsg->buckets[bktIndex].step_count = nla_get_u32( |
| 4472 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT]); |
| 4473 | hddLog(LOG1, FL("Step count %u"), |
| 4474 | pReqMsg->buckets[bktIndex].step_count); |
| 4475 | |
| 4476 | ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &passive_max_chn_time); |
| 4477 | ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &active_max_chn_time); |
| 4478 | |
| 4479 | /* Framework shall pass the channel list if the input WiFi band is |
| 4480 | * WIFI_BAND_UNSPECIFIED. |
| 4481 | * If the input WiFi band is specified (any value other than |
| 4482 | * WIFI_BAND_UNSPECIFIED) then driver populates the channel list |
| 4483 | */ |
| 4484 | if (pReqMsg->buckets[bktIndex].band != WIFI_BAND_UNSPECIFIED) { |
| 4485 | numChannels = 0; |
| 4486 | hddLog(LOG1, "WiFi band is specified, driver to fill channel list"); |
| 4487 | status = sme_GetValidChannelsByBand(pHddCtx->hHal, |
| 4488 | pReqMsg->buckets[bktIndex].band, |
| 4489 | chanList, &numChannels); |
| 4490 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4491 | hddLog(LOGE, |
| 4492 | FL("sme_GetValidChannelsByBand failed (err=%d)"), |
| 4493 | status); |
| 4494 | return -EINVAL; |
| 4495 | } |
| 4496 | |
| 4497 | pReqMsg->buckets[bktIndex].numChannels = |
| 4498 | VOS_MIN(numChannels, WLAN_EXTSCAN_MAX_CHANNELS); |
| 4499 | hddLog(LOG1, FL("Num channels %d"), |
| 4500 | pReqMsg->buckets[bktIndex].numChannels); |
| 4501 | |
| 4502 | for (j = 0; j < pReqMsg->buckets[bktIndex].numChannels; |
| 4503 | j++) { |
| 4504 | pReqMsg->buckets[bktIndex].channels[j].channel = |
| 4505 | chanList[j]; |
| 4506 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4507 | chnlClass = 0; |
| 4508 | if (CSR_IS_CHANNEL_DFS( |
| 4509 | vos_freq_to_chan(chanList[j]))) { |
| 4510 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4511 | passive = 1; |
| 4512 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4513 | dwellTimeMs = passive_max_chn_time; |
| 4514 | } else { |
| 4515 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4516 | passive = 0; |
| 4517 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4518 | dwellTimeMs = active_max_chn_time; |
| 4519 | } |
| 4520 | |
| 4521 | hddLog(LOG1, |
| 4522 | "Channel %u Passive %u Dwell time %u ms", |
| 4523 | pReqMsg->buckets[bktIndex].channels[j].channel, |
| 4524 | pReqMsg->buckets[bktIndex].channels[j].passive, |
| 4525 | pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs); |
| 4526 | } |
| 4527 | |
| 4528 | bktIndex++; |
| 4529 | continue; |
| 4530 | } |
| 4531 | |
| 4532 | /* Parse and fetch number of channels */ |
| 4533 | if (!bucket[ |
| 4534 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) { |
| 4535 | hddLog(LOGE, FL("attr num channels failed")); |
| 4536 | return -EINVAL; |
| 4537 | } |
| 4538 | |
| 4539 | pReqMsg->buckets[bktIndex].numChannels = |
| 4540 | nla_get_u32(bucket[ |
| 4541 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]); |
| 4542 | hddLog(LOG1, FL("num channels %d"), |
| 4543 | pReqMsg->buckets[bktIndex].numChannels); |
| 4544 | |
| 4545 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) { |
| 4546 | hddLog(LOGE, FL("attr channel spec failed")); |
| 4547 | return -EINVAL; |
| 4548 | } |
| 4549 | |
| 4550 | j = 0; |
| 4551 | nla_for_each_nested(channels, |
| 4552 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) { |
| 4553 | if (nla_parse(channel, |
| 4554 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4555 | nla_data(channels), nla_len(channels), |
| 4556 | wlan_hdd_extscan_config_policy)) { |
| 4557 | hddLog(LOGE, FL("nla_parse failed")); |
| 4558 | return -EINVAL; |
| 4559 | } |
| 4560 | |
| 4561 | /* Parse and fetch channel */ |
| 4562 | if (!channel[ |
| 4563 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) { |
| 4564 | hddLog(LOGE, FL("attr channel failed")); |
| 4565 | return -EINVAL; |
| 4566 | } |
| 4567 | pReqMsg->buckets[bktIndex].channels[j].channel = |
| 4568 | nla_get_u32(channel[ |
| 4569 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]); |
| 4570 | hddLog(LOG1, FL("channel %u"), |
| 4571 | pReqMsg->buckets[bktIndex].channels[j].channel); |
| 4572 | |
| 4573 | /* Parse and fetch dwell time */ |
| 4574 | if (!channel[ |
| 4575 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) { |
| 4576 | hddLog(LOGE, FL("attr dwelltime failed")); |
| 4577 | return -EINVAL; |
| 4578 | } |
| 4579 | pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs = |
| 4580 | nla_get_u32(channel[ |
| 4581 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]); |
| 4582 | |
| 4583 | hddLog(LOG1, FL("Dwell time (%u ms)"), |
| 4584 | pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs); |
| 4585 | |
| 4586 | |
| 4587 | /* Parse and fetch channel spec passive */ |
| 4588 | if (!channel[ |
| 4589 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) { |
| 4590 | hddLog(LOGE, |
| 4591 | FL("attr channel spec passive failed")); |
| 4592 | return -EINVAL; |
| 4593 | } |
| 4594 | pReqMsg->buckets[bktIndex].channels[j].passive = |
| 4595 | nla_get_u8(channel[ |
| 4596 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]); |
| 4597 | hddLog(LOG1, FL("Chnl spec passive %u"), |
| 4598 | pReqMsg->buckets[bktIndex].channels[j].passive); |
| 4599 | |
| 4600 | j++; |
| 4601 | } |
| 4602 | |
| 4603 | bktIndex++; |
| 4604 | } |
| 4605 | |
| 4606 | return 0; |
| 4607 | } |
| 4608 | |
| 4609 | |
| 4610 | /* |
| 4611 | * define short names for the global vendor params |
| 4612 | * used by wlan_hdd_cfg80211_extscan_start() |
| 4613 | */ |
| 4614 | #define PARAM_MAX \ |
| 4615 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX |
| 4616 | #define PARAM_REQUEST_ID \ |
| 4617 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID |
| 4618 | #define PARAM_BASE_PERIOD \ |
| 4619 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD |
| 4620 | #define PARAM_MAX_AP_PER_SCAN \ |
| 4621 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN |
| 4622 | #define PARAM_RPT_THRHLD_PERCENT \ |
| 4623 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT |
| 4624 | #define PARAM_RPT_THRHLD_NUM_SCANS \ |
| 4625 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS |
| 4626 | #define PARAM_NUM_BUCKETS \ |
| 4627 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS |
| 4628 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4629 | static int __wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4630 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4631 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4632 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4633 | tpSirEXTScanStartReqParams pReqMsg = NULL; |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4634 | struct net_device *dev = wdev->netdev; |
| 4635 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4636 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4637 | struct nlattr *tb[PARAM_MAX + 1]; |
| 4638 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4639 | eHalStatus status; |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4640 | tANI_U32 request_id; |
| 4641 | struct hdd_ext_scan_context *context; |
| 4642 | unsigned long rc; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4643 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4644 | ENTER(); |
| 4645 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4646 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 4647 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 4648 | return -EINVAL; |
| 4649 | } |
| 4650 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4651 | status = wlan_hdd_validate_context(pHddCtx); |
| 4652 | if (0 != status) |
| 4653 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4654 | return -EINVAL; |
| 4655 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4656 | /* check the EXTScan Capability */ |
| 4657 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4658 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4659 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4660 | { |
| 4661 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4662 | FL("EXTScan not enabled/supported by Firmware")); |
| 4663 | return -EINVAL; |
| 4664 | } |
| 4665 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4666 | if (nla_parse(tb, PARAM_MAX, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4667 | data, dataLen, |
| 4668 | wlan_hdd_extscan_config_policy)) { |
| 4669 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4670 | return -EINVAL; |
| 4671 | } |
| 4672 | |
| 4673 | /* Parse and fetch request Id */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4674 | if (!tb[PARAM_REQUEST_ID]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4675 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4676 | return -EINVAL; |
| 4677 | } |
| 4678 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4679 | pReqMsg = (tpSirEXTScanStartReqParams) |
| 4680 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4681 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4682 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 4683 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4684 | } |
| 4685 | |
| 4686 | pReqMsg->requestId = nla_get_u32( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4687 | tb[PARAM_REQUEST_ID]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4688 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 4689 | |
| 4690 | pReqMsg->sessionId = pAdapter->sessionId; |
| 4691 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 4692 | |
| 4693 | /* Parse and fetch base period */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4694 | if (!tb[PARAM_BASE_PERIOD]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4695 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed")); |
| 4696 | goto fail; |
| 4697 | } |
| 4698 | pReqMsg->basePeriod = nla_get_u32( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4699 | tb[PARAM_BASE_PERIOD]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4700 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"), |
| 4701 | pReqMsg->basePeriod); |
| 4702 | |
| 4703 | /* Parse and fetch max AP per scan */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4704 | if (!tb[PARAM_MAX_AP_PER_SCAN]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4705 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed")); |
| 4706 | goto fail; |
| 4707 | } |
| 4708 | pReqMsg->maxAPperScan = nla_get_u32( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4709 | tb[PARAM_MAX_AP_PER_SCAN]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4710 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"), |
| 4711 | pReqMsg->maxAPperScan); |
| 4712 | |
| 4713 | /* Parse and fetch report threshold */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4714 | if (!tb[PARAM_RPT_THRHLD_PERCENT]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4715 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed")); |
| 4716 | goto fail; |
| 4717 | } |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4718 | pReqMsg->reportThresholdPercent = nla_get_u8( |
| 4719 | tb[PARAM_RPT_THRHLD_PERCENT]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4720 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"), |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4721 | pReqMsg->reportThresholdPercent); |
| 4722 | |
| 4723 | /* Parse and fetch report threshold num scans */ |
| 4724 | if (!tb[PARAM_RPT_THRHLD_NUM_SCANS]) { |
| 4725 | hddLog(LOGE, FL("attr report_threshold num scans failed")); |
| 4726 | goto fail; |
| 4727 | } |
| 4728 | pReqMsg->reportThresholdNumScans = nla_get_u8( |
| 4729 | tb[PARAM_RPT_THRHLD_NUM_SCANS]); |
| 4730 | hddLog(LOG1, FL("Report Threshold num scans %d"), |
| 4731 | pReqMsg->reportThresholdNumScans); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4732 | |
| 4733 | /* Parse and fetch number of buckets */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4734 | if (!tb[PARAM_NUM_BUCKETS]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4735 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed")); |
| 4736 | goto fail; |
| 4737 | } |
| 4738 | pReqMsg->numBuckets = nla_get_u8( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4739 | tb[PARAM_NUM_BUCKETS]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4740 | if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) { |
| 4741 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets " |
| 4742 | "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS); |
| 4743 | pReqMsg->numBuckets = WLAN_EXTSCAN_MAX_BUCKETS; |
| 4744 | } |
| 4745 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"), |
| 4746 | pReqMsg->numBuckets); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4747 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4748 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) { |
| 4749 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed")); |
| 4750 | goto fail; |
| 4751 | } |
| 4752 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4753 | pReqMsg->homeAwayTime = pHddCtx->cfg_ini->nRestTimeConc; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4754 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4755 | if (hdd_extscan_start_fill_bucket_channel_spec(pHddCtx, pReqMsg, tb)) |
| 4756 | goto fail; |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4757 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4758 | context = &pHddCtx->ext_scan_context; |
| 4759 | spin_lock(&hdd_context_lock); |
| 4760 | INIT_COMPLETION(context->response_event); |
| 4761 | context->request_id = request_id = pReqMsg->requestId; |
| 4762 | spin_unlock(&hdd_context_lock); |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4763 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4764 | status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg); |
| 4765 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4766 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4767 | FL("sme_EXTScanStart failed(err=%d)"), status); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4768 | goto fail; |
| 4769 | } |
| 4770 | |
Srinivas Dasari | 91727c1 | 2016-03-23 17:59:06 +0530 | [diff] [blame] | 4771 | pHddCtx->extscan_start_time_since_boot = vos_get_monotonic_boottime(); |
| 4772 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4773 | /* request was sent -- wait for the response */ |
| 4774 | rc = wait_for_completion_timeout(&context->response_event, |
| 4775 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 4776 | |
| 4777 | if (!rc) { |
| 4778 | hddLog(LOGE, FL("sme_ExtScanStart timed out")); |
| 4779 | retval = -ETIMEDOUT; |
| 4780 | } else { |
| 4781 | spin_lock(&hdd_context_lock); |
| 4782 | if (context->request_id == request_id) |
| 4783 | retval = context->response_status; |
| 4784 | else |
| 4785 | retval = -EINVAL; |
| 4786 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4787 | } |
| 4788 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4789 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4790 | EXIT(); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4791 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4792 | |
| 4793 | fail: |
| 4794 | vos_mem_free(pReqMsg); |
| 4795 | return -EINVAL; |
| 4796 | } |
| 4797 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4798 | /* |
| 4799 | * done with short names for the global vendor params |
| 4800 | * used by wlan_hdd_cfg80211_extscan_start() |
| 4801 | */ |
| 4802 | #undef PARAM_MAX |
| 4803 | #undef PARAM_REQUEST_ID |
| 4804 | #undef PARAM_BASE_PERIOD |
| 4805 | #undef PARAMS_MAX_AP_PER_SCAN |
| 4806 | #undef PARAMS_RPT_THRHLD_PERCENT |
| 4807 | #undef PARAMS_RPT_THRHLD_NUM_SCANS |
| 4808 | #undef PARAMS_NUM_BUCKETS |
| 4809 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4810 | static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
| 4811 | struct wireless_dev *wdev, |
| 4812 | const void *data, int dataLen) |
| 4813 | { |
| 4814 | int ret = 0; |
| 4815 | |
| 4816 | vos_ssr_protect(__func__); |
| 4817 | ret = __wlan_hdd_cfg80211_extscan_start(wiphy, wdev, data, dataLen); |
| 4818 | vos_ssr_unprotect(__func__); |
| 4819 | |
| 4820 | return ret; |
| 4821 | } |
| 4822 | |
| 4823 | static int __wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4824 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4825 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4826 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4827 | tSirEXTScanStopReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4828 | struct net_device *dev = wdev->netdev; |
| 4829 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4830 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4831 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4832 | eHalStatus status; |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 4833 | int retval; |
| 4834 | unsigned long rc; |
| 4835 | struct hdd_ext_scan_context *context; |
| 4836 | tANI_U32 request_id; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4837 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4838 | ENTER(); |
| 4839 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 4840 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 4841 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 4842 | return -EINVAL; |
| 4843 | } |
| 4844 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4845 | status = wlan_hdd_validate_context(pHddCtx); |
| 4846 | if (0 != status) |
| 4847 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4848 | return -EINVAL; |
| 4849 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4850 | /* check the EXTScan Capability */ |
| 4851 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4852 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4853 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4854 | { |
| 4855 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4856 | FL("EXTScan not enabled/supported by Firmware")); |
| 4857 | return -EINVAL; |
| 4858 | } |
| 4859 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4860 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4861 | data, dataLen, |
| 4862 | wlan_hdd_extscan_config_policy)) { |
| 4863 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4864 | return -EINVAL; |
| 4865 | } |
| 4866 | |
| 4867 | /* Parse and fetch request Id */ |
| 4868 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4869 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4870 | return -EINVAL; |
| 4871 | } |
| 4872 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4873 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4874 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4875 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4876 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4877 | reqMsg.sessionId = pAdapter->sessionId; |
| 4878 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4879 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 4880 | context = &pHddCtx->ext_scan_context; |
| 4881 | spin_lock(&hdd_context_lock); |
| 4882 | INIT_COMPLETION(context->response_event); |
Sravanti Palakonda | 7539fb9 | 2016-02-26 17:49:21 +0530 | [diff] [blame] | 4883 | context->request_id = request_id = reqMsg.requestId; |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 4884 | spin_unlock(&hdd_context_lock); |
| 4885 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4886 | status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4887 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4888 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4889 | FL("sme_EXTScanStop failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4890 | return -EINVAL; |
| 4891 | } |
| 4892 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 4893 | /* request was sent -- wait for the response */ |
| 4894 | rc = wait_for_completion_timeout(&context->response_event, |
| 4895 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 4896 | |
| 4897 | if (!rc) { |
| 4898 | hddLog(LOGE, FL("sme_ExtScanStop timed out")); |
| 4899 | retval = -ETIMEDOUT; |
| 4900 | } else { |
| 4901 | spin_lock(&hdd_context_lock); |
| 4902 | if (context->request_id == request_id) |
| 4903 | retval = context->response_status; |
| 4904 | else |
| 4905 | retval = -EINVAL; |
| 4906 | spin_unlock(&hdd_context_lock); |
| 4907 | } |
| 4908 | |
| 4909 | return retval; |
| 4910 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4911 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4912 | return 0; |
| 4913 | } |
| 4914 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4915 | static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
| 4916 | struct wireless_dev *wdev, |
| 4917 | const void *data, int dataLen) |
| 4918 | { |
| 4919 | int ret = 0; |
| 4920 | |
| 4921 | vos_ssr_protect(__func__); |
| 4922 | ret = __wlan_hdd_cfg80211_extscan_stop(wiphy, wdev, data, dataLen); |
| 4923 | vos_ssr_unprotect(__func__); |
| 4924 | |
| 4925 | return ret; |
| 4926 | } |
| 4927 | |
| 4928 | static int __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4929 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4930 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4931 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4932 | tSirEXTScanResetBssidHotlistReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4933 | struct net_device *dev = wdev->netdev; |
| 4934 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4935 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4936 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4937 | eHalStatus status; |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4938 | struct hdd_ext_scan_context *context; |
| 4939 | tANI_U32 request_id; |
| 4940 | unsigned long rc; |
| 4941 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4942 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4943 | ENTER(); |
| 4944 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4945 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 4946 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 4947 | return -EINVAL; |
| 4948 | } |
| 4949 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4950 | status = wlan_hdd_validate_context(pHddCtx); |
| 4951 | if (0 != status) |
| 4952 | { |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4953 | hddLog(LOGE, FL("HDD context is not valid")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4954 | return -EINVAL; |
| 4955 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4956 | /* check the EXTScan Capability */ |
| 4957 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4958 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4959 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4960 | { |
| 4961 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4962 | FL("EXTScan not enabled/supported by Firmware")); |
| 4963 | return -EINVAL; |
| 4964 | } |
| 4965 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4966 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4967 | data, dataLen, |
| 4968 | wlan_hdd_extscan_config_policy)) { |
| 4969 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4970 | return -EINVAL; |
| 4971 | } |
| 4972 | |
| 4973 | /* Parse and fetch request Id */ |
| 4974 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4975 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4976 | return -EINVAL; |
| 4977 | } |
| 4978 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4979 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4980 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4981 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4982 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4983 | reqMsg.sessionId = pAdapter->sessionId; |
| 4984 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4985 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4986 | context = &pHddCtx->ext_scan_context; |
| 4987 | spin_lock(&hdd_context_lock); |
| 4988 | INIT_COMPLETION(context->response_event); |
| 4989 | context->request_id = request_id = reqMsg.requestId; |
| 4990 | spin_unlock(&hdd_context_lock); |
| 4991 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4992 | status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4993 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4994 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4995 | FL("sme_ResetBssHotlist failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4996 | return -EINVAL; |
| 4997 | } |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4998 | |
| 4999 | /* request was sent -- wait for the response */ |
| 5000 | rc = wait_for_completion_timeout(&context->response_event, |
| 5001 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 5002 | if (!rc) { |
| 5003 | hddLog(LOGE, FL("sme_ResetBssHotlist timed out")); |
| 5004 | retval = -ETIMEDOUT; |
| 5005 | } else { |
| 5006 | spin_lock(&hdd_context_lock); |
| 5007 | if (context->request_id == request_id) |
| 5008 | retval = context->response_status; |
| 5009 | else |
| 5010 | retval = -EINVAL; |
| 5011 | spin_unlock(&hdd_context_lock); |
| 5012 | } |
| 5013 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5014 | EXIT(); |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 5015 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5016 | } |
| 5017 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5018 | static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
| 5019 | struct wireless_dev *wdev, |
| 5020 | const void *data, int dataLen) |
| 5021 | { |
| 5022 | int ret = 0; |
| 5023 | |
| 5024 | vos_ssr_protect(__func__); |
| 5025 | ret = __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(wiphy, wdev, data, dataLen); |
| 5026 | vos_ssr_unprotect(__func__); |
| 5027 | |
| 5028 | return ret; |
| 5029 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5030 | #endif /* WLAN_FEATURE_EXTSCAN */ |
| 5031 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5032 | /*EXT TDLS*/ |
| 5033 | static const struct nla_policy |
| 5034 | wlan_hdd_tdls_config_enable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX +1] = |
| 5035 | { |
| 5036 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 5037 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL] = {.type = NLA_S32 }, |
| 5038 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS] = |
| 5039 | {.type = NLA_S32 }, |
| 5040 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS] = {.type = NLA_S32 }, |
| 5041 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS] = {.type = NLA_S32 }, |
| 5042 | |
| 5043 | }; |
| 5044 | |
| 5045 | static const struct nla_policy |
| 5046 | wlan_hdd_tdls_config_disable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX +1] = |
| 5047 | { |
| 5048 | [QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 5049 | |
| 5050 | }; |
| 5051 | |
| 5052 | static const struct nla_policy |
| 5053 | wlan_hdd_tdls_config_state_change_policy[ |
| 5054 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAX +1] = |
| 5055 | { |
| 5056 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 5057 | [QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE] = {.type = NLA_S32 }, |
| 5058 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5059 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL] = {.type = NLA_S32 }, |
| 5060 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS] = |
| 5061 | {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5062 | |
| 5063 | }; |
| 5064 | |
| 5065 | static const struct nla_policy |
| 5066 | wlan_hdd_tdls_config_get_status_policy[ |
| 5067 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX +1] = |
| 5068 | { |
| 5069 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 5070 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE] = {.type = NLA_S32 }, |
| 5071 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5072 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL] = {.type = NLA_S32 }, |
| 5073 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS] |
| 5074 | = {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5075 | |
| 5076 | }; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5077 | |
| 5078 | static const struct nla_policy |
| 5079 | wlan_hdd_mac_config[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX+1] = |
| 5080 | { |
| 5081 | [QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI] = {.type = NLA_UNSPEC }, |
| 5082 | }; |
| 5083 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5084 | static int __wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5085 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5086 | const void *data, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5087 | int data_len) |
| 5088 | { |
| 5089 | |
| 5090 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5091 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX + 1]; |
| 5092 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5093 | ENTER(); |
| 5094 | |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5095 | if (0 != wlan_hdd_validate_context(pHddCtx)){ |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5096 | return -EINVAL; |
| 5097 | } |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 5098 | if (0 == pHddCtx->cfg_ini->enableMacSpoofing) { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 5099 | hddLog(VOS_TRACE_LEVEL_INFO, FL("MAC_SPOOFED_SCAN disabled in ini")); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5100 | return -ENOTSUPP; |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 5101 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5102 | if (TRUE != sme_IsFeatureSupportedByFW(MAC_SPOOFED_SCAN)){ |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 5103 | hddLog(VOS_TRACE_LEVEL_INFO, FL("MAC_SPOOFED_SCAN not supported by FW")); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5104 | return -ENOTSUPP; |
| 5105 | } |
| 5106 | |
| 5107 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX, |
| 5108 | data, data_len, wlan_hdd_mac_config)) { |
| 5109 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5110 | return -EINVAL; |
| 5111 | } |
| 5112 | |
| 5113 | /* Parse and fetch mac address */ |
| 5114 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]) { |
| 5115 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5116 | return -EINVAL; |
| 5117 | } |
| 5118 | |
| 5119 | memcpy(pHddCtx->spoofMacAddr.randomMacAddr.bytes, nla_data( |
| 5120 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 5121 | VOS_MAC_ADDR_LAST_3_BYTES); |
| 5122 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 5123 | pHddCtx->spoofMacAddr.isEnabled = TRUE; |
| 5124 | |
| 5125 | 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] | 5126 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 5127 | VOS_MAC_ADDR_FIRST_3_BYTES); |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 5128 | if ((pHddCtx->spoofMacAddr.randomMacAddr.bytes[0] == 0) && |
| 5129 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[1] == 0) && |
| 5130 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[2] == 0)) |
| 5131 | { |
| 5132 | hddLog(LOG1, FL("ZERO MAC OUI Recieved. Disabling Spoofing")); |
| 5133 | vos_mem_zero(pHddCtx->spoofMacAddr.randomMacAddr.bytes, |
| 5134 | VOS_MAC_ADDRESS_LEN); |
| 5135 | pHddCtx->spoofMacAddr.isEnabled = FALSE; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5136 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5137 | |
Padma, Santhosh Kumar | db2d75b | 2015-11-17 12:18:10 +0530 | [diff] [blame] | 5138 | schedule_delayed_work(&pHddCtx->spoof_mac_addr_work, |
| 5139 | msecs_to_jiffies(MAC_ADDR_SPOOFING_DEFER_INTERVAL)); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5140 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5141 | EXIT(); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5142 | return 0; |
| 5143 | } |
| 5144 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5145 | static int wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
| 5146 | struct wireless_dev *wdev, |
| 5147 | const void *data, |
| 5148 | int data_len) |
| 5149 | { |
| 5150 | int ret = 0; |
| 5151 | |
| 5152 | vos_ssr_protect(__func__); |
| 5153 | ret = __wlan_hdd_cfg80211_set_spoofed_mac_oui(wiphy, wdev, data, data_len); |
| 5154 | vos_ssr_unprotect(__func__); |
| 5155 | |
| 5156 | return ret; |
| 5157 | } |
| 5158 | |
| 5159 | static int __wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5160 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5161 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5162 | int data_len) |
| 5163 | { |
| 5164 | u8 peer[6] = {0}; |
| 5165 | struct net_device *dev = wdev->netdev; |
| 5166 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5167 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5168 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; |
| 5169 | eHalStatus ret; |
| 5170 | tANI_S32 state; |
| 5171 | tANI_S32 reason; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5172 | tANI_S32 global_operating_class = 0; |
| 5173 | tANI_S32 channel = 0; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5174 | struct sk_buff *skb = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5175 | int retVal; |
| 5176 | |
| 5177 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5178 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5179 | if (!pAdapter) { |
| 5180 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 5181 | return -EINVAL; |
| 5182 | } |
| 5183 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5184 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5185 | if (0 != ret) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5186 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5187 | return -EINVAL; |
| 5188 | } |
| 5189 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5190 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5191 | return -ENOTSUPP; |
| 5192 | } |
| 5193 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, |
| 5194 | data, data_len, |
| 5195 | wlan_hdd_tdls_config_get_status_policy)) { |
| 5196 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5197 | return -EINVAL; |
| 5198 | } |
| 5199 | |
| 5200 | /* Parse and fetch mac address */ |
| 5201 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]) { |
| 5202 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5203 | return -EINVAL; |
| 5204 | } |
| 5205 | |
| 5206 | memcpy(peer, nla_data( |
| 5207 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]), |
| 5208 | sizeof(peer)); |
| 5209 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 5210 | |
Konamki, Sreelakshmi | abb59ed | 2015-06-12 12:13:23 +0530 | [diff] [blame] | 5211 | wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5212 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5213 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5214 | 4 * sizeof(s32) + |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5215 | NLMSG_HDRLEN); |
| 5216 | |
| 5217 | if (!skb) { |
| 5218 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5219 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 5220 | return -EINVAL; |
| 5221 | } |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5222 | 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] | 5223 | reason, |
| 5224 | state, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5225 | global_operating_class, |
| 5226 | channel, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5227 | MAC_ADDR_ARRAY(peer)); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5228 | if (nla_put_s32(skb, |
| 5229 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE, |
| 5230 | state) || |
| 5231 | nla_put_s32(skb, |
| 5232 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON, |
| 5233 | reason) || |
| 5234 | nla_put_s32(skb, |
| 5235 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS, |
| 5236 | global_operating_class) || |
| 5237 | nla_put_s32(skb, |
| 5238 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL, |
| 5239 | channel)) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5240 | |
| 5241 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 5242 | goto nla_put_failure; |
| 5243 | } |
| 5244 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5245 | retVal = cfg80211_vendor_cmd_reply(skb); |
| 5246 | EXIT(); |
| 5247 | return retVal; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5248 | |
| 5249 | nla_put_failure: |
| 5250 | kfree_skb(skb); |
| 5251 | return -EINVAL; |
| 5252 | } |
| 5253 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5254 | static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
| 5255 | struct wireless_dev *wdev, |
| 5256 | const void *data, |
| 5257 | int data_len) |
| 5258 | { |
| 5259 | int ret = 0; |
| 5260 | |
| 5261 | vos_ssr_protect(__func__); |
| 5262 | ret = __wlan_hdd_cfg80211_exttdls_get_status(wiphy, wdev, data, data_len); |
| 5263 | vos_ssr_unprotect(__func__); |
| 5264 | |
| 5265 | return ret; |
| 5266 | } |
| 5267 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 5268 | static int wlan_hdd_cfg80211_exttdls_callback( |
| 5269 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 5270 | const tANI_U8* mac, |
| 5271 | #else |
| 5272 | tANI_U8* mac, |
| 5273 | #endif |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5274 | tANI_S32 state, |
| 5275 | tANI_S32 reason, |
| 5276 | void *ctx) |
| 5277 | { |
| 5278 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)ctx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5279 | struct sk_buff *skb = NULL; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5280 | tANI_S32 global_operating_class = 0; |
| 5281 | tANI_S32 channel = 0; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5282 | hdd_context_t *pHddCtx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5283 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5284 | ENTER(); |
| 5285 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5286 | if (!pAdapter) { |
| 5287 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 5288 | return -EINVAL; |
| 5289 | } |
| 5290 | |
| 5291 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5292 | if (wlan_hdd_validate_context(pHddCtx)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5293 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5294 | return -EINVAL; |
| 5295 | } |
| 5296 | |
| 5297 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5298 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5299 | return -ENOTSUPP; |
| 5300 | } |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 5301 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 5302 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 5303 | NULL, |
| 5304 | #endif |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5305 | EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 5306 | QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX, |
| 5307 | GFP_KERNEL); |
| 5308 | |
| 5309 | if (!skb) { |
| 5310 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5311 | FL("cfg80211_vendor_event_alloc failed")); |
| 5312 | return -EINVAL; |
| 5313 | } |
| 5314 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5315 | hddLog(VOS_TRACE_LEVEL_INFO, "Reason: (%d) Status: (%d) Class: (%d) Channel: (%d)", |
| 5316 | reason, |
| 5317 | state, |
| 5318 | global_operating_class, |
| 5319 | channel); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5320 | hddLog(VOS_TRACE_LEVEL_WARN, "tdls peer " MAC_ADDRESS_STR, |
| 5321 | MAC_ADDR_ARRAY(mac)); |
| 5322 | |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5323 | if (nla_put(skb, |
| 5324 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR, |
| 5325 | VOS_MAC_ADDR_SIZE, mac) || |
| 5326 | nla_put_s32(skb, |
| 5327 | QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE, |
| 5328 | state) || |
| 5329 | nla_put_s32(skb, |
| 5330 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON, |
| 5331 | reason) || |
| 5332 | nla_put_s32(skb, |
| 5333 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL, |
| 5334 | channel) || |
| 5335 | nla_put_s32(skb, |
| 5336 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS, |
| 5337 | global_operating_class) |
| 5338 | ) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5339 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 5340 | goto nla_put_failure; |
| 5341 | } |
| 5342 | |
| 5343 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5344 | EXIT(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5345 | return (0); |
| 5346 | |
| 5347 | nla_put_failure: |
| 5348 | kfree_skb(skb); |
| 5349 | return -EINVAL; |
| 5350 | } |
| 5351 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5352 | static int __wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5353 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5354 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5355 | int data_len) |
| 5356 | { |
| 5357 | u8 peer[6] = {0}; |
| 5358 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5359 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5360 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1]; |
| 5361 | eHalStatus status; |
| 5362 | tdls_req_params_t pReqMsg = {0}; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5363 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5364 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5365 | |
| 5366 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5367 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5368 | if (!dev) { |
| 5369 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 5370 | return -EINVAL; |
| 5371 | } |
| 5372 | |
| 5373 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5374 | if (!pAdapter) { |
| 5375 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 5376 | return -EINVAL; |
| 5377 | } |
| 5378 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5379 | status = wlan_hdd_validate_context(pHddCtx); |
| 5380 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5381 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5382 | return -EINVAL; |
| 5383 | } |
| 5384 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5385 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5386 | return -ENOTSUPP; |
| 5387 | } |
| 5388 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX, |
| 5389 | data, data_len, |
| 5390 | wlan_hdd_tdls_config_enable_policy)) { |
| 5391 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5392 | return -EINVAL; |
| 5393 | } |
| 5394 | |
| 5395 | /* Parse and fetch mac address */ |
| 5396 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]) { |
| 5397 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5398 | return -EINVAL; |
| 5399 | } |
| 5400 | |
| 5401 | memcpy(peer, nla_data( |
| 5402 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]), |
| 5403 | sizeof(peer)); |
| 5404 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 5405 | |
| 5406 | /* Parse and fetch channel */ |
| 5407 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]) { |
| 5408 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 5409 | return -EINVAL; |
| 5410 | } |
| 5411 | pReqMsg.channel = nla_get_s32( |
| 5412 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]); |
| 5413 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Channel Num (%d)"), pReqMsg.channel); |
| 5414 | |
| 5415 | /* Parse and fetch global operating class */ |
| 5416 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]) { |
| 5417 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr operating class failed")); |
| 5418 | return -EINVAL; |
| 5419 | } |
| 5420 | pReqMsg.global_operating_class = nla_get_s32( |
| 5421 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]); |
| 5422 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Operating class (%d)"), |
| 5423 | pReqMsg.global_operating_class); |
| 5424 | |
| 5425 | /* Parse and fetch latency ms */ |
| 5426 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]) { |
| 5427 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr latency failed")); |
| 5428 | return -EINVAL; |
| 5429 | } |
| 5430 | pReqMsg.max_latency_ms = nla_get_s32( |
| 5431 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]); |
| 5432 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Latency (%d)"), |
| 5433 | pReqMsg.max_latency_ms); |
| 5434 | |
| 5435 | /* Parse and fetch required bandwidth kbps */ |
| 5436 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]) { |
| 5437 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bandwidth failed")); |
| 5438 | return -EINVAL; |
| 5439 | } |
| 5440 | |
| 5441 | pReqMsg.min_bandwidth_kbps = nla_get_s32( |
| 5442 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]); |
| 5443 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bandwidth (%d)"), |
| 5444 | pReqMsg.min_bandwidth_kbps); |
| 5445 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5446 | ret = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5447 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 5448 | &pReqMsg, |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5449 | wlan_hdd_cfg80211_exttdls_callback); |
| 5450 | |
| 5451 | EXIT(); |
| 5452 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5453 | } |
| 5454 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5455 | static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
| 5456 | struct wireless_dev *wdev, |
| 5457 | const void *data, |
| 5458 | int data_len) |
| 5459 | { |
| 5460 | int ret = 0; |
| 5461 | |
| 5462 | vos_ssr_protect(__func__); |
| 5463 | ret = __wlan_hdd_cfg80211_exttdls_enable(wiphy, wdev, data, data_len); |
| 5464 | vos_ssr_unprotect(__func__); |
| 5465 | |
| 5466 | return ret; |
| 5467 | } |
| 5468 | |
| 5469 | static int __wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5470 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5471 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5472 | int data_len) |
| 5473 | { |
| 5474 | u8 peer[6] = {0}; |
| 5475 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5476 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5477 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1]; |
| 5478 | eHalStatus status; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5479 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5480 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5481 | |
| 5482 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5483 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5484 | if (!dev) { |
| 5485 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 5486 | return -EINVAL; |
| 5487 | } |
| 5488 | |
| 5489 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5490 | if (!pAdapter) { |
| 5491 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 5492 | return -EINVAL; |
| 5493 | } |
| 5494 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5495 | status = wlan_hdd_validate_context(pHddCtx); |
| 5496 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5497 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5498 | return -EINVAL; |
| 5499 | } |
| 5500 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5501 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5502 | return -ENOTSUPP; |
| 5503 | } |
| 5504 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX, |
| 5505 | data, data_len, |
| 5506 | wlan_hdd_tdls_config_disable_policy)) { |
| 5507 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5508 | return -EINVAL; |
| 5509 | } |
| 5510 | /* Parse and fetch mac address */ |
| 5511 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]) { |
| 5512 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5513 | return -EINVAL; |
| 5514 | } |
| 5515 | |
| 5516 | memcpy(peer, nla_data( |
| 5517 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]), |
| 5518 | sizeof(peer)); |
| 5519 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 5520 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5521 | ret = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
| 5522 | |
| 5523 | EXIT(); |
| 5524 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5525 | } |
| 5526 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5527 | static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
| 5528 | struct wireless_dev *wdev, |
| 5529 | const void *data, |
| 5530 | int data_len) |
| 5531 | { |
| 5532 | int ret = 0; |
| 5533 | |
| 5534 | vos_ssr_protect(__func__); |
| 5535 | ret = __wlan_hdd_cfg80211_exttdls_disable(wiphy, wdev, data, data_len); |
| 5536 | vos_ssr_unprotect(__func__); |
| 5537 | |
| 5538 | return ret; |
| 5539 | } |
| 5540 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5541 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5542 | __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5543 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5544 | const void *data, int data_len) |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5545 | { |
| 5546 | struct net_device *dev = wdev->netdev; |
| 5547 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5548 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5549 | struct sk_buff *skb = NULL; |
| 5550 | tANI_U32 fset = 0; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5551 | int ret = 0; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5552 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5553 | ENTER(); |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5554 | |
| 5555 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5556 | if (0 != ret) |
| 5557 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5558 | return ret; |
| 5559 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5560 | if (wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { |
| 5561 | hddLog(LOG1, FL("Infra Station mode is supported by driver")); |
| 5562 | fset |= WIFI_FEATURE_INFRA; |
| 5563 | } |
| 5564 | |
| 5565 | if (TRUE == hdd_is_5g_supported(pHddCtx)) { |
| 5566 | hddLog(LOG1, FL("INFRA_5G is supported by firmware")); |
| 5567 | fset |= WIFI_FEATURE_INFRA_5G; |
| 5568 | } |
| 5569 | |
| 5570 | #ifdef WLAN_FEATURE_P2P |
| 5571 | if ((wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) && |
| 5572 | (wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_GO))) { |
| 5573 | hddLog(LOG1, FL("WiFi-Direct is supported by driver")); |
| 5574 | fset |= WIFI_FEATURE_P2P; |
| 5575 | } |
| 5576 | #endif |
| 5577 | |
| 5578 | /* Soft-AP is supported currently by default */ |
| 5579 | fset |= WIFI_FEATURE_SOFT_AP; |
| 5580 | |
Kanchanapally, Vidyullatha | 683aed0 | 2015-03-24 16:58:38 +0530 | [diff] [blame] | 5581 | /* HOTSPOT is a supplicant feature, enable it by default */ |
| 5582 | fset |= WIFI_FEATURE_HOTSPOT; |
| 5583 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5584 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5585 | if ((TRUE == pHddCtx->cfg_ini->fEnableEXTScan) && |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 5586 | sme_IsFeatureSupportedByFW(EXTENDED_SCAN) && |
| 5587 | sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED)) { |
| 5588 | hddLog(LOG1, FL("Enhanced EXTScan is supported by firmware")); |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5589 | fset |= WIFI_FEATURE_EXTSCAN; |
| 5590 | } |
| 5591 | #endif |
| 5592 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5593 | if (sme_IsFeatureSupportedByFW(NAN)) { |
| 5594 | hddLog(LOG1, FL("NAN is supported by firmware")); |
| 5595 | fset |= WIFI_FEATURE_NAN; |
| 5596 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5597 | |
| 5598 | /* D2D RTT is not supported currently by default */ |
| 5599 | if (sme_IsFeatureSupportedByFW(RTT)) { |
| 5600 | hddLog(LOG1, FL("RTT is supported by firmware")); |
| 5601 | fset |= WIFI_FEATURE_D2AP_RTT; |
| 5602 | } |
| 5603 | |
Padma, Santhosh Kumar | aac4c4d | 2015-12-08 16:07:47 +0530 | [diff] [blame] | 5604 | if (sme_IsFeatureSupportedByFW(RTT3)) { |
| 5605 | hddLog(LOG1, FL("RTT3 is supported by firmware")); |
| 5606 | fset |= WIFI_FEATURE_RTT3; |
| 5607 | } |
| 5608 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5609 | #ifdef FEATURE_WLAN_BATCH_SCAN |
| 5610 | if (fset & WIFI_FEATURE_EXTSCAN) { |
| 5611 | hddLog(LOG1, FL("Batch scan is supported as extscan is supported")); |
| 5612 | fset &= ~WIFI_FEATURE_BATCH_SCAN; |
| 5613 | } else if (sme_IsFeatureSupportedByFW(BATCH_SCAN)) { |
| 5614 | hddLog(LOG1, FL("Batch scan is supported by firmware")); |
| 5615 | fset |= WIFI_FEATURE_BATCH_SCAN; |
| 5616 | } |
| 5617 | #endif |
| 5618 | |
| 5619 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 5620 | if (pHddCtx->cfg_ini->configPNOScanSupport && |
| 5621 | (eHAL_STATUS_SUCCESS == wlan_hdd_is_pno_allowed(pAdapter))) { |
| 5622 | hddLog(LOG1, FL("PNO is supported by firmware")); |
| 5623 | fset |= WIFI_FEATURE_PNO; |
| 5624 | } |
| 5625 | #endif |
| 5626 | |
| 5627 | /* STA+STA is supported currently by default */ |
| 5628 | fset |= WIFI_FEATURE_ADDITIONAL_STA; |
| 5629 | |
| 5630 | #ifdef FEATURE_WLAN_TDLS |
| 5631 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSSupport) && |
| 5632 | sme_IsFeatureSupportedByFW(TDLS)) { |
| 5633 | hddLog(LOG1, FL("TDLS is supported by firmware")); |
| 5634 | fset |= WIFI_FEATURE_TDLS; |
| 5635 | } |
| 5636 | |
| 5637 | /* TDLS_OFFCHANNEL is not supported currently by default */ |
| 5638 | #endif |
| 5639 | |
| 5640 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 5641 | /* AP+STA concurrency is supported currently by default */ |
| 5642 | fset |= WIFI_FEATURE_AP_STA; |
| 5643 | #endif |
| 5644 | |
Mukul Sharma | 5add053 | 2015-08-17 15:57:47 +0530 | [diff] [blame] | 5645 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5646 | fset |= WIFI_FEATURE_LINK_LAYER_STATS; |
| 5647 | hddLog(LOG1, FL("Link layer stats is supported by driver")); |
| 5648 | #endif |
| 5649 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5650 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) + |
| 5651 | NLMSG_HDRLEN); |
| 5652 | |
| 5653 | if (!skb) { |
| 5654 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 5655 | return -EINVAL; |
| 5656 | } |
| 5657 | hddLog(LOG1, FL("Supported Features : 0x%x"), fset); |
| 5658 | |
| 5659 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_FEATURE_SET, fset)) { |
| 5660 | hddLog(LOGE, FL("nla put fail")); |
| 5661 | goto nla_put_failure; |
| 5662 | } |
| 5663 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5664 | ret = cfg80211_vendor_cmd_reply(skb); |
| 5665 | EXIT(); |
| 5666 | return ret; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5667 | |
| 5668 | nla_put_failure: |
| 5669 | kfree_skb(skb); |
| 5670 | return -EINVAL; |
| 5671 | } |
| 5672 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5673 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5674 | wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
| 5675 | struct wireless_dev *wdev, |
| 5676 | const void *data, int data_len) |
| 5677 | { |
| 5678 | int ret = 0; |
| 5679 | |
| 5680 | vos_ssr_protect(__func__); |
| 5681 | ret = __wlan_hdd_cfg80211_get_supported_features(wiphy, wdev, data, data_len); |
| 5682 | vos_ssr_unprotect(__func__); |
| 5683 | |
| 5684 | return ret; |
| 5685 | } |
| 5686 | |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 5687 | |
| 5688 | static const struct |
| 5689 | nla_policy |
| 5690 | qca_wlan_vendor_wifi_logger_get_ring_data_policy |
| 5691 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX + 1] = { |
| 5692 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID] |
| 5693 | = {.type = NLA_U32 }, |
| 5694 | }; |
| 5695 | |
| 5696 | static int |
| 5697 | __wlan_hdd_cfg80211_wifi_logger_get_ring_data(struct wiphy *wiphy, |
| 5698 | struct wireless_dev *wdev, |
| 5699 | const void *data, |
| 5700 | int data_len) |
| 5701 | { |
| 5702 | int ret; |
| 5703 | VOS_STATUS status; |
| 5704 | uint32_t ring_id; |
| 5705 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 5706 | struct nlattr *tb |
| 5707 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX + 1]; |
| 5708 | |
| 5709 | ENTER(); |
| 5710 | |
| 5711 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5712 | if (0 != ret) { |
| 5713 | return ret; |
| 5714 | } |
| 5715 | |
| 5716 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX, |
| 5717 | data, data_len, |
| 5718 | qca_wlan_vendor_wifi_logger_get_ring_data_policy)) { |
| 5719 | hddLog(LOGE, FL("Invalid attribute")); |
| 5720 | return -EINVAL; |
| 5721 | } |
| 5722 | |
| 5723 | /* Parse and fetch ring id */ |
| 5724 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID]) { |
| 5725 | hddLog(LOGE, FL("attr ATTR failed")); |
| 5726 | return -EINVAL; |
| 5727 | } |
| 5728 | |
| 5729 | ring_id = nla_get_u32( |
| 5730 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID]); |
| 5731 | |
| 5732 | hddLog(LOG1, FL("Bug report triggered by framework")); |
| 5733 | |
| 5734 | status = vos_fatal_event_logs_req(WLAN_LOG_TYPE_NON_FATAL, |
| 5735 | WLAN_LOG_INDICATOR_FRAMEWORK, |
| 5736 | WLAN_LOG_REASON_CODE_FRAMEWORK, |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 5737 | TRUE, TRUE |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 5738 | ); |
| 5739 | if (VOS_STATUS_SUCCESS != status) { |
| 5740 | hddLog(LOGE, FL("Failed to trigger bug report")); |
| 5741 | |
| 5742 | return -EINVAL; |
| 5743 | } |
| 5744 | |
| 5745 | return 0; |
| 5746 | |
| 5747 | |
| 5748 | } |
| 5749 | |
| 5750 | |
| 5751 | static int |
| 5752 | wlan_hdd_cfg80211_wifi_logger_get_ring_data(struct wiphy *wiphy, |
| 5753 | struct wireless_dev *wdev, |
| 5754 | const void *data, |
| 5755 | int data_len) |
| 5756 | { |
| 5757 | int ret = 0; |
| 5758 | |
| 5759 | vos_ssr_protect(__func__); |
| 5760 | ret = __wlan_hdd_cfg80211_wifi_logger_get_ring_data(wiphy, |
| 5761 | wdev, data, data_len); |
| 5762 | vos_ssr_unprotect(__func__); |
| 5763 | |
| 5764 | return ret; |
| 5765 | |
| 5766 | } |
| 5767 | |
| 5768 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5769 | static int |
| 5770 | __wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5771 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5772 | const void *data, int data_len) |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5773 | { |
| 5774 | uint32_t feature_set_matrix[WLAN_HDD_MAX_FEATURE_SET] = {0}; |
| 5775 | uint8_t i, feature_sets, max_feature_sets; |
| 5776 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX + 1]; |
| 5777 | struct sk_buff *reply_skb; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5778 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5779 | int ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5780 | |
| 5781 | ENTER(); |
| 5782 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5783 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5784 | if (0 != ret) |
| 5785 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5786 | return ret; |
| 5787 | } |
| 5788 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5789 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX, |
| 5790 | data, data_len, NULL)) { |
| 5791 | hddLog(LOGE, FL("Invalid ATTR")); |
| 5792 | return -EINVAL; |
| 5793 | } |
| 5794 | |
| 5795 | /* Parse and fetch max feature set */ |
| 5796 | if (!tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]) { |
| 5797 | hddLog(LOGE, FL("Attr max feature set size failed")); |
| 5798 | return -EINVAL; |
| 5799 | } |
| 5800 | max_feature_sets = nla_get_u32( |
| 5801 | tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]); |
| 5802 | hddLog(LOG1, FL("Max feature set size (%d)"), max_feature_sets); |
| 5803 | |
| 5804 | /* Fill feature combination matrix */ |
| 5805 | feature_sets = 0; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5806 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5807 | WIFI_FEATURE_P2P; |
| 5808 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5809 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5810 | WIFI_FEATURE_SOFT_AP; |
| 5811 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5812 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_P2P | |
| 5813 | WIFI_FEATURE_SOFT_AP; |
| 5814 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5815 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5816 | WIFI_FEATURE_SOFT_AP | |
| 5817 | WIFI_FEATURE_P2P; |
| 5818 | |
| 5819 | /* Add more feature combinations here */ |
| 5820 | |
| 5821 | feature_sets = VOS_MIN(feature_sets, max_feature_sets); |
| 5822 | hddLog(LOG1, FL("Number of feature sets (%d)"), feature_sets); |
| 5823 | hddLog(LOG1, "Feature set matrix"); |
| 5824 | for (i = 0; i < feature_sets; i++) |
| 5825 | hddLog(LOG1, "[%d] 0x%02X", i, feature_set_matrix[i]); |
| 5826 | |
| 5827 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 5828 | sizeof(u32) * feature_sets + |
| 5829 | NLMSG_HDRLEN); |
| 5830 | |
| 5831 | if (reply_skb) { |
| 5832 | if (nla_put_u32(reply_skb, |
| 5833 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET_SIZE, |
| 5834 | feature_sets) || |
| 5835 | nla_put(reply_skb, |
| 5836 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET, |
| 5837 | sizeof(u32) * feature_sets, feature_set_matrix)) { |
| 5838 | hddLog(LOGE, FL("nla put fail")); |
| 5839 | kfree_skb(reply_skb); |
| 5840 | return -EINVAL; |
| 5841 | } |
| 5842 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5843 | ret = cfg80211_vendor_cmd_reply(reply_skb); |
| 5844 | EXIT(); |
| 5845 | return ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5846 | } |
| 5847 | hddLog(LOGE, FL("Feature set matrix: buffer alloc fail")); |
| 5848 | return -ENOMEM; |
| 5849 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5850 | } |
| 5851 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5852 | static int |
| 5853 | wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
| 5854 | struct wireless_dev *wdev, |
| 5855 | const void *data, int data_len) |
| 5856 | { |
| 5857 | int ret = 0; |
| 5858 | |
| 5859 | vos_ssr_protect(__func__); |
| 5860 | ret = __wlan_hdd_cfg80211_get_concurrency_matrix(wiphy, wdev, data, |
| 5861 | data_len); |
| 5862 | vos_ssr_unprotect(__func__); |
| 5863 | |
| 5864 | return ret; |
| 5865 | } |
| 5866 | |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 5867 | |
| 5868 | static int |
| 5869 | __wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy, |
| 5870 | struct wireless_dev *wdev, |
| 5871 | const void *data, int data_len) |
| 5872 | { |
| 5873 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5874 | int ret; |
| 5875 | ENTER(); |
| 5876 | |
| 5877 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5878 | if (0 != ret) |
| 5879 | { |
| 5880 | return ret; |
| 5881 | } |
| 5882 | |
| 5883 | if( !pHddCtx->cfg_ini->enableFwrMemDump || |
| 5884 | (FALSE == sme_IsFeatureSupportedByFW(MEMORY_DUMP_SUPPORTED))) |
| 5885 | { |
| 5886 | hddLog(VOS_TRACE_LEVEL_INFO, FL("FW dump Logging not supported")); |
| 5887 | return -EINVAL; |
| 5888 | } |
| 5889 | /*call common API for FW mem dump req*/ |
| 5890 | ret = wlan_hdd_fw_mem_dump_req(pHddCtx); |
| 5891 | |
Abhishek Singh | c783fa7 | 2015-12-09 18:07:34 +0530 | [diff] [blame] | 5892 | if (!ret) |
c_manjee | 04b4c5c | 2015-10-13 18:35:01 +0530 | [diff] [blame] | 5893 | { |
| 5894 | /*indicate to userspace the status of fw mem dump */ |
| 5895 | wlan_indicate_mem_dump_complete(true); |
| 5896 | } |
| 5897 | else |
| 5898 | { |
| 5899 | /*else send failure to userspace */ |
| 5900 | wlan_indicate_mem_dump_complete(false); |
| 5901 | } |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 5902 | EXIT(); |
| 5903 | return ret; |
| 5904 | } |
| 5905 | |
| 5906 | /** |
| 5907 | * wlan_hdd_cfg80211_get_fw_mem_dump() - Get FW memory dump |
| 5908 | * @wiphy: pointer to wireless wiphy structure. |
| 5909 | * @wdev: pointer to wireless_dev structure. |
| 5910 | * @data: Pointer to the NL data. |
| 5911 | * @data_len:Length of @data |
| 5912 | * |
| 5913 | * This is called when wlan driver needs to get the firmware memory dump |
| 5914 | * via vendor specific command. |
| 5915 | * |
| 5916 | * Return: 0 on success, error number otherwise. |
| 5917 | */ |
| 5918 | |
| 5919 | static int |
| 5920 | wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy, |
| 5921 | struct wireless_dev *wdev, |
| 5922 | const void *data, int data_len) |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 5923 | { |
| 5924 | int ret = 0; |
| 5925 | vos_ssr_protect(__func__); |
| 5926 | ret = __wlan_hdd_cfg80211_get_fw_mem_dump(wiphy, wdev, data, |
| 5927 | data_len); |
| 5928 | vos_ssr_unprotect(__func__); |
| 5929 | return ret; |
| 5930 | } |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 5931 | |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 5932 | static const struct |
| 5933 | nla_policy |
| 5934 | qca_wlan_vendor_wifi_logger_start_policy |
| 5935 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX + 1] = { |
| 5936 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID] |
| 5937 | = {.type = NLA_U32 }, |
| 5938 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL] |
| 5939 | = {.type = NLA_U32 }, |
| 5940 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS] |
| 5941 | = {.type = NLA_U32 }, |
| 5942 | }; |
| 5943 | |
| 5944 | /** |
| 5945 | * __wlan_hdd_cfg80211_wifi_logger_start() - This function is used to enable |
| 5946 | * or disable the collection of packet statistics from the firmware |
| 5947 | * @wiphy: WIPHY structure pointer |
| 5948 | * @wdev: Wireless device structure pointer |
| 5949 | * @data: Pointer to the data received |
| 5950 | * @data_len: Length of the data received |
| 5951 | * |
| 5952 | * This function is used to enable or disable the collection of packet |
| 5953 | * statistics from the firmware |
| 5954 | * |
| 5955 | * Return: 0 on success and errno on failure |
| 5956 | */ |
| 5957 | static int __wlan_hdd_cfg80211_wifi_logger_start(struct wiphy *wiphy, |
| 5958 | struct wireless_dev *wdev, |
| 5959 | const void *data, |
| 5960 | int data_len) |
| 5961 | { |
| 5962 | eHalStatus status; |
| 5963 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 5964 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX + 1]; |
| 5965 | tAniWifiStartLog start_log; |
| 5966 | |
| 5967 | status = wlan_hdd_validate_context(hdd_ctx); |
| 5968 | if (0 != status) { |
| 5969 | return -EINVAL; |
| 5970 | } |
| 5971 | |
| 5972 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX, |
| 5973 | data, data_len, |
| 5974 | qca_wlan_vendor_wifi_logger_start_policy)) { |
| 5975 | hddLog(LOGE, FL("Invalid attribute")); |
| 5976 | return -EINVAL; |
| 5977 | } |
| 5978 | |
| 5979 | /* Parse and fetch ring id */ |
| 5980 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID]) { |
| 5981 | hddLog(LOGE, FL("attr ATTR failed")); |
| 5982 | return -EINVAL; |
| 5983 | } |
| 5984 | start_log.ringId = nla_get_u32( |
| 5985 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID]); |
| 5986 | hddLog(LOG1, FL("Ring ID=%d"), start_log.ringId); |
| 5987 | |
| 5988 | /* Parse and fetch verbose level */ |
| 5989 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL]) { |
| 5990 | hddLog(LOGE, FL("attr verbose_level failed")); |
| 5991 | return -EINVAL; |
| 5992 | } |
| 5993 | start_log.verboseLevel = nla_get_u32( |
| 5994 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL]); |
| 5995 | hddLog(LOG1, FL("verbose_level=%d"), start_log.verboseLevel); |
| 5996 | |
| 5997 | /* Parse and fetch flag */ |
| 5998 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS]) { |
| 5999 | hddLog(LOGE, FL("attr flag failed")); |
| 6000 | return -EINVAL; |
| 6001 | } |
| 6002 | start_log.flag = nla_get_u32( |
| 6003 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS]); |
| 6004 | hddLog(LOG1, FL("flag=%d"), start_log.flag); |
| 6005 | |
| 6006 | if ((RING_ID_PER_PACKET_STATS == start_log.ringId) && |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 6007 | (!hdd_ctx->cfg_ini->wlanPerPktStatsLogEnable || |
| 6008 | !vos_isPktStatsEnabled())) |
| 6009 | |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 6010 | { |
| 6011 | hddLog(LOGE, FL("per pkt stats not enabled")); |
| 6012 | return -EINVAL; |
| 6013 | } |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 6014 | |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 6015 | vos_set_ring_log_level(start_log.ringId, start_log.verboseLevel); |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 6016 | return 0; |
| 6017 | } |
| 6018 | |
| 6019 | /** |
| 6020 | * wlan_hdd_cfg80211_wifi_logger_start() - Wrapper function used to enable |
| 6021 | * or disable the collection of packet statistics from the firmware |
| 6022 | * @wiphy: WIPHY structure pointer |
| 6023 | * @wdev: Wireless device structure pointer |
| 6024 | * @data: Pointer to the data received |
| 6025 | * @data_len: Length of the data received |
| 6026 | * |
| 6027 | * This function is used to enable or disable the collection of packet |
| 6028 | * statistics from the firmware |
| 6029 | * |
| 6030 | * Return: 0 on success and errno on failure |
| 6031 | */ |
| 6032 | static int wlan_hdd_cfg80211_wifi_logger_start(struct wiphy *wiphy, |
| 6033 | struct wireless_dev *wdev, |
| 6034 | const void *data, |
| 6035 | int data_len) |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 6036 | { |
| 6037 | int ret = 0; |
| 6038 | |
| 6039 | vos_ssr_protect(__func__); |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 6040 | |
| 6041 | ret = __wlan_hdd_cfg80211_wifi_logger_start(wiphy, |
| 6042 | wdev, data, data_len); |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 6043 | vos_ssr_unprotect(__func__); |
| 6044 | |
| 6045 | return ret; |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 6046 | } |
| 6047 | |
| 6048 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6049 | static const struct nla_policy |
| 6050 | wlan_hdd_set_no_dfs_flag_config_policy[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX |
| 6051 | +1] = |
| 6052 | { |
| 6053 | [QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG] = {.type = NLA_U32 }, |
| 6054 | }; |
| 6055 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6056 | static int __wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6057 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 6058 | const void *data, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6059 | int data_len) |
| 6060 | { |
| 6061 | struct net_device *dev = wdev->netdev; |
| 6062 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6063 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6064 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6065 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX + 1]; |
| 6066 | eHalStatus status; |
| 6067 | u32 dfsFlag = 0; |
| 6068 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6069 | ENTER(); |
| 6070 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6071 | status = wlan_hdd_validate_context(pHddCtx); |
| 6072 | if (0 != status) { |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6073 | return -EINVAL; |
| 6074 | } |
| 6075 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX, |
| 6076 | data, data_len, |
| 6077 | wlan_hdd_set_no_dfs_flag_config_policy)) { |
| 6078 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 6079 | return -EINVAL; |
| 6080 | } |
| 6081 | |
| 6082 | /* Parse and fetch required bandwidth kbps */ |
| 6083 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]) { |
| 6084 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dfs flag failed")); |
| 6085 | return -EINVAL; |
| 6086 | } |
| 6087 | |
| 6088 | dfsFlag = nla_get_u32( |
| 6089 | tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]); |
| 6090 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" DFS flag (%d)"), |
| 6091 | dfsFlag); |
| 6092 | |
| 6093 | pHddCtx->disable_dfs_flag = dfsFlag; |
| 6094 | |
| 6095 | sme_disable_dfs_channel(hHal, dfsFlag); |
| 6096 | sme_FilterScanResults(hHal, pAdapter->sessionId); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6097 | |
| 6098 | EXIT(); |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6099 | return 0; |
| 6100 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 6101 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6102 | static int wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
| 6103 | struct wireless_dev *wdev, |
| 6104 | const void *data, |
| 6105 | int data_len) |
| 6106 | { |
| 6107 | int ret = 0; |
| 6108 | |
| 6109 | vos_ssr_protect(__func__); |
| 6110 | ret = __wlan_hdd_cfg80211_disable_dfs_channels(wiphy, wdev, data, data_len); |
| 6111 | vos_ssr_unprotect(__func__); |
| 6112 | |
| 6113 | return ret; |
| 6114 | |
| 6115 | } |
| 6116 | |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6117 | const struct |
| 6118 | nla_policy qca_wlan_vendor_attr[QCA_WLAN_VENDOR_ATTR_MAX+1] = |
| 6119 | { |
| 6120 | [QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY] = { .type = NLA_U32 }, |
| 6121 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { .type = NLA_UNSPEC }, |
| 6122 | }; |
| 6123 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6124 | static int __wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 6125 | struct wireless_dev *wdev, const void *data, int data_len) |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6126 | { |
| 6127 | |
| 6128 | u8 bssid[6] = {0}; |
| 6129 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6130 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 6131 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6132 | v_U32_t isFwrRoamEnabled = FALSE; |
| 6133 | int ret; |
| 6134 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6135 | ENTER(); |
| 6136 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6137 | ret = wlan_hdd_validate_context(pHddCtx); |
| 6138 | if (0 != ret) { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6139 | return ret; |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6140 | } |
| 6141 | |
| 6142 | ret = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, |
| 6143 | data, data_len, |
| 6144 | qca_wlan_vendor_attr); |
| 6145 | if (ret){ |
| 6146 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 6147 | return -EINVAL; |
| 6148 | } |
| 6149 | |
| 6150 | /* Parse and fetch Enable flag */ |
| 6151 | if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]) { |
| 6152 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr enable failed")); |
| 6153 | return -EINVAL; |
| 6154 | } |
| 6155 | |
| 6156 | isFwrRoamEnabled = nla_get_u32( |
| 6157 | tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]); |
| 6158 | |
| 6159 | hddLog(VOS_TRACE_LEVEL_INFO, FL("isFwrRoamEnabled (%d)"), isFwrRoamEnabled); |
| 6160 | |
| 6161 | /* Parse and fetch bssid */ |
| 6162 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 6163 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bss id failed")); |
| 6164 | return -EINVAL; |
| 6165 | } |
| 6166 | |
| 6167 | memcpy(bssid, nla_data( |
| 6168 | tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 6169 | sizeof(bssid)); |
| 6170 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(bssid)); |
| 6171 | |
| 6172 | //Update roaming |
| 6173 | status = sme_ConfigFwrRoaming((tHalHandle)(pHddCtx->hHal), isFwrRoamEnabled); |
Abhishek Singh | c6ab38f | 2016-06-28 17:48:16 +0530 | [diff] [blame] | 6174 | if (!HAL_STATUS_SUCCESS(status)) { |
| 6175 | hddLog(LOGE, |
| 6176 | FL("sme_ConfigFwrRoaming failed (err=%d)"), status); |
| 6177 | return -EINVAL; |
| 6178 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6179 | EXIT(); |
Abhishek Singh | c6ab38f | 2016-06-28 17:48:16 +0530 | [diff] [blame] | 6180 | return 0; |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6181 | } |
| 6182 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6183 | static int wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
| 6184 | struct wireless_dev *wdev, const void *data, int data_len) |
| 6185 | { |
| 6186 | int ret = 0; |
| 6187 | |
| 6188 | vos_ssr_protect(__func__); |
| 6189 | ret = __wlan_hdd_cfg80211_firmware_roaming(wiphy, wdev, data, data_len); |
| 6190 | vos_ssr_unprotect(__func__); |
| 6191 | |
| 6192 | return ret; |
| 6193 | } |
| 6194 | |
Sushant Kaushik | 847890c | 2015-09-28 16:05:17 +0530 | [diff] [blame] | 6195 | static const struct |
| 6196 | nla_policy |
| 6197 | qca_wlan_vendor_get_wifi_info_policy[ |
| 6198 | QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX +1] = { |
| 6199 | [QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION] = {.type = NLA_U8 }, |
| 6200 | [QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION] = {.type = NLA_U8 }, |
| 6201 | }; |
| 6202 | |
| 6203 | |
| 6204 | /** |
| 6205 | * __wlan_hdd_cfg80211_get_wifi_info() - Get the wifi driver related info |
| 6206 | * @wiphy: pointer to wireless wiphy structure. |
| 6207 | * @wdev: pointer to wireless_dev structure. |
| 6208 | * @data: Pointer to the data to be passed via vendor interface |
| 6209 | * @data_len:Length of the data to be passed |
| 6210 | * |
| 6211 | * This is called when wlan driver needs to send wifi driver related info |
| 6212 | * (driver/fw version) to the user space application upon request. |
| 6213 | * |
| 6214 | * Return: Return the Success or Failure code. |
| 6215 | */ |
| 6216 | static int __wlan_hdd_cfg80211_get_wifi_info(struct wiphy *wiphy, |
| 6217 | struct wireless_dev *wdev, |
| 6218 | const void *data, int data_len) |
| 6219 | { |
| 6220 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6221 | struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX + 1]; |
| 6222 | tSirVersionString version; |
| 6223 | uint32 version_len; |
| 6224 | uint8 attr; |
| 6225 | int status; |
| 6226 | struct sk_buff *reply_skb = NULL; |
| 6227 | |
| 6228 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 6229 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 6230 | return -EINVAL; |
| 6231 | } |
| 6232 | |
| 6233 | status = wlan_hdd_validate_context(hdd_ctx); |
| 6234 | if (0 != status) { |
| 6235 | hddLog(LOGE, FL("HDD context is not valid")); |
| 6236 | return -EINVAL; |
| 6237 | } |
| 6238 | |
| 6239 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX, data, |
| 6240 | data_len, qca_wlan_vendor_get_wifi_info_policy)) { |
| 6241 | hddLog(LOGE, FL("WIFI_INFO_GET NL CMD parsing failed")); |
| 6242 | return -EINVAL; |
| 6243 | } |
| 6244 | |
| 6245 | if (tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION]) { |
| 6246 | hddLog(LOG1, FL("Rcvd req for Driver version Driver version is %s"), |
| 6247 | QWLAN_VERSIONSTR); |
| 6248 | strlcpy(version, QWLAN_VERSIONSTR, sizeof(version)); |
| 6249 | attr = QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION; |
| 6250 | } else if (tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION]) { |
| 6251 | hddLog(LOG1, FL("Rcvd req for FW version FW version is %s"), |
| 6252 | hdd_ctx->fw_Version); |
| 6253 | strlcpy(version, hdd_ctx->fw_Version, sizeof(version)); |
| 6254 | attr = QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION; |
| 6255 | } else { |
| 6256 | hddLog(LOGE, FL("Invalid attribute in get wifi info request")); |
| 6257 | return -EINVAL; |
| 6258 | } |
| 6259 | |
| 6260 | version_len = strlen(version); |
| 6261 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 6262 | version_len + NLA_HDRLEN + NLMSG_HDRLEN); |
| 6263 | if (!reply_skb) { |
| 6264 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 6265 | return -ENOMEM; |
| 6266 | } |
| 6267 | |
| 6268 | if (nla_put(reply_skb, attr, version_len, version)) { |
| 6269 | hddLog(LOGE, FL("nla put fail")); |
| 6270 | kfree_skb(reply_skb); |
| 6271 | return -EINVAL; |
| 6272 | } |
| 6273 | |
| 6274 | return cfg80211_vendor_cmd_reply(reply_skb); |
| 6275 | } |
| 6276 | |
| 6277 | /** |
| 6278 | * __wlan_hdd_cfg80211_get_wifi_info() - Get the wifi driver related info |
| 6279 | * @wiphy: pointer to wireless wiphy structure. |
| 6280 | * @wdev: pointer to wireless_dev structure. |
| 6281 | * @data: Pointer to the data to be passed via vendor interface |
| 6282 | * @data_len:Length of the data to be passed |
| 6283 | * @data_len: Length of the data received |
| 6284 | * |
| 6285 | * This function is used to enable or disable the collection of packet |
| 6286 | * statistics from the firmware |
| 6287 | * |
| 6288 | * Return: 0 on success and errno on failure |
| 6289 | */ |
| 6290 | |
| 6291 | static int |
| 6292 | wlan_hdd_cfg80211_get_wifi_info(struct wiphy *wiphy, |
| 6293 | struct wireless_dev *wdev, |
| 6294 | const void *data, int data_len) |
| 6295 | |
| 6296 | |
| 6297 | { |
| 6298 | int ret = 0; |
| 6299 | |
| 6300 | vos_ssr_protect(__func__); |
| 6301 | ret = __wlan_hdd_cfg80211_get_wifi_info(wiphy, |
| 6302 | wdev, data, data_len); |
| 6303 | vos_ssr_unprotect(__func__); |
| 6304 | |
| 6305 | return ret; |
| 6306 | } |
| 6307 | |
| 6308 | |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6309 | /* |
| 6310 | * define short names for the global vendor params |
| 6311 | * used by __wlan_hdd_cfg80211_monitor_rssi() |
| 6312 | */ |
| 6313 | #define PARAM_MAX QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX |
| 6314 | #define PARAM_REQUEST_ID QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID |
| 6315 | #define PARAM_CONTROL QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CONTROL |
| 6316 | #define PARAM_MIN_RSSI QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MIN_RSSI |
| 6317 | #define PARAM_MAX_RSSI QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX_RSSI |
| 6318 | |
| 6319 | /**--------------------------------------------------------------------------- |
| 6320 | |
| 6321 | \brief hdd_rssi_monitor_start_done - callback to be executed when rssi |
| 6322 | monitor start is completed successfully. |
| 6323 | |
| 6324 | \return - None |
| 6325 | |
| 6326 | --------------------------------------------------------------------------*/ |
| 6327 | void hdd_rssi_monitor_start_done(void *fwRssiMonitorCbContext, VOS_STATUS status) |
| 6328 | { |
| 6329 | hdd_context_t* pHddCtx = (hdd_context_t*)fwRssiMonitorCbContext; |
| 6330 | |
| 6331 | if (NULL == pHddCtx) |
| 6332 | { |
| 6333 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6334 | "%s: HDD context is NULL",__func__); |
| 6335 | return; |
| 6336 | } |
| 6337 | |
| 6338 | if (VOS_STATUS_SUCCESS == status) |
| 6339 | { |
| 6340 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rssi Monitor start successful")); |
| 6341 | } |
| 6342 | else |
| 6343 | { |
| 6344 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Rssi Monitor start not successful")); |
| 6345 | } |
| 6346 | |
| 6347 | return; |
| 6348 | } |
| 6349 | |
| 6350 | /**--------------------------------------------------------------------------- |
| 6351 | |
| 6352 | \brief hdd_rssi_monitor_stop_done - callback to be executed when rssi monitor |
| 6353 | stop is completed successfully. |
| 6354 | |
| 6355 | \return - None |
| 6356 | |
| 6357 | --------------------------------------------------------------------------*/ |
| 6358 | void hdd_rssi_monitor_stop_done(void *fwRssiMonitorCbContext, VOS_STATUS status) |
| 6359 | { |
| 6360 | hdd_context_t* pHddCtx = (hdd_context_t*)fwRssiMonitorCbContext; |
| 6361 | |
| 6362 | if (NULL == pHddCtx) |
| 6363 | { |
| 6364 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6365 | "%s: HDD context is NULL",__func__); |
| 6366 | return; |
| 6367 | } |
| 6368 | |
| 6369 | if (VOS_STATUS_SUCCESS == status) |
| 6370 | { |
| 6371 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rssi Monitor stop successful")); |
| 6372 | } |
| 6373 | else |
| 6374 | { |
| 6375 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Rssi Monitor stop not successful")); |
| 6376 | } |
| 6377 | |
| 6378 | return; |
| 6379 | } |
| 6380 | |
| 6381 | /** |
| 6382 | * __wlan_hdd_cfg80211_monitor_rssi() - monitor rssi |
| 6383 | * @wiphy: Pointer to wireless phy |
| 6384 | * @wdev: Pointer to wireless device |
| 6385 | * @data: Pointer to data |
| 6386 | * @data_len: Data length |
| 6387 | * |
| 6388 | * Return: 0 on success, negative errno on failure |
| 6389 | */ |
| 6390 | |
| 6391 | static int |
| 6392 | __wlan_hdd_cfg80211_monitor_rssi(struct wiphy *wiphy, |
| 6393 | struct wireless_dev *wdev, |
| 6394 | const void *data, |
| 6395 | int data_len) |
| 6396 | { |
| 6397 | struct net_device *dev = wdev->netdev; |
| 6398 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6399 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6400 | hdd_station_ctx_t *pHddStaCtx; |
| 6401 | struct nlattr *tb[PARAM_MAX + 1]; |
| 6402 | tpSirRssiMonitorReq pReq; |
| 6403 | eHalStatus status; |
| 6404 | int ret; |
| 6405 | uint32_t control; |
| 6406 | static const struct nla_policy policy[PARAM_MAX + 1] = { |
| 6407 | [PARAM_REQUEST_ID] = { .type = NLA_U32 }, |
| 6408 | [PARAM_CONTROL] = { .type = NLA_U32 }, |
| 6409 | [PARAM_MIN_RSSI] = { .type = NLA_S8 }, |
| 6410 | [PARAM_MAX_RSSI] = { .type = NLA_S8 }, |
| 6411 | }; |
| 6412 | |
| 6413 | ENTER(); |
| 6414 | |
| 6415 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6416 | if (0 != ret) { |
| 6417 | return -EINVAL; |
| 6418 | } |
| 6419 | |
| 6420 | if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) { |
| 6421 | hddLog(LOGE, FL("Not in Connected state!")); |
| 6422 | return -ENOTSUPP; |
| 6423 | } |
| 6424 | |
| 6425 | if (nla_parse(tb, PARAM_MAX, data, data_len, policy)) { |
| 6426 | hddLog(LOGE, FL("Invalid ATTR")); |
| 6427 | return -EINVAL; |
| 6428 | } |
| 6429 | |
| 6430 | if (!tb[PARAM_REQUEST_ID]) { |
| 6431 | hddLog(LOGE, FL("attr request id failed")); |
| 6432 | return -EINVAL; |
| 6433 | } |
| 6434 | |
| 6435 | if (!tb[PARAM_CONTROL]) { |
| 6436 | hddLog(LOGE, FL("attr control failed")); |
| 6437 | return -EINVAL; |
| 6438 | } |
| 6439 | |
| 6440 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6441 | |
| 6442 | pReq = vos_mem_malloc(sizeof(tSirRssiMonitorReq)); |
| 6443 | if(NULL == pReq) |
| 6444 | { |
| 6445 | hddLog(LOGE, |
| 6446 | FL("vos_mem_alloc failed ")); |
| 6447 | return eHAL_STATUS_FAILED_ALLOC; |
| 6448 | } |
| 6449 | vos_mem_set(pReq, sizeof(tSirRssiMonitorReq), 0); |
| 6450 | |
| 6451 | pReq->requestId = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 6452 | pReq->sessionId = pAdapter->sessionId; |
| 6453 | pReq->rssiMonitorCbContext = hdd_ctx; |
| 6454 | control = nla_get_u32(tb[PARAM_CONTROL]); |
| 6455 | vos_mem_copy( &pReq->currentBssId, pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 6456 | |
| 6457 | hddLog(LOG1, FL("Request Id: %u Session_id: %d Control: %d"), |
| 6458 | pReq->requestId, pReq->sessionId, control); |
| 6459 | |
| 6460 | if (control == QCA_WLAN_RSSI_MONITORING_START) { |
| 6461 | if (!tb[PARAM_MIN_RSSI]) { |
| 6462 | hddLog(LOGE, FL("attr min rssi failed")); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6463 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6464 | } |
| 6465 | |
| 6466 | if (!tb[PARAM_MAX_RSSI]) { |
| 6467 | hddLog(LOGE, FL("attr max rssi failed")); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6468 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6469 | } |
| 6470 | |
| 6471 | pReq->minRssi = nla_get_s8(tb[PARAM_MIN_RSSI]); |
| 6472 | pReq->maxRssi = nla_get_s8(tb[PARAM_MAX_RSSI]); |
| 6473 | pReq->rssiMonitorCallback = hdd_rssi_monitor_start_done; |
| 6474 | |
| 6475 | if (!(pReq->minRssi < pReq->maxRssi)) { |
| 6476 | hddLog(LOGW, FL("min_rssi: %d must be less than max_rssi: %d"), |
| 6477 | pReq->minRssi, pReq->maxRssi); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6478 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6479 | } |
| 6480 | hddLog(LOG1, FL("Min_rssi: %d Max_rssi: %d"), |
| 6481 | pReq->minRssi, pReq->maxRssi); |
| 6482 | status = sme_StartRssiMonitoring(hdd_ctx->hHal, pReq); |
| 6483 | |
| 6484 | } |
| 6485 | else if (control == QCA_WLAN_RSSI_MONITORING_STOP) { |
| 6486 | pReq->rssiMonitorCallback = hdd_rssi_monitor_stop_done; |
| 6487 | status = sme_StopRssiMonitoring(hdd_ctx->hHal, pReq); |
| 6488 | } |
| 6489 | else { |
| 6490 | hddLog(LOGE, FL("Invalid control cmd: %d"), control); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6491 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6492 | } |
| 6493 | |
| 6494 | if (!HAL_STATUS_SUCCESS(status)) { |
| 6495 | hddLog(LOGE, |
| 6496 | FL("sme_set_rssi_monitoring failed(err=%d)"), status); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6497 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6498 | } |
| 6499 | |
| 6500 | return 0; |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6501 | fail: |
| 6502 | vos_mem_free(pReq); |
| 6503 | return -EINVAL; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6504 | } |
| 6505 | |
| 6506 | /* |
| 6507 | * done with short names for the global vendor params |
| 6508 | * used by __wlan_hdd_cfg80211_monitor_rssi() |
| 6509 | */ |
| 6510 | #undef PARAM_MAX |
| 6511 | #undef PARAM_CONTROL |
| 6512 | #undef PARAM_REQUEST_ID |
| 6513 | #undef PARAM_MAX_RSSI |
| 6514 | #undef PARAM_MIN_RSSI |
| 6515 | |
| 6516 | /** |
| 6517 | * wlan_hdd_cfg80211_monitor_rssi() - SSR wrapper to rssi monitoring |
| 6518 | * @wiphy: wiphy structure pointer |
| 6519 | * @wdev: Wireless device structure pointer |
| 6520 | * @data: Pointer to the data received |
| 6521 | * @data_len: Length of @data |
| 6522 | * |
| 6523 | * Return: 0 on success; errno on failure |
| 6524 | */ |
| 6525 | static int |
| 6526 | wlan_hdd_cfg80211_monitor_rssi(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 6527 | const void *data, int data_len) |
| 6528 | { |
| 6529 | int ret; |
| 6530 | |
| 6531 | vos_ssr_protect(__func__); |
| 6532 | ret = __wlan_hdd_cfg80211_monitor_rssi(wiphy, wdev, data, data_len); |
| 6533 | vos_ssr_unprotect(__func__); |
| 6534 | |
| 6535 | return ret; |
| 6536 | } |
| 6537 | |
| 6538 | /** |
| 6539 | * hdd_rssi_threshold_breached_cb() - rssi breached NL event |
| 6540 | * @hddctx: HDD context |
| 6541 | * @data: rssi breached event data |
| 6542 | * |
| 6543 | * This function reads the rssi breached event %data and fill in the skb with |
| 6544 | * NL attributes and send up the NL event. |
| 6545 | * This callback execute in atomic context and must not invoke any |
| 6546 | * blocking calls. |
| 6547 | * |
| 6548 | * Return: none |
| 6549 | */ |
| 6550 | void hdd_rssi_threshold_breached_cb(void *hddctx, |
| 6551 | struct rssi_breach_event *data) |
| 6552 | { |
| 6553 | hdd_context_t *pHddCtx = (hdd_context_t *)hddctx; |
| 6554 | int status; |
| 6555 | struct sk_buff *skb; |
| 6556 | |
| 6557 | ENTER(); |
| 6558 | status = wlan_hdd_validate_context(pHddCtx); |
| 6559 | |
| 6560 | if (0 != status) { |
| 6561 | return; |
| 6562 | } |
| 6563 | |
| 6564 | if (!data) { |
| 6565 | hddLog(LOGE, FL("data is null")); |
| 6566 | return; |
| 6567 | } |
| 6568 | |
| 6569 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 6570 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 6571 | NULL, |
| 6572 | #endif |
| 6573 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 6574 | QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI_INDEX, |
| 6575 | GFP_KERNEL); |
| 6576 | |
| 6577 | if (!skb) { |
| 6578 | hddLog(LOGE, FL("cfg80211_vendor_event_alloc failed")); |
| 6579 | return; |
| 6580 | } |
| 6581 | |
| 6582 | hddLog(LOG1, "Req Id: %u Current rssi: %d", |
| 6583 | data->request_id, data->curr_rssi); |
| 6584 | hddLog(LOG1, "Current BSSID: "MAC_ADDRESS_STR, |
| 6585 | MAC_ADDR_ARRAY(data->curr_bssid.bytes)); |
| 6586 | |
| 6587 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID, |
| 6588 | data->request_id) || |
| 6589 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CUR_BSSID, |
| 6590 | sizeof(data->curr_bssid), data->curr_bssid.bytes) || |
| 6591 | nla_put_s8(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CUR_RSSI, |
| 6592 | data->curr_rssi)) { |
| 6593 | hddLog(LOGE, FL("nla put fail")); |
| 6594 | goto fail; |
| 6595 | } |
| 6596 | |
| 6597 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 6598 | return; |
| 6599 | |
| 6600 | fail: |
| 6601 | kfree_skb(skb); |
| 6602 | return; |
| 6603 | } |
| 6604 | |
| 6605 | |
| 6606 | |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 6607 | /** |
| 6608 | * __wlan_hdd_cfg80211_setband() - set band |
| 6609 | * @wiphy: Pointer to wireless phy |
| 6610 | * @wdev: Pointer to wireless device |
| 6611 | * @data: Pointer to data |
| 6612 | * @data_len: Data length |
| 6613 | * |
| 6614 | * Return: 0 on success, negative errno on failure |
| 6615 | */ |
| 6616 | static int |
| 6617 | __wlan_hdd_cfg80211_setband(struct wiphy *wiphy, |
| 6618 | struct wireless_dev *wdev, |
| 6619 | const void *data, |
| 6620 | int data_len) |
| 6621 | { |
| 6622 | struct net_device *dev = wdev->netdev; |
| 6623 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6624 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 6625 | int ret; |
| 6626 | static const struct nla_policy policy[QCA_WLAN_VENDOR_ATTR_MAX + 1] |
| 6627 | = {[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE] = { .type = NLA_U32 }}; |
| 6628 | |
| 6629 | ENTER(); |
| 6630 | |
| 6631 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6632 | if (0 != ret) { |
| 6633 | hddLog(LOGE, FL("HDD context is not valid")); |
| 6634 | return ret; |
| 6635 | } |
| 6636 | |
| 6637 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len, |
| 6638 | policy)) { |
| 6639 | hddLog(LOGE, FL("Invalid ATTR")); |
| 6640 | return -EINVAL; |
| 6641 | } |
| 6642 | |
| 6643 | if (!tb[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE]) { |
| 6644 | hddLog(LOGE, FL("attr QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE failed")); |
| 6645 | return -EINVAL; |
| 6646 | } |
| 6647 | |
Hanumantha Reddy Pothula | 1347e43 | 2015-08-05 09:53:44 +0530 | [diff] [blame] | 6648 | hdd_ctx->isSetBandByNL = TRUE; |
| 6649 | ret = hdd_setBand(dev, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 6650 | nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE])); |
Hanumantha Reddy Pothula | 1347e43 | 2015-08-05 09:53:44 +0530 | [diff] [blame] | 6651 | hdd_ctx->isSetBandByNL = FALSE; |
| 6652 | |
| 6653 | EXIT(); |
| 6654 | return ret; |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 6655 | } |
| 6656 | |
| 6657 | /** |
| 6658 | * wlan_hdd_cfg80211_setband() - Wrapper to offload packets |
| 6659 | * @wiphy: wiphy structure pointer |
| 6660 | * @wdev: Wireless device structure pointer |
| 6661 | * @data: Pointer to the data received |
| 6662 | * @data_len: Length of @data |
| 6663 | * |
| 6664 | * Return: 0 on success; errno on failure |
| 6665 | */ |
| 6666 | static int wlan_hdd_cfg80211_setband(struct wiphy *wiphy, |
| 6667 | struct wireless_dev *wdev, |
| 6668 | const void *data, |
| 6669 | int data_len) |
| 6670 | { |
| 6671 | int ret = 0; |
| 6672 | |
| 6673 | vos_ssr_protect(__func__); |
| 6674 | ret = __wlan_hdd_cfg80211_setband(wiphy, |
| 6675 | wdev, data, data_len); |
| 6676 | vos_ssr_unprotect(__func__); |
| 6677 | |
| 6678 | return ret; |
| 6679 | } |
| 6680 | |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 6681 | #ifdef WLAN_FEATURE_OFFLOAD_PACKETS |
| 6682 | /** |
| 6683 | * hdd_map_req_id_to_pattern_id() - map request id to pattern id |
| 6684 | * @hdd_ctx: HDD context |
| 6685 | * @request_id: [input] request id |
| 6686 | * @pattern_id: [output] pattern id |
| 6687 | * |
| 6688 | * This function loops through request id to pattern id array |
| 6689 | * if the slot is available, store the request id and return pattern id |
| 6690 | * if entry exists, return the pattern id |
| 6691 | * |
| 6692 | * Return: 0 on success and errno on failure |
| 6693 | */ |
| 6694 | static int hdd_map_req_id_to_pattern_id(hdd_context_t *hdd_ctx, |
| 6695 | uint32_t request_id, |
| 6696 | uint8_t *pattern_id) |
| 6697 | { |
| 6698 | uint32_t i; |
| 6699 | |
| 6700 | mutex_lock(&hdd_ctx->op_ctx.op_lock); |
| 6701 | for (i = 0; i < MAXNUM_PERIODIC_TX_PTRNS; i++) |
| 6702 | { |
| 6703 | if (hdd_ctx->op_ctx.op_table[i].request_id == 0) |
| 6704 | { |
| 6705 | hdd_ctx->op_ctx.op_table[i].request_id = request_id; |
| 6706 | *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id; |
| 6707 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6708 | return 0; |
| 6709 | } else if (hdd_ctx->op_ctx.op_table[i].request_id == |
| 6710 | request_id) { |
| 6711 | *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id; |
| 6712 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6713 | return 0; |
| 6714 | } |
| 6715 | } |
| 6716 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6717 | return -EINVAL; |
| 6718 | } |
| 6719 | |
| 6720 | /** |
| 6721 | * hdd_unmap_req_id_to_pattern_id() - unmap request id to pattern id |
| 6722 | * @hdd_ctx: HDD context |
| 6723 | * @request_id: [input] request id |
| 6724 | * @pattern_id: [output] pattern id |
| 6725 | * |
| 6726 | * This function loops through request id to pattern id array |
| 6727 | * reset request id to 0 (slot available again) and |
| 6728 | * return pattern id |
| 6729 | * |
| 6730 | * Return: 0 on success and errno on failure |
| 6731 | */ |
| 6732 | static int hdd_unmap_req_id_to_pattern_id(hdd_context_t *hdd_ctx, |
| 6733 | uint32_t request_id, |
| 6734 | uint8_t *pattern_id) |
| 6735 | { |
| 6736 | uint32_t i; |
| 6737 | |
| 6738 | mutex_lock(&hdd_ctx->op_ctx.op_lock); |
| 6739 | for (i = 0; i < MAXNUM_PERIODIC_TX_PTRNS; i++) |
| 6740 | { |
| 6741 | if (hdd_ctx->op_ctx.op_table[i].request_id == request_id) |
| 6742 | { |
| 6743 | hdd_ctx->op_ctx.op_table[i].request_id = 0; |
| 6744 | *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id; |
| 6745 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6746 | return 0; |
| 6747 | } |
| 6748 | } |
| 6749 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6750 | return -EINVAL; |
| 6751 | } |
| 6752 | |
| 6753 | |
| 6754 | /* |
| 6755 | * define short names for the global vendor params |
| 6756 | * used by __wlan_hdd_cfg80211_offloaded_packets() |
| 6757 | */ |
| 6758 | #define PARAM_MAX QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_MAX |
| 6759 | #define PARAM_REQUEST_ID \ |
| 6760 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_REQUEST_ID |
| 6761 | #define PARAM_CONTROL \ |
| 6762 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SENDING_CONTROL |
| 6763 | #define PARAM_IP_PACKET \ |
| 6764 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_IP_PACKET_DATA |
| 6765 | #define PARAM_SRC_MAC_ADDR \ |
| 6766 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SRC_MAC_ADDR |
| 6767 | #define PARAM_DST_MAC_ADDR \ |
| 6768 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_DST_MAC_ADDR |
| 6769 | #define PARAM_PERIOD QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_PERIOD |
| 6770 | |
| 6771 | /** |
| 6772 | * wlan_hdd_add_tx_ptrn() - add tx pattern |
| 6773 | * @adapter: adapter pointer |
| 6774 | * @hdd_ctx: hdd context |
| 6775 | * @tb: nl attributes |
| 6776 | * |
| 6777 | * This function reads the NL attributes and forms a AddTxPtrn message |
| 6778 | * posts it to SME. |
| 6779 | * |
| 6780 | */ |
| 6781 | static int |
| 6782 | wlan_hdd_add_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx, |
| 6783 | struct nlattr **tb) |
| 6784 | { |
| 6785 | struct sSirAddPeriodicTxPtrn *add_req; |
| 6786 | eHalStatus status; |
| 6787 | uint32_t request_id, ret, len; |
| 6788 | uint8_t pattern_id = 0; |
| 6789 | v_MACADDR_t dst_addr; |
| 6790 | uint16_t eth_type = htons(ETH_P_IP); |
| 6791 | |
| 6792 | if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) |
| 6793 | { |
| 6794 | hddLog(LOGE, FL("Not in Connected state!")); |
| 6795 | return -ENOTSUPP; |
| 6796 | } |
| 6797 | |
| 6798 | add_req = vos_mem_malloc(sizeof(*add_req)); |
| 6799 | if (!add_req) |
| 6800 | { |
| 6801 | hddLog(LOGE, FL("memory allocation failed")); |
| 6802 | return -ENOMEM; |
| 6803 | } |
| 6804 | |
| 6805 | /* Parse and fetch request Id */ |
| 6806 | if (!tb[PARAM_REQUEST_ID]) |
| 6807 | { |
| 6808 | hddLog(LOGE, FL("attr request id failed")); |
| 6809 | goto fail; |
| 6810 | } |
| 6811 | |
| 6812 | request_id = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 6813 | hddLog(LOG1, FL("Request Id: %u"), request_id); |
| 6814 | if (request_id == 0) |
| 6815 | { |
| 6816 | hddLog(LOGE, FL("request_id cannot be zero")); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6817 | goto fail; |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 6818 | } |
| 6819 | |
| 6820 | if (!tb[PARAM_PERIOD]) |
| 6821 | { |
| 6822 | hddLog(LOGE, FL("attr period failed")); |
| 6823 | goto fail; |
| 6824 | } |
| 6825 | add_req->usPtrnIntervalMs = nla_get_u32(tb[PARAM_PERIOD]); |
| 6826 | hddLog(LOG1, FL("Period: %u ms"), add_req->usPtrnIntervalMs); |
| 6827 | if (add_req->usPtrnIntervalMs == 0) |
| 6828 | { |
| 6829 | hddLog(LOGE, FL("Invalid interval zero, return failure")); |
| 6830 | goto fail; |
| 6831 | } |
| 6832 | |
| 6833 | if (!tb[PARAM_SRC_MAC_ADDR]) |
| 6834 | { |
| 6835 | hddLog(LOGE, FL("attr source mac address failed")); |
| 6836 | goto fail; |
| 6837 | } |
| 6838 | nla_memcpy(add_req->macAddress, tb[PARAM_SRC_MAC_ADDR], |
| 6839 | VOS_MAC_ADDR_SIZE); |
| 6840 | hddLog(LOG1, "input src mac address: "MAC_ADDRESS_STR, |
| 6841 | MAC_ADDR_ARRAY(add_req->macAddress)); |
| 6842 | |
| 6843 | if (memcmp(add_req->macAddress, adapter->macAddressCurrent.bytes, |
| 6844 | VOS_MAC_ADDR_SIZE)) |
| 6845 | { |
| 6846 | hddLog(LOGE, |
| 6847 | FL("input src mac address and connected ap bssid are different")); |
| 6848 | goto fail; |
| 6849 | } |
| 6850 | |
| 6851 | if (!tb[PARAM_DST_MAC_ADDR]) |
| 6852 | { |
| 6853 | hddLog(LOGE, FL("attr dst mac address failed")); |
| 6854 | goto fail; |
| 6855 | } |
| 6856 | nla_memcpy(dst_addr.bytes, tb[PARAM_DST_MAC_ADDR], VOS_MAC_ADDR_SIZE); |
| 6857 | hddLog(LOG1, "input dst mac address: "MAC_ADDRESS_STR, |
| 6858 | MAC_ADDR_ARRAY(dst_addr.bytes)); |
| 6859 | |
| 6860 | if (!tb[PARAM_IP_PACKET]) |
| 6861 | { |
| 6862 | hddLog(LOGE, FL("attr ip packet failed")); |
| 6863 | goto fail; |
| 6864 | } |
| 6865 | add_req->ucPtrnSize = nla_len(tb[PARAM_IP_PACKET]); |
| 6866 | hddLog(LOG1, FL("IP packet len: %u"), add_req->ucPtrnSize); |
| 6867 | |
| 6868 | if (add_req->ucPtrnSize < 0 || |
| 6869 | add_req->ucPtrnSize > (PERIODIC_TX_PTRN_MAX_SIZE - |
| 6870 | HDD_ETH_HEADER_LEN)) |
| 6871 | { |
| 6872 | hddLog(LOGE, FL("Invalid IP packet len: %d"), |
| 6873 | add_req->ucPtrnSize); |
| 6874 | goto fail; |
| 6875 | } |
| 6876 | |
| 6877 | len = 0; |
| 6878 | vos_mem_copy(&add_req->ucPattern[0], dst_addr.bytes, VOS_MAC_ADDR_SIZE); |
| 6879 | len += VOS_MAC_ADDR_SIZE; |
| 6880 | vos_mem_copy(&add_req->ucPattern[len], add_req->macAddress, |
| 6881 | VOS_MAC_ADDR_SIZE); |
| 6882 | len += VOS_MAC_ADDR_SIZE; |
| 6883 | vos_mem_copy(&add_req->ucPattern[len], ð_type, 2); |
| 6884 | len += 2; |
| 6885 | |
| 6886 | /* |
| 6887 | * This is the IP packet, add 14 bytes Ethernet (802.3) header |
| 6888 | * ------------------------------------------------------------ |
| 6889 | * | 14 bytes Ethernet (802.3) header | IP header and payload | |
| 6890 | * ------------------------------------------------------------ |
| 6891 | */ |
| 6892 | vos_mem_copy(&add_req->ucPattern[len], |
| 6893 | nla_data(tb[PARAM_IP_PACKET]), |
| 6894 | add_req->ucPtrnSize); |
| 6895 | add_req->ucPtrnSize += len; |
| 6896 | |
| 6897 | VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6898 | add_req->ucPattern, add_req->ucPtrnSize); |
| 6899 | |
| 6900 | ret = hdd_map_req_id_to_pattern_id(hdd_ctx, request_id, &pattern_id); |
| 6901 | if (ret) |
| 6902 | { |
| 6903 | hddLog(LOGW, FL("req id to pattern id failed (ret=%d)"), ret); |
| 6904 | goto fail; |
| 6905 | } |
| 6906 | add_req->ucPtrnId = pattern_id; |
| 6907 | hddLog(LOG1, FL("pattern id: %d"), add_req->ucPtrnId); |
| 6908 | |
| 6909 | status = sme_AddPeriodicTxPtrn(hdd_ctx->hHal, add_req); |
| 6910 | if (!HAL_STATUS_SUCCESS(status)) |
| 6911 | { |
| 6912 | hddLog(LOGE, |
| 6913 | FL("sme_AddPeriodicTxPtrn failed (err=%d)"), status); |
| 6914 | goto fail; |
| 6915 | } |
| 6916 | |
| 6917 | EXIT(); |
| 6918 | vos_mem_free(add_req); |
| 6919 | return 0; |
| 6920 | |
| 6921 | fail: |
| 6922 | vos_mem_free(add_req); |
| 6923 | return -EINVAL; |
| 6924 | } |
| 6925 | |
| 6926 | /** |
| 6927 | * wlan_hdd_del_tx_ptrn() - delete tx pattern |
| 6928 | * @adapter: adapter pointer |
| 6929 | * @hdd_ctx: hdd context |
| 6930 | * @tb: nl attributes |
| 6931 | * |
| 6932 | * This function reads the NL attributes and forms a DelTxPtrn message |
| 6933 | * posts it to SME. |
| 6934 | * |
| 6935 | */ |
| 6936 | static int |
| 6937 | wlan_hdd_del_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx, |
| 6938 | struct nlattr **tb) |
| 6939 | { |
| 6940 | struct sSirDelPeriodicTxPtrn *del_req; |
| 6941 | eHalStatus status; |
| 6942 | uint32_t request_id, ret; |
| 6943 | uint8_t pattern_id = 0; |
| 6944 | |
| 6945 | /* Parse and fetch request Id */ |
| 6946 | if (!tb[PARAM_REQUEST_ID]) |
| 6947 | { |
| 6948 | hddLog(LOGE, FL("attr request id failed")); |
| 6949 | return -EINVAL; |
| 6950 | } |
| 6951 | request_id = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 6952 | if (request_id == 0) |
| 6953 | { |
| 6954 | hddLog(LOGE, FL("request_id cannot be zero")); |
| 6955 | return -EINVAL; |
| 6956 | } |
| 6957 | |
| 6958 | ret = hdd_unmap_req_id_to_pattern_id(hdd_ctx, request_id, &pattern_id); |
| 6959 | if (ret) |
| 6960 | { |
| 6961 | hddLog(LOGW, FL("req id to pattern id failed (ret=%d)"), ret); |
| 6962 | return -EINVAL; |
| 6963 | } |
| 6964 | |
| 6965 | del_req = vos_mem_malloc(sizeof(*del_req)); |
| 6966 | if (!del_req) |
| 6967 | { |
| 6968 | hddLog(LOGE, FL("memory allocation failed")); |
| 6969 | return -ENOMEM; |
| 6970 | } |
| 6971 | |
| 6972 | vos_mem_set(del_req, sizeof(*del_req), 0); |
| 6973 | vos_mem_copy(del_req->macAddress, adapter->macAddressCurrent.bytes, |
| 6974 | VOS_MAC_ADDR_SIZE); |
| 6975 | hddLog(LOG1, MAC_ADDRESS_STR, MAC_ADDR_ARRAY(del_req->macAddress)); |
| 6976 | del_req->ucPatternIdBitmap |= (0x1 << pattern_id); |
| 6977 | hddLog(LOG1, FL("Request Id: %u Pattern id: %d, bitmap %04x"), |
| 6978 | request_id, pattern_id, del_req->ucPatternIdBitmap); |
| 6979 | |
| 6980 | status = sme_DelPeriodicTxPtrn(hdd_ctx->hHal, del_req); |
| 6981 | if (!HAL_STATUS_SUCCESS(status)) |
| 6982 | { |
| 6983 | hddLog(LOGE, |
| 6984 | FL("sme_DelPeriodicTxPtrn failed (err=%d)"), status); |
| 6985 | goto fail; |
| 6986 | } |
| 6987 | |
| 6988 | EXIT(); |
| 6989 | vos_mem_free(del_req); |
| 6990 | return 0; |
| 6991 | |
| 6992 | fail: |
| 6993 | vos_mem_free(del_req); |
| 6994 | return -EINVAL; |
| 6995 | } |
| 6996 | |
| 6997 | |
| 6998 | /** |
| 6999 | * __wlan_hdd_cfg80211_offloaded_packets() - send offloaded packets |
| 7000 | * @wiphy: Pointer to wireless phy |
| 7001 | * @wdev: Pointer to wireless device |
| 7002 | * @data: Pointer to data |
| 7003 | * @data_len: Data length |
| 7004 | * |
| 7005 | * Return: 0 on success, negative errno on failure |
| 7006 | */ |
| 7007 | static int |
| 7008 | __wlan_hdd_cfg80211_offloaded_packets(struct wiphy *wiphy, |
| 7009 | struct wireless_dev *wdev, |
| 7010 | const void *data, |
| 7011 | int data_len) |
| 7012 | { |
| 7013 | struct net_device *dev = wdev->netdev; |
| 7014 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7015 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 7016 | struct nlattr *tb[PARAM_MAX + 1]; |
| 7017 | uint8_t control; |
| 7018 | int ret; |
| 7019 | static const struct nla_policy policy[PARAM_MAX + 1] = |
| 7020 | { |
| 7021 | [PARAM_REQUEST_ID] = { .type = NLA_U32 }, |
| 7022 | [PARAM_CONTROL] = { .type = NLA_U32 }, |
| 7023 | [PARAM_SRC_MAC_ADDR] = { .type = NLA_BINARY, |
| 7024 | .len = VOS_MAC_ADDR_SIZE }, |
| 7025 | [PARAM_DST_MAC_ADDR] = { .type = NLA_BINARY, |
| 7026 | .len = VOS_MAC_ADDR_SIZE }, |
| 7027 | [PARAM_PERIOD] = { .type = NLA_U32 }, |
| 7028 | }; |
| 7029 | |
| 7030 | ENTER(); |
| 7031 | |
| 7032 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7033 | if (0 != ret) |
| 7034 | { |
| 7035 | hddLog(LOGE, FL("HDD context is not valid")); |
| 7036 | return ret; |
| 7037 | } |
| 7038 | |
| 7039 | if (!sme_IsFeatureSupportedByFW(WLAN_PERIODIC_TX_PTRN)) |
| 7040 | { |
| 7041 | hddLog(LOGE, |
| 7042 | FL("Periodic Tx Pattern Offload feature is not supported in FW!")); |
| 7043 | return -ENOTSUPP; |
| 7044 | } |
| 7045 | |
| 7046 | if (nla_parse(tb, PARAM_MAX, data, data_len, policy)) |
| 7047 | { |
| 7048 | hddLog(LOGE, FL("Invalid ATTR")); |
| 7049 | return -EINVAL; |
| 7050 | } |
| 7051 | |
| 7052 | if (!tb[PARAM_CONTROL]) |
| 7053 | { |
| 7054 | hddLog(LOGE, FL("attr control failed")); |
| 7055 | return -EINVAL; |
| 7056 | } |
| 7057 | control = nla_get_u32(tb[PARAM_CONTROL]); |
| 7058 | hddLog(LOG1, FL("Control: %d"), control); |
| 7059 | |
| 7060 | if (control == WLAN_START_OFFLOADED_PACKETS) |
| 7061 | return wlan_hdd_add_tx_ptrn(adapter, hdd_ctx, tb); |
| 7062 | else if (control == WLAN_STOP_OFFLOADED_PACKETS) |
| 7063 | return wlan_hdd_del_tx_ptrn(adapter, hdd_ctx, tb); |
| 7064 | else |
| 7065 | { |
| 7066 | hddLog(LOGE, FL("Invalid control: %d"), control); |
| 7067 | return -EINVAL; |
| 7068 | } |
| 7069 | } |
| 7070 | |
| 7071 | /* |
| 7072 | * done with short names for the global vendor params |
| 7073 | * used by __wlan_hdd_cfg80211_offloaded_packets() |
| 7074 | */ |
| 7075 | #undef PARAM_MAX |
| 7076 | #undef PARAM_REQUEST_ID |
| 7077 | #undef PARAM_CONTROL |
| 7078 | #undef PARAM_IP_PACKET |
| 7079 | #undef PARAM_SRC_MAC_ADDR |
| 7080 | #undef PARAM_DST_MAC_ADDR |
| 7081 | #undef PARAM_PERIOD |
| 7082 | |
| 7083 | /** |
| 7084 | * wlan_hdd_cfg80211_offloaded_packets() - Wrapper to offload packets |
| 7085 | * @wiphy: wiphy structure pointer |
| 7086 | * @wdev: Wireless device structure pointer |
| 7087 | * @data: Pointer to the data received |
| 7088 | * @data_len: Length of @data |
| 7089 | * |
| 7090 | * Return: 0 on success; errno on failure |
| 7091 | */ |
| 7092 | static int wlan_hdd_cfg80211_offloaded_packets(struct wiphy *wiphy, |
| 7093 | struct wireless_dev *wdev, |
| 7094 | const void *data, |
| 7095 | int data_len) |
| 7096 | { |
| 7097 | int ret = 0; |
| 7098 | |
| 7099 | vos_ssr_protect(__func__); |
| 7100 | ret = __wlan_hdd_cfg80211_offloaded_packets(wiphy, |
| 7101 | wdev, data, data_len); |
| 7102 | vos_ssr_unprotect(__func__); |
| 7103 | |
| 7104 | return ret; |
| 7105 | } |
| 7106 | #endif |
| 7107 | |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7108 | static const struct |
| 7109 | nla_policy |
| 7110 | qca_wlan_vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_MAX+1] = { |
| 7111 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { .type = NLA_UNSPEC }, |
| 7112 | }; |
| 7113 | |
| 7114 | /** |
| 7115 | * wlan_hdd_cfg80211_get_link_properties() - This function is used to |
| 7116 | * get link properties like nss, rate flags and operating frequency for |
| 7117 | * the connection with the given peer. |
| 7118 | * @wiphy: WIPHY structure pointer |
| 7119 | * @wdev: Wireless device structure pointer |
| 7120 | * @data: Pointer to the data received |
| 7121 | * @data_len: Length of the data received |
| 7122 | * |
| 7123 | * This function return the above link properties on success. |
| 7124 | * |
| 7125 | * Return: 0 on success and errno on failure |
| 7126 | */ |
| 7127 | static int wlan_hdd_cfg80211_get_link_properties(struct wiphy *wiphy, |
| 7128 | struct wireless_dev *wdev, |
| 7129 | const void *data, |
| 7130 | int data_len) |
| 7131 | { |
| 7132 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 7133 | struct net_device *dev = wdev->netdev; |
| 7134 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7135 | hdd_station_ctx_t *hdd_sta_ctx; |
| 7136 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX+1]; |
| 7137 | uint8_t peer_mac[VOS_MAC_ADDR_SIZE]; |
| 7138 | uint32_t sta_id; |
| 7139 | struct sk_buff *reply_skb; |
| 7140 | uint32_t rate_flags = 0; |
| 7141 | uint8_t nss; |
| 7142 | uint8_t final_rate_flags = 0; |
| 7143 | uint32_t freq; |
| 7144 | v_CONTEXT_t pVosContext = NULL; |
| 7145 | ptSapContext pSapCtx = NULL; |
| 7146 | |
| 7147 | if (0 != wlan_hdd_validate_context(hdd_ctx)) { |
| 7148 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid")); |
| 7149 | return -EINVAL; |
| 7150 | } |
| 7151 | |
| 7152 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len, |
| 7153 | qca_wlan_vendor_attr_policy)) { |
| 7154 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid attribute")); |
| 7155 | return -EINVAL; |
| 7156 | } |
| 7157 | |
| 7158 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 7159 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7160 | FL("Attribute peerMac not provided for mode=%d"), |
| 7161 | adapter->device_mode); |
| 7162 | return -EINVAL; |
| 7163 | } |
| 7164 | |
| 7165 | memcpy(peer_mac, nla_data(tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 7166 | sizeof(peer_mac)); |
| 7167 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7168 | FL("peerMac="MAC_ADDRESS_STR" for device_mode:%d"), |
| 7169 | MAC_ADDR_ARRAY(peer_mac), adapter->device_mode); |
| 7170 | |
| 7171 | if (adapter->device_mode == WLAN_HDD_INFRA_STATION || |
| 7172 | adapter->device_mode == WLAN_HDD_P2P_CLIENT) { |
| 7173 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 7174 | if ((hdd_sta_ctx->conn_info.connState != |
| 7175 | eConnectionState_Associated) || |
| 7176 | !vos_mem_compare(hdd_sta_ctx->conn_info.bssId, peer_mac, |
| 7177 | VOS_MAC_ADDRESS_LEN)) { |
| 7178 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7179 | FL("Not Associated to mac "MAC_ADDRESS_STR), |
| 7180 | MAC_ADDR_ARRAY(peer_mac)); |
| 7181 | return -EINVAL; |
| 7182 | } |
| 7183 | |
| 7184 | nss = 1; //pronto supports only one spatial stream |
| 7185 | freq = vos_chan_to_freq( |
| 7186 | hdd_sta_ctx->conn_info.operationChannel); |
| 7187 | rate_flags = hdd_sta_ctx->conn_info.rate_flags; |
| 7188 | |
| 7189 | } else if (adapter->device_mode == WLAN_HDD_P2P_GO || |
| 7190 | adapter->device_mode == WLAN_HDD_SOFTAP) { |
| 7191 | |
| 7192 | pVosContext = ( WLAN_HDD_GET_CTX(adapter))->pvosContext; |
| 7193 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 7194 | if(pSapCtx == NULL){ |
| 7195 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7196 | FL("psapCtx is NULL")); |
| 7197 | return -ENOENT; |
| 7198 | } |
| 7199 | |
| 7200 | |
| 7201 | for (sta_id = 0; sta_id < WLAN_MAX_STA_COUNT; sta_id++) { |
| 7202 | if (pSapCtx->aStaInfo[sta_id].isUsed && |
| 7203 | !vos_is_macaddr_broadcast( |
| 7204 | &pSapCtx->aStaInfo[sta_id].macAddrSTA) && |
| 7205 | vos_mem_compare( |
| 7206 | &pSapCtx->aStaInfo[sta_id].macAddrSTA, |
| 7207 | peer_mac, VOS_MAC_ADDRESS_LEN)) |
| 7208 | break; |
| 7209 | } |
| 7210 | |
| 7211 | if (WLAN_MAX_STA_COUNT == sta_id) { |
| 7212 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7213 | FL("No active peer with mac="MAC_ADDRESS_STR), |
| 7214 | MAC_ADDR_ARRAY(peer_mac)); |
| 7215 | return -EINVAL; |
| 7216 | } |
| 7217 | |
| 7218 | nss = 1; //pronto supports only one spatial stream |
| 7219 | freq = vos_chan_to_freq( |
| 7220 | (WLAN_HDD_GET_AP_CTX_PTR(adapter))->operatingChannel); |
| 7221 | rate_flags = pSapCtx->aStaInfo[sta_id].rate_flags; |
| 7222 | } else { |
| 7223 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7224 | FL("Not Associated! with mac"MAC_ADDRESS_STR), |
| 7225 | MAC_ADDR_ARRAY(peer_mac)); |
| 7226 | return -EINVAL; |
| 7227 | } |
| 7228 | |
| 7229 | if (!(rate_flags & eHAL_TX_RATE_LEGACY)) { |
| 7230 | if (rate_flags & eHAL_TX_RATE_VHT80) { |
| 7231 | final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7232 | final_rate_flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 7233 | } else if (rate_flags & eHAL_TX_RATE_VHT40) { |
| 7234 | final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7235 | final_rate_flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 7236 | } else if (rate_flags & eHAL_TX_RATE_VHT20) { |
| 7237 | final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7238 | } else if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) { |
| 7239 | final_rate_flags |= RATE_INFO_FLAGS_MCS; |
| 7240 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 7241 | final_rate_flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 7242 | } |
| 7243 | |
| 7244 | if (rate_flags & eHAL_TX_RATE_SGI) { |
| 7245 | if (!(final_rate_flags & RATE_INFO_FLAGS_VHT_MCS)) |
| 7246 | final_rate_flags |= RATE_INFO_FLAGS_MCS; |
| 7247 | final_rate_flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 7248 | } |
| 7249 | } |
| 7250 | |
| 7251 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 7252 | sizeof(u8) + sizeof(u8) + sizeof(u32) + NLMSG_HDRLEN); |
| 7253 | |
| 7254 | if (NULL == reply_skb) { |
| 7255 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7256 | FL("getLinkProperties: skb alloc failed")); |
| 7257 | return -EINVAL; |
| 7258 | } |
| 7259 | |
| 7260 | if (nla_put_u8(reply_skb, |
| 7261 | QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_NSS, |
| 7262 | nss) || |
| 7263 | nla_put_u8(reply_skb, |
| 7264 | QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_RATE_FLAGS, |
| 7265 | final_rate_flags) || |
| 7266 | nla_put_u32(reply_skb, |
| 7267 | QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_FREQ, |
| 7268 | freq)) { |
| 7269 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_put failed")); |
| 7270 | kfree_skb(reply_skb); |
| 7271 | return -EINVAL; |
| 7272 | } |
| 7273 | |
| 7274 | return cfg80211_vendor_cmd_reply(reply_skb); |
| 7275 | } |
| 7276 | |
Ravi Kumar bokka | 7d03276 | 2016-12-12 23:33:01 +0530 | [diff] [blame] | 7277 | #define BEACON_MISS_THRESH_2_4 \ |
| 7278 | QCA_WLAN_VENDOR_ATTR_CONFIG_BEACON_MISS_THRESHOLD_24 |
| 7279 | #define BEACON_MISS_THRESH_5_0 \ |
| 7280 | QCA_WLAN_VENDOR_ATTR_CONFIG_BEACON_MISS_THRESHOLD_5 |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7281 | #define PARAM_WIFICONFIG_MAX QCA_WLAN_VENDOR_ATTR_CONFIG_MAX |
| 7282 | #define PARAM_MODULATED_DTIM QCA_WLAN_VENDOR_ATTR_CONFIG_MODULATED_DTIM |
| 7283 | #define PARAM_STATS_AVG_FACTOR QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR |
| 7284 | #define PARAM_GUARD_TIME QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME |
Mahesh A Saptasagar | 41f9ddd | 2016-02-09 14:01:03 +0530 | [diff] [blame] | 7285 | #define PARAM_BCNMISS_PENALTY_PARAM_COUNT \ |
| 7286 | QCA_WLAN_VENDOR_ATTR_CONFIG_PENALIZE_AFTER_NCONS_BEACON_MISS |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7287 | |
| 7288 | /** |
| 7289 | * __wlan_hdd_cfg80211_wifi_configuration_set() - Wifi configuration |
| 7290 | * vendor command |
| 7291 | * |
| 7292 | * @wiphy: wiphy device pointer |
| 7293 | * @wdev: wireless device pointer |
| 7294 | * @data: Vendor command data buffer |
| 7295 | * @data_len: Buffer length |
| 7296 | * |
| 7297 | * Handles QCA_WLAN_VENDOR_ATTR_CONFIG_MAX. |
| 7298 | * |
| 7299 | * Return: EOK or other error codes. |
| 7300 | */ |
| 7301 | |
| 7302 | static int __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, |
| 7303 | struct wireless_dev *wdev, |
| 7304 | const void *data, |
| 7305 | int data_len) |
| 7306 | { |
| 7307 | struct net_device *dev = wdev->netdev; |
| 7308 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7309 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 7310 | hdd_station_ctx_t *pHddStaCtx; |
| 7311 | struct nlattr *tb[PARAM_WIFICONFIG_MAX + 1]; |
| 7312 | tpSetWifiConfigParams pReq; |
Mahesh A Saptasagar | 41f9ddd | 2016-02-09 14:01:03 +0530 | [diff] [blame] | 7313 | tModifyRoamParamsReqParams modifyRoamParamsReq; |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7314 | eHalStatus status; |
| 7315 | int ret_val; |
Ravi Kumar bokka | 7d03276 | 2016-12-12 23:33:01 +0530 | [diff] [blame] | 7316 | uint8_t hb_thresh_val; |
| 7317 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7318 | static const struct nla_policy policy[PARAM_WIFICONFIG_MAX + 1] = { |
| 7319 | [PARAM_STATS_AVG_FACTOR] = { .type = NLA_U16 }, |
| 7320 | [PARAM_MODULATED_DTIM] = { .type = NLA_U32 }, |
Mahesh A Saptasagar | 41f9ddd | 2016-02-09 14:01:03 +0530 | [diff] [blame] | 7321 | [PARAM_GUARD_TIME] = { .type = NLA_U32}, |
| 7322 | [PARAM_BCNMISS_PENALTY_PARAM_COUNT] = |
| 7323 | { .type = NLA_U32}, |
Ravi Kumar bokka | 7d03276 | 2016-12-12 23:33:01 +0530 | [diff] [blame] | 7324 | [BEACON_MISS_THRESH_2_4] = { .type = NLA_U8 }, |
| 7325 | [BEACON_MISS_THRESH_5_0] = { .type = NLA_U8 }, |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7326 | }; |
| 7327 | |
| 7328 | ENTER(); |
| 7329 | |
| 7330 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 7331 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 7332 | return -EINVAL; |
| 7333 | } |
| 7334 | |
| 7335 | ret_val = wlan_hdd_validate_context(pHddCtx); |
| 7336 | if (ret_val) { |
| 7337 | return ret_val; |
| 7338 | } |
| 7339 | |
| 7340 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7341 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7342 | if (nla_parse(tb, PARAM_WIFICONFIG_MAX, data, data_len, policy)) { |
| 7343 | hddLog(LOGE, FL("Invalid ATTR")); |
| 7344 | return -EINVAL; |
| 7345 | } |
| 7346 | |
| 7347 | /* check the Wifi Capability */ |
| 7348 | if ( (TRUE != pHddCtx->cfg_ini->fEnableWifiConfig) && |
| 7349 | (TRUE != sme_IsFeatureSupportedByFW(WIFI_CONFIG))) |
| 7350 | { |
| 7351 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7352 | FL("WIFICONFIG not supported by Firmware")); |
| 7353 | return -EINVAL; |
| 7354 | } |
| 7355 | |
Mahesh A Saptasagar | 41f9ddd | 2016-02-09 14:01:03 +0530 | [diff] [blame] | 7356 | if (tb[PARAM_BCNMISS_PENALTY_PARAM_COUNT]) { |
| 7357 | modifyRoamParamsReq.param = WIFI_CONFIG_SET_BCNMISS_PENALTY_COUNT; |
| 7358 | modifyRoamParamsReq.value = |
| 7359 | nla_get_u32(tb[PARAM_BCNMISS_PENALTY_PARAM_COUNT]); |
| 7360 | |
| 7361 | if (eHAL_STATUS_SUCCESS != |
| 7362 | sme_setBcnMissPenaltyCount(pHddCtx->hHal,&modifyRoamParamsReq)) |
| 7363 | { |
| 7364 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed", __func__); |
| 7365 | ret_val = -EINVAL; |
| 7366 | } |
| 7367 | return ret_val; |
| 7368 | } |
| 7369 | |
| 7370 | /* Moved this down in order to provide provision to set beacon |
| 7371 | * miss penalty count irrespective of connection state. |
| 7372 | */ |
| 7373 | if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) { |
| 7374 | hddLog(LOGE, FL("Not in Connected state!")); |
| 7375 | return -ENOTSUPP; |
| 7376 | } |
| 7377 | |
| 7378 | pReq = vos_mem_malloc(sizeof(tSetWifiConfigParams)); |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7379 | |
| 7380 | if (!pReq) { |
| 7381 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 7382 | "%s: Not able to allocate memory for tSetWifiConfigParams", |
| 7383 | __func__); |
| 7384 | return eHAL_STATUS_E_MALLOC_FAILED; |
| 7385 | } |
| 7386 | |
| 7387 | vos_mem_set(pReq, sizeof(tSetWifiConfigParams), 0); |
| 7388 | |
| 7389 | pReq->sessionId = pAdapter->sessionId; |
| 7390 | vos_mem_copy( &pReq->bssId, pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 7391 | |
| 7392 | if (tb[PARAM_MODULATED_DTIM]) { |
| 7393 | pReq->paramValue = nla_get_u32( |
| 7394 | tb[PARAM_MODULATED_DTIM]); |
| 7395 | hddLog(LOG1, FL("Modulated DTIM: pReq->paramValue:%d "), |
| 7396 | pReq->paramValue); |
Arun Khandavalli | 876886f | 2015-11-23 11:42:27 +0530 | [diff] [blame] | 7397 | pHddCtx->cfg_ini->enableDynamicDTIM = pReq->paramValue; |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7398 | hdd_set_pwrparams(pHddCtx); |
| 7399 | if (BMPS == pmcGetPmcState(pHddCtx->hHal)) { |
| 7400 | hddLog( LOG1, FL("WifiConfig: Requesting FullPower!")); |
| 7401 | |
| 7402 | sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7403 | iw_full_power_cbfn, pAdapter, |
| 7404 | eSME_FULL_PWR_NEEDED_BY_HDD); |
| 7405 | } |
| 7406 | else |
| 7407 | { |
| 7408 | hddLog( LOG1, FL("WifiConfig Not in BMPS state")); |
| 7409 | } |
| 7410 | } |
| 7411 | |
| 7412 | if (tb[PARAM_STATS_AVG_FACTOR]) { |
| 7413 | pReq->paramType = WIFI_CONFIG_SET_AVG_STATS_FACTOR; |
| 7414 | pReq->paramValue = nla_get_u16( |
| 7415 | tb[PARAM_STATS_AVG_FACTOR]); |
| 7416 | hddLog(LOG1, FL("AVG_STATS_FACTOR pReq->paramType:%d,pReq->paramValue:%d "), |
| 7417 | pReq->paramType, pReq->paramValue); |
| 7418 | status = sme_set_wificonfig_params(pHddCtx->hHal, pReq); |
| 7419 | |
| 7420 | if (eHAL_STATUS_SUCCESS != status) |
| 7421 | { |
| 7422 | vos_mem_free(pReq); |
| 7423 | pReq = NULL; |
| 7424 | ret_val = -EPERM; |
| 7425 | return ret_val; |
| 7426 | } |
| 7427 | } |
| 7428 | |
| 7429 | |
| 7430 | if (tb[PARAM_GUARD_TIME]) { |
| 7431 | pReq->paramType = WIFI_CONFIG_SET_GUARD_TIME; |
| 7432 | pReq->paramValue = nla_get_u32( |
| 7433 | tb[PARAM_GUARD_TIME]); |
| 7434 | hddLog(LOG1, FL("GUARD_TIME pReq->paramType:%d,pReq->paramValue:%d "), |
| 7435 | pReq->paramType, pReq->paramValue); |
| 7436 | status = sme_set_wificonfig_params(pHddCtx->hHal, pReq); |
| 7437 | |
| 7438 | if (eHAL_STATUS_SUCCESS != status) |
| 7439 | { |
| 7440 | vos_mem_free(pReq); |
| 7441 | pReq = NULL; |
| 7442 | ret_val = -EPERM; |
| 7443 | return ret_val; |
| 7444 | } |
| 7445 | |
| 7446 | } |
| 7447 | |
Ravi Kumar bokka | 7d03276 | 2016-12-12 23:33:01 +0530 | [diff] [blame] | 7448 | if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_BEACON_MISS_THRESHOLD_24]) { |
| 7449 | hb_thresh_val = nla_get_u8( |
| 7450 | tb[QCA_WLAN_VENDOR_ATTR_CONFIG_BEACON_MISS_THRESHOLD_24]); |
| 7451 | |
| 7452 | hddLog(LOG1, "WLAN set heartbeat threshold for 2.4Ghz %d", |
| 7453 | hb_thresh_val); |
| 7454 | ccmCfgSetInt((WLAN_HDD_GET_CTX(pAdapter))->hHal, |
| 7455 | WNI_CFG_HEART_BEAT_THRESHOLD, hb_thresh_val, |
| 7456 | NULL, eANI_BOOLEAN_FALSE); |
| 7457 | |
| 7458 | status = sme_update_hb_threshold( |
| 7459 | (WLAN_HDD_GET_CTX(pAdapter))->hHal, |
| 7460 | WNI_CFG_HEART_BEAT_THRESHOLD, |
| 7461 | hb_thresh_val, eCSR_BAND_24); |
| 7462 | if (eHAL_STATUS_SUCCESS != status) { |
| 7463 | hddLog(LOGE, "WLAN set heartbeat threshold FAILED %d", status); |
| 7464 | vos_mem_free(pReq); |
| 7465 | pReq = NULL; |
| 7466 | return -EPERM; |
| 7467 | } |
| 7468 | } |
| 7469 | |
| 7470 | if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_BEACON_MISS_THRESHOLD_5]) { |
| 7471 | hb_thresh_val = nla_get_u8( |
| 7472 | tb[QCA_WLAN_VENDOR_ATTR_CONFIG_BEACON_MISS_THRESHOLD_5]); |
| 7473 | |
| 7474 | hddLog(LOG1, "WLAN set heartbeat threshold for 5Ghz %d", |
| 7475 | hb_thresh_val); |
| 7476 | ccmCfgSetInt((WLAN_HDD_GET_CTX(pAdapter))->hHal, |
| 7477 | WNI_CFG_HEART_BEAT_THRESHOLD, hb_thresh_val, |
| 7478 | NULL, eANI_BOOLEAN_FALSE); |
| 7479 | |
| 7480 | status = sme_update_hb_threshold( |
| 7481 | (WLAN_HDD_GET_CTX(pAdapter))->hHal, |
| 7482 | WNI_CFG_HEART_BEAT_THRESHOLD, |
| 7483 | hb_thresh_val, eCSR_BAND_5G); |
| 7484 | if (eHAL_STATUS_SUCCESS != status) { |
| 7485 | hddLog(LOGE, "WLAN set heartbeat threshold FAILED %d", status); |
| 7486 | vos_mem_free(pReq); |
| 7487 | pReq = NULL; |
| 7488 | return -EPERM; |
| 7489 | } |
| 7490 | } |
| 7491 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7492 | EXIT(); |
| 7493 | return ret_val; |
| 7494 | } |
| 7495 | |
| 7496 | /** |
| 7497 | * wlan_hdd_cfg80211_wifi_configuration_set() - Wifi configuration |
| 7498 | * vendor command |
| 7499 | * |
| 7500 | * @wiphy: wiphy device pointer |
| 7501 | * @wdev: wireless device pointer |
| 7502 | * @data: Vendor command data buffer |
| 7503 | * @data_len: Buffer length |
| 7504 | * |
| 7505 | * Handles QCA_WLAN_VENDOR_ATTR_CONFIG_MAX. |
| 7506 | * |
| 7507 | * Return: EOK or other error codes. |
| 7508 | */ |
| 7509 | static int wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, |
| 7510 | struct wireless_dev *wdev, |
| 7511 | const void *data, |
| 7512 | int data_len) |
| 7513 | { |
| 7514 | int ret; |
| 7515 | |
| 7516 | vos_ssr_protect(__func__); |
| 7517 | ret = __wlan_hdd_cfg80211_wifi_configuration_set(wiphy, wdev, |
| 7518 | data, data_len); |
| 7519 | vos_ssr_unprotect(__func__); |
| 7520 | |
| 7521 | return ret; |
| 7522 | } |
Anurag Chouhan | 6ee8154 | 2017-02-09 18:09:27 +0530 | [diff] [blame] | 7523 | |
| 7524 | /* |
| 7525 | * define short names for the global vendor params |
| 7526 | * used by wlan_hdd_cfg80211_setarp_stats_cmd() |
| 7527 | */ |
| 7528 | #define STATS_SET_INVALID \ |
| 7529 | QCA_ATTR_NUD_STATS_SET_INVALID |
| 7530 | #define STATS_SET_START \ |
| 7531 | QCA_ATTR_NUD_STATS_SET_START |
| 7532 | #define STATS_GW_IPV4 \ |
| 7533 | QCA_ATTR_NUD_STATS_GW_IPV4 |
| 7534 | #define STATS_SET_MAX \ |
| 7535 | QCA_ATTR_NUD_STATS_SET_MAX |
| 7536 | |
| 7537 | const struct nla_policy |
| 7538 | qca_wlan_vendor_set_nud_stats[STATS_SET_MAX +1] = |
| 7539 | { |
| 7540 | [STATS_SET_START] = {.type = NLA_FLAG }, |
| 7541 | [STATS_GW_IPV4] = {.type = NLA_U32 }, |
| 7542 | }; |
| 7543 | |
| 7544 | /** |
| 7545 | * hdd_set_nud_stats_cb() - hdd callback api to get status |
| 7546 | * @data: pointer to adapter |
| 7547 | * @rsp: status |
| 7548 | * |
| 7549 | * Return: None |
| 7550 | */ |
| 7551 | static void hdd_set_nud_stats_cb(void *data, VOS_STATUS rsp) |
| 7552 | { |
| 7553 | |
| 7554 | hdd_adapter_t *adapter = (hdd_adapter_t *)data; |
| 7555 | |
| 7556 | if (NULL == adapter) |
| 7557 | return; |
| 7558 | |
| 7559 | if (VOS_STATUS_SUCCESS == rsp) { |
| 7560 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7561 | "%s success received STATS_SET_START", __func__); |
| 7562 | } else { |
| 7563 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7564 | "%s STATS_SET_START Failed!!", __func__); |
| 7565 | } |
| 7566 | return; |
| 7567 | } |
| 7568 | |
| 7569 | /** |
| 7570 | * __wlan_hdd_cfg80211_set_nud_stats() - set arp stats command to firmware |
| 7571 | * @wiphy: pointer to wireless wiphy structure. |
| 7572 | * @wdev: pointer to wireless_dev structure. |
| 7573 | * @data: pointer to apfind configuration data. |
| 7574 | * @data_len: the length in byte of apfind data. |
| 7575 | * |
| 7576 | * This is called when wlan driver needs to send arp stats to |
| 7577 | * firmware. |
| 7578 | * |
| 7579 | * Return: An error code or 0 on success. |
| 7580 | */ |
| 7581 | static int __wlan_hdd_cfg80211_set_nud_stats(struct wiphy *wiphy, |
| 7582 | struct wireless_dev *wdev, |
| 7583 | const void *data, int data_len) |
| 7584 | { |
| 7585 | struct nlattr *tb[STATS_SET_MAX + 1]; |
| 7586 | struct net_device *dev = wdev->netdev; |
| 7587 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7588 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 7589 | setArpStatsParams arp_stats_params; |
| 7590 | int err = 0; |
| 7591 | |
| 7592 | ENTER(); |
| 7593 | |
| 7594 | err = wlan_hdd_validate_context(hdd_ctx); |
| 7595 | if (0 != err) |
| 7596 | return err; |
| 7597 | |
| 7598 | if (!sme_IsFeatureSupportedByFW(NUD_DEBUG)) { |
| 7599 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7600 | "%s NUD_DEBUG feature not supported by firmware!!", __func__); |
| 7601 | return -EINVAL; |
| 7602 | } |
| 7603 | |
| 7604 | err = nla_parse(tb, STATS_SET_MAX, data, data_len, |
| 7605 | qca_wlan_vendor_set_nud_stats); |
| 7606 | if (err) |
| 7607 | { |
| 7608 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7609 | "%s STATS_SET_START ATTR", __func__); |
| 7610 | return err; |
| 7611 | } |
| 7612 | |
| 7613 | if (tb[STATS_SET_START]) |
| 7614 | { |
| 7615 | if (!tb[STATS_GW_IPV4]) { |
| 7616 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7617 | "%s STATS_SET_START CMD", __func__); |
| 7618 | return -EINVAL; |
| 7619 | } |
| 7620 | arp_stats_params.flag = true; |
| 7621 | arp_stats_params.ip_addr = nla_get_u32(tb[STATS_GW_IPV4]); |
| 7622 | } else { |
| 7623 | arp_stats_params.flag = false; |
| 7624 | } |
| 7625 | if (arp_stats_params.flag) { |
| 7626 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7627 | "%s STATS_SET_START Cleared!!", __func__); |
| 7628 | vos_mem_zero(&adapter->hdd_stats.hddArpStats, sizeof(adapter->hdd_stats.hddArpStats)); |
| 7629 | } |
| 7630 | |
| 7631 | arp_stats_params.pkt_type = 1; // ARP packet type |
| 7632 | |
| 7633 | arp_stats_params.rsp_cb_fn = hdd_set_nud_stats_cb; |
| 7634 | arp_stats_params.data_ctx = adapter; |
| 7635 | |
| 7636 | if (eHAL_STATUS_SUCCESS != |
| 7637 | sme_set_nud_debug_stats(hdd_ctx->hHal, &arp_stats_params)) { |
| 7638 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7639 | "%s STATS_SET_START CMD Failed!!", __func__); |
| 7640 | return -EINVAL; |
| 7641 | } |
| 7642 | |
| 7643 | EXIT(); |
| 7644 | |
| 7645 | return err; |
| 7646 | } |
| 7647 | |
| 7648 | /** |
| 7649 | * wlan_hdd_cfg80211_set_nud_stats() - set arp stats command to firmware |
| 7650 | * @wiphy: pointer to wireless wiphy structure. |
| 7651 | * @wdev: pointer to wireless_dev structure. |
| 7652 | * @data: pointer to apfind configuration data. |
| 7653 | * @data_len: the length in byte of apfind data. |
| 7654 | * |
| 7655 | * This is called when wlan driver needs to send arp stats to |
| 7656 | * firmware. |
| 7657 | * |
| 7658 | * Return: An error code or 0 on success. |
| 7659 | */ |
| 7660 | static int wlan_hdd_cfg80211_set_nud_stats(struct wiphy *wiphy, |
| 7661 | struct wireless_dev *wdev, |
| 7662 | const void *data, int data_len) |
| 7663 | { |
| 7664 | int ret; |
| 7665 | |
| 7666 | vos_ssr_protect(__func__); |
| 7667 | ret = __wlan_hdd_cfg80211_set_nud_stats(wiphy, wdev, data, data_len); |
| 7668 | vos_ssr_unprotect(__func__); |
| 7669 | |
| 7670 | return ret; |
| 7671 | } |
| 7672 | #undef STATS_SET_INVALID |
| 7673 | #undef STATS_SET_START |
| 7674 | #undef STATS_GW_IPV4 |
| 7675 | #undef STATS_SET_MAX |
| 7676 | |
| 7677 | /* |
| 7678 | * define short names for the global vendor params |
| 7679 | * used by wlan_hdd_cfg80211_setarp_stats_cmd() |
| 7680 | */ |
| 7681 | #define STATS_GET_INVALID \ |
| 7682 | QCA_ATTR_NUD_STATS_SET_INVALID |
| 7683 | #define COUNT_FROM_NETDEV \ |
| 7684 | QCA_ATTR_NUD_STATS_ARP_REQ_COUNT_FROM_NETDEV |
| 7685 | #define COUNT_TO_LOWER_MAC \ |
| 7686 | QCA_ATTR_NUD_STATS_ARP_REQ_COUNT_TO_LOWER_MAC |
| 7687 | #define RX_COUNT_BY_LOWER_MAC \ |
| 7688 | QCA_ATTR_NUD_STATS_ARP_REQ_RX_COUNT_BY_LOWER_MAC |
| 7689 | #define COUNT_TX_SUCCESS \ |
| 7690 | QCA_ATTR_NUD_STATS_ARP_REQ_COUNT_TX_SUCCESS |
| 7691 | #define RSP_RX_COUNT_BY_LOWER_MAC \ |
| 7692 | QCA_ATTR_NUD_STATS_ARP_RSP_RX_COUNT_BY_LOWER_MAC |
| 7693 | #define RSP_RX_COUNT_BY_UPPER_MAC \ |
| 7694 | QCA_ATTR_NUD_STATS_ARP_RSP_RX_COUNT_BY_UPPER_MAC |
| 7695 | #define RSP_COUNT_TO_NETDEV \ |
| 7696 | QCA_ATTR_NUD_STATS_ARP_RSP_COUNT_TO_NETDEV |
| 7697 | #define RSP_COUNT_OUT_OF_ORDER_DROP \ |
| 7698 | QCA_ATTR_NUD_STATS_ARP_RSP_COUNT_OUT_OF_ORDER_DROP |
| 7699 | #define AP_LINK_ACTIVE \ |
| 7700 | QCA_ATTR_NUD_STATS_AP_LINK_ACTIVE |
| 7701 | #define AP_LINK_DAD \ |
| 7702 | QCA_ATTR_NUD_STATS_AP_LINK_DAD |
| 7703 | #define STATS_GET_MAX \ |
| 7704 | QCA_ATTR_NUD_STATS_GET_MAX |
| 7705 | |
| 7706 | const struct nla_policy |
| 7707 | qca_wlan_vendor_get_nud_stats[STATS_GET_MAX +1] = |
| 7708 | { |
| 7709 | [COUNT_FROM_NETDEV] = {.type = NLA_U16 }, |
| 7710 | [COUNT_TO_LOWER_MAC] = {.type = NLA_U16 }, |
| 7711 | [RX_COUNT_BY_LOWER_MAC] = {.type = NLA_U16 }, |
| 7712 | [COUNT_TX_SUCCESS] = {.type = NLA_U16 }, |
| 7713 | [RSP_RX_COUNT_BY_LOWER_MAC] = {.type = NLA_U16 }, |
| 7714 | [RSP_RX_COUNT_BY_UPPER_MAC] = {.type = NLA_U16 }, |
| 7715 | [RSP_COUNT_TO_NETDEV] = {.type = NLA_U16 }, |
| 7716 | [RSP_COUNT_OUT_OF_ORDER_DROP] = {.type = NLA_U16 }, |
| 7717 | [AP_LINK_ACTIVE] = {.type = NLA_FLAG }, |
| 7718 | [AP_LINK_DAD] = {.type = NLA_FLAG }, |
| 7719 | }; |
| 7720 | |
| 7721 | static void hdd_get_nud_stats_cb(void *data, rsp_stats *rsp) |
| 7722 | { |
| 7723 | |
| 7724 | hdd_adapter_t *adapter = (hdd_adapter_t *)data; |
| 7725 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 7726 | struct hdd_nud_stats_context *context; |
| 7727 | int status; |
| 7728 | |
| 7729 | ENTER(); |
| 7730 | |
| 7731 | if (NULL == adapter) |
| 7732 | return; |
| 7733 | |
| 7734 | status = wlan_hdd_validate_context(hdd_ctx); |
| 7735 | if (0 != status) { |
| 7736 | return; |
| 7737 | } |
| 7738 | |
| 7739 | if (!rsp) { |
| 7740 | hddLog(LOGE, FL("data is null")); |
| 7741 | return; |
| 7742 | } |
| 7743 | |
| 7744 | adapter->hdd_stats.hddArpStats.tx_fw_cnt = rsp->tx_fw_cnt; |
| 7745 | adapter->hdd_stats.hddArpStats.rx_fw_cnt = rsp->rx_fw_cnt; |
| 7746 | adapter->hdd_stats.hddArpStats.tx_ack_cnt = rsp->tx_ack_cnt; |
| 7747 | adapter->dad |= rsp->dad; |
| 7748 | |
| 7749 | spin_lock(&hdd_context_lock); |
| 7750 | context = &hdd_ctx->nud_stats_context; |
| 7751 | complete(&context->response_event); |
| 7752 | spin_unlock(&hdd_context_lock); |
| 7753 | |
| 7754 | return; |
| 7755 | } |
| 7756 | static int __wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy, |
| 7757 | struct wireless_dev *wdev, |
| 7758 | const void *data, int data_len) |
| 7759 | { |
| 7760 | int err = 0; |
| 7761 | unsigned long rc; |
| 7762 | struct hdd_nud_stats_context *context; |
| 7763 | struct net_device *dev = wdev->netdev; |
| 7764 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7765 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 7766 | getArpStatsParams arp_stats_params; |
| 7767 | struct sk_buff *skb; |
| 7768 | |
| 7769 | ENTER(); |
| 7770 | |
| 7771 | err = wlan_hdd_validate_context(hdd_ctx); |
| 7772 | if (0 != err) |
| 7773 | return err; |
| 7774 | |
| 7775 | arp_stats_params.pkt_type = WLAN_NUD_STATS_ARP_PKT_TYPE; |
| 7776 | arp_stats_params.get_rsp_cb_fn = hdd_get_nud_stats_cb; |
| 7777 | arp_stats_params.data_ctx = adapter; |
| 7778 | |
| 7779 | spin_lock(&hdd_context_lock); |
| 7780 | context = &hdd_ctx->nud_stats_context; |
| 7781 | INIT_COMPLETION(context->response_event); |
| 7782 | spin_unlock(&hdd_context_lock); |
| 7783 | |
| 7784 | if (!sme_IsFeatureSupportedByFW(NUD_DEBUG)) { |
| 7785 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7786 | "%s NUD_DEBUG feature not supported by firmware!!", __func__); |
| 7787 | return -EINVAL; |
| 7788 | } |
| 7789 | |
| 7790 | if (eHAL_STATUS_SUCCESS != |
| 7791 | sme_get_nud_debug_stats(hdd_ctx->hHal, &arp_stats_params)) { |
| 7792 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7793 | "%s STATS_SET_START CMD Failed!!", __func__); |
| 7794 | return -EINVAL; |
| 7795 | } |
| 7796 | |
| 7797 | rc = wait_for_completion_timeout(&context->response_event, |
| 7798 | msecs_to_jiffies(WLAN_WAIT_TIME_NUD_STATS)); |
| 7799 | if (!rc) |
| 7800 | { |
| 7801 | hddLog(LOGE, |
| 7802 | FL("Target response timed out request ")); |
| 7803 | return -ETIMEDOUT; |
| 7804 | } |
| 7805 | |
| 7806 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 7807 | WLAN_NUD_STATS_LEN); |
| 7808 | if (!skb) |
| 7809 | { |
| 7810 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7811 | "%s: cfg80211_vendor_cmd_alloc_reply_skb failed", |
| 7812 | __func__); |
| 7813 | return -ENOMEM; |
| 7814 | } |
| 7815 | |
| 7816 | if (nla_put_u16(skb, COUNT_FROM_NETDEV, |
| 7817 | adapter->hdd_stats.hddArpStats.txCount) || |
| 7818 | nla_put_u16(skb, COUNT_TO_LOWER_MAC, |
| 7819 | adapter->hdd_stats.hddArpStats.tx_host_fw_sent) || |
| 7820 | nla_put_u16(skb, RX_COUNT_BY_LOWER_MAC, |
| 7821 | adapter->hdd_stats.hddArpStats.tx_fw_cnt) || |
| 7822 | nla_put_u16(skb, COUNT_TX_SUCCESS, |
| 7823 | adapter->hdd_stats.hddArpStats.tx_ack_cnt) || |
| 7824 | nla_put_u16(skb, RSP_RX_COUNT_BY_LOWER_MAC, |
| 7825 | adapter->hdd_stats.hddArpStats.rx_fw_cnt) || |
| 7826 | nla_put_u16(skb, RSP_RX_COUNT_BY_UPPER_MAC, |
| 7827 | adapter->hdd_stats.hddArpStats.rxCount) || |
| 7828 | nla_put_u16(skb, RSP_COUNT_TO_NETDEV, |
| 7829 | adapter->hdd_stats.hddArpStats.rxDelivered) || |
| 7830 | nla_put_u16(skb, RSP_COUNT_OUT_OF_ORDER_DROP, |
| 7831 | adapter->hdd_stats.hddArpStats.rx_host_drop_reorder)) { |
| 7832 | hddLog(LOGE, FL("nla put fail")); |
| 7833 | kfree_skb(skb); |
| 7834 | return -EINVAL; |
| 7835 | } |
| 7836 | if (adapter->con_status) |
| 7837 | nla_put_flag(skb, AP_LINK_ACTIVE); |
| 7838 | if (adapter->dad) |
| 7839 | nla_put_flag(skb, AP_LINK_DAD); |
| 7840 | |
| 7841 | cfg80211_vendor_cmd_reply(skb); |
| 7842 | return err; |
| 7843 | } |
| 7844 | |
| 7845 | static int wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy, |
| 7846 | struct wireless_dev *wdev, |
| 7847 | const void *data, int data_len) |
| 7848 | { |
| 7849 | int ret; |
| 7850 | |
| 7851 | vos_ssr_protect(__func__); |
| 7852 | ret = __wlan_hdd_cfg80211_get_nud_stats(wiphy, wdev, data, data_len); |
| 7853 | vos_ssr_unprotect(__func__); |
| 7854 | |
| 7855 | return ret; |
| 7856 | } |
| 7857 | |
| 7858 | #undef QCA_ATTR_NUD_STATS_SET_INVALID |
| 7859 | #undef QCA_ATTR_NUD_STATS_ARP_REQ_COUNT_FROM_NETDEV |
| 7860 | #undef QCA_ATTR_NUD_STATS_ARP_REQ_COUNT_TO_LOWER_MAC |
| 7861 | #undef QCA_ATTR_NUD_STATS_ARP_REQ_RX_COUNT_BY_LOWER_MAC |
| 7862 | #undef QCA_ATTR_NUD_STATS_ARP_REQ_COUNT_TX_SUCCESS |
| 7863 | #undef QCA_ATTR_NUD_STATS_ARP_RSP_RX_COUNT_BY_LOWER_MAC |
| 7864 | #undef QCA_ATTR_NUD_STATS_ARP_RSP_RX_COUNT_BY_UPPER_MAC |
| 7865 | #undef QCA_ATTR_NUD_STATS_ARP_RSP_COUNT_TO_NETDEV |
| 7866 | #undef QCA_ATTR_NUD_STATS_ARP_RSP_COUNT_OUT_OF_ORDER_DROP |
| 7867 | #undef QCA_ATTR_NUD_STATS_AP_LINK_ACTIVE |
| 7868 | #undef QCA_ATTR_NUD_STATS_GET_MAX |
| 7869 | |
| 7870 | |
| 7871 | |
Kapil Gupta | ee33bf1 | 2016-12-20 18:27:37 +0530 | [diff] [blame] | 7872 | #ifdef WLAN_FEATURE_APFIND |
| 7873 | /** |
| 7874 | * __wlan_hdd_cfg80211_apfind_cmd() - set configuration to firmware |
| 7875 | * @wiphy: pointer to wireless wiphy structure. |
| 7876 | * @wdev: pointer to wireless_dev structure. |
| 7877 | * @data: pointer to apfind configuration data. |
| 7878 | * @data_len: the length in byte of apfind data. |
| 7879 | * |
| 7880 | * This is called when wlan driver needs to send APFIND configurations to |
| 7881 | * firmware. |
| 7882 | * |
| 7883 | * Return: An error code or 0 on success. |
| 7884 | */ |
| 7885 | static int __wlan_hdd_cfg80211_apfind_cmd(struct wiphy *wiphy, |
| 7886 | struct wireless_dev *wdev, |
| 7887 | const void *data, int data_len) |
| 7888 | { |
| 7889 | struct sme_ap_find_request_req apfind_req; |
| 7890 | VOS_STATUS status; |
| 7891 | int ret_val; |
| 7892 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 7893 | |
| 7894 | ENTER(); |
| 7895 | |
| 7896 | ret_val = wlan_hdd_validate_context(hdd_ctx); |
| 7897 | if (ret_val) |
| 7898 | return ret_val; |
| 7899 | |
| 7900 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 7901 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 7902 | return -EPERM; |
| 7903 | } |
| 7904 | |
| 7905 | apfind_req.request_data_len = data_len; |
| 7906 | apfind_req.request_data = data; |
| 7907 | |
| 7908 | status = sme_apfind_set_cmd(&apfind_req); |
| 7909 | if (VOS_STATUS_SUCCESS != status) { |
| 7910 | ret_val = -EIO; |
| 7911 | } |
| 7912 | return ret_val; |
| 7913 | } |
| 7914 | |
| 7915 | /** |
| 7916 | * wlan_hdd_cfg80211_apfind_cmd() - set configuration to firmware |
| 7917 | * @wiphy: pointer to wireless wiphy structure. |
| 7918 | * @wdev: pointer to wireless_dev structure. |
| 7919 | * @data: pointer to apfind configuration data. |
| 7920 | * @data_len: the length in byte of apfind data. |
| 7921 | * |
| 7922 | * This is called when wlan driver needs to send APFIND configurations to |
| 7923 | * firmware. |
| 7924 | * |
| 7925 | * Return: An error code or 0 on success. |
| 7926 | */ |
| 7927 | static int wlan_hdd_cfg80211_apfind_cmd(struct wiphy *wiphy, |
| 7928 | struct wireless_dev *wdev, |
| 7929 | const void *data, int data_len) |
| 7930 | { |
| 7931 | int ret; |
| 7932 | |
| 7933 | vos_ssr_protect(__func__); |
| 7934 | ret = __wlan_hdd_cfg80211_apfind_cmd(wiphy, wdev, data, data_len); |
| 7935 | vos_ssr_unprotect(__func__); |
| 7936 | |
| 7937 | return ret; |
| 7938 | } |
| 7939 | #endif /* WLAN_FEATURE_APFIND */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7940 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 7941 | { |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 7942 | { |
| 7943 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7944 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAMING, |
| 7945 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7946 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7947 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7948 | .doit = wlan_hdd_cfg80211_firmware_roaming |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 7949 | }, |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 7950 | |
| 7951 | { |
| 7952 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7953 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN, |
| 7954 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7955 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7956 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7957 | .doit = wlan_hdd_cfg80211_nan_request |
| 7958 | }, |
| 7959 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7960 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 7961 | { |
| 7962 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7963 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 7964 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7965 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7966 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7967 | .doit = wlan_hdd_cfg80211_ll_stats_clear |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7968 | }, |
| 7969 | |
| 7970 | { |
| 7971 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7972 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 7973 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7974 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7975 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7976 | .doit = wlan_hdd_cfg80211_ll_stats_set |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7977 | }, |
| 7978 | |
| 7979 | { |
| 7980 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7981 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 7982 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7983 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7984 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7985 | .doit = wlan_hdd_cfg80211_ll_stats_get |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7986 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7987 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7988 | #ifdef WLAN_FEATURE_EXTSCAN |
| 7989 | { |
| 7990 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7991 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START, |
| 7992 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7993 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7994 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7995 | .doit = wlan_hdd_cfg80211_extscan_start |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7996 | }, |
| 7997 | { |
| 7998 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7999 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP, |
| 8000 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8001 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8002 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8003 | .doit = wlan_hdd_cfg80211_extscan_stop |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8004 | }, |
| 8005 | { |
| 8006 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8007 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS, |
| 8008 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8009 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8010 | .doit = wlan_hdd_cfg80211_extscan_get_valid_channels |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8011 | }, |
| 8012 | { |
| 8013 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8014 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES, |
| 8015 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8016 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8017 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8018 | .doit = wlan_hdd_cfg80211_extscan_get_capabilities |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8019 | }, |
| 8020 | { |
| 8021 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8022 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS, |
| 8023 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8024 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8025 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8026 | .doit = wlan_hdd_cfg80211_extscan_get_cached_results |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8027 | }, |
| 8028 | { |
| 8029 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8030 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST, |
| 8031 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8032 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8033 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8034 | .doit = wlan_hdd_cfg80211_extscan_set_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8035 | }, |
| 8036 | { |
| 8037 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8038 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST, |
| 8039 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8040 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8041 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8042 | .doit = wlan_hdd_cfg80211_extscan_reset_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8043 | }, |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 8044 | { |
| 8045 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8046 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SSID_HOTLIST, |
| 8047 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8048 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8049 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8050 | .doit = wlan_hdd_cfg80211_extscan_set_ssid_hotlist |
| 8051 | }, |
| 8052 | { |
| 8053 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8054 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SSID_HOTLIST, |
| 8055 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8056 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8057 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8058 | .doit = wlan_hdd_cfg80211_extscan_reset_ssid_hotlist |
| 8059 | }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8060 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8061 | /*EXT TDLS*/ |
| 8062 | { |
| 8063 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8064 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE, |
| 8065 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8066 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8067 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8068 | .doit = wlan_hdd_cfg80211_exttdls_enable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8069 | }, |
| 8070 | { |
| 8071 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8072 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE, |
| 8073 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8074 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8075 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8076 | .doit = wlan_hdd_cfg80211_exttdls_disable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8077 | }, |
| 8078 | { |
| 8079 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8080 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS, |
| 8081 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8082 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8083 | .doit = wlan_hdd_cfg80211_exttdls_get_status |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8084 | }, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 8085 | { |
| 8086 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8087 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES, |
| 8088 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8089 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8090 | .doit = wlan_hdd_cfg80211_get_supported_features |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 8091 | }, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 8092 | { |
| 8093 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8094 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG, |
| 8095 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8096 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8097 | .doit = wlan_hdd_cfg80211_disable_dfs_channels |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 8098 | }, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 8099 | { |
| 8100 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8101 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MAC_OUI, |
| 8102 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8103 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8104 | .doit = wlan_hdd_cfg80211_set_spoofed_mac_oui |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 8105 | }, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 8106 | { |
| 8107 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8108 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX, |
| 8109 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8110 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8111 | .doit = wlan_hdd_cfg80211_get_concurrency_matrix |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 8112 | }, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 8113 | { |
| 8114 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 8115 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP, |
| 8116 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8117 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8118 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8119 | .doit = wlan_hdd_cfg80211_get_fw_mem_dump |
| 8120 | }, |
| 8121 | { |
| 8122 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 8123 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SETBAND, |
| 8124 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8125 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8126 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8127 | .doit = wlan_hdd_cfg80211_setband |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 8128 | }, |
| 8129 | { |
| 8130 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8131 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_START, |
| 8132 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8133 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
| 8134 | .doit = wlan_hdd_cfg80211_wifi_logger_start |
| 8135 | }, |
Sushant Kaushik | 847890c | 2015-09-28 16:05:17 +0530 | [diff] [blame] | 8136 | { |
| 8137 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8138 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO, |
| 8139 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8140 | WIPHY_VENDOR_CMD_NEED_NETDEV| |
| 8141 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8142 | .doit = wlan_hdd_cfg80211_get_wifi_info |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 8143 | }, |
| 8144 | { |
| 8145 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8146 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_RING_DATA, |
| 8147 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8148 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8149 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8150 | .doit = wlan_hdd_cfg80211_wifi_logger_get_ring_data |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 8151 | }, |
| 8152 | { |
| 8153 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8154 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI, |
| 8155 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8156 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8157 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8158 | .doit = wlan_hdd_cfg80211_monitor_rssi |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 8159 | }, |
| 8160 | #ifdef WLAN_FEATURE_OFFLOAD_PACKETS |
| 8161 | { |
| 8162 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8163 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_OFFLOADED_PACKETS, |
| 8164 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8165 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8166 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8167 | .doit = wlan_hdd_cfg80211_offloaded_packets |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 8168 | }, |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 8169 | #endif |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 8170 | { |
| 8171 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8172 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES, |
| 8173 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8174 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8175 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8176 | .doit = wlan_hdd_cfg80211_get_link_properties |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 8177 | }, |
| 8178 | { |
| 8179 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8180 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION, |
| 8181 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8182 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8183 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8184 | .doit = wlan_hdd_cfg80211_wifi_configuration_set |
Kapil Gupta | ee33bf1 | 2016-12-20 18:27:37 +0530 | [diff] [blame] | 8185 | }, |
| 8186 | #ifdef WLAN_FEATURE_APFIND |
| 8187 | { |
| 8188 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8189 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_APFIND, |
| 8190 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8191 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
| 8192 | .doit = wlan_hdd_cfg80211_apfind_cmd |
| 8193 | }, |
| 8194 | #endif /* WLAN_FEATURE_APFIND */ |
Anurag Chouhan | 6ee8154 | 2017-02-09 18:09:27 +0530 | [diff] [blame] | 8195 | { |
| 8196 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8197 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NUD_STATS_SET, |
| 8198 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8199 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8200 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8201 | .doit = wlan_hdd_cfg80211_set_nud_stats |
| 8202 | }, |
| 8203 | { |
| 8204 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8205 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NUD_STATS_GET, |
| 8206 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8207 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8208 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8209 | .doit = wlan_hdd_cfg80211_get_nud_stats |
| 8210 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8211 | }; |
| 8212 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 8213 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8214 | static const |
| 8215 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 8216 | { |
| 8217 | #ifdef FEATURE_WLAN_CH_AVOID |
| 8218 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8219 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8220 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 8221 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8222 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 8223 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 8224 | { |
| 8225 | /* Index = 1*/ |
| 8226 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8227 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 8228 | }, |
| 8229 | { |
| 8230 | /* Index = 2*/ |
| 8231 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8232 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 8233 | }, |
| 8234 | { |
| 8235 | /* Index = 3*/ |
| 8236 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8237 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 8238 | }, |
| 8239 | { |
| 8240 | /* Index = 4*/ |
| 8241 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8242 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 8243 | }, |
| 8244 | { |
| 8245 | /* Index = 5*/ |
| 8246 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8247 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 8248 | }, |
| 8249 | { |
| 8250 | /* Index = 6*/ |
| 8251 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8252 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 8253 | }, |
| 8254 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8255 | #ifdef WLAN_FEATURE_EXTSCAN |
| 8256 | { |
| 8257 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8258 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START |
| 8259 | }, |
| 8260 | { |
| 8261 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8262 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP |
| 8263 | }, |
| 8264 | { |
| 8265 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8266 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES |
| 8267 | }, |
| 8268 | { |
| 8269 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8270 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS |
| 8271 | }, |
| 8272 | { |
| 8273 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8274 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE |
| 8275 | }, |
| 8276 | { |
| 8277 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8278 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT |
| 8279 | }, |
| 8280 | { |
| 8281 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8282 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT |
| 8283 | }, |
| 8284 | { |
| 8285 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8286 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND |
| 8287 | }, |
| 8288 | { |
| 8289 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8290 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST |
| 8291 | }, |
| 8292 | { |
| 8293 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8294 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST |
| 8295 | }, |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 8296 | { |
| 8297 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8298 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SSID_HOTLIST |
| 8299 | }, |
| 8300 | { |
| 8301 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8302 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SSID_HOTLIST |
| 8303 | }, |
| 8304 | [QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND_INDEX] = { |
| 8305 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8306 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND |
| 8307 | }, |
| 8308 | [QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST_INDEX] = { |
| 8309 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8310 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST |
| 8311 | }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8312 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8313 | /*EXT TDLS*/ |
| 8314 | { |
| 8315 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8316 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE |
| 8317 | }, |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 8318 | [QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP_INDEX] = { |
| 8319 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8320 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP |
| 8321 | }, |
| 8322 | |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 8323 | |
Srinivas Dasari | bd1cf64 | 2017-01-23 14:54:41 +0530 | [diff] [blame] | 8324 | [QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX] = { |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 8325 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8326 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN |
| 8327 | }, |
| 8328 | |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 8329 | { |
| 8330 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8331 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO, |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 8332 | }, |
| 8333 | [QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI_INDEX] = { |
| 8334 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8335 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI |
| 8336 | }, |
Padma, Santhosh Kumar | 7bbc7d9 | 2015-12-08 20:23:19 +0530 | [diff] [blame] | 8337 | [QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST_INDEX] = { |
| 8338 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8339 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST |
| 8340 | }, |
Anurag Chouhan | 6ee8154 | 2017-02-09 18:09:27 +0530 | [diff] [blame] | 8341 | [QCA_NL80211_VENDOR_SUBCMD_NUD_STATS_GET_INDEX] = { |
| 8342 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8343 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_NUD_STATS_GET, |
| 8344 | }, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 8345 | }; |
| 8346 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8347 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8348 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8349 | * This function is called by hdd_wlan_startup() |
| 8350 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8351 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8352 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8353 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8354 | { |
| 8355 | struct wiphy *wiphy; |
| 8356 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8357 | /* |
| 8358 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8359 | */ |
| 8360 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 8361 | |
| 8362 | if (!wiphy) |
| 8363 | { |
| 8364 | /* Print error and jump into err label and free the memory */ |
| 8365 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 8366 | return NULL; |
| 8367 | } |
| 8368 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8369 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8370 | return wiphy; |
| 8371 | } |
| 8372 | |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 8373 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(4,4,0)) || \ |
| 8374 | defined (CFG80211_MULTI_SCAN_PLAN_BACKPORT) |
| 8375 | /** |
| 8376 | * hdd_config_sched_scan_plans_to_wiphy() - configure sched scan plans to wiphy |
| 8377 | * @wiphy: pointer to wiphy |
| 8378 | * @config: pointer to config |
| 8379 | * |
| 8380 | * Return: None |
| 8381 | */ |
| 8382 | static void hdd_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy, |
| 8383 | hdd_config_t *config) |
| 8384 | { |
| 8385 | wiphy->max_sched_scan_plans = MAX_SCHED_SCAN_PLANS; |
| 8386 | if (config->max_sched_scan_plan_interval) |
| 8387 | wiphy->max_sched_scan_plan_interval = |
| 8388 | config->max_sched_scan_plan_interval; |
| 8389 | if (config->max_sched_scan_plan_iterations) |
| 8390 | wiphy->max_sched_scan_plan_iterations = |
| 8391 | config->max_sched_scan_plan_iterations; |
| 8392 | } |
| 8393 | #else |
| 8394 | static void hdd_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy, |
| 8395 | hdd_config_t *config) |
| 8396 | { |
| 8397 | } |
| 8398 | #endif |
| 8399 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8400 | /* |
| 8401 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8402 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8403 | * private ioctl to change the band value |
| 8404 | */ |
| 8405 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 8406 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 8407 | int i, j; |
| 8408 | eNVChannelEnabledType channelEnabledState; |
| 8409 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8410 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8411 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 8412 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8413 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 8414 | |
| 8415 | if (NULL == wiphy->bands[i]) |
| 8416 | { |
| 8417 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 8418 | __func__, i); |
| 8419 | continue; |
| 8420 | } |
| 8421 | |
| 8422 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 8423 | { |
| 8424 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 8425 | |
| 8426 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 8427 | band->channels[j].hw_value); |
| 8428 | |
| 8429 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 8430 | { |
Abhishek Singh | 678227a | 2014-11-04 10:52:38 +0530 | [diff] [blame] | 8431 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 8432 | continue; |
| 8433 | } |
| 8434 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 8435 | { |
| 8436 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 8437 | continue; |
| 8438 | } |
| 8439 | |
| 8440 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 8441 | NV_CHANNEL_INVALID == channelEnabledState) |
| 8442 | { |
| 8443 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 8444 | } |
| 8445 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 8446 | { |
| 8447 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 8448 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 8449 | } |
| 8450 | else |
| 8451 | { |
| 8452 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 8453 | |IEEE80211_CHAN_RADAR); |
| 8454 | } |
| 8455 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8456 | } |
| 8457 | return 0; |
| 8458 | } |
| 8459 | /* |
| 8460 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8461 | * This function is called by hdd_wlan_startup() |
| 8462 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8463 | * This function is used to initialize and register wiphy structure. |
| 8464 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8465 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8466 | struct wiphy *wiphy, |
| 8467 | hdd_config_t *pCfg |
| 8468 | ) |
| 8469 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 8470 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 8471 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 8472 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8473 | ENTER(); |
| 8474 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8475 | /* Now bind the underlying wlan device with wiphy */ |
| 8476 | set_wiphy_dev(wiphy, dev); |
| 8477 | |
| 8478 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 8479 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 8480 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 8481 | /* the flag for the other case would be initialzed in |
| 8482 | vos_init_wiphy_from_nv_bin */ |
Manjeet Singh | 9e19de6 | 2016-08-18 18:26:41 +0530 | [diff] [blame] | 8483 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 8484 | wiphy->regulatory_flags |= REGULATORY_STRICT_REG; |
| 8485 | #else |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 8486 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 8487 | #endif |
Manjeet Singh | 9e19de6 | 2016-08-18 18:26:41 +0530 | [diff] [blame] | 8488 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 8489 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 8490 | /* This will disable updating of NL channels from passive to |
| 8491 | * active if a beacon is received on passive channel. */ |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 8492 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 8493 | wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS; |
| 8494 | #else |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 8495 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 8496 | #endif |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 8497 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 8498 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8499 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 8500 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 8501 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 8502 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8503 | | WIPHY_FLAG_OFFCHAN_TX; |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 8504 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
Rajeev Kumar Sirasanagandla | 0d6dd75 | 2016-08-17 15:01:39 +0530 | [diff] [blame] | 8505 | wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE; |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 8506 | #else |
| 8507 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
| 8508 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8509 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 8510 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8511 | #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] | 8512 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 8513 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 8514 | || pCfg->isFastRoamIniFeatureEnabled |
| 8515 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8516 | #ifdef FEATURE_WLAN_ESE |
| 8517 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 8518 | #endif |
| 8519 | ) |
| 8520 | { |
| 8521 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 8522 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 8523 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8524 | #ifdef FEATURE_WLAN_TDLS |
| 8525 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 8526 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 8527 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8528 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 8529 | if (pCfg->configPNOScanSupport) |
| 8530 | { |
| 8531 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 8532 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 8533 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 8534 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 8535 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 8536 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 8537 | |
Abhishek Singh | 10d8597 | 2015-04-17 10:27:23 +0530 | [diff] [blame] | 8538 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 8539 | wiphy->features |= NL80211_FEATURE_HT_IBSS; |
| 8540 | #endif |
| 8541 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 8542 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 8543 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 8544 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 8545 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 8546 | driver need to determine what to do with both |
| 8547 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 8548 | |
| 8549 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 8550 | #else |
| 8551 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 8552 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8553 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8554 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 8555 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 8556 | wiphy->max_scan_ie_len = SIR_MAC_MAX_ADD_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8557 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 8558 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 8559 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8560 | /* Supports STATION & AD-HOC modes right now */ |
Bhargav Shah | 0d2e3e5 | 2015-07-24 16:51:01 +0530 | [diff] [blame] | 8561 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
| 8562 | | BIT(NL80211_IFTYPE_ADHOC) |
| 8563 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 8564 | | BIT(NL80211_IFTYPE_P2P_GO) |
| 8565 | | BIT(NL80211_IFTYPE_AP); |
| 8566 | |
| 8567 | if (VOS_MONITOR_MODE == hdd_get_conparam()) |
| 8568 | { |
| 8569 | wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); |
| 8570 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8571 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 8572 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 8573 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 8574 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 8575 | if( pCfg->enableMCC ) |
| 8576 | { |
| 8577 | /* Currently, supports up to two channels */ |
| 8578 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 8579 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 8580 | if( !pCfg->allowMCCGODiffBI ) |
| 8581 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 8582 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 8583 | } |
| 8584 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 8585 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 8586 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 8587 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 8588 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8589 | /* Before registering we need to update the ht capabilitied based |
| 8590 | * on ini values*/ |
| 8591 | if( !pCfg->ShortGI20MhzEnable ) |
| 8592 | { |
| 8593 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 8594 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8595 | } |
| 8596 | |
| 8597 | if( !pCfg->ShortGI40MhzEnable ) |
| 8598 | { |
| 8599 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 8600 | } |
| 8601 | |
| 8602 | if( !pCfg->nChannelBondingMode5GHz ) |
| 8603 | { |
| 8604 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 8605 | } |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 8606 | /* |
| 8607 | * In case of static linked driver at the time of driver unload, |
| 8608 | * module exit doesn't happens. Module cleanup helps in cleaning |
| 8609 | * of static memory. |
| 8610 | * If driver load happens statically, at the time of driver unload, |
| 8611 | * wiphy flags don't get reset because of static memory. |
| 8612 | * It's better not to store channel in static memory. |
| 8613 | */ |
| 8614 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
| 8615 | wiphy->bands[IEEE80211_BAND_2GHZ]->channels = |
| 8616 | (struct ieee80211_channel *)vos_mem_malloc(sizeof(hdd_channels_2_4_GHZ)); |
| 8617 | if (wiphy->bands[IEEE80211_BAND_2GHZ]->channels == NULL) |
| 8618 | { |
| 8619 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8620 | FL("Not enough memory to allocate channels")); |
| 8621 | return -ENOMEM; |
| 8622 | } |
| 8623 | vos_mem_copy(wiphy->bands[IEEE80211_BAND_2GHZ]->channels, |
| 8624 | &hdd_channels_2_4_GHZ[0], |
| 8625 | sizeof(hdd_channels_2_4_GHZ)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8626 | |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 8627 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 8628 | { |
| 8629 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 8630 | wiphy->bands[IEEE80211_BAND_5GHZ]->channels = |
| 8631 | (struct ieee80211_channel *)vos_mem_malloc(sizeof(hdd_channels_5_GHZ)); |
| 8632 | if (wiphy->bands[IEEE80211_BAND_5GHZ]->channels == NULL) |
| 8633 | { |
| 8634 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8635 | FL("Not enough memory to allocate channels")); |
| 8636 | vos_mem_free(wiphy->bands[IEEE80211_BAND_2GHZ]->channels); |
| 8637 | wiphy->bands[IEEE80211_BAND_2GHZ]->channels = NULL; |
| 8638 | return -ENOMEM; |
| 8639 | } |
| 8640 | vos_mem_copy(wiphy->bands[IEEE80211_BAND_5GHZ]->channels, |
| 8641 | &hdd_channels_5_GHZ[0], |
| 8642 | sizeof(hdd_channels_5_GHZ)); |
| 8643 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 8644 | |
| 8645 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 8646 | { |
| 8647 | |
| 8648 | if (NULL == wiphy->bands[i]) |
| 8649 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 8650 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: wiphy->bands[i] is NULL, i = %d", |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 8651 | __func__, i); |
| 8652 | continue; |
| 8653 | } |
| 8654 | |
| 8655 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 8656 | { |
| 8657 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 8658 | |
| 8659 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 8660 | { |
| 8661 | // Enable social channels for P2P |
| 8662 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 8663 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 8664 | else |
| 8665 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 8666 | continue; |
| 8667 | } |
| 8668 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 8669 | { |
| 8670 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 8671 | continue; |
| 8672 | } |
| 8673 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8674 | } |
| 8675 | /*Initialise the supported cipher suite details*/ |
| 8676 | wiphy->cipher_suites = hdd_cipher_suites; |
| 8677 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 8678 | |
| 8679 | /*signal strength in mBm (100*dBm) */ |
| 8680 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 8681 | |
| 8682 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 8683 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8684 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8685 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8686 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 8687 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 8688 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 8689 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 8690 | |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 8691 | hdd_config_sched_scan_plans_to_wiphy(wiphy, pCfg); |
| 8692 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8693 | EXIT(); |
| 8694 | return 0; |
| 8695 | } |
| 8696 | |
| 8697 | /* In this function we are registering wiphy. */ |
| 8698 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 8699 | { |
| 8700 | ENTER(); |
| 8701 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8702 | if (0 > wiphy_register(wiphy)) |
| 8703 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8704 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8705 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 8706 | return -EIO; |
| 8707 | } |
| 8708 | |
| 8709 | EXIT(); |
| 8710 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8711 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8712 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8713 | /* In this function we are updating channel list when, |
| 8714 | regulatory domain is FCC and country code is US. |
| 8715 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 8716 | As per FCC smart phone is not a indoor device. |
| 8717 | GO should not opeate on indoor channels */ |
| 8718 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 8719 | { |
| 8720 | int j; |
| 8721 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 8722 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 8723 | //Default counrtycode from NV at the time of wiphy initialization. |
| 8724 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 8725 | &defaultCountryCode[0])) |
| 8726 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8727 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8728 | } |
| 8729 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 8730 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8731 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 8732 | { |
| 8733 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 8734 | return; |
| 8735 | } |
| 8736 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 8737 | { |
| 8738 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 8739 | // Mark UNII -1 band channel as passive |
| 8740 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 8741 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 8742 | } |
| 8743 | } |
| 8744 | } |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 8745 | /* This function registers for all frame which supplicant is interested in */ |
| 8746 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8747 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8748 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8749 | /* Register for all P2P action, public action etc frames */ |
| 8750 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8751 | ENTER(); |
Abhishek Singh | 16e0576 | 2015-11-30 14:29:27 +0530 | [diff] [blame] | 8752 | /* Register frame indication call back */ |
| 8753 | sme_register_mgmt_frame_ind_callback(hHal, hdd_indicate_mgmt_frame); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8754 | /* Right now we are registering these frame when driver is getting |
| 8755 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 8756 | frame register ops, we will move this code as a part of that */ |
| 8757 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8758 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8759 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 8760 | |
| 8761 | /* GAS Initial Response */ |
| 8762 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8763 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8764 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8765 | /* GAS Comeback Request */ |
| 8766 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8767 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 8768 | |
| 8769 | /* GAS Comeback Response */ |
| 8770 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8771 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 8772 | |
| 8773 | /* P2P Public Action */ |
| 8774 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8775 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8776 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 8777 | |
| 8778 | /* P2P Action */ |
| 8779 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8780 | (v_U8_t*)P2P_ACTION_FRAME, |
| 8781 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8782 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 8783 | /* WNM BSS Transition Request frame */ |
| 8784 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8785 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 8786 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 8787 | |
| 8788 | /* WNM-Notification */ |
| 8789 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8790 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 8791 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8792 | } |
| 8793 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 8794 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8795 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8796 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8797 | /* Register for all P2P action, public action etc frames */ |
| 8798 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 8799 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8800 | ENTER(); |
| 8801 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8802 | /* Right now we are registering these frame when driver is getting |
| 8803 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 8804 | frame register ops, we will move this code as a part of that */ |
| 8805 | /* GAS Initial Request */ |
| 8806 | |
| 8807 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8808 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 8809 | |
| 8810 | /* GAS Initial Response */ |
| 8811 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8812 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8813 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8814 | /* GAS Comeback Request */ |
| 8815 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8816 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 8817 | |
| 8818 | /* GAS Comeback Response */ |
| 8819 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8820 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 8821 | |
| 8822 | /* P2P Public Action */ |
| 8823 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8824 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8825 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 8826 | |
| 8827 | /* P2P Action */ |
| 8828 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8829 | (v_U8_t*)P2P_ACTION_FRAME, |
| 8830 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 8831 | /* WNM-Notification */ |
| 8832 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8833 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 8834 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8835 | } |
| 8836 | |
| 8837 | #ifdef FEATURE_WLAN_WAPI |
| 8838 | void wlan_hdd_cfg80211_set_key_wapi(hdd_adapter_t* pAdapter, u8 key_index, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 8839 | const u8 *mac_addr, const u8 *key , int key_Len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8840 | { |
| 8841 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8842 | tCsrRoamSetKey setKey; |
| 8843 | v_BOOL_t isConnected = TRUE; |
| 8844 | int status = 0; |
| 8845 | v_U32_t roamId= 0xFF; |
| 8846 | tANI_U8 *pKeyPtr = NULL; |
| 8847 | int n = 0; |
| 8848 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8849 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 8850 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8851 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8852 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 8853 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8854 | setKey.keyId = key_index; // Store Key ID |
| 8855 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 8856 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 8857 | setKey.paeRole = 0 ; // the PAE role |
| 8858 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 8859 | { |
| 8860 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 8861 | } |
| 8862 | else |
| 8863 | { |
| 8864 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 8865 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 8866 | } |
| 8867 | setKey.keyLength = key_Len; |
| 8868 | pKeyPtr = setKey.Key; |
| 8869 | memcpy( pKeyPtr, key, key_Len); |
| 8870 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8871 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8872 | __func__, key_Len); |
| 8873 | for (n = 0 ; n < key_Len; n++) |
| 8874 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 8875 | __func__,n,setKey.Key[n]); |
| 8876 | |
| 8877 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 8878 | if ( isConnected ) |
| 8879 | { |
| 8880 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8881 | pAdapter->sessionId, &setKey, &roamId ); |
| 8882 | } |
| 8883 | if ( status != 0 ) |
| 8884 | { |
| 8885 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8886 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 8887 | __LINE__, status ); |
| 8888 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 8889 | } |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8890 | /* Need to clear any trace of key value in the memory. |
| 8891 | * Thus zero out the memory even though it is local |
| 8892 | * variable. |
| 8893 | */ |
| 8894 | vos_mem_zero(&setKey, sizeof(setKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8895 | } |
| 8896 | #endif /* FEATURE_WLAN_WAPI*/ |
| 8897 | |
| 8898 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8899 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8900 | beacon_data_t **ppBeacon, |
| 8901 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8902 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8903 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8904 | beacon_data_t **ppBeacon, |
| 8905 | struct cfg80211_beacon_data *params, |
| 8906 | int dtim_period) |
| 8907 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8908 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8909 | int size; |
| 8910 | beacon_data_t *beacon = NULL; |
| 8911 | beacon_data_t *old = NULL; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 8912 | int head_len, tail_len, proberesp_ies_len, assocresp_ies_len; |
| 8913 | const u8 *head, *tail, *proberesp_ies, *assocresp_ies; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8914 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8915 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8916 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8917 | { |
| 8918 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8919 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8920 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8921 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8922 | |
| 8923 | old = pAdapter->sessionCtx.ap.beacon; |
| 8924 | |
| 8925 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8926 | { |
| 8927 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8928 | FL("session(%d) old and new heads points to NULL"), |
| 8929 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8930 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8931 | } |
| 8932 | |
| 8933 | if (params->tail && !params->tail_len) |
| 8934 | { |
| 8935 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8936 | FL("tail_len is zero but tail is not NULL")); |
| 8937 | return -EINVAL; |
| 8938 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8939 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8940 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 8941 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 8942 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8943 | { |
| 8944 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8945 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8946 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8947 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8948 | #endif |
| 8949 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 8950 | if (params->head) |
| 8951 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8952 | head_len = params->head_len; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 8953 | head = params->head; |
| 8954 | } else |
| 8955 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8956 | head_len = old->head_len; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 8957 | head = old->head; |
| 8958 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8959 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 8960 | if (params->tail || !old) |
| 8961 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8962 | tail_len = params->tail_len; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 8963 | tail = params->tail; |
| 8964 | } else |
| 8965 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8966 | tail_len = old->tail_len; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 8967 | tail = old->tail; |
| 8968 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8969 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 8970 | if (params->proberesp_ies || !old) |
| 8971 | { |
| 8972 | proberesp_ies_len = params->proberesp_ies_len; |
| 8973 | proberesp_ies = params->proberesp_ies; |
| 8974 | } else |
| 8975 | { |
| 8976 | proberesp_ies_len = old->proberesp_ies_len; |
| 8977 | proberesp_ies = old->proberesp_ies; |
| 8978 | } |
| 8979 | |
| 8980 | if (params->assocresp_ies || !old) |
| 8981 | { |
| 8982 | assocresp_ies_len = params->assocresp_ies_len; |
| 8983 | assocresp_ies = params->assocresp_ies; |
| 8984 | } else |
| 8985 | { |
| 8986 | assocresp_ies_len = old->assocresp_ies_len; |
| 8987 | assocresp_ies = old->assocresp_ies; |
| 8988 | } |
| 8989 | |
| 8990 | size = sizeof(beacon_data_t) + head_len + tail_len + |
| 8991 | proberesp_ies_len + assocresp_ies_len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8992 | |
| 8993 | beacon = kzalloc(size, GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8994 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8995 | { |
| 8996 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8997 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8998 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8999 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9000 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9001 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9002 | if (params->dtim_period) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9003 | beacon->dtim_period = params->dtim_period; |
| 9004 | else |
| 9005 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9006 | #else |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9007 | if (dtim_period) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9008 | beacon->dtim_period = dtim_period; |
| 9009 | else |
| 9010 | beacon->dtim_period = old->dtim_period; |
| 9011 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9012 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9013 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 9014 | beacon->tail = beacon->head + head_len; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9015 | beacon->proberesp_ies = beacon->tail + tail_len; |
| 9016 | beacon->assocresp_ies = beacon->proberesp_ies + proberesp_ies_len; |
| 9017 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9018 | beacon->head_len = head_len; |
| 9019 | beacon->tail_len = tail_len; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9020 | beacon->proberesp_ies_len = proberesp_ies_len; |
| 9021 | beacon->assocresp_ies_len= assocresp_ies_len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9022 | |
c_manjee | 527ecac | 2017-01-25 12:25:27 +0530 | [diff] [blame] | 9023 | if (head && head_len) |
| 9024 | memcpy(beacon->head, head, head_len); |
| 9025 | if (tail && tail_len) |
| 9026 | memcpy(beacon->tail, tail, tail_len); |
| 9027 | if (proberesp_ies && proberesp_ies_len) |
| 9028 | memcpy(beacon->proberesp_ies, proberesp_ies, proberesp_ies_len); |
| 9029 | if (assocresp_ies && assocresp_ies_len) |
| 9030 | memcpy(beacon->assocresp_ies, assocresp_ies, assocresp_ies_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9031 | |
| 9032 | *ppBeacon = beacon; |
| 9033 | |
| 9034 | kfree(old); |
| 9035 | |
| 9036 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9037 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9038 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 9039 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr( |
| 9040 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 9041 | const v_U8_t *pIes, |
| 9042 | #else |
| 9043 | v_U8_t *pIes, |
| 9044 | #endif |
| 9045 | int length, v_U8_t eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9046 | { |
| 9047 | int left = length; |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 9048 | v_U8_t *ptr = (v_U8_t *)pIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9049 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9050 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9051 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9052 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9053 | elem_id = ptr[0]; |
| 9054 | elem_len = ptr[1]; |
| 9055 | left -= 2; |
| 9056 | if(elem_len > left) |
| 9057 | { |
| 9058 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 9059 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9060 | eid,elem_len,left); |
| 9061 | return NULL; |
| 9062 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9063 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9064 | { |
| 9065 | return ptr; |
| 9066 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9067 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9068 | left -= elem_len; |
| 9069 | ptr += (elem_len + 2); |
| 9070 | } |
| 9071 | return NULL; |
| 9072 | } |
| 9073 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9074 | /* Check if rate is 11g rate or not */ |
| 9075 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 9076 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 9077 | 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] | 9078 | u8 i; |
| 9079 | for (i = 0; i < 8; i++) |
| 9080 | { |
| 9081 | if(rate == gRateArray[i]) |
| 9082 | return TRUE; |
| 9083 | } |
| 9084 | return FALSE; |
| 9085 | } |
| 9086 | |
| 9087 | /* Check for 11g rate and set proper 11g only mode */ |
| 9088 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 9089 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 9090 | { |
| 9091 | u8 i, num_rates = pIe[0]; |
| 9092 | |
| 9093 | pIe += 1; |
| 9094 | for ( i = 0; i < num_rates; i++) |
| 9095 | { |
| 9096 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 9097 | { |
| 9098 | /* If rate set have 11g rate than change the mode to 11G */ |
| 9099 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 9100 | if (pIe[i] & BASIC_RATE_MASK) |
| 9101 | { |
| 9102 | /* If we have 11g rate as basic rate, it means mode |
| 9103 | is 11g only mode. |
| 9104 | */ |
| 9105 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 9106 | *pCheckRatesfor11g = FALSE; |
| 9107 | } |
| 9108 | } |
| 9109 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 9110 | { |
| 9111 | *require_ht = TRUE; |
| 9112 | } |
| 9113 | } |
| 9114 | return; |
| 9115 | } |
| 9116 | |
| 9117 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 9118 | { |
| 9119 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 9120 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 9121 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 9122 | u8 checkRatesfor11g = TRUE; |
| 9123 | u8 require_ht = FALSE; |
| 9124 | u8 *pIe=NULL; |
| 9125 | |
| 9126 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 9127 | |
| 9128 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 9129 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 9130 | if (pIe != NULL) |
| 9131 | { |
| 9132 | pIe += 1; |
| 9133 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 9134 | &pConfig->SapHw_mode); |
| 9135 | } |
| 9136 | |
| 9137 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 9138 | WLAN_EID_EXT_SUPP_RATES); |
| 9139 | if (pIe != NULL) |
| 9140 | { |
| 9141 | |
| 9142 | pIe += 1; |
| 9143 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 9144 | &pConfig->SapHw_mode); |
| 9145 | } |
| 9146 | |
| 9147 | if( pConfig->channel > 14 ) |
| 9148 | { |
| 9149 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 9150 | } |
| 9151 | |
| 9152 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 9153 | WLAN_EID_HT_CAPABILITY); |
| 9154 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9155 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9156 | { |
| 9157 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 9158 | if(require_ht) |
| 9159 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 9160 | } |
| 9161 | } |
| 9162 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9163 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 9164 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 9165 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 9166 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9167 | v_U8_t *pIe = NULL; |
| 9168 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 9169 | |
| 9170 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 9171 | pBeacon->tail, pBeacon->tail_len); |
| 9172 | |
| 9173 | if (pIe) |
| 9174 | { |
| 9175 | ielen = pIe[1] + 2; |
| 9176 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 9177 | { |
| 9178 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 9179 | } |
| 9180 | else |
| 9181 | { |
| 9182 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 9183 | return -EINVAL; |
| 9184 | } |
| 9185 | *total_ielen += ielen; |
| 9186 | } |
| 9187 | return 0; |
| 9188 | } |
| 9189 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 9190 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 9191 | v_U8_t *genie, v_U8_t *total_ielen) |
| 9192 | { |
| 9193 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 9194 | int left = pBeacon->tail_len; |
| 9195 | v_U8_t *ptr = pBeacon->tail; |
| 9196 | v_U8_t elem_id, elem_len; |
| 9197 | v_U16_t ielen = 0; |
| 9198 | |
| 9199 | if ( NULL == ptr || 0 == left ) |
| 9200 | return; |
| 9201 | |
| 9202 | while (left >= 2) |
| 9203 | { |
| 9204 | elem_id = ptr[0]; |
| 9205 | elem_len = ptr[1]; |
| 9206 | left -= 2; |
| 9207 | if (elem_len > left) |
| 9208 | { |
| 9209 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 9210 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 9211 | elem_id, elem_len, left); |
| 9212 | return; |
| 9213 | } |
| 9214 | if (IE_EID_VENDOR == elem_id) |
| 9215 | { |
| 9216 | /* skipping the VSIE's which we don't want to include or |
| 9217 | * it will be included by existing code |
| 9218 | */ |
| 9219 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 9220 | #ifdef WLAN_FEATURE_WFD |
| 9221 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 9222 | #endif |
| 9223 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 9224 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 9225 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 9226 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 9227 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 9228 | { |
| 9229 | ielen = ptr[1] + 2; |
| 9230 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 9231 | { |
| 9232 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 9233 | *total_ielen += ielen; |
| 9234 | } |
| 9235 | else |
| 9236 | { |
| 9237 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 9238 | "IE Length is too big " |
| 9239 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 9240 | elem_id, elem_len, *total_ielen); |
| 9241 | } |
| 9242 | } |
| 9243 | } |
| 9244 | |
| 9245 | left -= elem_len; |
| 9246 | ptr += (elem_len + 2); |
| 9247 | } |
| 9248 | return; |
| 9249 | } |
| 9250 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9251 | int wlan_hdd_cfg80211_update_apies(hdd_adapter_t *pHostapdAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9252 | { |
| 9253 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9254 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9255 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9256 | int ret = 0; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9257 | beacon_data_t *pBeacon = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9258 | |
| 9259 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 9260 | |
| 9261 | if(genie == NULL) { |
| 9262 | |
| 9263 | return -ENOMEM; |
| 9264 | } |
| 9265 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9266 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9267 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 9268 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9269 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9270 | hddLog(LOGE, |
| 9271 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9272 | ret = -EINVAL; |
| 9273 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9274 | } |
| 9275 | |
| 9276 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9277 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 9278 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 9279 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9280 | hddLog(LOGE, |
| 9281 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9282 | ret = -EINVAL; |
| 9283 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9284 | } |
| 9285 | #endif |
| 9286 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9287 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 9288 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9289 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9290 | hddLog(LOGE, |
| 9291 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9292 | ret = -EINVAL; |
| 9293 | goto done; |
| 9294 | } |
| 9295 | |
| 9296 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 9297 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 9298 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9299 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9300 | |
| 9301 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 9302 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 9303 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 9304 | { |
| 9305 | hddLog(LOGE, |
| 9306 | "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] | 9307 | ret = -EINVAL; |
| 9308 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9309 | } |
| 9310 | |
| 9311 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 9312 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 9313 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 9314 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 9315 | ==eHAL_STATUS_FAILURE) |
| 9316 | { |
| 9317 | hddLog(LOGE, |
| 9318 | "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] | 9319 | ret = -EINVAL; |
| 9320 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9321 | } |
| 9322 | |
| 9323 | // Added for ProResp IE |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9324 | if ((pBeacon->proberesp_ies != NULL) && (pBeacon->proberesp_ies_len != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9325 | { |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9326 | u16 rem_probe_resp_ie_len = pBeacon->proberesp_ies_len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9327 | u8 probe_rsp_ie_len[3] = {0}; |
| 9328 | u8 counter = 0; |
| 9329 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 9330 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 9331 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 9332 | Store More then 255 bytes into One Variable. |
| 9333 | */ |
| 9334 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 9335 | { |
| 9336 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 9337 | { |
| 9338 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 9339 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 9340 | } |
| 9341 | else |
| 9342 | { |
| 9343 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 9344 | rem_probe_resp_ie_len = 0; |
| 9345 | } |
| 9346 | } |
| 9347 | |
| 9348 | rem_probe_resp_ie_len = 0; |
| 9349 | |
| 9350 | if (probe_rsp_ie_len[0] > 0) |
| 9351 | { |
| 9352 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 9353 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9354 | (tANI_U8*)&pBeacon-> |
| 9355 | proberesp_ies[rem_probe_resp_ie_len], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9356 | probe_rsp_ie_len[0], NULL, |
| 9357 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 9358 | { |
| 9359 | hddLog(LOGE, |
| 9360 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9361 | ret = -EINVAL; |
| 9362 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9363 | } |
| 9364 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 9365 | } |
| 9366 | |
| 9367 | if (probe_rsp_ie_len[1] > 0) |
| 9368 | { |
| 9369 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 9370 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9371 | (tANI_U8*)&pBeacon-> |
| 9372 | proberesp_ies[rem_probe_resp_ie_len], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9373 | probe_rsp_ie_len[1], NULL, |
| 9374 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 9375 | { |
| 9376 | hddLog(LOGE, |
| 9377 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9378 | ret = -EINVAL; |
| 9379 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9380 | } |
| 9381 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 9382 | } |
| 9383 | |
| 9384 | if (probe_rsp_ie_len[2] > 0) |
| 9385 | { |
| 9386 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 9387 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9388 | (tANI_U8*)&pBeacon-> |
| 9389 | proberesp_ies[rem_probe_resp_ie_len], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9390 | probe_rsp_ie_len[2], NULL, |
| 9391 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 9392 | { |
| 9393 | hddLog(LOGE, |
| 9394 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9395 | ret = -EINVAL; |
| 9396 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9397 | } |
| 9398 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 9399 | } |
| 9400 | |
| 9401 | if (probe_rsp_ie_len[1] == 0 ) |
| 9402 | { |
| 9403 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 9404 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 9405 | eANI_BOOLEAN_FALSE) ) |
| 9406 | { |
| 9407 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9408 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9409 | } |
| 9410 | } |
| 9411 | |
| 9412 | if (probe_rsp_ie_len[2] == 0 ) |
| 9413 | { |
| 9414 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 9415 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 9416 | eANI_BOOLEAN_FALSE) ) |
| 9417 | { |
| 9418 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9419 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9420 | } |
| 9421 | } |
| 9422 | |
| 9423 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 9424 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 9425 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 9426 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 9427 | == eHAL_STATUS_FAILURE) |
| 9428 | { |
| 9429 | hddLog(LOGE, |
| 9430 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9431 | ret = -EINVAL; |
| 9432 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9433 | } |
| 9434 | } |
| 9435 | else |
| 9436 | { |
| 9437 | // Reset WNI_CFG_PROBE_RSP Flags |
| 9438 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 9439 | |
| 9440 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9441 | "%s: No Probe Response IE received in set beacon", |
| 9442 | __func__); |
| 9443 | } |
| 9444 | |
| 9445 | // Added for AssocResp IE |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9446 | if ((pBeacon->assocresp_ies != NULL) && (pBeacon->assocresp_ies_len != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9447 | { |
| 9448 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9449 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)pBeacon->assocresp_ies, |
| 9450 | pBeacon->assocresp_ies_len, NULL, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9451 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 9452 | { |
| 9453 | hddLog(LOGE, |
| 9454 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9455 | ret = -EINVAL; |
| 9456 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9457 | } |
| 9458 | |
| 9459 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 9460 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 9461 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 9462 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 9463 | == eHAL_STATUS_FAILURE) |
| 9464 | { |
| 9465 | hddLog(LOGE, |
| 9466 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9467 | ret = -EINVAL; |
| 9468 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9469 | } |
| 9470 | } |
| 9471 | else |
| 9472 | { |
| 9473 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9474 | "%s: No Assoc Response IE received in set beacon", |
| 9475 | __func__); |
| 9476 | |
| 9477 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 9478 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 9479 | eANI_BOOLEAN_FALSE) ) |
| 9480 | { |
| 9481 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9482 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9483 | } |
| 9484 | } |
| 9485 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9486 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9487 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9488 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9489 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9490 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9491 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9492 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 9493 | * called by wlan_hdd_cfg80211_start_bss() and |
| 9494 | * wlan_hdd_cfg80211_set_channel() |
| 9495 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9496 | * channel list. |
| 9497 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 9498 | 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] | 9499 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9500 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9501 | v_U32_t num_ch = 0; |
| 9502 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 9503 | u32 indx = 0; |
| 9504 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 9505 | v_U8_t fValidChannel = FALSE, count = 0; |
| 9506 | 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] | 9507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9508 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 9509 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 9510 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9511 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 9512 | /* Validate the channel */ |
| 9513 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9514 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 9515 | if ( channel == rfChannels[count].channelNum ) |
| 9516 | { |
| 9517 | fValidChannel = TRUE; |
| 9518 | break; |
| 9519 | } |
| 9520 | } |
| 9521 | if (fValidChannel != TRUE) |
| 9522 | { |
| 9523 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9524 | "%s: Invalid Channel [%d]", __func__, channel); |
| 9525 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9526 | } |
| 9527 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 9528 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9529 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 9530 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 9531 | valid_ch, &num_ch)) |
| 9532 | { |
| 9533 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9534 | "%s: failed to get valid channel list", __func__); |
| 9535 | return VOS_STATUS_E_FAILURE; |
| 9536 | } |
| 9537 | for (indx = 0; indx < num_ch; indx++) |
| 9538 | { |
| 9539 | if (channel == valid_ch[indx]) |
| 9540 | { |
| 9541 | break; |
| 9542 | } |
| 9543 | } |
| 9544 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 9545 | if (indx >= num_ch) |
| 9546 | { |
| 9547 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 9548 | { |
| 9549 | eCsrBand band; |
| 9550 | unsigned int freq; |
| 9551 | |
| 9552 | sme_GetFreqBand(hHal, &band); |
| 9553 | |
| 9554 | if (eCSR_BAND_5G == band) |
| 9555 | { |
| 9556 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 9557 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 9558 | { |
| 9559 | freq = ieee80211_channel_to_frequency(channel, |
| 9560 | IEEE80211_BAND_2GHZ); |
| 9561 | } |
| 9562 | else |
| 9563 | { |
| 9564 | freq = ieee80211_channel_to_frequency(channel, |
| 9565 | IEEE80211_BAND_5GHZ); |
| 9566 | } |
| 9567 | #else |
| 9568 | freq = ieee80211_channel_to_frequency(channel); |
| 9569 | #endif |
| 9570 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 9571 | return VOS_STATUS_SUCCESS; |
| 9572 | } |
| 9573 | } |
| 9574 | |
| 9575 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9576 | "%s: Invalid Channel [%d]", __func__, channel); |
| 9577 | return VOS_STATUS_E_FAILURE; |
| 9578 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9579 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 9580 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9581 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9582 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9583 | } |
| 9584 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9585 | /** |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9586 | * FUNCTION: __wlan_hdd_cfg80211_set_channel |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9587 | * This function is used to set the channel number |
| 9588 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9589 | 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] | 9590 | struct ieee80211_channel *chan, |
| 9591 | enum nl80211_channel_type channel_type |
| 9592 | ) |
| 9593 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9594 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9595 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 9596 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9597 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9598 | hdd_context_t *pHddCtx; |
| 9599 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9600 | |
| 9601 | ENTER(); |
| 9602 | |
| 9603 | if( NULL == dev ) |
| 9604 | { |
| 9605 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9606 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9607 | return -ENODEV; |
| 9608 | } |
| 9609 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9610 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9611 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9612 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 9613 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9614 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9615 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 9616 | hdd_device_modetoString(pAdapter->device_mode), |
| 9617 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9618 | |
| 9619 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9620 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9621 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9622 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9623 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9624 | } |
| 9625 | |
| 9626 | /* |
| 9627 | * Do freq to chan conversion |
| 9628 | * TODO: for 11a |
| 9629 | */ |
| 9630 | |
| 9631 | channel = ieee80211_frequency_to_channel(freq); |
| 9632 | |
| 9633 | /* Check freq range */ |
| 9634 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 9635 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 9636 | { |
| 9637 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9638 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9639 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 9640 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 9641 | return -EINVAL; |
| 9642 | } |
| 9643 | |
| 9644 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 9645 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 9646 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 9647 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9648 | { |
| 9649 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 9650 | { |
| 9651 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9652 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9653 | return -EINVAL; |
| 9654 | } |
| 9655 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 9656 | "%s: set channel to [%d] for device mode =%d", |
| 9657 | __func__, channel,pAdapter->device_mode); |
| 9658 | } |
| 9659 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9660 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9661 | ) |
| 9662 | { |
| 9663 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9664 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 9665 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9666 | |
| 9667 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 9668 | { |
| 9669 | /* Link is up then return cant set channel*/ |
| 9670 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9671 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9672 | return -EINVAL; |
| 9673 | } |
| 9674 | |
| 9675 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 9676 | pHddStaCtx->conn_info.operationChannel = channel; |
| 9677 | pRoamProfile->ChannelInfo.ChannelList = |
| 9678 | &pHddStaCtx->conn_info.operationChannel; |
| 9679 | } |
| 9680 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9681 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9682 | ) |
| 9683 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9684 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 9685 | { |
| 9686 | if(VOS_STATUS_SUCCESS != |
| 9687 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 9688 | { |
| 9689 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9690 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9691 | return -EINVAL; |
| 9692 | } |
| 9693 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 9694 | } |
| 9695 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9696 | { |
| 9697 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 9698 | |
| 9699 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 9700 | channel set by supplicant |
| 9701 | */ |
| 9702 | if ( cfg_param->apAutoChannelSelection ) |
| 9703 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9704 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 9705 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9706 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9707 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 9708 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9709 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9710 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9711 | else |
| 9712 | { |
| 9713 | if(VOS_STATUS_SUCCESS != |
| 9714 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 9715 | { |
| 9716 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9717 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9718 | return -EINVAL; |
| 9719 | } |
| 9720 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 9721 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9722 | } |
| 9723 | } |
| 9724 | else |
| 9725 | { |
| 9726 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 9727 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 9728 | return -EINVAL; |
| 9729 | } |
| 9730 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9731 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9732 | } |
| 9733 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9734 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, |
| 9735 | struct net_device *dev, |
| 9736 | struct ieee80211_channel *chan, |
| 9737 | enum nl80211_channel_type channel_type |
| 9738 | ) |
| 9739 | { |
| 9740 | int ret; |
| 9741 | |
| 9742 | vos_ssr_protect(__func__); |
| 9743 | ret = __wlan_hdd_cfg80211_set_channel(wiphy, dev, chan, channel_type); |
| 9744 | vos_ssr_unprotect(__func__); |
| 9745 | |
| 9746 | return ret; |
| 9747 | } |
| 9748 | |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 9749 | #ifdef DHCP_SERVER_OFFLOAD |
| 9750 | void hdd_dhcp_server_offload_done(void *fw_dhcp_srv_offload_cb_context, |
| 9751 | VOS_STATUS status) |
| 9752 | { |
| 9753 | hdd_adapter_t* adapter = (hdd_adapter_t*)fw_dhcp_srv_offload_cb_context; |
| 9754 | |
| 9755 | ENTER(); |
| 9756 | |
| 9757 | if (NULL == adapter) |
| 9758 | { |
| 9759 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9760 | "%s: adapter is NULL",__func__); |
| 9761 | return; |
| 9762 | } |
| 9763 | |
| 9764 | adapter->dhcp_status.dhcp_offload_status = status; |
| 9765 | vos_event_set(&adapter->dhcp_status.vos_event); |
| 9766 | return; |
| 9767 | } |
| 9768 | |
| 9769 | /** |
| 9770 | * wlan_hdd_set_dhcp_server_offload() - set dhcp server offload |
| 9771 | * @hostapd_adapter: pointer to hostapd adapter. |
Anurag Chouhan | 638f5e2 | 2017-03-06 12:28:43 +0530 | [diff] [blame] | 9772 | * @re_init: flag set if api called post ssr |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 9773 | * |
| 9774 | * Return: None |
| 9775 | */ |
Anurag Chouhan | 638f5e2 | 2017-03-06 12:28:43 +0530 | [diff] [blame] | 9776 | VOS_STATUS wlan_hdd_set_dhcp_server_offload(hdd_adapter_t *hostapd_adapter, |
| 9777 | bool re_init) |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 9778 | { |
| 9779 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(hostapd_adapter); |
| 9780 | sir_dhcp_srv_offload_info dhcp_srv_info; |
| 9781 | tANI_U8 num_entries = 0; |
| 9782 | tANI_U8 srv_ip[IPADDR_NUM_ENTRIES]; |
| 9783 | tANI_U8 num; |
| 9784 | tANI_U32 temp; |
| 9785 | VOS_STATUS ret; |
| 9786 | |
| 9787 | ENTER(); |
| 9788 | |
Anurag Chouhan | 638f5e2 | 2017-03-06 12:28:43 +0530 | [diff] [blame] | 9789 | if (!re_init) { |
| 9790 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 9791 | if (0 != ret) |
| 9792 | return VOS_STATUS_E_INVAL; |
| 9793 | } |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 9794 | |
| 9795 | /* Prepare the request to send to SME */ |
| 9796 | dhcp_srv_info = vos_mem_malloc(sizeof(*dhcp_srv_info)); |
| 9797 | if (NULL == dhcp_srv_info) { |
| 9798 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9799 | "%s: could not allocate tDhcpSrvOffloadInfo!", __func__); |
| 9800 | return VOS_STATUS_E_NOMEM; |
| 9801 | } |
| 9802 | |
| 9803 | vos_mem_zero(dhcp_srv_info, sizeof(*dhcp_srv_info)); |
| 9804 | |
| 9805 | dhcp_srv_info->bssidx = hostapd_adapter->sessionId; |
| 9806 | dhcp_srv_info->dhcp_srv_offload_enabled = TRUE; |
| 9807 | dhcp_srv_info->dhcp_client_num = hdd_ctx->cfg_ini->dhcp_max_num_clients; |
| 9808 | dhcp_srv_info->start_lsb = hdd_ctx->cfg_ini->dhcp_start_lsb; |
| 9809 | dhcp_srv_info->dhcp_offload_callback = hdd_dhcp_server_offload_done; |
| 9810 | dhcp_srv_info->dhcp_server_offload_cb_context = hostapd_adapter; |
| 9811 | |
| 9812 | hdd_string_to_u8_array(hdd_ctx->cfg_ini->dhcp_srv_ip, |
| 9813 | srv_ip, |
| 9814 | &num_entries, |
Anurag Chouhan | ac145c2 | 2016-11-22 16:51:47 +0530 | [diff] [blame] | 9815 | IPADDR_NUM_ENTRIES, "."); |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 9816 | if (num_entries != IPADDR_NUM_ENTRIES) { |
| 9817 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9818 | "%s: incorrect IP address (%s) assigned for DHCP server!", |
| 9819 | __func__, hdd_ctx->cfg_ini->dhcp_srv_ip); |
| 9820 | vos_mem_free(dhcp_srv_info); |
| 9821 | return VOS_STATUS_E_FAILURE; |
| 9822 | } |
| 9823 | |
| 9824 | if ((srv_ip[0] >= 224) && (srv_ip[0] <= 239)) { |
| 9825 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9826 | "%s: invalid IP address (%s)! It could NOT be multicast IP address!", |
| 9827 | __func__, hdd_ctx->cfg_ini->dhcp_srv_ip); |
| 9828 | vos_mem_free(dhcp_srv_info); |
| 9829 | return VOS_STATUS_E_FAILURE; |
| 9830 | } |
| 9831 | |
| 9832 | if (srv_ip[IPADDR_NUM_ENTRIES-1] >= DHCP_START_POOL_ADDRESS) { |
| 9833 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9834 | "%s: invalid IP address (%s)! The last field must be less than 100!", |
| 9835 | __func__, hdd_ctx->cfg_ini->dhcp_srv_ip); |
| 9836 | vos_mem_free(dhcp_srv_info); |
| 9837 | return VOS_STATUS_E_FAILURE; |
| 9838 | } |
| 9839 | |
| 9840 | for (num = 0; num < num_entries; num++) { |
| 9841 | temp = srv_ip[num]; |
| 9842 | dhcp_srv_info->dhcp_srv_ip |= (temp << (8 * num)); |
| 9843 | } |
| 9844 | |
| 9845 | if (eHAL_STATUS_SUCCESS != |
| 9846 | sme_set_dhcp_srv_offload(hdd_ctx->hHal, dhcp_srv_info)) { |
| 9847 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9848 | "%s: sme_set_dhcp_srv_offload fail!", __func__); |
| 9849 | vos_mem_free(dhcp_srv_info); |
| 9850 | return VOS_STATUS_E_FAILURE; |
| 9851 | } |
| 9852 | |
| 9853 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 9854 | "%s: enable DHCP Server offload successfully!", __func__); |
| 9855 | |
| 9856 | vos_mem_free(dhcp_srv_info); |
| 9857 | return 0; |
| 9858 | } |
| 9859 | #endif /* DHCP_SERVER_OFFLOAD */ |
| 9860 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9861 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 9862 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 9863 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9864 | #else |
| 9865 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 9866 | struct cfg80211_beacon_data *params, |
| 9867 | const u8 *ssid, size_t ssid_len, |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 9868 | enum nl80211_hidden_ssid hidden_ssid, |
| 9869 | v_U8_t auth_type) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9870 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9871 | { |
| 9872 | tsap_Config_t *pConfig; |
| 9873 | beacon_data_t *pBeacon = NULL; |
| 9874 | struct ieee80211_mgmt *pMgmt_frame; |
| 9875 | v_U8_t *pIe=NULL; |
| 9876 | v_U16_t capab_info; |
| 9877 | eCsrAuthType RSNAuthType; |
| 9878 | eCsrEncryptionType RSNEncryptType; |
| 9879 | eCsrEncryptionType mcRSNEncryptType; |
| 9880 | int status = VOS_STATUS_SUCCESS; |
| 9881 | tpWLAN_SAPEventCB pSapEventCallback; |
| 9882 | hdd_hostapd_state_t *pHostapdState; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9883 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 9884 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9885 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 9886 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9887 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 9888 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 9889 | tSmeConfigParams *psmeConfig; |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 9890 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 9891 | v_BOOL_t MFPRequired = VOS_FALSE; |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 9892 | v_BOOL_t sapEnable11AC = |
| 9893 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapEnable11AC; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9894 | u_int16_t prev_rsn_length = 0; |
| 9895 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9896 | ENTER(); |
| 9897 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 9898 | iniConfig = pHddCtx->cfg_ini; |
| 9899 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9900 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 9901 | |
| 9902 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 9903 | |
| 9904 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 9905 | |
| 9906 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 9907 | |
| 9908 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 9909 | |
| 9910 | //channel is already set in the set_channel Call back |
| 9911 | //pConfig->channel = pCommitConfig->channel; |
| 9912 | |
| 9913 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9914 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9915 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 9916 | |
| 9917 | pConfig->dtim_period = pBeacon->dtim_period; |
| 9918 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9919 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9920 | pConfig->dtim_period); |
| 9921 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 9922 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9923 | { |
| 9924 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9925 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 9926 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 9927 | { |
| 9928 | tANI_BOOLEAN restartNeeded; |
| 9929 | pConfig->ieee80211d = 1; |
| 9930 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 9931 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 9932 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 9933 | } |
| 9934 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9935 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9936 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9937 | pConfig->ieee80211d = 1; |
| 9938 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 9939 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 9940 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9941 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9942 | else |
| 9943 | { |
| 9944 | pConfig->ieee80211d = 0; |
| 9945 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 9946 | /* |
| 9947 | * If auto channel is configured i.e. channel is 0, |
| 9948 | * so skip channel validation. |
| 9949 | */ |
| 9950 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 9951 | { |
| 9952 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 9953 | { |
| 9954 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9955 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 9956 | return -EINVAL; |
| 9957 | } |
| 9958 | } |
| 9959 | else |
| 9960 | { |
| 9961 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 9962 | { |
| 9963 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 9964 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 9965 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 9966 | } |
| 9967 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 9968 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9969 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9970 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9971 | { |
| 9972 | pConfig->ieee80211d = 0; |
| 9973 | } |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 9974 | |
| 9975 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 9976 | if (params->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
| 9977 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 9978 | else if (params->auth_type == NL80211_AUTHTYPE_SHARED_KEY) |
| 9979 | pConfig->authType = eSAP_SHARED_KEY; |
| 9980 | else |
| 9981 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 9982 | #else |
| 9983 | if (auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
| 9984 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 9985 | else if (auth_type == NL80211_AUTHTYPE_SHARED_KEY) |
| 9986 | pConfig->authType = eSAP_SHARED_KEY; |
| 9987 | else |
| 9988 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 9989 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9990 | |
| 9991 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9992 | |
| 9993 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9994 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
Agrawal Ashish | a8e8a72 | 2016-10-18 19:07:45 +0530 | [diff] [blame] | 9995 | #ifdef SAP_AUTH_OFFLOAD |
| 9996 | /* In case of sap offload, hostapd.conf is configuted with open mode and |
| 9997 | * security is configured from ini file. Due to open mode in hostapd.conf |
| 9998 | * privacy bit is set to false which will result in not sending, |
| 9999 | * data packets as encrypted. |
| 10000 | * If enable_sap_auth_offload is enabled in ini and |
| 10001 | * sap_auth_offload_sec_type is type of WPA2-PSK, |
| 10002 | * driver will set privacy bit to 1. |
| 10003 | */ |
| 10004 | if (pHddCtx->cfg_ini->enable_sap_auth_offload && |
| 10005 | pHddCtx->cfg_ini->sap_auth_offload_sec_type) |
| 10006 | pConfig->privacy = VOS_TRUE; |
| 10007 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10008 | |
| 10009 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 10010 | |
| 10011 | /*Set wps station to configured*/ |
| 10012 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 10013 | |
| 10014 | if(pIe) |
| 10015 | { |
| 10016 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 10017 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10018 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10019 | return -EINVAL; |
| 10020 | } |
| 10021 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 10022 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 10023 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10024 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 10025 | * WPS state |
| 10026 | */ |
| 10027 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 10028 | { |
| 10029 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 10030 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 10031 | { |
| 10032 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 10033 | } |
| 10034 | } |
| 10035 | } |
| 10036 | else |
| 10037 | { |
| 10038 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 10039 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10040 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10041 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 10042 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 10043 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 10044 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 10045 | eCSR_ENCRYPT_TYPE_NONE; |
| 10046 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10047 | pConfig->RSNWPAReqIELength = 0; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10048 | memset(&pConfig->RSNWPAReqIE[0], 0, sizeof(pConfig->RSNWPAReqIE)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10049 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10050 | WLAN_EID_RSN); |
| 10051 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10052 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10053 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10054 | if (pConfig->RSNWPAReqIELength <= sizeof(pConfig->RSNWPAReqIE)) |
| 10055 | memcpy(&pConfig->RSNWPAReqIE[0], pIe, |
| 10056 | pConfig->RSNWPAReqIELength); |
| 10057 | else |
| 10058 | hddLog(LOGE, "RSNWPA IE MAX Length exceeded; length =%d", |
| 10059 | pConfig->RSNWPAReqIELength); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10060 | /* The actual processing may eventually be more extensive than |
| 10061 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10062 | * by the app. |
| 10063 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10064 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10065 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 10066 | &RSNEncryptType, |
| 10067 | &mcRSNEncryptType, |
| 10068 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 10069 | &MFPCapable, |
| 10070 | &MFPRequired, |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10071 | pConfig->RSNWPAReqIE[1]+2, |
| 10072 | pConfig->RSNWPAReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10073 | |
| 10074 | if( VOS_STATUS_SUCCESS == status ) |
| 10075 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10076 | /* Now copy over all the security attributes you have |
| 10077 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10078 | * */ |
| 10079 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 10080 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 10081 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 10082 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 10083 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10084 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10085 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 10086 | } |
| 10087 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10088 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10089 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 10090 | pBeacon->tail, pBeacon->tail_len); |
| 10091 | |
| 10092 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 10093 | { |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10094 | if (pConfig->RSNWPAReqIE[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10095 | { |
| 10096 | /*Mixed mode WPA/WPA2*/ |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10097 | prev_rsn_length = pConfig->RSNWPAReqIELength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10098 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10099 | if (pConfig->RSNWPAReqIELength <= |
| 10100 | (sizeof(pConfig->RSNWPAReqIE) - prev_rsn_length)) |
| 10101 | memcpy(&pConfig->RSNWPAReqIE[0] + prev_rsn_length, pIe, |
| 10102 | pIe[1] + 2); |
| 10103 | else |
| 10104 | hddLog(LOGE, "RSNWPA IE MAX Length exceeded; length =%d", |
| 10105 | pConfig->RSNWPAReqIELength); |
| 10106 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10107 | } |
| 10108 | else |
| 10109 | { |
| 10110 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10111 | if (pConfig->RSNWPAReqIELength <= sizeof(pConfig->RSNWPAReqIE)) |
| 10112 | memcpy(&pConfig->RSNWPAReqIE[0], pIe, |
| 10113 | pConfig->RSNWPAReqIELength); |
| 10114 | else |
| 10115 | hddLog(LOGE, "RSNWPA IE MAX Length exceeded; length =%d", |
| 10116 | pConfig->RSNWPAReqIELength); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10117 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10118 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 10119 | &RSNEncryptType, |
| 10120 | &mcRSNEncryptType, |
| 10121 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 10122 | &MFPCapable, |
| 10123 | &MFPRequired, |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10124 | pConfig->RSNWPAReqIE[1]+2, |
| 10125 | pConfig->RSNWPAReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10126 | |
| 10127 | if( VOS_STATUS_SUCCESS == status ) |
| 10128 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10129 | /* Now copy over all the security attributes you have |
| 10130 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10131 | * */ |
| 10132 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 10133 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 10134 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 10135 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 10136 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10137 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10138 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 10139 | } |
| 10140 | } |
| 10141 | } |
| 10142 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10143 | if (pConfig->RSNWPAReqIELength > sizeof(pConfig->RSNWPAReqIE)) { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 10144 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 10145 | return -EINVAL; |
| 10146 | } |
| 10147 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10148 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 10149 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10150 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10151 | if (params->ssid != NULL) |
| 10152 | { |
| 10153 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 10154 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 10155 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 10156 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 10157 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10158 | #else |
| 10159 | if (ssid != NULL) |
| 10160 | { |
| 10161 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 10162 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 10163 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 10164 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 10165 | } |
| 10166 | #endif |
| 10167 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10168 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10169 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10170 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10171 | /* default value */ |
| 10172 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 10173 | pConfig->num_accept_mac = 0; |
| 10174 | pConfig->num_deny_mac = 0; |
| 10175 | |
| 10176 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 10177 | pBeacon->tail, pBeacon->tail_len); |
| 10178 | |
| 10179 | /* pIe for black list is following form: |
| 10180 | type : 1 byte |
| 10181 | length : 1 byte |
| 10182 | OUI : 4 bytes |
| 10183 | acl type : 1 byte |
| 10184 | no of mac addr in black list: 1 byte |
| 10185 | 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] | 10186 | */ |
| 10187 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10188 | { |
| 10189 | pConfig->SapMacaddr_acl = pIe[6]; |
| 10190 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10191 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10192 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 10193 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 10194 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10195 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 10196 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 10197 | { |
| 10198 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 10199 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10200 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10201 | } |
| 10202 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 10203 | pBeacon->tail, pBeacon->tail_len); |
| 10204 | |
| 10205 | /* pIe for white list is following form: |
| 10206 | type : 1 byte |
| 10207 | length : 1 byte |
| 10208 | OUI : 4 bytes |
| 10209 | acl type : 1 byte |
| 10210 | no of mac addr in white list: 1 byte |
| 10211 | 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] | 10212 | */ |
| 10213 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10214 | { |
| 10215 | pConfig->SapMacaddr_acl = pIe[6]; |
| 10216 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10217 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10218 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 10219 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 10220 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10221 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 10222 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 10223 | { |
| 10224 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 10225 | acl_entry++; |
| 10226 | } |
| 10227 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 10228 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10229 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 10230 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10231 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 10232 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 10233 | * This is valid only if mode is set to 11n in hostapd, sapEnable11AC |
| 10234 | * 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] | 10235 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 10236 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 10237 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 10238 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 10239 | (sapEnable11AC) && (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 10240 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10241 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 10242 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10243 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 10244 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 10245 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 10246 | /* If ACS disable and selected channel <= 14 |
| 10247 | * OR |
| 10248 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 10249 | * AND |
| 10250 | * VHT in 2.4G Disabled |
| 10251 | * THEN |
| 10252 | * Fallback to 11N mode |
| 10253 | */ |
| 10254 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 10255 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 10256 | operatingBand == eSAP_RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 10257 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 10258 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 10259 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 10260 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 10261 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 10262 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10263 | } |
| 10264 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10266 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 10267 | pConfig->ht_capab = |
| 10268 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 10269 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10270 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10271 | { |
| 10272 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 10273 | return -EINVAL; |
| 10274 | } |
| 10275 | |
| 10276 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10277 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10278 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 10279 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10280 | pConfig->obssProtEnabled = |
| 10281 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10282 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 10283 | #ifdef WLAN_FEATURE_11W |
| 10284 | pConfig->mfpCapable = MFPCapable; |
| 10285 | pConfig->mfpRequired = MFPRequired; |
| 10286 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 10287 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 10288 | #endif |
| 10289 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10290 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10291 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10292 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 10293 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 10294 | (int)pConfig->channel); |
| 10295 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 10296 | pConfig->SapHw_mode, pConfig->privacy, |
| 10297 | pConfig->authType); |
| 10298 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 10299 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 10300 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 10301 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10302 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10303 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10304 | { |
| 10305 | //Bss already started. just return. |
| 10306 | //TODO Probably it should update some beacon params. |
| 10307 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 10308 | EXIT(); |
| 10309 | return 0; |
| 10310 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10311 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10312 | if (vos_max_concurrent_connections_reached()) { |
| 10313 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 10314 | return -EINVAL; |
| 10315 | } |
| 10316 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10317 | pConfig->persona = pHostapdAdapter->device_mode; |
| 10318 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 10319 | psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams)); |
| 10320 | if ( NULL != psmeConfig) |
| 10321 | { |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 10322 | vos_mem_zero(psmeConfig, sizeof (tSmeConfigParams)); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 10323 | sme_GetConfigParam(hHal, psmeConfig); |
| 10324 | pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference; |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 10325 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 10326 | if (((pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 10327 | || (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 10328 | && pHddCtx->cfg_ini->apHT40_24GEnabled) |
| 10329 | { |
| 10330 | psmeConfig->csrConfig.apHT40_24GEnabled = 1; |
| 10331 | sme_UpdateConfig (hHal, psmeConfig); |
| 10332 | } |
| 10333 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 10334 | vos_mem_free(psmeConfig); |
| 10335 | } |
Peng Xu | afc34e3 | 2014-09-25 13:23:55 +0530 | [diff] [blame] | 10336 | pConfig->acsBandSwitchThreshold = iniConfig->acsBandSwitchThreshold; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 10337 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10338 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 10339 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 10340 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 10341 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10342 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10343 | return -EINVAL; |
| 10344 | } |
| 10345 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10346 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10347 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 10348 | |
| 10349 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10350 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10351 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10352 | { |
| 10353 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10354 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 10355 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10356 | VOS_ASSERT(0); |
| 10357 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10358 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10359 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Nishank Aggarwal | c11826c | 2016-12-15 18:54:10 +0530 | [diff] [blame] | 10360 | if (WLANSAP_get_sessionId(pVosContext, &pHostapdAdapter->sessionId) != |
| 10361 | VOS_STATUS_SUCCESS) |
| 10362 | { |
| 10363 | hddLog(LOGE,FL("Fail to get Softap sessionID")); |
| 10364 | VOS_ASSERT(0); |
| 10365 | } |
Kaushik, Sushant | f607080 | 2014-10-15 15:09:23 +0530 | [diff] [blame] | 10366 | /* Initialize WMM configuation */ |
| 10367 | hdd_wmm_init(pHostapdAdapter); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10368 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10369 | |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 10370 | #ifdef DHCP_SERVER_OFFLOAD |
| 10371 | /* set dhcp server offload */ |
| 10372 | if (iniConfig->enable_dhcp_srv_offload && |
| 10373 | sme_IsFeatureSupportedByFW(SAP_OFFLOADS)) { |
Anurag Chouhan | 638f5e2 | 2017-03-06 12:28:43 +0530 | [diff] [blame] | 10374 | status = wlan_hdd_set_dhcp_server_offload(pHostapdAdapter, false); |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 10375 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 10376 | { |
| 10377 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10378 | ("HDD DHCP Server Offload Failed!!")); |
| 10379 | return -EINVAL; |
| 10380 | } |
| 10381 | vos_event_reset(&pHostapdAdapter->dhcp_status.vos_event); |
| 10382 | status = vos_wait_single_event(&pHostapdAdapter->dhcp_status.vos_event, 2000); |
| 10383 | if (!VOS_IS_STATUS_SUCCESS(status) || pHostapdAdapter->dhcp_status.dhcp_offload_status) |
| 10384 | { |
| 10385 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10386 | ("ERROR: DHCP HDD vos wait for single_event failed!! %d"), |
| 10387 | pHostapdAdapter->dhcp_status.dhcp_offload_status); |
| 10388 | return -EINVAL; |
| 10389 | } |
Anurag Chouhan | 0b29de0 | 2016-12-16 13:18:40 +0530 | [diff] [blame] | 10390 | #ifdef MDNS_OFFLOAD |
| 10391 | if (iniConfig->enable_mdns_offload) { |
| 10392 | status = wlan_hdd_set_mdns_offload(pHostapdAdapter); |
| 10393 | if (VOS_IS_STATUS_SUCCESS(status)) |
| 10394 | { |
| 10395 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10396 | ("HDD MDNS Server Offload Failed!!")); |
| 10397 | return -EINVAL; |
| 10398 | } |
| 10399 | vos_event_reset(&pHostapdAdapter->mdns_status.vos_event); |
| 10400 | status = vos_wait_single_event(&pHostapdAdapter-> |
| 10401 | mdns_status.vos_event, 2000); |
| 10402 | if (!VOS_IS_STATUS_SUCCESS(status) || |
| 10403 | pHostapdAdapter->mdns_status.mdns_enable_status || |
| 10404 | pHostapdAdapter->mdns_status.mdns_fqdn_status || |
| 10405 | pHostapdAdapter->mdns_status.mdns_resp_status) |
| 10406 | { |
| 10407 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10408 | ("MDNS HDD vos wait for single_event failed!! enable %d fqdn %d resp %d"), |
| 10409 | pHostapdAdapter->mdns_status.mdns_enable_status, |
| 10410 | pHostapdAdapter->mdns_status.mdns_fqdn_status, |
| 10411 | pHostapdAdapter->mdns_status.mdns_resp_status); |
| 10412 | return -EINVAL; |
| 10413 | } |
| 10414 | } |
| 10415 | #endif /* MDNS_OFFLOAD */ |
| 10416 | } else { |
| 10417 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10418 | ("DHCP Disabled ini %d, FW %d"), |
| 10419 | iniConfig->enable_dhcp_srv_offload, |
| 10420 | sme_IsFeatureSupportedByFW(SAP_OFFLOADS)); |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 10421 | } |
| 10422 | #endif /* DHCP_SERVER_OFFLOAD */ |
| 10423 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 10424 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 10425 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 10426 | { |
| 10427 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 10428 | { |
| 10429 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 10430 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 10431 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 10432 | } |
| 10433 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 10434 | { |
| 10435 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 10436 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 10437 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 10438 | } |
| 10439 | } |
| 10440 | #endif |
Ashish Kumar Dhanotiya | 42aa515 | 2017-01-03 20:25:57 +0530 | [diff] [blame] | 10441 | /* Check and restart SAP if it is on Unsafe channel */ |
| 10442 | hdd_check_for_unsafe_ch(pHostapdAdapter, pHddCtx); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 10443 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10444 | pHostapdState->bCommit = TRUE; |
| 10445 | EXIT(); |
| 10446 | |
| 10447 | return 0; |
| 10448 | } |
| 10449 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10450 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10451 | static int __wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10452 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10453 | struct beacon_parameters *params) |
| 10454 | { |
| 10455 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10456 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10457 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10458 | |
| 10459 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10460 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10461 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10462 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 10463 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10464 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 10465 | hdd_device_modetoString(pAdapter->device_mode), |
| 10466 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10467 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10468 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10469 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10470 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10471 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10472 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10473 | } |
| 10474 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10475 | if (vos_max_concurrent_connections_reached()) { |
| 10476 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 10477 | return -EINVAL; |
| 10478 | } |
| 10479 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10480 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10481 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10482 | ) |
| 10483 | { |
| 10484 | beacon_data_t *old,*new; |
| 10485 | |
| 10486 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10487 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10488 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10489 | { |
| 10490 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 10491 | FL("already beacon info added to session(%d)"), |
| 10492 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10493 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10494 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10495 | |
| 10496 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 10497 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10498 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10499 | { |
| 10500 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10501 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10502 | return -EINVAL; |
| 10503 | } |
| 10504 | |
| 10505 | pAdapter->sessionCtx.ap.beacon = new; |
| 10506 | |
| 10507 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 10508 | } |
| 10509 | |
| 10510 | EXIT(); |
| 10511 | return status; |
| 10512 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10513 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10514 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 10515 | struct net_device *dev, |
| 10516 | struct beacon_parameters *params) |
| 10517 | { |
| 10518 | int ret; |
| 10519 | |
| 10520 | vos_ssr_protect(__func__); |
| 10521 | ret = __wlan_hdd_cfg80211_add_beacon(wiphy, dev, params); |
| 10522 | vos_ssr_unprotect(__func__); |
| 10523 | |
| 10524 | return ret; |
| 10525 | } |
| 10526 | |
| 10527 | static int __wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10528 | struct net_device *dev, |
| 10529 | struct beacon_parameters *params) |
| 10530 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10531 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10532 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10533 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10534 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10535 | |
| 10536 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 10537 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10538 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10539 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 10540 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 10541 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 10542 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10543 | pAdapter->device_mode); |
| 10544 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10545 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10546 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10547 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10548 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10549 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10550 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10551 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10552 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10553 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10554 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10555 | { |
| 10556 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10557 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10558 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10559 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10560 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10561 | { |
| 10562 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10563 | FL("session(%d) old and new heads points to NULL"), |
| 10564 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10565 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10566 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10567 | |
| 10568 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 10569 | |
| 10570 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10571 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10572 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10573 | return -EINVAL; |
| 10574 | } |
| 10575 | |
| 10576 | pAdapter->sessionCtx.ap.beacon = new; |
| 10577 | |
| 10578 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 10579 | } |
| 10580 | |
| 10581 | EXIT(); |
| 10582 | return status; |
| 10583 | } |
| 10584 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10585 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
| 10586 | struct net_device *dev, |
| 10587 | struct beacon_parameters *params) |
| 10588 | { |
| 10589 | int ret; |
| 10590 | |
| 10591 | vos_ssr_protect(__func__); |
| 10592 | ret = __wlan_hdd_cfg80211_set_beacon(wiphy, dev, params); |
| 10593 | vos_ssr_unprotect(__func__); |
| 10594 | |
| 10595 | return ret; |
| 10596 | } |
| 10597 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10598 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 10599 | |
| 10600 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10601 | static int __wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10602 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10603 | #else |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10604 | static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10605 | struct net_device *dev) |
| 10606 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10607 | { |
| 10608 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10609 | hdd_context_t *pHddCtx = NULL; |
| 10610 | hdd_scaninfo_t *pScanInfo = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10611 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 10612 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10613 | |
| 10614 | ENTER(); |
| 10615 | |
| 10616 | if (NULL == pAdapter) |
| 10617 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10618 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10619 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10620 | return -ENODEV; |
| 10621 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10622 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10623 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10624 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 10625 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10626 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10627 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10628 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10629 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10630 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 10631 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10632 | |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 10633 | pScanInfo = &pHddCtx->scan_info; |
| 10634 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10635 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 10636 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10637 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10638 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 10639 | ret = wlan_hdd_scan_abort(pAdapter); |
| 10640 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 10641 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10642 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 10643 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10644 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10645 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 10646 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10647 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 10648 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10649 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 10650 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10651 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 10652 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10653 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 10654 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10655 | } |
| 10656 | |
Rashmi Ramanna | 1f0948d | 2014-08-28 15:33:48 +0530 | [diff] [blame] | 10657 | /* Delete all associated STAs before stopping AP/P2P GO */ |
| 10658 | hdd_del_all_sta(pAdapter); |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 10659 | hdd_hostapd_stop(dev); |
| 10660 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10661 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10662 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10663 | ) |
| 10664 | { |
| 10665 | beacon_data_t *old; |
| 10666 | |
| 10667 | old = pAdapter->sessionCtx.ap.beacon; |
| 10668 | |
| 10669 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10670 | { |
| 10671 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10672 | FL("session(%d) beacon data points to NULL"), |
| 10673 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10674 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10675 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10676 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10677 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10678 | |
| 10679 | mutex_lock(&pHddCtx->sap_lock); |
| 10680 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 10681 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 10682 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10683 | { |
| 10684 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 10685 | |
| 10686 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 10687 | |
| 10688 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 10689 | { |
| 10690 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10691 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10692 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10693 | } |
| 10694 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10695 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10696 | /* BSS stopped, clear the active sessions for this device mode */ |
| 10697 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10698 | } |
| 10699 | mutex_unlock(&pHddCtx->sap_lock); |
| 10700 | |
| 10701 | if(status != VOS_STATUS_SUCCESS) |
| 10702 | { |
| 10703 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10704 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10705 | return -EINVAL; |
| 10706 | } |
| 10707 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 10708 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10709 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 10710 | ==eHAL_STATUS_FAILURE) |
| 10711 | { |
| 10712 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10713 | "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] | 10714 | } |
| 10715 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 10716 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10717 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 10718 | eANI_BOOLEAN_FALSE) ) |
| 10719 | { |
| 10720 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10721 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10722 | } |
| 10723 | |
| 10724 | // Reset WNI_CFG_PROBE_RSP Flags |
| 10725 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 10726 | |
| 10727 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 10728 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 10729 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 10730 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 10731 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 10732 | { |
| 10733 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 10734 | "GO got removed"); |
| 10735 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 10736 | } |
| 10737 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10738 | } |
| 10739 | EXIT(); |
| 10740 | return status; |
| 10741 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10742 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10743 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 10744 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 10745 | struct net_device *dev) |
| 10746 | { |
| 10747 | int ret; |
| 10748 | |
| 10749 | vos_ssr_protect(__func__); |
| 10750 | ret = __wlan_hdd_cfg80211_del_beacon(wiphy, dev); |
| 10751 | vos_ssr_unprotect(__func__); |
| 10752 | |
| 10753 | return ret; |
| 10754 | } |
| 10755 | #else |
| 10756 | static int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, |
| 10757 | struct net_device *dev) |
| 10758 | { |
| 10759 | int ret; |
| 10760 | |
| 10761 | vos_ssr_protect(__func__); |
| 10762 | ret = __wlan_hdd_cfg80211_stop_ap(wiphy, dev); |
| 10763 | vos_ssr_unprotect(__func__); |
| 10764 | |
| 10765 | return ret; |
| 10766 | } |
| 10767 | #endif |
| 10768 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10769 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 10770 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10771 | static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10772 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10773 | struct cfg80211_ap_settings *params) |
| 10774 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10775 | hdd_adapter_t *pAdapter; |
| 10776 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10777 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10778 | |
| 10779 | ENTER(); |
| 10780 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 10781 | if (NULL == dev || NULL == params) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 10782 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10783 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 10784 | "%s: Device or params is Null", __func__); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10785 | return -ENODEV; |
| 10786 | } |
| 10787 | |
| 10788 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 10789 | if (NULL == pAdapter) |
| 10790 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10791 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10792 | "%s: HDD adapter is Null", __func__); |
| 10793 | return -ENODEV; |
| 10794 | } |
| 10795 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10796 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10797 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 10798 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10799 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 10800 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10801 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10802 | "%s: HDD adapter magic is invalid", __func__); |
| 10803 | return -ENODEV; |
| 10804 | } |
| 10805 | |
| 10806 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10807 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10808 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10809 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10810 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10811 | } |
| 10812 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10813 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 10814 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10815 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10816 | |
| 10817 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10818 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10819 | ) |
| 10820 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10821 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10822 | |
| 10823 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10824 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10825 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10826 | { |
| 10827 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 10828 | FL("already beacon info added to session(%d)"), |
| 10829 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10830 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10831 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10832 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 10833 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 10834 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 10835 | &new, |
| 10836 | ¶ms->beacon); |
| 10837 | #else |
| 10838 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 10839 | &new, |
| 10840 | ¶ms->beacon, |
| 10841 | params->dtim_period); |
| 10842 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10843 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10844 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10845 | { |
| 10846 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10847 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10848 | return -EINVAL; |
| 10849 | } |
| 10850 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10851 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 10852 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 10853 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 10854 | params->channel, params->channel_type); |
| 10855 | #else |
| 10856 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 10857 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10858 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10859 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 10860 | params->ssid_len, params->hidden_ssid, |
| 10861 | params->auth_type); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10862 | } |
| 10863 | |
| 10864 | EXIT(); |
| 10865 | return status; |
| 10866 | } |
| 10867 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10868 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 10869 | struct net_device *dev, |
| 10870 | struct cfg80211_ap_settings *params) |
| 10871 | { |
| 10872 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10873 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10874 | vos_ssr_protect(__func__); |
| 10875 | ret = __wlan_hdd_cfg80211_start_ap(wiphy, dev, params); |
| 10876 | vos_ssr_unprotect(__func__); |
| 10877 | |
| 10878 | return ret; |
| 10879 | } |
| 10880 | |
| 10881 | static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10882 | struct net_device *dev, |
| 10883 | struct cfg80211_beacon_data *params) |
| 10884 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10885 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10886 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10887 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10888 | |
| 10889 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10890 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10891 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10892 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 10893 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10894 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10895 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10896 | |
| 10897 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10898 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10899 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 10900 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10901 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 10902 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10903 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10904 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10905 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10906 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10907 | { |
| 10908 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10909 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10910 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10911 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10912 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10913 | { |
| 10914 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10915 | FL("session(%d) beacon data points to NULL"), |
| 10916 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10917 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10918 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10919 | |
| 10920 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 10921 | |
| 10922 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10923 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10924 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10925 | return -EINVAL; |
| 10926 | } |
| 10927 | |
| 10928 | pAdapter->sessionCtx.ap.beacon = new; |
| 10929 | |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 10930 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0, |
| 10931 | pAdapter->sessionCtx.ap.sapConfig.authType); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10932 | } |
| 10933 | |
| 10934 | EXIT(); |
| 10935 | return status; |
| 10936 | } |
| 10937 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10938 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
| 10939 | struct net_device *dev, |
| 10940 | struct cfg80211_beacon_data *params) |
| 10941 | { |
| 10942 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10943 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10944 | vos_ssr_protect(__func__); |
| 10945 | ret = __wlan_hdd_cfg80211_change_beacon(wiphy, dev, params); |
| 10946 | vos_ssr_unprotect(__func__); |
| 10947 | |
| 10948 | return ret; |
| 10949 | } |
| 10950 | |
| 10951 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10952 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 10953 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10954 | struct net_device *dev, |
| 10955 | struct bss_parameters *params) |
| 10956 | { |
| 10957 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10958 | hdd_context_t *pHddCtx; |
| 10959 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10960 | |
| 10961 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10962 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10963 | if (NULL == pAdapter) |
| 10964 | { |
| 10965 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10966 | "%s: HDD adapter is Null", __func__); |
| 10967 | return -ENODEV; |
| 10968 | } |
| 10969 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10970 | ret = wlan_hdd_validate_context(pHddCtx); |
| 10971 | if (0 != ret) |
| 10972 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10973 | return ret; |
| 10974 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10975 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10976 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 10977 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10978 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 10979 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10980 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10981 | |
| 10982 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10983 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10984 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10985 | { |
| 10986 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 10987 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10988 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10989 | { |
| 10990 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10991 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10992 | } |
| 10993 | |
| 10994 | EXIT(); |
| 10995 | return 0; |
| 10996 | } |
| 10997 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 10998 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 10999 | struct net_device *dev, |
| 11000 | struct bss_parameters *params) |
| 11001 | { |
| 11002 | int ret; |
| 11003 | |
| 11004 | vos_ssr_protect(__func__); |
| 11005 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 11006 | vos_ssr_unprotect(__func__); |
| 11007 | |
| 11008 | return ret; |
| 11009 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 11010 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 11011 | * to wait for contry code completion |
| 11012 | */ |
| 11013 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 11014 | { |
| 11015 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 11016 | complete(&call_back_pAdapter->change_country_code); |
| 11017 | return NULL; |
| 11018 | } |
| 11019 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11020 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 11021 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11022 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 11023 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 11024 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11025 | struct net_device *ndev, |
| 11026 | enum nl80211_iftype type, |
| 11027 | u32 *flags, |
| 11028 | struct vif_params *params |
| 11029 | ) |
| 11030 | { |
| 11031 | struct wireless_dev *wdev; |
| 11032 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 11033 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 11034 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11035 | tCsrRoamProfile *pRoamProfile = NULL; |
| 11036 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11037 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11038 | eMib_dot11DesiredBssType connectedBssType; |
| 11039 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11040 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11041 | |
| 11042 | ENTER(); |
| 11043 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11044 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 11045 | { |
| 11046 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11047 | "%s: Adapter context is null", __func__); |
| 11048 | return VOS_STATUS_E_FAILURE; |
| 11049 | } |
| 11050 | |
| 11051 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11052 | if (!pHddCtx) |
| 11053 | { |
| 11054 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11055 | "%s: HDD context is null", __func__); |
| 11056 | return VOS_STATUS_E_FAILURE; |
| 11057 | } |
| 11058 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11059 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11060 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 11061 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11062 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11063 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11064 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11065 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11066 | } |
| 11067 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11068 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 11069 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 11070 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11071 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11072 | if (vos_max_concurrent_connections_reached()) { |
| 11073 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 11074 | return -EINVAL; |
| 11075 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11076 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11077 | wdev = ndev->ieee80211_ptr; |
| 11078 | |
| 11079 | #ifdef WLAN_BTAMP_FEATURE |
| 11080 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 11081 | (NL80211_IFTYPE_ADHOC == type)|| |
| 11082 | (NL80211_IFTYPE_AP == type)|| |
| 11083 | (NL80211_IFTYPE_P2P_GO == type)) |
| 11084 | { |
| 11085 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 11086 | // stop AMP traffic |
| 11087 | status = WLANBAP_StopAmp(); |
| 11088 | if(VOS_STATUS_SUCCESS != status ) |
| 11089 | { |
| 11090 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 11091 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 11092 | "%s: Failed to stop AMP", __func__); |
| 11093 | return -EINVAL; |
| 11094 | } |
| 11095 | } |
| 11096 | #endif //WLAN_BTAMP_FEATURE |
| 11097 | /* Reset the current device mode bit mask*/ |
| 11098 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 11099 | |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 11100 | if ((pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) && |
| 11101 | ((type == NL80211_IFTYPE_P2P_CLIENT) || |
| 11102 | (type == NL80211_IFTYPE_P2P_GO))) |
| 11103 | { |
| 11104 | /* Notify Mode change in case of concurrency. |
| 11105 | * Below function invokes TDLS teardown Functionality Since TDLS is |
| 11106 | * not Supported in case of concurrency i.e Once P2P session |
| 11107 | * is detected disable offchannel and teardown TDLS links |
| 11108 | */ |
| 11109 | hddLog(LOG1, |
| 11110 | FL("Device mode = %d Interface type = %d"), |
| 11111 | pAdapter->device_mode, type); |
| 11112 | hdd_tdls_notify_mode_change(pAdapter, pHddCtx); |
| 11113 | } |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 11114 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11115 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11116 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11117 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11118 | ) |
| 11119 | { |
| 11120 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 11121 | if (!pWextState) |
| 11122 | { |
| 11123 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11124 | "%s: pWextState is null", __func__); |
| 11125 | return VOS_STATUS_E_FAILURE; |
| 11126 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11127 | pRoamProfile = &pWextState->roamProfile; |
| 11128 | LastBSSType = pRoamProfile->BSSType; |
| 11129 | |
| 11130 | switch (type) |
| 11131 | { |
| 11132 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11133 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11134 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11135 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 11136 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11137 | #ifdef WLAN_FEATURE_11AC |
| 11138 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 11139 | { |
| 11140 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 11141 | } |
| 11142 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11143 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11144 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11145 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 11146 | //Check for sub-string p2p to confirm its a p2p interface |
| 11147 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11148 | { |
Mahesh A Saptasagar | c48ae8a | 2015-08-09 00:04:35 +0530 | [diff] [blame] | 11149 | #ifdef FEATURE_WLAN_TDLS |
| 11150 | mutex_lock(&pHddCtx->tdls_lock); |
| 11151 | wlan_hdd_tdls_exit(pAdapter, TRUE); |
| 11152 | mutex_unlock(&pHddCtx->tdls_lock); |
| 11153 | #endif |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 11154 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 11155 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 11156 | } |
| 11157 | else |
| 11158 | { |
| 11159 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11160 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 11161 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11162 | break; |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 11163 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11164 | case NL80211_IFTYPE_ADHOC: |
| 11165 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11166 | "%s: setting interface Type to ADHOC", __func__); |
| 11167 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 11168 | pRoamProfile->phyMode = |
| 11169 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 11170 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11171 | wdev->iftype = type; |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 11172 | hdd_set_ibss_ops( pAdapter ); |
| 11173 | hdd_ibss_init_tx_rx( pAdapter ); |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 11174 | |
| 11175 | status = hdd_sta_id_hash_attach(pAdapter); |
| 11176 | if (VOS_STATUS_SUCCESS != status) { |
| 11177 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11178 | FL("Failed to initialize hash for IBSS")); |
| 11179 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11180 | break; |
| 11181 | |
| 11182 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11183 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11184 | { |
| 11185 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 11186 | "%s: setting interface Type to %s", __func__, |
| 11187 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 11188 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 11189 | //Cancel any remain on channel for GO mode |
| 11190 | if (NL80211_IFTYPE_P2P_GO == type) |
| 11191 | { |
| 11192 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 11193 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 11194 | if (NL80211_IFTYPE_AP == type) |
| 11195 | { |
| 11196 | /* As Loading WLAN Driver one interface being created for p2p device |
| 11197 | * address. This will take one HW STA and the max number of clients |
| 11198 | * that can connect to softAP will be reduced by one. so while changing |
| 11199 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 11200 | * interface as it is not required in SoftAP mode. |
| 11201 | */ |
| 11202 | |
| 11203 | // Get P2P Adapter |
| 11204 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 11205 | |
| 11206 | if (pP2pAdapter) |
| 11207 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 11208 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 11209 | hdd_deinit_adapter(pHddCtx, pP2pAdapter, TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 11210 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 11211 | } |
| 11212 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 11213 | //Disable IMPS & BMPS for SAP/GO |
| 11214 | if(VOS_STATUS_E_FAILURE == |
| 11215 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 11216 | { |
| 11217 | //Fail to Exit BMPS |
| 11218 | VOS_ASSERT(0); |
| 11219 | } |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 11220 | |
| 11221 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
| 11222 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 11223 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 11224 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 11225 | /* A Mutex Lock is introduced while changing the mode to |
| 11226 | * protect the concurrent access for the Adapters by TDLS |
| 11227 | * module. |
| 11228 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 11229 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 11230 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11231 | //De-init the adapter. |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 11232 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11233 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11234 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 11235 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 11236 | #ifdef FEATURE_WLAN_TDLS |
| 11237 | mutex_unlock(&pHddCtx->tdls_lock); |
| 11238 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 11239 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 11240 | (pConfig->apRandomBssidEnabled)) |
| 11241 | { |
| 11242 | /* To meet Android requirements create a randomized |
| 11243 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 11244 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 11245 | ndev->dev_addr[0] = 0x02; |
| 11246 | ndev->dev_addr[1] = 0x1A; |
| 11247 | ndev->dev_addr[2] = 0x11; |
| 11248 | ndev->dev_addr[3] |= 0xF0; |
| 11249 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 11250 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 11251 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 11252 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 11253 | } |
| 11254 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11255 | hdd_set_ap_ops( pAdapter->dev ); |
| 11256 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 11257 | /* This is for only SAP mode where users can |
| 11258 | * control country through ini. |
| 11259 | * P2P GO follows station country code |
| 11260 | * acquired during the STA scanning. */ |
| 11261 | if((NL80211_IFTYPE_AP == type) && |
| 11262 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 11263 | { |
| 11264 | int status = 0; |
| 11265 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 11266 | "%s: setting country code from INI ", __func__); |
| 11267 | init_completion(&pAdapter->change_country_code); |
| 11268 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 11269 | (void *)(tSmeChangeCountryCallback) |
| 11270 | wlan_hdd_change_country_code_cb, |
| 11271 | pConfig->apCntryCode, pAdapter, |
| 11272 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 11273 | eSIR_FALSE, |
| 11274 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 11275 | if (eHAL_STATUS_SUCCESS == status) |
| 11276 | { |
| 11277 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11278 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 11279 | &pAdapter->change_country_code, |
| 11280 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11281 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 11282 | { |
| 11283 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11284 | FL("SME Timed out while setting country code %ld"), |
| 11285 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 11286 | |
| 11287 | if (pHddCtx->isLogpInProgress) |
| 11288 | { |
| 11289 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11290 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 11291 | return -EAGAIN; |
| 11292 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 11293 | } |
| 11294 | } |
| 11295 | else |
| 11296 | { |
| 11297 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11298 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 11299 | return -EINVAL; |
| 11300 | } |
| 11301 | } |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 11302 | status = hdd_init_ap_mode(pAdapter, false); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11303 | if(status != VOS_STATUS_SUCCESS) |
| 11304 | { |
| 11305 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 11306 | "%s: Error initializing the ap mode", __func__); |
| 11307 | return -EINVAL; |
| 11308 | } |
| 11309 | hdd_set_conparam(1); |
| 11310 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 11311 | status = hdd_sta_id_hash_attach(pAdapter); |
| 11312 | if (VOS_STATUS_SUCCESS != status) |
| 11313 | { |
| 11314 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11315 | FL("Failed to initialize hash for AP")); |
| 11316 | return -EINVAL; |
| 11317 | } |
| 11318 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11319 | /*interface type changed update in wiphy structure*/ |
| 11320 | if(wdev) |
| 11321 | { |
| 11322 | wdev->iftype = type; |
| 11323 | pHddCtx->change_iface = type; |
| 11324 | } |
| 11325 | else |
| 11326 | { |
| 11327 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11328 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 11329 | return -EINVAL; |
| 11330 | } |
| 11331 | goto done; |
| 11332 | } |
| 11333 | |
| 11334 | default: |
| 11335 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 11336 | __func__); |
| 11337 | return -EOPNOTSUPP; |
| 11338 | } |
| 11339 | } |
| 11340 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11341 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11342 | ) |
| 11343 | { |
| 11344 | switch(type) |
| 11345 | { |
| 11346 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11347 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11348 | case NL80211_IFTYPE_ADHOC: |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 11349 | |
| 11350 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 11351 | #ifdef FEATURE_WLAN_TDLS |
| 11352 | |
| 11353 | /* A Mutex Lock is introduced while changing the mode to |
| 11354 | * protect the concurrent access for the Adapters by TDLS |
| 11355 | * module. |
| 11356 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 11357 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 11358 | #endif |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 11359 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11360 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 11361 | //Check for sub-string p2p to confirm its a p2p interface |
| 11362 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 11363 | { |
| 11364 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 11365 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 11366 | } |
| 11367 | else |
| 11368 | { |
| 11369 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11370 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 11371 | } |
Agrawal Ashish | cfe8328 | 2016-09-29 13:03:45 +0530 | [diff] [blame] | 11372 | |
| 11373 | /* set con_mode to STA only when no SAP concurrency mode */ |
| 11374 | if (!(hdd_get_concurrency_mode() & (VOS_SAP | VOS_P2P_GO))) |
| 11375 | hdd_set_conparam(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11376 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11377 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 11378 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 11379 | #ifdef FEATURE_WLAN_TDLS |
| 11380 | mutex_unlock(&pHddCtx->tdls_lock); |
| 11381 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 11382 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11383 | if( VOS_STATUS_SUCCESS != status ) |
| 11384 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11385 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 11386 | * This is the right place to enable back bmps_imps() |
| 11387 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 11388 | if (pHddCtx->hdd_wlan_suspended) |
| 11389 | { |
| 11390 | hdd_set_pwrparams(pHddCtx); |
| 11391 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11392 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11393 | goto done; |
| 11394 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11395 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11396 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11397 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 11398 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11399 | goto done; |
| 11400 | default: |
| 11401 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 11402 | __func__); |
| 11403 | return -EOPNOTSUPP; |
| 11404 | |
| 11405 | } |
| 11406 | |
| 11407 | } |
| 11408 | else |
| 11409 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11410 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 11411 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 11412 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11413 | return -EOPNOTSUPP; |
| 11414 | } |
| 11415 | |
| 11416 | |
| 11417 | if(pRoamProfile) |
| 11418 | { |
| 11419 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 11420 | { |
| 11421 | /*interface type changed update in wiphy structure*/ |
| 11422 | wdev->iftype = type; |
| 11423 | |
| 11424 | /*the BSS mode changed, We need to issue disconnect |
| 11425 | if connected or in IBSS disconnect state*/ |
| 11426 | if ( hdd_connGetConnectedBssType( |
| 11427 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 11428 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 11429 | { |
| 11430 | /*need to issue a disconnect to CSR.*/ |
| 11431 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 11432 | if( eHAL_STATUS_SUCCESS == |
| 11433 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11434 | pAdapter->sessionId, |
| 11435 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 11436 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11437 | ret = wait_for_completion_interruptible_timeout( |
| 11438 | &pAdapter->disconnect_comp_var, |
| 11439 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 11440 | if (ret <= 0) |
| 11441 | { |
| 11442 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11443 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 11444 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11445 | } |
| 11446 | } |
| 11447 | } |
| 11448 | } |
| 11449 | |
| 11450 | done: |
| 11451 | /*set bitmask based on updated value*/ |
| 11452 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 11453 | |
| 11454 | /* Only STA mode support TM now |
| 11455 | * all other mode, TM feature should be disabled */ |
| 11456 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 11457 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 11458 | { |
| 11459 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 11460 | } |
| 11461 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11462 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11463 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11464 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11465 | { |
| 11466 | //we are ok to do AMP |
| 11467 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 11468 | } |
| 11469 | #endif //WLAN_BTAMP_FEATURE |
| 11470 | EXIT(); |
| 11471 | return 0; |
| 11472 | } |
| 11473 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 11474 | /* |
| 11475 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 11476 | * wrapper function to protect the actual implementation from SSR. |
| 11477 | */ |
| 11478 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 11479 | struct net_device *ndev, |
| 11480 | enum nl80211_iftype type, |
| 11481 | u32 *flags, |
| 11482 | struct vif_params *params |
| 11483 | ) |
| 11484 | { |
| 11485 | int ret; |
| 11486 | |
| 11487 | vos_ssr_protect(__func__); |
| 11488 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 11489 | vos_ssr_unprotect(__func__); |
| 11490 | |
| 11491 | return ret; |
| 11492 | } |
| 11493 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11494 | #ifdef FEATURE_WLAN_TDLS |
| 11495 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 11496 | struct net_device *dev, |
| 11497 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 11498 | const u8 *mac, |
| 11499 | #else |
| 11500 | u8 *mac, |
| 11501 | #endif |
| 11502 | bool update, tCsrStaParams *StaParams) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11503 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11504 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11505 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11506 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 11507 | tANI_U16 numCurrTdlsPeers; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 11508 | hdd_adapter_t *pAdapter; |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 11509 | VOS_STATUS status; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11510 | |
| 11511 | ENTER(); |
| 11512 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 11513 | if (!dev) { |
| 11514 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 11515 | return -EINVAL; |
| 11516 | } |
| 11517 | |
| 11518 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 11519 | if (!pAdapter) { |
| 11520 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 11521 | return -EINVAL; |
| 11522 | } |
| 11523 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 11524 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11525 | { |
| 11526 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11527 | "Invalid arguments"); |
| 11528 | return -EINVAL; |
| 11529 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 11530 | |
| 11531 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 11532 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 11533 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 11534 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 11535 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 11536 | MAC_ADDRESS_STR " Request declined.", |
| 11537 | __func__, MAC_ADDR_ARRAY(mac)); |
| 11538 | return -ENOTSUPP; |
| 11539 | } |
| 11540 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11541 | if (pHddCtx->isLogpInProgress) |
| 11542 | { |
| 11543 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11544 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 11545 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 11546 | mac, |
| 11547 | eTDLS_LINK_IDLE, |
| 11548 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11549 | return -EBUSY; |
| 11550 | } |
| 11551 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 11552 | mutex_lock(&pHddCtx->tdls_lock); |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 11553 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11554 | |
| 11555 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 11556 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11557 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 11558 | __func__, MAC_ADDR_ARRAY(mac), update); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 11559 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11560 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 11561 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11562 | |
| 11563 | /* in add station, we accept existing valid staId if there is */ |
| 11564 | if ((0 == update) && |
| 11565 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 11566 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11567 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 11568 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11569 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11570 | " link_status %d. staId %d. add station ignored.", |
| 11571 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 11572 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11573 | return 0; |
| 11574 | } |
| 11575 | /* in change station, we accept only when staId is valid */ |
| 11576 | if ((1 == update) && |
| 11577 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 11578 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 11579 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 11580 | tANI_U16 staId = pTdlsPeer->staId; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 11581 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11582 | "%s: " MAC_ADDRESS_STR |
| 11583 | " link status %d. staId %d. change station %s.", |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 11584 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, staId, |
| 11585 | (TDLS_STA_INDEX_VALID(staId)) ? "ignored" : "declined"); |
| 11586 | mutex_unlock(&pHddCtx->tdls_lock); |
| 11587 | return (TDLS_STA_INDEX_VALID(staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11588 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 11589 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 11590 | |
| 11591 | /* when others are on-going, we want to change link_status to idle */ |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 11592 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11593 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 11594 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11595 | "%s: " MAC_ADDRESS_STR |
| 11596 | " TDLS setup is ongoing. Request declined.", |
| 11597 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 11598 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11599 | } |
| 11600 | |
| 11601 | /* first to check if we reached to maximum supported TDLS peer. |
| 11602 | TODO: for now, return -EPERM looks working fine, |
| 11603 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 11604 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 11605 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11606 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 11607 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11608 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 11609 | " TDLS Max peer already connected. Request declined." |
| 11610 | " Num of peers (%d), Max allowed (%d).", |
| 11611 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 11612 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 11613 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11614 | } |
| 11615 | else |
| 11616 | { |
| 11617 | hddTdlsPeer_t *pTdlsPeer; |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 11618 | mutex_lock(&pHddCtx->tdls_lock); |
| 11619 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11620 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11621 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 11622 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 11623 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11624 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 11625 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11626 | return -EPERM; |
| 11627 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 11628 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11629 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11630 | if (0 == update) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 11631 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 11632 | mac, |
| 11633 | eTDLS_LINK_CONNECTING, |
| 11634 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11635 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 11636 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 11637 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11638 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 11639 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11640 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11641 | if(StaParams->htcap_present) |
| 11642 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 11643 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11644 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 11645 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11646 | "ht_capa->extended_capabilities: %0x", |
| 11647 | StaParams->HTCap.extendedHtCapInfo); |
| 11648 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 11649 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11650 | "params->capability: %0x",StaParams->capability); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 11651 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 11652 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11653 | if(StaParams->vhtcap_present) |
| 11654 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 11655 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11656 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 11657 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 11658 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 11659 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11660 | { |
| 11661 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11662 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11663 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 11664 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11665 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 11666 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 11667 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 11668 | else if ((1 == update) && (NULL == StaParams)) |
| 11669 | { |
| 11670 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11671 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 11672 | return -EPERM; |
| 11673 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11674 | |
| 11675 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 11676 | |
| 11677 | if (!update) |
| 11678 | { |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 11679 | /*Before adding sta make sure that device exited from BMPS*/ |
| 11680 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 11681 | { |
| 11682 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11683 | "%s: Adding tdls peer sta. Disable BMPS", __func__); |
| 11684 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 11685 | if (status != VOS_STATUS_SUCCESS) { |
| 11686 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
| 11687 | } |
| 11688 | } |
| 11689 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 11690 | ret = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11691 | pAdapter->sessionId, mac); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 11692 | if (ret != eHAL_STATUS_SUCCESS) { |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 11693 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11694 | FL("Failed to add TDLS peer STA. Enable Bmps")); |
| 11695 | wlan_hdd_tdls_check_bmps(pAdapter); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 11696 | return -EPERM; |
| 11697 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11698 | } |
| 11699 | else |
| 11700 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 11701 | ret = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11702 | pAdapter->sessionId, mac, StaParams); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 11703 | if (ret != eHAL_STATUS_SUCCESS) { |
| 11704 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to change TDLS peer STA params")); |
| 11705 | return -EPERM; |
| 11706 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11707 | } |
| 11708 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11709 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11710 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 11711 | |
Masti, Narayanraddi | 255d8c5 | 2016-01-07 16:26:06 +0530 | [diff] [blame] | 11712 | mutex_lock(&pHddCtx->tdls_lock); |
| 11713 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE); |
| 11714 | |
Masti, Narayanraddi | 0726246 | 2016-01-19 12:40:06 +0530 | [diff] [blame] | 11715 | if ((pTdlsPeer != NULL) && |
| 11716 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11717 | { |
Masti, Narayanraddi | 0726246 | 2016-01-19 12:40:06 +0530 | [diff] [blame] | 11718 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11719 | FL("peer link status %u"), pTdlsPeer->link_status); |
| 11720 | mutex_unlock(&pHddCtx->tdls_lock); |
| 11721 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11722 | } |
Masti, Narayanraddi | 255d8c5 | 2016-01-07 16:26:06 +0530 | [diff] [blame] | 11723 | mutex_unlock(&pHddCtx->tdls_lock); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11724 | |
Masti, Narayanraddi | 0726246 | 2016-01-19 12:40:06 +0530 | [diff] [blame] | 11725 | if (ret <= 0) |
| 11726 | { |
| 11727 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11728 | "%s: timeout waiting for tdls add station indication %ld", |
| 11729 | __func__, ret); |
| 11730 | goto error; |
| 11731 | } |
| 11732 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11733 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 11734 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 11735 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11736 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 11737 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11738 | } |
| 11739 | |
| 11740 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 11741 | |
| 11742 | error: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 11743 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 11744 | mac, |
| 11745 | eTDLS_LINK_IDLE, |
| 11746 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 11747 | return -EPERM; |
| 11748 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11749 | } |
| 11750 | #endif |
| 11751 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11752 | static int __wlan_hdd_change_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11753 | struct net_device *dev, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 11754 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 11755 | const u8 *mac, |
| 11756 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11757 | u8 *mac, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 11758 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11759 | struct station_parameters *params) |
| 11760 | { |
| 11761 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 11762 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11763 | hdd_context_t *pHddCtx; |
| 11764 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11765 | v_MACADDR_t STAMacAddress; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11766 | int ret = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 11767 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11768 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11769 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 11770 | tANI_U8 isOffChannelSupported = 0; |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 11771 | tANI_U8 isQosWmmSta = FALSE; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 11772 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11773 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 11774 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 11775 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 11776 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11777 | if ((NULL == pAdapter)) |
| 11778 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11779 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11780 | "invalid adapter "); |
| 11781 | return -EINVAL; |
| 11782 | } |
| 11783 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11784 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11785 | TRACE_CODE_HDD_CHANGE_STATION, |
| 11786 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11787 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11788 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11789 | ret = wlan_hdd_validate_context(pHddCtx); |
| 11790 | if (0 != ret) |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11791 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11792 | return ret; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11793 | } |
| 11794 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11795 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11796 | |
| 11797 | if (NULL == pHddStaCtx) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11798 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11799 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 11800 | "invalid HDD station context"); |
| 11801 | return -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11802 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11803 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 11804 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11805 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 11806 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11807 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11808 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11809 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11810 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11811 | WLANTL_STA_AUTHENTICATED); |
| 11812 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11813 | if (status != VOS_STATUS_SUCCESS) |
| 11814 | { |
| 11815 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11816 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 11817 | return -EINVAL; |
| 11818 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11819 | } |
| 11820 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 11821 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 11822 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11823 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11824 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 11825 | StaParams.capability = params->capability; |
| 11826 | StaParams.uapsd_queues = params->uapsd_queues; |
| 11827 | StaParams.max_sp = params->max_sp; |
| 11828 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 11829 | /* Convert (first channel , number of channels) tuple to |
| 11830 | * the total list of channels. This goes with the assumption |
| 11831 | * that if the first channel is < 14, then the next channels |
| 11832 | * are an incremental of 1 else an incremental of 4 till the number |
| 11833 | * of channels. |
| 11834 | */ |
| 11835 | if (0 != params->supported_channels_len) { |
| 11836 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 11837 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 11838 | { |
| 11839 | int wifi_chan_index; |
| 11840 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 11841 | wifi_chan_index = |
| 11842 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 11843 | no_of_channels = params->supported_channels[i+1]; |
| 11844 | for(k=1; k <= no_of_channels; k++) |
| 11845 | { |
| 11846 | StaParams.supported_channels[j+1] = |
| 11847 | StaParams.supported_channels[j] + wifi_chan_index; |
| 11848 | j+=1; |
| 11849 | } |
| 11850 | } |
| 11851 | StaParams.supported_channels_len = j; |
| 11852 | } |
| 11853 | vos_mem_copy(StaParams.supported_oper_classes, |
| 11854 | params->supported_oper_classes, |
| 11855 | params->supported_oper_classes_len); |
| 11856 | StaParams.supported_oper_classes_len = |
| 11857 | params->supported_oper_classes_len; |
| 11858 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11859 | if (0 != params->ext_capab_len) |
| 11860 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 11861 | sizeof(StaParams.extn_capability)); |
| 11862 | |
| 11863 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11864 | { |
| 11865 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11866 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11867 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11868 | |
| 11869 | StaParams.supported_rates_len = params->supported_rates_len; |
| 11870 | |
| 11871 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 11872 | * The supported_rates array , for all the structures propogating till Add Sta |
| 11873 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 11874 | * modified to send more rates. |
| 11875 | */ |
| 11876 | |
| 11877 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 11878 | */ |
| 11879 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 11880 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 11881 | |
| 11882 | if (0 != StaParams.supported_rates_len) { |
| 11883 | int i = 0; |
| 11884 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 11885 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11886 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11887 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 11888 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11889 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11890 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 11891 | } |
| 11892 | |
| 11893 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11894 | { |
| 11895 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11896 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11897 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11898 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11899 | if (0 != params->ext_capab_len ) { |
| 11900 | /*Define A Macro : TODO Sunil*/ |
| 11901 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 11902 | isBufSta = 1; |
| 11903 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 11904 | /* TDLS Channel Switching Support */ |
| 11905 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 11906 | isOffChannelSupported = 1; |
| 11907 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11908 | } |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 11909 | |
| 11910 | if (pHddCtx->cfg_ini->fEnableTDLSWmmMode && |
Nitesh Shah | 48df4c0 | 2016-08-12 16:27:33 +0530 | [diff] [blame] | 11911 | (params->ht_capa || params->vht_capa || |
| 11912 | (params->sta_flags_set & BIT(NL80211_STA_FLAG_WME)))) |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 11913 | /* TDLS Peer is WME/QoS capable */ |
| 11914 | isQosWmmSta = TRUE; |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 11915 | |
| 11916 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11917 | "%s: TDLS Peer is QOS capable isQosWmmSta= %d HTcapPresent= %d", |
| 11918 | __func__, isQosWmmSta, StaParams.htcap_present); |
| 11919 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 11920 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 11921 | &StaParams, isBufSta, |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 11922 | isOffChannelSupported, |
| 11923 | isQosWmmSta); |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 11924 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 11925 | if (VOS_STATUS_SUCCESS != status) { |
| 11926 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11927 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 11928 | return -EINVAL; |
| 11929 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11930 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 11931 | |
| 11932 | if (VOS_STATUS_SUCCESS != status) { |
| 11933 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11934 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 11935 | return -EINVAL; |
| 11936 | } |
| 11937 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 11938 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 11939 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11940 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11941 | return status; |
| 11942 | } |
| 11943 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 11944 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 11945 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 11946 | struct net_device *dev, |
| 11947 | const u8 *mac, |
| 11948 | struct station_parameters *params) |
| 11949 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11950 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 11951 | struct net_device *dev, |
| 11952 | u8 *mac, |
| 11953 | struct station_parameters *params) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 11954 | #endif |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11955 | { |
| 11956 | int ret; |
| 11957 | |
| 11958 | vos_ssr_protect(__func__); |
| 11959 | ret = __wlan_hdd_change_station(wiphy, dev, mac, params); |
| 11960 | vos_ssr_unprotect(__func__); |
| 11961 | |
| 11962 | return ret; |
| 11963 | } |
| 11964 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11965 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11966 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11967 | * This function is used to initialize the key information |
| 11968 | */ |
| 11969 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11970 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11971 | struct net_device *ndev, |
| 11972 | u8 key_index, bool pairwise, |
| 11973 | const u8 *mac_addr, |
| 11974 | struct key_params *params |
| 11975 | ) |
| 11976 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11977 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11978 | struct net_device *ndev, |
| 11979 | u8 key_index, const u8 *mac_addr, |
| 11980 | struct key_params *params |
| 11981 | ) |
| 11982 | #endif |
| 11983 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11984 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11985 | tCsrRoamSetKey setKey; |
| 11986 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11987 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11988 | v_U32_t roamId= 0xFF; |
| 11989 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11990 | hdd_hostapd_state_t *pHostapdState; |
| 11991 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11992 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11993 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11994 | |
| 11995 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11996 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11997 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11998 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 11999 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12000 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12001 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12002 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12003 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12004 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12005 | } |
| 12006 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12007 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 12008 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12009 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12010 | |
| 12011 | if (CSR_MAX_NUM_KEY <= key_index) |
| 12012 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 12013 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12014 | key_index); |
| 12015 | |
| 12016 | return -EINVAL; |
| 12017 | } |
| 12018 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 12019 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 12020 | { |
| 12021 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 12022 | params->key_len); |
| 12023 | |
| 12024 | return -EINVAL; |
| 12025 | } |
| 12026 | |
| 12027 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12028 | "%s: called with key index = %d & key length %d", |
| 12029 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12030 | |
| 12031 | /*extract key idx, key len and key*/ |
| 12032 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 12033 | setKey.keyId = key_index; |
| 12034 | setKey.keyLength = params->key_len; |
| 12035 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 12036 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 12037 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12038 | { |
| 12039 | case WLAN_CIPHER_SUITE_WEP40: |
| 12040 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 12041 | break; |
| 12042 | |
| 12043 | case WLAN_CIPHER_SUITE_WEP104: |
| 12044 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 12045 | break; |
| 12046 | |
| 12047 | case WLAN_CIPHER_SUITE_TKIP: |
| 12048 | { |
| 12049 | u8 *pKey = &setKey.Key[0]; |
| 12050 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 12051 | |
| 12052 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 12053 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 12054 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12055 | |
| 12056 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 12057 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12058 | |--------------|----------|----------| |
| 12059 | <---16bytes---><--8bytes--><--8bytes--> |
| 12060 | |
| 12061 | */ |
| 12062 | /*Sme expects the 32 bytes key to be in the below order |
| 12063 | |
| 12064 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 12065 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12066 | |--------------|----------|----------| |
| 12067 | <---16bytes---><--8bytes--><--8bytes--> |
| 12068 | */ |
| 12069 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 12070 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12071 | |
| 12072 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 12073 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12074 | |
| 12075 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 12076 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12077 | |
| 12078 | |
| 12079 | break; |
| 12080 | } |
| 12081 | |
| 12082 | case WLAN_CIPHER_SUITE_CCMP: |
| 12083 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 12084 | break; |
| 12085 | |
| 12086 | #ifdef FEATURE_WLAN_WAPI |
| 12087 | case WLAN_CIPHER_SUITE_SMS4: |
| 12088 | { |
| 12089 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 12090 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 12091 | params->key, params->key_len); |
| 12092 | return 0; |
| 12093 | } |
| 12094 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12095 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 12096 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12097 | case WLAN_CIPHER_SUITE_KRK: |
| 12098 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 12099 | break; |
| 12100 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12101 | |
| 12102 | #ifdef WLAN_FEATURE_11W |
| 12103 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 12104 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 12105 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12106 | #endif |
| 12107 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12108 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 12109 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12110 | __func__, params->cipher); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 12111 | status = -EOPNOTSUPP; |
| 12112 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12113 | } |
| 12114 | |
| 12115 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 12116 | __func__, setKey.encType); |
| 12117 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12118 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12119 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12120 | (!pairwise) |
| 12121 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 12122 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12123 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12124 | ) |
| 12125 | { |
| 12126 | /* set group key*/ |
| 12127 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12128 | "%s- %d: setting Broadcast key", |
| 12129 | __func__, __LINE__); |
| 12130 | setKey.keyDirection = eSIR_RX_ONLY; |
| 12131 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 12132 | } |
| 12133 | else |
| 12134 | { |
| 12135 | /* set pairwise key*/ |
| 12136 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12137 | "%s- %d: setting pairwise key", |
| 12138 | __func__, __LINE__); |
| 12139 | setKey.keyDirection = eSIR_TX_RX; |
| 12140 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 12141 | } |
| 12142 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 12143 | { |
| 12144 | setKey.keyDirection = eSIR_TX_RX; |
| 12145 | /*Set the group key*/ |
| 12146 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12147 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12148 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12149 | if ( 0 != status ) |
| 12150 | { |
| 12151 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12152 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 12153 | status = -EINVAL; |
| 12154 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12155 | } |
| 12156 | /*Save the keys here and call sme_RoamSetKey for setting |
| 12157 | the PTK after peer joins the IBSS network*/ |
| 12158 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 12159 | &setKey, sizeof(tCsrRoamSetKey)); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 12160 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 12161 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 12162 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 12163 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 12164 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12165 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 12166 | if( pHostapdState->bssState == BSS_START ) |
| 12167 | { |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 12168 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12169 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 12170 | |
| 12171 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 12172 | { |
| 12173 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12174 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 12175 | __LINE__, vos_status ); |
| 12176 | |
| 12177 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 12178 | |
| 12179 | status = -EINVAL; |
| 12180 | goto end; |
| 12181 | } |
| 12182 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12183 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 12184 | |
| 12185 | if ( status != eHAL_STATUS_SUCCESS ) |
| 12186 | { |
| 12187 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12188 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 12189 | __LINE__, status ); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 12190 | status = -EINVAL; |
| 12191 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12192 | } |
| 12193 | } |
| 12194 | |
| 12195 | /* Saving WEP keys */ |
| 12196 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 12197 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 12198 | { |
| 12199 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 12200 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 12201 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 12202 | } |
| 12203 | else |
| 12204 | { |
| 12205 | //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] | 12206 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12207 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 12208 | } |
| 12209 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 12210 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 12211 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12212 | { |
| 12213 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12214 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12215 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 12216 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12217 | if (!pairwise) |
| 12218 | #else |
| 12219 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 12220 | #endif |
| 12221 | { |
| 12222 | /* set group key*/ |
| 12223 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 12224 | { |
| 12225 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12226 | "%s- %d: Perform Set key Complete", |
| 12227 | __func__, __LINE__); |
| 12228 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 12229 | } |
| 12230 | } |
| 12231 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12232 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 12233 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 12234 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 12235 | |
| 12236 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 12237 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12238 | params->key, params->key_len); |
| 12239 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 12240 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12241 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 12242 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12243 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12244 | "%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] | 12245 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 12246 | setKey.peerMac[2], setKey.peerMac[3], |
| 12247 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12248 | setKey.keyDirection); |
| 12249 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 12250 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 12251 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 12252 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 12253 | { |
| 12254 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12255 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 12256 | __LINE__, vos_status ); |
| 12257 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 12258 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12259 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 12260 | status = -EINVAL; |
| 12261 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12262 | |
| 12263 | } |
| 12264 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12265 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 12266 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 12267 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 12268 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12269 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 12270 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12271 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 12272 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 12273 | "%s: Update PreAuth Key success", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 12274 | status = 0; |
| 12275 | goto end; |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 12276 | } |
| 12277 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 12278 | { |
| 12279 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12280 | "%s: Update PreAuth Key failed", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 12281 | status = -EINVAL; |
| 12282 | goto end; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 12283 | } |
| 12284 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12285 | |
| 12286 | /* issue set key request to SME*/ |
| 12287 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12288 | pAdapter->sessionId, &setKey, &roamId ); |
| 12289 | |
| 12290 | if ( 0 != status ) |
| 12291 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12292 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12293 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 12294 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 12295 | status = -EINVAL; |
| 12296 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12297 | } |
| 12298 | |
| 12299 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12300 | /* in case of IBSS as there was no information available about WEP keys during |
| 12301 | * 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] | 12302 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12303 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 12304 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 12305 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12306 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 12307 | ) |
| 12308 | && |
| 12309 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 12310 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 12311 | ) |
| 12312 | ) |
| 12313 | { |
| 12314 | setKey.keyDirection = eSIR_RX_ONLY; |
| 12315 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 12316 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12317 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12318 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12319 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 12320 | setKey.peerMac[2], setKey.peerMac[3], |
| 12321 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12322 | setKey.keyDirection); |
| 12323 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12324 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12325 | pAdapter->sessionId, &setKey, &roamId ); |
| 12326 | |
| 12327 | if ( 0 != status ) |
| 12328 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12329 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12330 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12331 | __func__, status); |
| 12332 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 12333 | status = -EINVAL; |
| 12334 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12335 | } |
| 12336 | } |
| 12337 | } |
| 12338 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 12339 | end: |
| 12340 | /* Need to clear any trace of key value in the memory. |
| 12341 | * Thus zero out the memory even though it is local |
| 12342 | * variable. |
| 12343 | */ |
| 12344 | vos_mem_zero(&setKey, sizeof(setKey)); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12345 | EXIT(); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 12346 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12347 | } |
| 12348 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 12349 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12350 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 12351 | struct net_device *ndev, |
| 12352 | u8 key_index, bool pairwise, |
| 12353 | const u8 *mac_addr, |
| 12354 | struct key_params *params |
| 12355 | ) |
| 12356 | #else |
| 12357 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 12358 | struct net_device *ndev, |
| 12359 | u8 key_index, const u8 *mac_addr, |
| 12360 | struct key_params *params |
| 12361 | ) |
| 12362 | #endif |
| 12363 | { |
| 12364 | int ret; |
| 12365 | vos_ssr_protect(__func__); |
| 12366 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12367 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 12368 | mac_addr, params); |
| 12369 | #else |
| 12370 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 12371 | params); |
| 12372 | #endif |
| 12373 | vos_ssr_unprotect(__func__); |
| 12374 | |
| 12375 | return ret; |
| 12376 | } |
| 12377 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12378 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 12379 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12380 | * This function is used to get the key information |
| 12381 | */ |
| 12382 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 12383 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12384 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12385 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12386 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12387 | const u8 *mac_addr, void *cookie, |
| 12388 | void (*callback)(void *cookie, struct key_params*) |
| 12389 | ) |
| 12390 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 12391 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12392 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12393 | struct net_device *ndev, |
| 12394 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 12395 | void (*callback)(void *cookie, struct key_params*) |
| 12396 | ) |
| 12397 | #endif |
| 12398 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12399 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 12400 | hdd_wext_state_t *pWextState = NULL; |
| 12401 | tCsrRoamProfile *pRoamProfile = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12402 | struct key_params params; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 12403 | hdd_context_t *pHddCtx; |
| 12404 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12405 | |
| 12406 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12407 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 12408 | if (NULL == pAdapter) |
| 12409 | { |
| 12410 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12411 | "%s: HDD adapter is Null", __func__); |
| 12412 | return -ENODEV; |
| 12413 | } |
| 12414 | |
| 12415 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12416 | ret = wlan_hdd_validate_context(pHddCtx); |
| 12417 | if (0 != ret) |
| 12418 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 12419 | return ret; |
| 12420 | } |
| 12421 | |
| 12422 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12423 | pRoamProfile = &(pWextState->roamProfile); |
| 12424 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12425 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 12426 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12427 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12428 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12429 | memset(¶ms, 0, sizeof(params)); |
| 12430 | |
| 12431 | if (CSR_MAX_NUM_KEY <= key_index) |
| 12432 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12433 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12434 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12435 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12436 | |
| 12437 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 12438 | { |
| 12439 | case eCSR_ENCRYPT_TYPE_NONE: |
| 12440 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 12441 | break; |
| 12442 | |
| 12443 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 12444 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 12445 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 12446 | break; |
| 12447 | |
| 12448 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 12449 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 12450 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 12451 | break; |
| 12452 | |
| 12453 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 12454 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 12455 | break; |
| 12456 | |
| 12457 | case eCSR_ENCRYPT_TYPE_AES: |
| 12458 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 12459 | break; |
| 12460 | |
| 12461 | default: |
| 12462 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 12463 | break; |
| 12464 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12465 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 12466 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12467 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 12468 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12469 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12470 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 12471 | params.seq_len = 0; |
| 12472 | params.seq = NULL; |
| 12473 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 12474 | callback(cookie, ¶ms); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12475 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12476 | return 0; |
| 12477 | } |
| 12478 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 12479 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12480 | static int wlan_hdd_cfg80211_get_key( |
| 12481 | struct wiphy *wiphy, |
| 12482 | struct net_device *ndev, |
| 12483 | u8 key_index, bool pairwise, |
| 12484 | const u8 *mac_addr, void *cookie, |
| 12485 | void (*callback)(void *cookie, struct key_params*) |
| 12486 | ) |
| 12487 | #else |
| 12488 | static int wlan_hdd_cfg80211_get_key( |
| 12489 | struct wiphy *wiphy, |
| 12490 | struct net_device *ndev, |
| 12491 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 12492 | void (*callback)(void *cookie, struct key_params*) |
| 12493 | ) |
| 12494 | #endif |
| 12495 | { |
| 12496 | int ret; |
| 12497 | |
| 12498 | vos_ssr_protect(__func__); |
| 12499 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12500 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 12501 | mac_addr, cookie, callback); |
| 12502 | #else |
| 12503 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 12504 | callback); |
| 12505 | #endif |
| 12506 | vos_ssr_unprotect(__func__); |
| 12507 | |
| 12508 | return ret; |
| 12509 | } |
| 12510 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12511 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12512 | * FUNCTION: __wlan_hdd_cfg80211_del_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12513 | * This function is used to delete the key information |
| 12514 | */ |
| 12515 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12516 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12517 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12518 | u8 key_index, |
| 12519 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12520 | const u8 *mac_addr |
| 12521 | ) |
| 12522 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12523 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12524 | struct net_device *ndev, |
| 12525 | u8 key_index, |
| 12526 | const u8 *mac_addr |
| 12527 | ) |
| 12528 | #endif |
| 12529 | { |
| 12530 | int status = 0; |
| 12531 | |
| 12532 | //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] | 12533 | //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] | 12534 | //it is observed that this is invalidating peer |
| 12535 | //key index whenever re-key is done. This is affecting data link. |
| 12536 | //It should be ok to ignore del_key. |
| 12537 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12538 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 12539 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12540 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 12541 | tCsrRoamSetKey setKey; |
| 12542 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12543 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12544 | ENTER(); |
| 12545 | |
| 12546 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 12547 | __func__,pAdapter->device_mode); |
| 12548 | |
| 12549 | if (CSR_MAX_NUM_KEY <= key_index) |
| 12550 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12551 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12552 | key_index); |
| 12553 | |
| 12554 | return -EINVAL; |
| 12555 | } |
| 12556 | |
| 12557 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 12558 | setKey.keyId = key_index; |
| 12559 | |
| 12560 | if (mac_addr) |
| 12561 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 12562 | else |
| 12563 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 12564 | |
| 12565 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 12566 | |
| 12567 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12568 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12569 | ) |
| 12570 | { |
| 12571 | |
| 12572 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12573 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 12574 | if( pHostapdState->bssState == BSS_START) |
| 12575 | { |
| 12576 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12577 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12578 | if ( status != eHAL_STATUS_SUCCESS ) |
| 12579 | { |
| 12580 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12581 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 12582 | __LINE__, status ); |
| 12583 | } |
| 12584 | } |
| 12585 | } |
| 12586 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12587 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12588 | ) |
| 12589 | { |
| 12590 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12591 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12592 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 12593 | |
| 12594 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12595 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12596 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 12597 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12598 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12599 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 12600 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12601 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12602 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12603 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12604 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12605 | if ( 0 != status ) |
| 12606 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12607 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12608 | "%s: sme_RoamSetKey failure, returned %d", |
| 12609 | __func__, status); |
| 12610 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 12611 | return -EINVAL; |
| 12612 | } |
| 12613 | } |
| 12614 | } |
| 12615 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12616 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12617 | return status; |
| 12618 | } |
| 12619 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 12620 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12621 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 12622 | struct net_device *ndev, |
| 12623 | u8 key_index, |
| 12624 | bool pairwise, |
| 12625 | const u8 *mac_addr |
| 12626 | ) |
| 12627 | #else |
| 12628 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 12629 | struct net_device *ndev, |
| 12630 | u8 key_index, |
| 12631 | const u8 *mac_addr |
| 12632 | ) |
| 12633 | #endif |
| 12634 | { |
| 12635 | int ret; |
| 12636 | |
| 12637 | vos_ssr_protect(__func__); |
| 12638 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12639 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, pairwise, |
| 12640 | mac_addr); |
| 12641 | #else |
| 12642 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, mac_addr); |
| 12643 | #endif |
| 12644 | vos_ssr_unprotect(__func__); |
| 12645 | |
| 12646 | return ret; |
| 12647 | } |
| 12648 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12649 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 12650 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12651 | * This function is used to set the default tx key index |
| 12652 | */ |
| 12653 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 12654 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12655 | struct net_device *ndev, |
| 12656 | u8 key_index, |
| 12657 | bool unicast, bool multicast) |
| 12658 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 12659 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12660 | struct net_device *ndev, |
| 12661 | u8 key_index) |
| 12662 | #endif |
| 12663 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12664 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12665 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 12666 | hdd_wext_state_t *pWextState; |
| 12667 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12668 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12669 | |
| 12670 | ENTER(); |
| 12671 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 12672 | if ((NULL == pAdapter)) |
| 12673 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12674 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 12675 | "invalid adapter"); |
| 12676 | return -EINVAL; |
| 12677 | } |
| 12678 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12679 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12680 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 12681 | pAdapter->sessionId, key_index)); |
| 12682 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 12683 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12684 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12685 | |
| 12686 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 12687 | { |
| 12688 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 12689 | "invalid Wext state or HDD context"); |
| 12690 | return -EINVAL; |
| 12691 | } |
| 12692 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12693 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12694 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12695 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12696 | if (CSR_MAX_NUM_KEY <= key_index) |
| 12697 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12698 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12699 | key_index); |
| 12700 | |
| 12701 | return -EINVAL; |
| 12702 | } |
| 12703 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12704 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12705 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12706 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12707 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12708 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12709 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12710 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12711 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12712 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12713 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12714 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 12715 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 12716 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12717 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 12718 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12719 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12720 | { |
| 12721 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12722 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12723 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12724 | tCsrRoamSetKey setKey; |
| 12725 | v_U32_t roamId= 0xFF; |
| 12726 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12727 | |
| 12728 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12729 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12730 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12731 | Keys->defaultIndex = (u8)key_index; |
| 12732 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 12733 | setKey.keyId = key_index; |
| 12734 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12735 | |
| 12736 | vos_mem_copy(&setKey.Key[0], |
| 12737 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12738 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12739 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 12740 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12741 | |
| 12742 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12743 | &pHddStaCtx->conn_info.bssId[0], |
| 12744 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12745 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 12746 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 12747 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 12748 | eCSR_ENCRYPT_TYPE_WEP104) |
| 12749 | { |
| 12750 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 12751 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 12752 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 12753 | type(104) and switching encryption type to 40*/ |
| 12754 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 12755 | eCSR_ENCRYPT_TYPE_WEP40; |
| 12756 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 12757 | eCSR_ENCRYPT_TYPE_WEP40; |
| 12758 | } |
| 12759 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12760 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12761 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12762 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12763 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12764 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12765 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12766 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12767 | if ( 0 != status ) |
| 12768 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12769 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12770 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12771 | status); |
| 12772 | return -EINVAL; |
| 12773 | } |
| 12774 | } |
| 12775 | } |
| 12776 | |
| 12777 | /* In SoftAp mode setting key direction for default mode */ |
| 12778 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 12779 | { |
| 12780 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 12781 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 12782 | (eCSR_ENCRYPT_TYPE_AES != |
| 12783 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 12784 | ) |
| 12785 | { |
| 12786 | /* Saving key direction for default key index to TX default */ |
| 12787 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 12788 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 12789 | } |
| 12790 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12791 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12792 | return status; |
| 12793 | } |
| 12794 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 12795 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12796 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 12797 | struct net_device *ndev, |
| 12798 | u8 key_index, |
| 12799 | bool unicast, bool multicast) |
| 12800 | #else |
| 12801 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 12802 | struct net_device *ndev, |
| 12803 | u8 key_index) |
| 12804 | #endif |
| 12805 | { |
| 12806 | int ret; |
| 12807 | vos_ssr_protect(__func__); |
| 12808 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12809 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 12810 | multicast); |
| 12811 | #else |
| 12812 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 12813 | #endif |
| 12814 | vos_ssr_unprotect(__func__); |
| 12815 | |
| 12816 | return ret; |
| 12817 | } |
| 12818 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12819 | /* |
| 12820 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 12821 | * This function is used to inform the BSS details to nl80211 interface. |
| 12822 | */ |
| 12823 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 12824 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 12825 | { |
| 12826 | struct net_device *dev = pAdapter->dev; |
| 12827 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 12828 | struct wiphy *wiphy = wdev->wiphy; |
| 12829 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 12830 | int chan_no; |
| 12831 | int ie_length; |
| 12832 | const char *ie; |
| 12833 | unsigned int freq; |
| 12834 | struct ieee80211_channel *chan; |
| 12835 | int rssi = 0; |
| 12836 | struct cfg80211_bss *bss = NULL; |
| 12837 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12838 | if( NULL == pBssDesc ) |
| 12839 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12840 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12841 | return bss; |
| 12842 | } |
| 12843 | |
| 12844 | chan_no = pBssDesc->channelId; |
| 12845 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 12846 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 12847 | |
| 12848 | if( NULL == ie ) |
| 12849 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12850 | 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] | 12851 | return bss; |
| 12852 | } |
| 12853 | |
| 12854 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 12855 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 12856 | { |
| 12857 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 12858 | } |
| 12859 | else |
| 12860 | { |
| 12861 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 12862 | } |
| 12863 | #else |
| 12864 | freq = ieee80211_channel_to_frequency(chan_no); |
| 12865 | #endif |
| 12866 | |
| 12867 | chan = __ieee80211_get_channel(wiphy, freq); |
| 12868 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 12869 | if (!chan) { |
| 12870 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 12871 | return NULL; |
| 12872 | } |
| 12873 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 12874 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12875 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 12876 | return cfg80211_inform_bss(wiphy, chan, |
| 12877 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 12878 | CFG80211_BSS_FTYPE_UNKNOWN, |
| 12879 | #endif |
| 12880 | pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12881 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12882 | pBssDesc->capabilityInfo, |
| 12883 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 12884 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12885 | } |
| 12886 | |
Abhishek Singh | 72c2f4e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 12887 | /* |
| 12888 | * wlan_hdd_cfg80211_update_bss_list :to inform nl80211 |
| 12889 | * interface that BSS might have been lost. |
| 12890 | * @pAdapter: adaptor |
| 12891 | * @bssid: bssid which might have been lost |
| 12892 | * |
| 12893 | * Return: bss which is unlinked from kernel cache |
| 12894 | */ |
| 12895 | struct cfg80211_bss* wlan_hdd_cfg80211_update_bss_list( |
| 12896 | hdd_adapter_t *pAdapter, tSirMacAddr bssid) |
| 12897 | { |
| 12898 | struct net_device *dev = pAdapter->dev; |
| 12899 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 12900 | struct wiphy *wiphy = wdev->wiphy; |
| 12901 | struct cfg80211_bss *bss = NULL; |
| 12902 | |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 12903 | bss = hdd_get_bss_entry(wiphy, |
| 12904 | NULL, bssid, |
| 12905 | NULL, 0); |
Abhishek Singh | 72c2f4e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 12906 | if (bss == NULL) { |
| 12907 | hddLog(LOGE, FL("BSS not present")); |
| 12908 | } else { |
| 12909 | hddLog(LOG1, FL("cfg80211_unlink_bss called for BSSID " |
| 12910 | MAC_ADDRESS_STR), MAC_ADDR_ARRAY(bssid)); |
| 12911 | cfg80211_unlink_bss(wiphy, bss); |
| 12912 | } |
| 12913 | return bss; |
| 12914 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12915 | |
| 12916 | |
| 12917 | /* |
| 12918 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 12919 | * This function is used to inform the BSS details to nl80211 interface. |
| 12920 | */ |
| 12921 | struct cfg80211_bss* |
| 12922 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 12923 | tSirBssDescription *bss_desc |
| 12924 | ) |
| 12925 | { |
| 12926 | /* |
| 12927 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 12928 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 12929 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 12930 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 12931 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 12932 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 12933 | cfg80211_inform_bss_frame. |
| 12934 | */ |
| 12935 | struct net_device *dev = pAdapter->dev; |
| 12936 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 12937 | struct wiphy *wiphy = wdev->wiphy; |
| 12938 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 12939 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 12940 | qcom_ie_age *qie_age = NULL; |
| 12941 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 12942 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12943 | 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] | 12944 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12945 | const char *ie = |
| 12946 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 12947 | unsigned int freq; |
| 12948 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 12949 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12950 | struct cfg80211_bss *bss_status = NULL; |
| 12951 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 12952 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12953 | hdd_context_t *pHddCtx; |
| 12954 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12955 | #ifdef WLAN_OPEN_SOURCE |
| 12956 | struct timespec ts; |
| 12957 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12958 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12959 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12960 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12961 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12962 | if (0 != status) |
| 12963 | { |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 12964 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12965 | } |
| 12966 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 12967 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12968 | if (!mgmt) |
| 12969 | { |
| 12970 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12971 | "%s: memory allocation failed ", __func__); |
| 12972 | return NULL; |
| 12973 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 12974 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12975 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12976 | |
| 12977 | #ifdef WLAN_OPEN_SOURCE |
| 12978 | /* Android does not want the timestamp from the frame. |
| 12979 | Instead it wants a monotonic increasing value */ |
| 12980 | get_monotonic_boottime(&ts); |
| 12981 | mgmt->u.probe_resp.timestamp = |
| 12982 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 12983 | #else |
| 12984 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12985 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 12986 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12987 | |
| 12988 | #endif |
| 12989 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12990 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 12991 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 12992 | |
| 12993 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 12994 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 12995 | /* Assuming this is the last IE, copy at the end */ |
| 12996 | ie_length -=sizeof(qcom_ie_age); |
| 12997 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 12998 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 12999 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 13000 | qie_age->oui_1 = QCOM_OUI1; |
| 13001 | qie_age->oui_2 = QCOM_OUI2; |
| 13002 | qie_age->oui_3 = QCOM_OUI3; |
| 13003 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
Selvaraj, Sridhar | 4b3a836 | 2016-10-12 12:34:08 +0530 | [diff] [blame] | 13004 | /* Lowi expects the timestamp of bss in units of 1/10 ms. In driver all |
| 13005 | * bss related timestamp is in units of ms. Due to this when scan results |
| 13006 | * are sent to lowi the scan age is high.To address this, send age in units |
| 13007 | * of 1/10 ms. |
| 13008 | */ |
| 13009 | qie_age->age = (vos_timer_get_system_time() - |
| 13010 | bss_desc->nReceivedTime)/10; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 13011 | #endif |
| 13012 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13013 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 13014 | if (bss_desc->fProbeRsp) |
| 13015 | { |
| 13016 | mgmt->frame_control |= |
| 13017 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 13018 | } |
| 13019 | else |
| 13020 | { |
| 13021 | mgmt->frame_control |= |
| 13022 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 13023 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13024 | |
| 13025 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13026 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13027 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 13028 | { |
| 13029 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 13030 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13031 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13032 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 13033 | |
| 13034 | { |
| 13035 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 13036 | } |
| 13037 | else |
| 13038 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13039 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 13040 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13041 | kfree(mgmt); |
| 13042 | return NULL; |
| 13043 | } |
| 13044 | #else |
| 13045 | freq = ieee80211_channel_to_frequency(chan_no); |
| 13046 | #endif |
| 13047 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 13048 | /*when the band is changed on the fly using the GUI, three things are done |
| 13049 | * 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) |
| 13050 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 13051 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 13052 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 13053 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 13054 | * 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 |
| 13055 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 13056 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 13057 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 13058 | * So drop the bss and continue to next bss. |
| 13059 | */ |
| 13060 | if(chan == NULL) |
| 13061 | { |
Deepthi Gowri | 306657b | 2016-04-28 17:10:41 +0530 | [diff] [blame] | 13062 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13063 | FL("chan pointer is NULL, chan_no: %d freq: %d"), |
| 13064 | chan_no, freq); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 13065 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 13066 | return NULL; |
| 13067 | } |
Hanumantha Reddy Pothula | 904bcef | 2015-06-19 11:56:29 +0530 | [diff] [blame] | 13068 | /*To keep the rssi icon of the connected AP in the scan window |
| 13069 | *and the rssi icon of the wireless networks in sync |
| 13070 | * */ |
| 13071 | if (( eConnectionState_Associated == |
| 13072 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 13073 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 13074 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 13075 | WNI_CFG_BSSID_LEN)) && |
| 13076 | (pHddCtx->hdd_wlan_suspended == FALSE)) |
| 13077 | { |
| 13078 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 13079 | rssi = (pAdapter->rssi * 100); |
| 13080 | } |
| 13081 | else |
| 13082 | { |
| 13083 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 13084 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13085 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13086 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
Sushant Kaushik | 0b34342 | 2015-05-25 17:15:55 +0530 | [diff] [blame] | 13087 | " RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 13088 | vos_freq_to_chan(chan->center_freq), (int)(rssi/100)); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13089 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13090 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 13091 | frame_len, rssi, GFP_KERNEL); |
| 13092 | kfree(mgmt); |
| 13093 | return bss_status; |
| 13094 | } |
| 13095 | |
| 13096 | /* |
| 13097 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 13098 | * This function is used to update the BSS data base of CFG8011 |
| 13099 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13100 | 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] | 13101 | tCsrRoamInfo *pRoamInfo |
| 13102 | ) |
| 13103 | { |
| 13104 | tCsrRoamConnectedProfile roamProfile; |
| 13105 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 13106 | struct cfg80211_bss *bss = NULL; |
| 13107 | |
| 13108 | ENTER(); |
| 13109 | |
| 13110 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 13111 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 13112 | |
| 13113 | if (NULL != roamProfile.pBssDesc) |
| 13114 | { |
Girish Gowli | f4b6802 | 2014-08-28 23:18:57 +0530 | [diff] [blame] | 13115 | bss = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 13116 | roamProfile.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13117 | |
| 13118 | if (NULL == bss) |
| 13119 | { |
| 13120 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 13121 | __func__); |
| 13122 | } |
| 13123 | |
| 13124 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 13125 | } |
| 13126 | else |
| 13127 | { |
| 13128 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 13129 | __func__); |
| 13130 | } |
| 13131 | return bss; |
| 13132 | } |
| 13133 | |
| 13134 | /* |
| 13135 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 13136 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13137 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 13138 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13139 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13140 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13141 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13142 | tCsrScanResultInfo *pScanResult; |
| 13143 | eHalStatus status = 0; |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 13144 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13145 | tScanResultHandle pResult; |
| 13146 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 13147 | hdd_context_t *pHddCtx; |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 13148 | bool is_p2p_scan = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13149 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13150 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13151 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13152 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 13153 | NO_SESSION, pAdapter->sessionId)); |
| 13154 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 13155 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 13156 | ret = wlan_hdd_validate_context(pHddCtx); |
| 13157 | if (0 != ret) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13158 | { |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 13159 | return ret; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 13160 | } |
| 13161 | |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 13162 | if (pAdapter->request != NULL) |
| 13163 | { |
| 13164 | if ((pAdapter->request->n_ssids == 1) |
| 13165 | && (pAdapter->request->ssids != NULL) |
| 13166 | && vos_mem_compare(&pAdapter->request->ssids[0], "DIRECT-", 7)) |
| 13167 | is_p2p_scan = true; |
| 13168 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13169 | /* |
| 13170 | * start getting scan results and populate cgf80211 BSS database |
| 13171 | */ |
| 13172 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 13173 | |
| 13174 | /* no scan results */ |
| 13175 | if (NULL == pResult) |
| 13176 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13177 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 13178 | __func__, status); |
Mahesh A Saptasagar | 51dc36c | 2015-06-16 12:07:15 +0530 | [diff] [blame] | 13179 | wlan_hdd_get_frame_logs(pAdapter, |
| 13180 | WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13181 | return status; |
| 13182 | } |
| 13183 | |
| 13184 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 13185 | |
| 13186 | while (pScanResult) |
| 13187 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13188 | /* |
| 13189 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 13190 | * entry already exists in bss data base of cfg80211 for that |
| 13191 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 13192 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 13193 | * mgmt packet as input. As of now there is no possibility to get |
| 13194 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13195 | * ieee80211_mgmt(probe response) and passing to c |
| 13196 | * fg80211_inform_bss_frame. |
| 13197 | * */ |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 13198 | if(is_p2p_scan && (pScanResult->ssId.ssId != NULL) && |
| 13199 | !vos_mem_compare( pScanResult->ssId.ssId, "DIRECT-", 7) ) |
| 13200 | { |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 13201 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 13202 | continue; //Skip the non p2p bss entries |
| 13203 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13204 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 13205 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13206 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13207 | |
| 13208 | if (NULL == bss_status) |
| 13209 | { |
| 13210 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13211 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13212 | } |
| 13213 | else |
| 13214 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 13215 | cfg80211_put_bss( |
| 13216 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 13217 | wiphy, |
| 13218 | #endif |
| 13219 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13220 | } |
| 13221 | |
| 13222 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 13223 | } |
| 13224 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13225 | sme_ScanResultPurge(hHal, pResult); |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 13226 | is_p2p_scan = false; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13227 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13228 | } |
| 13229 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13230 | void |
| 13231 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 13232 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13233 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 13234 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13235 | } /****** end hddPrintMacAddr() ******/ |
| 13236 | |
| 13237 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 13238 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13239 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13240 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13241 | "%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] | 13242 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 13243 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 13244 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13245 | } /****** end hddPrintPmkId() ******/ |
| 13246 | |
| 13247 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 13248 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 13249 | |
| 13250 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 13251 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 13252 | |
| 13253 | #define dump_bssid(bssid) \ |
| 13254 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13255 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 13256 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13257 | } |
| 13258 | |
| 13259 | #define dump_pmkid(pMac, pmkid) \ |
| 13260 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13261 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 13262 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13263 | } |
| 13264 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 13265 | #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] | 13266 | /* |
| 13267 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 13268 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 13269 | */ |
| 13270 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13271 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13272 | int index, bool preauth ) |
| 13273 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13274 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13275 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 13276 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13277 | |
| 13278 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13279 | 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] | 13280 | |
| 13281 | if( NULL == pRoamInfo ) |
| 13282 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13283 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13284 | return -EINVAL; |
| 13285 | } |
| 13286 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 13287 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 13288 | { |
| 13289 | dump_bssid(pRoamInfo->bssid); |
| 13290 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13291 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 13292 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13293 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13294 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13295 | } |
| 13296 | #endif //FEATURE_WLAN_LFR |
| 13297 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 13298 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 13299 | /* |
| 13300 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 13301 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 13302 | * |
| 13303 | */ |
| 13304 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 13305 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 13306 | tCsrRoamInfo *pRoamInfo) |
| 13307 | { |
| 13308 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 13309 | union iwreq_data wrqu; |
| 13310 | |
| 13311 | ENTER(); |
| 13312 | |
| 13313 | if (NULL == pAdapter) |
| 13314 | { |
| 13315 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 13316 | return VOS_STATUS_E_FAILURE; |
| 13317 | } |
| 13318 | |
| 13319 | /* create the event */ |
| 13320 | memset(&wrqu, 0, sizeof(wrqu)); |
| 13321 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 13322 | |
| 13323 | wrqu.data.pointer = metrics_notification; |
| 13324 | wrqu.data.length = scnprintf(metrics_notification, |
| 13325 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 13326 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 13327 | |
| 13328 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 13329 | |
| 13330 | EXIT(); |
| 13331 | |
| 13332 | return VOS_STATUS_SUCCESS; |
| 13333 | } |
| 13334 | |
| 13335 | /* |
| 13336 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 13337 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 13338 | * or failure |
| 13339 | */ |
| 13340 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 13341 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 13342 | { |
| 13343 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 13344 | union iwreq_data wrqu; |
| 13345 | |
| 13346 | ENTER(); |
| 13347 | |
| 13348 | if (NULL == pAdapter) |
| 13349 | { |
| 13350 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 13351 | return VOS_STATUS_E_FAILURE; |
| 13352 | } |
| 13353 | |
| 13354 | /* create the event */ |
| 13355 | memset(&wrqu, 0, sizeof(wrqu)); |
| 13356 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 13357 | |
| 13358 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 13359 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 13360 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 13361 | |
| 13362 | if (1 == preauth_status) |
| 13363 | strncat(metrics_notification, " TRUE", 5); |
| 13364 | else |
| 13365 | strncat(metrics_notification, " FALSE", 6); |
| 13366 | |
| 13367 | wrqu.data.pointer = metrics_notification; |
| 13368 | wrqu.data.length = strlen(metrics_notification); |
| 13369 | |
| 13370 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 13371 | |
| 13372 | EXIT(); |
| 13373 | |
| 13374 | return VOS_STATUS_SUCCESS; |
| 13375 | } |
| 13376 | |
| 13377 | /* |
| 13378 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 13379 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 13380 | * |
| 13381 | */ |
| 13382 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 13383 | tCsrRoamInfo *pRoamInfo) |
| 13384 | { |
| 13385 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 13386 | union iwreq_data wrqu; |
| 13387 | |
| 13388 | ENTER(); |
| 13389 | |
| 13390 | if (NULL == pAdapter) |
| 13391 | { |
| 13392 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 13393 | return VOS_STATUS_E_FAILURE; |
| 13394 | } |
| 13395 | |
| 13396 | /* create the event */ |
| 13397 | memset(&wrqu, 0, sizeof(wrqu)); |
| 13398 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 13399 | |
| 13400 | wrqu.data.pointer = metrics_notification; |
| 13401 | wrqu.data.length = scnprintf(metrics_notification, |
| 13402 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 13403 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 13404 | |
| 13405 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 13406 | |
| 13407 | EXIT(); |
| 13408 | |
| 13409 | return VOS_STATUS_SUCCESS; |
| 13410 | } |
| 13411 | #endif |
| 13412 | |
Manjeet Singh | aaee9cd | 2016-09-13 19:23:30 +0530 | [diff] [blame] | 13413 | |
| 13414 | /** |
| 13415 | * wlan_hdd_cfg80211_validate_scan_req - validate scan request |
| 13416 | * @scan_req: scan request to be checked |
| 13417 | * |
| 13418 | * Return: true or false |
| 13419 | */ |
| 13420 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) |
| 13421 | static inline bool wlan_hdd_cfg80211_validate_scan_req(struct |
| 13422 | cfg80211_scan_request |
| 13423 | *scan_req) |
| 13424 | { |
| 13425 | if (!scan_req || !scan_req->wiphy) { |
| 13426 | hddLog(VOS_TRACE_LEVEL_ERROR, "Invalid scan request"); |
| 13427 | return false; |
| 13428 | } |
| 13429 | if (vos_is_load_unload_in_progress(VOS_MODULE_ID_HDD, NULL)) { |
| 13430 | hddLog(VOS_TRACE_LEVEL_ERROR, "Load/Unload in progress"); |
| 13431 | return false; |
| 13432 | } |
| 13433 | return true; |
| 13434 | } |
| 13435 | #else |
| 13436 | static inline bool wlan_hdd_cfg80211_validate_scan_req(struct |
| 13437 | cfg80211_scan_request |
| 13438 | *scan_req) |
| 13439 | { |
| 13440 | if (!scan_req || !scan_req->wiphy) { |
| 13441 | hddLog(VOS_TRACE_LEVEL_ERROR, "Invalid scan request"); |
| 13442 | return false; |
| 13443 | } |
| 13444 | return true; |
| 13445 | } |
| 13446 | #endif |
| 13447 | |
| 13448 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13449 | /* |
| 13450 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 13451 | * scanning callback function, called after finishing scan |
| 13452 | * |
| 13453 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13454 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13455 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 13456 | { |
| 13457 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13458 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13459 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 13460 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13461 | struct cfg80211_scan_request *req = NULL; |
| 13462 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 13463 | bool aborted = false; |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 13464 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 13465 | bool iface_down = false; |
| 13466 | #endif |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13467 | long waitRet = 0; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13468 | tANI_U8 i; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 13469 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13470 | |
| 13471 | ENTER(); |
| 13472 | |
c_manjee | 1b4ab9a | 2016-10-26 11:36:55 +0530 | [diff] [blame] | 13473 | if (!pAdapter || pAdapter->magic != WLAN_HDD_ADAPTER_MAGIC || |
| 13474 | !pAdapter->dev) { |
| 13475 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Adapter is not valid")); |
| 13476 | return 0; |
| 13477 | } |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 13478 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Siddharth Bhal | 5c2e02d | 2015-05-05 17:35:29 +0530 | [diff] [blame] | 13479 | if (NULL == pHddCtx) { |
| 13480 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is Null")); |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 13481 | return 0; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 13482 | } |
| 13483 | |
Mahesh A Saptasagar | 1129675 | 2016-01-07 17:53:02 +0530 | [diff] [blame] | 13484 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 13485 | if (!(pAdapter->dev->flags & IFF_UP)) |
| 13486 | { |
| 13487 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Interface is down")); |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 13488 | iface_down = true; |
Mahesh A Saptasagar | 1129675 | 2016-01-07 17:53:02 +0530 | [diff] [blame] | 13489 | } |
| 13490 | #endif |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 13491 | pScanInfo = &pHddCtx->scan_info; |
| 13492 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13493 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13494 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13495 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13496 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 13497 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 13498 | pScanInfo->mScanPendingCounter = 0; |
| 13499 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13500 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13501 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13502 | &pScanInfo->scan_req_completion_event, |
| 13503 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13504 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13505 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13506 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13507 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13508 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13509 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13510 | } |
| 13511 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 13512 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13513 | { |
| 13514 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13515 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13516 | } |
| 13517 | |
| 13518 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13519 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13520 | { |
| 13521 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13522 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13523 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13524 | (int) scanId); |
| 13525 | } |
| 13526 | |
Mahesh A Saptasagar | 9dd7284 | 2016-04-15 19:45:14 +0530 | [diff] [blame] | 13527 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 13528 | if (!iface_down) |
Mahesh A Saptasagar | 9dd7284 | 2016-04-15 19:45:14 +0530 | [diff] [blame] | 13529 | #endif |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 13530 | { |
| 13531 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
| 13532 | pAdapter); |
| 13533 | if (0 > ret) |
| 13534 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | 9dd7284 | 2016-04-15 19:45:14 +0530 | [diff] [blame] | 13535 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13536 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13537 | /* If any client wait scan result through WEXT |
| 13538 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 13539 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13540 | { |
| 13541 | /* The other scan request waiting for current scan finish |
| 13542 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 13543 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13544 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 13545 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13546 | } |
| 13547 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 13548 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13549 | { |
| 13550 | struct net_device *dev = pAdapter->dev; |
| 13551 | union iwreq_data wrqu; |
| 13552 | int we_event; |
| 13553 | char *msg; |
| 13554 | |
| 13555 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 13556 | we_event = SIOCGIWSCAN; |
| 13557 | msg = NULL; |
| 13558 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 13559 | } |
| 13560 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 13561 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13562 | |
| 13563 | /* Get the Scan Req */ |
| 13564 | req = pAdapter->request; |
mukul sharma | e704182 | 2015-12-03 15:09:21 +0530 | [diff] [blame] | 13565 | pAdapter->request = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13566 | |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 13567 | /* Scan is no longer pending */ |
| 13568 | pScanInfo->mScanPending = VOS_FALSE; |
| 13569 | |
Manjeet Singh | aaee9cd | 2016-09-13 19:23:30 +0530 | [diff] [blame] | 13570 | if (!wlan_hdd_cfg80211_validate_scan_req(req)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13571 | { |
Manjeet Singh | aaee9cd | 2016-09-13 19:23:30 +0530 | [diff] [blame] | 13572 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 13573 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("interface state %s"), |
| 13574 | iface_down ? "up" : "down"); |
| 13575 | #endif |
| 13576 | |
| 13577 | if (pAdapter->dev) { |
| 13578 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("device name %s"), |
| 13579 | pAdapter->dev->name); |
| 13580 | } |
mukul sharma | e704182 | 2015-12-03 15:09:21 +0530 | [diff] [blame] | 13581 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13582 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13583 | } |
| 13584 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13585 | /* last_scan_timestamp is used to decide if new scan |
| 13586 | * is needed or not on station interface. If last station |
| 13587 | * scan time and new station scan time is less then |
| 13588 | * last_scan_timestamp ; driver will return cached scan. |
| 13589 | */ |
| 13590 | if (req->no_cck == FALSE && status == eCSR_SCAN_SUCCESS) // no_cck will be set during p2p find |
| 13591 | { |
| 13592 | pScanInfo->last_scan_timestamp = vos_timer_get_system_time(); |
| 13593 | |
| 13594 | if ( req->n_channels ) |
| 13595 | { |
| 13596 | for (i = 0; i < req->n_channels ; i++ ) |
| 13597 | { |
| 13598 | pHddCtx->scan_info.last_scan_channelList[i] = req->channels[i]->hw_value; |
| 13599 | } |
| 13600 | /* store no of channel scanned */ |
| 13601 | pHddCtx->scan_info.last_scan_numChannels= req->n_channels; |
| 13602 | } |
| 13603 | |
| 13604 | } |
| 13605 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 13606 | /* |
| 13607 | * cfg80211_scan_done informing NL80211 about completion |
| 13608 | * of scanning |
| 13609 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 13610 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 13611 | { |
| 13612 | aborted = true; |
| 13613 | } |
mukul sharma | e704182 | 2015-12-03 15:09:21 +0530 | [diff] [blame] | 13614 | |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 13615 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 13616 | if (!iface_down) |
| 13617 | #endif |
| 13618 | cfg80211_scan_done(req, aborted); |
mukul sharma | e704182 | 2015-12-03 15:09:21 +0530 | [diff] [blame] | 13619 | |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 13620 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13621 | |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 13622 | allow_suspend: |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 13623 | if ((pHddCtx->cfg_ini->enableMacSpoofing == MAC_ADDR_SPOOFING_FW_HOST_ENABLE |
| 13624 | ) && (pHddCtx->spoofMacAddr.isEnabled |
| 13625 | || pHddCtx->spoofMacAddr.isReqDeferred)) { |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 13626 | /* Generate new random mac addr for next scan */ |
| 13627 | hddLog(VOS_TRACE_LEVEL_INFO, "scan completed - generate new spoof mac addr"); |
Padma, Santhosh Kumar | db2d75b | 2015-11-17 12:18:10 +0530 | [diff] [blame] | 13628 | |
| 13629 | schedule_delayed_work(&pHddCtx->spoof_mac_addr_work, |
| 13630 | msecs_to_jiffies(MAC_ADDR_SPOOFING_DEFER_INTERVAL)); |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 13631 | } |
| 13632 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 13633 | /* release the wake lock at the end of the scan*/ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 13634 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13635 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 13636 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 13637 | * immediatly after the driver gets connect request(i.e after scan) |
| 13638 | * from supplicant, this result in app's is suspending and not able |
| 13639 | * to process the connect request to AP */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 13640 | hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 13641 | |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 13642 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 13643 | if (!iface_down) |
| 13644 | #endif |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 13645 | #ifdef FEATURE_WLAN_TDLS |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 13646 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 13647 | #endif |
| 13648 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13649 | EXIT(); |
| 13650 | return 0; |
| 13651 | } |
| 13652 | |
| 13653 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 13654 | * FUNCTION: hdd_isConnectionInProgress |
| 13655 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13656 | * |
| 13657 | */ |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 13658 | v_BOOL_t hdd_isConnectionInProgress(hdd_context_t *pHddCtx, v_U8_t *session_id, |
| 13659 | scan_reject_states *reason) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13660 | { |
| 13661 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 13662 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 13663 | hdd_adapter_t *pAdapter = NULL; |
| 13664 | VOS_STATUS status = 0; |
| 13665 | v_U8_t staId = 0; |
| 13666 | v_U8_t *staMac = NULL; |
| 13667 | |
| 13668 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 13669 | |
| 13670 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 13671 | { |
| 13672 | pAdapter = pAdapterNode->pAdapter; |
| 13673 | |
| 13674 | if( pAdapter ) |
| 13675 | { |
| 13676 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 13677 | "%s: Adapter with device mode %s (%d) exists", |
| 13678 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 13679 | pAdapter->device_mode); |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 13680 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 13681 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 13682 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 13683 | (eConnectionState_Connecting == |
| 13684 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 13685 | { |
| 13686 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13687 | "%s: %p(%d) Connection is in progress", __func__, |
| 13688 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 13689 | if (session_id && reason) |
| 13690 | { |
| 13691 | *session_id = pAdapter->sessionId; |
| 13692 | *reason = eHDD_CONNECTION_IN_PROGRESS; |
| 13693 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 13694 | return VOS_TRUE; |
| 13695 | } |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 13696 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Padma, Santhosh Kumar | 3b9657d | 2015-02-04 19:37:32 +0530 | [diff] [blame] | 13697 | smeNeighborMiddleOfRoaming(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 13698 | { |
| 13699 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13700 | "%s: %p(%d) Reassociation is in progress", __func__, |
| 13701 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 13702 | if (session_id && reason) |
| 13703 | { |
| 13704 | *session_id = pAdapter->sessionId; |
| 13705 | *reason = eHDD_REASSOC_IN_PROGRESS; |
| 13706 | } |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 13707 | return VOS_TRUE; |
| 13708 | } |
| 13709 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 13710 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 13711 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13712 | { |
| 13713 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13714 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 13715 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13716 | { |
| 13717 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 13718 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13719 | "%s: client " MAC_ADDRESS_STR |
| 13720 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 13721 | MAC_ADDR_ARRAY(staMac)); |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 13722 | if (session_id && reason) |
| 13723 | { |
| 13724 | *session_id = pAdapter->sessionId; |
| 13725 | *reason = eHDD_EAPOL_IN_PROGRESS; |
| 13726 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 13727 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13728 | } |
| 13729 | } |
| 13730 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 13731 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 13732 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13733 | v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 13734 | ptSapContext pSapCtx = NULL; |
| 13735 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 13736 | if(pSapCtx == NULL){ |
| 13737 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13738 | FL("psapCtx is NULL")); |
| 13739 | return VOS_FALSE; |
| 13740 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13741 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 13742 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13743 | if ((pSapCtx->aStaInfo[staId].isUsed) && |
| 13744 | (WLANTL_STA_CONNECTED == pSapCtx->aStaInfo[staId].tlSTAState)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13745 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 13746 | staMac = (v_U8_t *) &(pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13747 | |
| 13748 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13749 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 13750 | "middle of WPS/EAPOL exchange.", __func__, |
| 13751 | MAC_ADDR_ARRAY(staMac)); |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 13752 | if (session_id && reason) |
| 13753 | { |
| 13754 | *session_id = pAdapter->sessionId; |
| 13755 | *reason = eHDD_SAP_EAPOL_IN_PROGRESS; |
| 13756 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 13757 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13758 | } |
| 13759 | } |
| 13760 | } |
| 13761 | } |
| 13762 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 13763 | pAdapterNode = pNext; |
| 13764 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 13765 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13766 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13767 | |
Selvaraj, Sridhar | d2b078a | 2016-06-18 10:44:37 +0530 | [diff] [blame] | 13768 | /** |
| 13769 | * csr_scan_request_assign_bssid() - Set the BSSID received from Supplicant |
| 13770 | * to the Scan request |
| 13771 | * @scanRequest: Pointer to the csr scan request |
| 13772 | * @request: Pointer to the scan request from supplicant |
| 13773 | * |
| 13774 | * Return: None |
| 13775 | */ |
| 13776 | #ifdef CFG80211_SCAN_BSSID |
| 13777 | static inline void csr_scan_request_assign_bssid(tCsrScanRequest *scanRequest, |
| 13778 | struct cfg80211_scan_request *request) |
| 13779 | { |
| 13780 | vos_mem_copy(scanRequest->bssid, request->bssid, VOS_MAC_ADDR_SIZE); |
| 13781 | } |
| 13782 | #else |
| 13783 | static inline void csr_scan_request_assign_bssid(tCsrScanRequest *scanRequest, |
| 13784 | struct cfg80211_scan_request *request) |
| 13785 | { |
| 13786 | } |
| 13787 | #endif |
| 13788 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13789 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 13790 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13791 | * this scan respond to scan trigger and update cfg80211 scan database |
| 13792 | * later, scan dump command can be used to recieve scan results |
| 13793 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 13794 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 13795 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 13796 | struct net_device *dev, |
| 13797 | #endif |
| 13798 | struct cfg80211_scan_request *request) |
| 13799 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 13800 | hdd_adapter_t *pAdapter = NULL; |
| 13801 | hdd_context_t *pHddCtx = NULL; |
| 13802 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13803 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13804 | tCsrScanRequest scanRequest; |
| 13805 | tANI_U8 *channelList = NULL, i; |
| 13806 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13807 | int status; |
| 13808 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13809 | v_U8_t* pP2pIe = NULL; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13810 | int ret = 0; |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 13811 | v_U8_t *pWpsIe=NULL; |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 13812 | bool is_p2p_scan = false; |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 13813 | v_U8_t curr_session_id; |
| 13814 | scan_reject_states curr_reason; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13815 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 13816 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 13817 | struct net_device *dev = NULL; |
| 13818 | if (NULL == request) |
| 13819 | { |
| 13820 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13821 | "%s: scan req param null", __func__); |
| 13822 | return -EINVAL; |
| 13823 | } |
| 13824 | dev = request->wdev->netdev; |
| 13825 | #endif |
| 13826 | |
| 13827 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 13828 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 13829 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 13830 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13831 | ENTER(); |
| 13832 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 13833 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 13834 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 13835 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13836 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13837 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13838 | if (0 != status) |
| 13839 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13840 | return status; |
| 13841 | } |
| 13842 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 13843 | if (NULL == pwextBuf) |
| 13844 | { |
| 13845 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 13846 | __func__); |
| 13847 | return -EIO; |
| 13848 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13849 | cfg_param = pHddCtx->cfg_ini; |
| 13850 | pScanInfo = &pHddCtx->scan_info; |
| 13851 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13852 | #ifdef WLAN_BTAMP_FEATURE |
| 13853 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13854 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13855 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 13856 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13857 | "%s: No scanning when AMP is on", __func__); |
| 13858 | return -EOPNOTSUPP; |
| 13859 | } |
| 13860 | #endif |
| 13861 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13862 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13863 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13864 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 13865 | "%s: Not scanning on device_mode = %s (%d)", |
| 13866 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 13867 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13868 | return -EOPNOTSUPP; |
| 13869 | } |
| 13870 | |
| 13871 | if (TRUE == pScanInfo->mScanPending) |
| 13872 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 13873 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 13874 | { |
| 13875 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 13876 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13877 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13878 | } |
| 13879 | |
Hanumantha Reddy Pothula | 4b6be06 | 2015-08-18 14:06:24 +0530 | [diff] [blame] | 13880 | // Don't allow scan if PNO scan is going on. |
| 13881 | if (pHddCtx->isPnoEnable) |
| 13882 | { |
| 13883 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13884 | FL("pno scan in progress")); |
| 13885 | return -EBUSY; |
| 13886 | } |
| 13887 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13888 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13889 | //Channel and action frame is pending |
| 13890 | //Otherwise Cancel Remain On Channel and allow Scan |
| 13891 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13892 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13893 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 13894 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13895 | return -EBUSY; |
| 13896 | } |
| 13897 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13898 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 13899 | { |
| 13900 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 13901 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13902 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13903 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13904 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 13905 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13906 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13907 | "%s: MAX TM Level Scan not allowed", __func__); |
| 13908 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13909 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13910 | } |
| 13911 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 13912 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13913 | /* Check if scan is allowed at this point of time. |
| 13914 | */ |
Hanumanth Reddy Pothula | ec96084 | 2016-09-14 19:04:26 +0530 | [diff] [blame] | 13915 | if (TRUE == pHddCtx->btCoexModeSet) |
| 13916 | { |
| 13917 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13918 | FL("BTCoex Mode operation in progress")); |
| 13919 | return -EBUSY; |
| 13920 | } |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 13921 | if (hdd_isConnectionInProgress(pHddCtx, &curr_session_id, &curr_reason)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13922 | { |
Agrawal Ashish | c932a8d | 2016-08-17 19:21:02 +0530 | [diff] [blame] | 13923 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Scan not allowed")); |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 13924 | if (pHddCtx->last_scan_reject_session_id != curr_session_id || |
| 13925 | pHddCtx->last_scan_reject_reason != curr_reason || |
| 13926 | !pHddCtx->last_scan_reject_timestamp) |
| 13927 | { |
| 13928 | pHddCtx->last_scan_reject_session_id = curr_session_id; |
| 13929 | pHddCtx->last_scan_reject_reason = curr_reason; |
Sreelakshmi Konamki | f0646d5 | 2016-12-09 12:35:31 +0530 | [diff] [blame] | 13930 | pHddCtx->last_scan_reject_timestamp = jiffies_to_msecs(jiffies); |
Agrawal Ashish | c932a8d | 2016-08-17 19:21:02 +0530 | [diff] [blame] | 13931 | } |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 13932 | else { |
Sreelakshmi Konamki | f0646d5 | 2016-12-09 12:35:31 +0530 | [diff] [blame] | 13933 | if ((jiffies_to_msecs(jiffies) - |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 13934 | pHddCtx->last_scan_reject_timestamp) >= |
| 13935 | SCAN_REJECT_THRESHOLD_TIME) |
| 13936 | { |
| 13937 | pHddCtx->last_scan_reject_timestamp = 0; |
| 13938 | if (pHddCtx->cfg_ini->enableFatalEvent) |
| 13939 | vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL, |
| 13940 | WLAN_LOG_INDICATOR_HOST_DRIVER, |
| 13941 | WLAN_LOG_REASON_SCAN_NOT_ALLOWED, |
| 13942 | FALSE, FALSE); |
| 13943 | else |
| 13944 | { |
| 13945 | hddLog(LOGE, FL("Triggering SSR")); |
| 13946 | vos_wlanRestart(); |
| 13947 | } |
| 13948 | } |
| 13949 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13950 | return -EBUSY; |
| 13951 | } |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 13952 | pHddCtx->last_scan_reject_timestamp = 0; |
| 13953 | pHddCtx->last_scan_reject_session_id = 0xFF; |
| 13954 | pHddCtx->last_scan_reject_reason = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13955 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13956 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 13957 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13958 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 13959 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 13960 | * is not aging out the scan results. |
| 13961 | */ |
| 13962 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13963 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13964 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13965 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13966 | |
| 13967 | if ((request->ssids) && (0 < request->n_ssids)) |
| 13968 | { |
| 13969 | tCsrSSIDInfo *SsidInfo; |
| 13970 | int j; |
| 13971 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 13972 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 13973 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 13974 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 13975 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 13976 | |
| 13977 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 13978 | { |
| 13979 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13980 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 13981 | return -ENOMEM; |
| 13982 | } |
| 13983 | |
| 13984 | /* copy all the ssid's and their length */ |
| 13985 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 13986 | { |
| 13987 | /* get the ssid length */ |
| 13988 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 13989 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 13990 | SsidInfo->SSID.length); |
| 13991 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 13992 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 13993 | j, SsidInfo->SSID.ssId); |
| 13994 | } |
| 13995 | /* set the scan type to active */ |
| 13996 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 13997 | } |
| 13998 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13999 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 14000 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14001 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 14002 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14003 | /* set the scan type to active */ |
| 14004 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14005 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14006 | else |
| 14007 | { |
| 14008 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 14009 | scanRequest.scanType = pScanInfo->scan_mode; |
| 14010 | } |
| 14011 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 14012 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14013 | |
Selvaraj, Sridhar | d2b078a | 2016-06-18 10:44:37 +0530 | [diff] [blame] | 14014 | csr_scan_request_assign_bssid(&scanRequest, request); |
| 14015 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14016 | /* set BSSType to default type */ |
| 14017 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 14018 | |
| 14019 | /*TODO: scan the requested channels only*/ |
| 14020 | |
| 14021 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14022 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14023 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14024 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 14025 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 14026 | request->n_channels = MAX_CHANNEL; |
| 14027 | } |
| 14028 | |
| 14029 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14030 | "No of Scan Channels: %d", request->n_channels); |
| 14031 | |
| 14032 | |
| 14033 | if( request->n_channels ) |
| 14034 | { |
| 14035 | char chList [(request->n_channels*5)+1]; |
| 14036 | int len; |
| 14037 | channelList = vos_mem_malloc( request->n_channels ); |
| 14038 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 14039 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14040 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 14041 | "%s: memory alloc failed channelList", __func__); |
| 14042 | status = -ENOMEM; |
| 14043 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 14044 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14045 | |
| 14046 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 14047 | { |
| 14048 | channelList[i] = request->channels[i]->hw_value; |
| 14049 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 14050 | } |
| 14051 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 14052 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14053 | "Channel-List: %s ", chList); |
| 14054 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 14055 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14056 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 14057 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 14058 | |
| 14059 | /* set requestType to full scan */ |
| 14060 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 14061 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 14062 | /* if there is back to back scan happening in driver with in |
| 14063 | * nDeferScanTimeInterval interval driver should defer new scan request |
| 14064 | * and should provide last cached scan results instead of new channel list. |
| 14065 | * This rule is not applicable if scan is p2p scan. |
| 14066 | * This condition will work only in case when last request no of channels |
| 14067 | * and channels are exactly same as new request. |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 14068 | * This should be done only in connected state |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 14069 | * Scan shouldn't be defered for WPS scan case. |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 14070 | */ |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 14071 | |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 14072 | pWpsIe = wlan_hdd_get_wps_ie_ptr((v_U8_t*)request->ie,request->ie_len); |
| 14073 | /* if wps ie is NULL , then only defer scan */ |
| 14074 | if ( pWpsIe == NULL && |
| 14075 | (VOS_STATUS_SUCCESS == hdd_is_any_session_connected(pHddCtx))) |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 14076 | { |
| 14077 | if ( pScanInfo->last_scan_timestamp !=0 && |
| 14078 | ((vos_timer_get_system_time() - pScanInfo->last_scan_timestamp ) < pHddCtx->cfg_ini->nDeferScanTimeInterval)) |
| 14079 | { |
| 14080 | if ( request->no_cck == FALSE && scanRequest.ChannelInfo.numOfChannels != 1 && |
| 14081 | (pScanInfo->last_scan_numChannels == scanRequest.ChannelInfo.numOfChannels) && |
| 14082 | vos_mem_compare(pScanInfo->last_scan_channelList, |
| 14083 | channelList, pScanInfo->last_scan_numChannels)) |
| 14084 | { |
| 14085 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 14086 | " New and old station scan time differ is less then %u", |
| 14087 | pHddCtx->cfg_ini->nDeferScanTimeInterval); |
| 14088 | |
| 14089 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 14090 | pAdapter); |
| 14091 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 14092 | hddLog(VOS_TRACE_LEVEL_WARN, |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 14093 | "Return old cached scan as all channels and no of channels are same"); |
| 14094 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 14095 | if (0 > ret) |
| 14096 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 14097 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 14098 | cfg80211_scan_done(request, eCSR_SCAN_SUCCESS); |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 14099 | |
| 14100 | status = eHAL_STATUS_SUCCESS; |
| 14101 | goto free_mem; |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 14102 | } |
| 14103 | } |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 14104 | } |
| 14105 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14106 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 14107 | * search (Flush on both full scan and social scan but not on single |
| 14108 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 14109 | */ |
| 14110 | |
| 14111 | /* Supplicant does single channel scan after 8-way handshake |
| 14112 | * and in that case driver shoudnt flush scan results. If |
| 14113 | * driver flushes the scan results here and unfortunately if |
| 14114 | * the AP doesnt respond to our probe req then association |
| 14115 | * fails which is not desired |
| 14116 | */ |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 14117 | if ((request->n_ssids == 1) |
| 14118 | && (request->ssids != NULL) |
| 14119 | && vos_mem_compare(&request->ssids[0], "DIRECT-", 7)) |
| 14120 | is_p2p_scan = true; |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14121 | |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 14122 | if( is_p2p_scan || |
| 14123 | (request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN) ) |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14124 | { |
| 14125 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 14126 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14127 | pAdapter->sessionId ); |
| 14128 | } |
| 14129 | |
| 14130 | if( request->ie_len ) |
| 14131 | { |
| 14132 | /* save this for future association (join requires this) */ |
| 14133 | /*TODO: Array needs to be converted to dynamic allocation, |
| 14134 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 14135 | * CR 597966 |
| 14136 | */ |
| 14137 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 14138 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 14139 | pScanInfo->scanAddIE.length = request->ie_len; |
| 14140 | |
| 14141 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 14142 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 14143 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14144 | { |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 14145 | if (request->ie_len <= SIR_MAC_MAX_ADD_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14146 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14147 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 14148 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 14149 | request->ie, request->ie_len); |
| 14150 | } |
| 14151 | else |
| 14152 | { |
| 14153 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 14154 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14155 | } |
| 14156 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14157 | } |
| 14158 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 14159 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 14160 | |
| 14161 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 14162 | request->ie_len); |
| 14163 | if (pP2pIe != NULL) |
| 14164 | { |
| 14165 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 14166 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 14167 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 14168 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 14169 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14170 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 14171 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 14172 | "Go nego completed to Connection is started"); |
| 14173 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 14174 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 14175 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14176 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 14177 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14178 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14179 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 14180 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 14181 | "Disconnected state to Connection is started"); |
| 14182 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 14183 | "for 4way Handshake"); |
| 14184 | } |
| 14185 | #endif |
| 14186 | |
| 14187 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 14188 | if(TRUE == request->no_cck) |
| 14189 | { |
| 14190 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14191 | "%s: This is a P2P Search", __func__); |
| 14192 | scanRequest.p2pSearch = 1; |
| 14193 | |
| 14194 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 14195 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14196 | /* set requestType to P2P Discovery */ |
| 14197 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 14198 | } |
| 14199 | |
| 14200 | /* |
| 14201 | Skip Dfs Channel in case of P2P Search |
| 14202 | if it is set in ini file |
| 14203 | */ |
| 14204 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 14205 | { |
| 14206 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 14207 | } |
| 14208 | else |
| 14209 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 14210 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 14211 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14212 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 14213 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14214 | } |
| 14215 | } |
| 14216 | |
| 14217 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 14218 | |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 14219 | #ifdef FEATURE_WLAN_TDLS |
| 14220 | /* if tdls disagree scan right now, return immediately. |
| 14221 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 14222 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 14223 | */ |
| 14224 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 14225 | wiphy, |
| 14226 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 14227 | dev, |
| 14228 | #endif |
| 14229 | request); |
Abhishek Singh | e2b6395 | 2016-01-05 18:27:29 +0530 | [diff] [blame] | 14230 | if (status <= 0) |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 14231 | { |
Abhishek Singh | e2b6395 | 2016-01-05 18:27:29 +0530 | [diff] [blame] | 14232 | if (!status) |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 14233 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 14234 | "scan rejected %d", __func__, status); |
| 14235 | else |
| 14236 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 14237 | __func__, status); |
Abhishek Singh | e2b6395 | 2016-01-05 18:27:29 +0530 | [diff] [blame] | 14238 | hdd_wlan_block_scan_by_tdls(); |
Gupta, Kapil | 2ebf3e0 | 2016-03-17 19:45:19 +0530 | [diff] [blame] | 14239 | goto free_mem; |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 14240 | } |
| 14241 | #endif |
| 14242 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 14243 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 14244 | * address the following issues. |
| 14245 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 14246 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 14247 | * for long time, this result in apps running at full power for long time. |
| 14248 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 14249 | * be stuck in full power because of resume BMPS |
| 14250 | */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 14251 | hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14252 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 14253 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 14254 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 14255 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 14256 | scanRequest.requestType, scanRequest.scanType, |
| 14257 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 14258 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 14259 | |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 14260 | if (pHddCtx->spoofMacAddr.isEnabled && |
| 14261 | pHddCtx->cfg_ini->enableMacSpoofing == 1) |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 14262 | { |
| 14263 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14264 | "%s: MAC Spoofing enabled for current scan", __func__); |
| 14265 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 14266 | * to fill TxBds for probe request during current scan |
| 14267 | */ |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 14268 | status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 14269 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 14270 | |
| 14271 | if(status != VOS_STATUS_SUCCESS) |
| 14272 | { |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 14273 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 14274 | status = -EFAULT; |
Ganesh Kondabattini | 6d3b490 | 2015-05-12 23:19:22 +0530 | [diff] [blame] | 14275 | #ifdef FEATURE_WLAN_TDLS |
| 14276 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 14277 | #endif |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 14278 | goto free_mem; |
| 14279 | } |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 14280 | } |
Mahesh A Saptasagar | 51dc36c | 2015-06-16 12:07:15 +0530 | [diff] [blame] | 14281 | wlan_hdd_get_frame_logs(pAdapter, WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14282 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14283 | pAdapter->sessionId, &scanRequest, &scanId, |
| 14284 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14286 | if (eHAL_STATUS_SUCCESS != status) |
| 14287 | { |
| 14288 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 14289 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 14290 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 14291 | if(eHAL_STATUS_RESOURCES == status) |
| 14292 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 14293 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 14294 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 14295 | status = -EBUSY; |
| 14296 | } else { |
| 14297 | status = -EIO; |
| 14298 | } |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 14299 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 14300 | |
| 14301 | #ifdef FEATURE_WLAN_TDLS |
| 14302 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 14303 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14304 | goto free_mem; |
| 14305 | } |
| 14306 | |
| 14307 | pScanInfo->mScanPending = TRUE; |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 14308 | pScanInfo->sessionId = pAdapter->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14309 | pAdapter->request = request; |
| 14310 | pScanInfo->scanId = scanId; |
| 14311 | |
| 14312 | complete(&pScanInfo->scan_req_completion_event); |
| 14313 | |
| 14314 | free_mem: |
| 14315 | if( scanRequest.SSIDs.SSIDList ) |
| 14316 | { |
| 14317 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 14318 | } |
| 14319 | |
| 14320 | if( channelList ) |
| 14321 | vos_mem_free( channelList ); |
| 14322 | |
| 14323 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14324 | return status; |
| 14325 | } |
| 14326 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 14327 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 14328 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 14329 | struct net_device *dev, |
| 14330 | #endif |
| 14331 | struct cfg80211_scan_request *request) |
| 14332 | { |
| 14333 | int ret; |
| 14334 | |
| 14335 | vos_ssr_protect(__func__); |
| 14336 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 14337 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 14338 | dev, |
| 14339 | #endif |
| 14340 | request); |
| 14341 | vos_ssr_unprotect(__func__); |
| 14342 | |
| 14343 | return ret; |
| 14344 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 14345 | |
| 14346 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 14347 | { |
| 14348 | v_U8_t iniDot11Mode = |
| 14349 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 14350 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 14351 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 14352 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 14353 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 14354 | switch ( iniDot11Mode ) |
| 14355 | { |
| 14356 | case eHDD_DOT11_MODE_AUTO: |
| 14357 | case eHDD_DOT11_MODE_11ac: |
| 14358 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 14359 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 4b1d235 | 2014-08-01 21:59:28 +0530 | [diff] [blame] | 14360 | if ( sme_IsFeatureSupportedByDriver(DOT11AC) && |
| 14361 | sme_IsFeatureSupportedByFW(DOT11AC) ) |
| 14362 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 14363 | else |
| 14364 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 14365 | #else |
| 14366 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 14367 | #endif |
| 14368 | break; |
| 14369 | case eHDD_DOT11_MODE_11n: |
| 14370 | case eHDD_DOT11_MODE_11n_ONLY: |
| 14371 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 14372 | break; |
| 14373 | default: |
| 14374 | hddDot11Mode = iniDot11Mode; |
| 14375 | break; |
| 14376 | } |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 14377 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 14378 | if (operationChannel > SIR_11B_CHANNEL_END) |
| 14379 | #endif |
| 14380 | { |
| 14381 | /* This call decides required channel bonding mode */ |
| 14382 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 14383 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 14384 | operationChannel); |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 14385 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 14386 | } |
| 14387 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14388 | /* |
| 14389 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14390 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14391 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14392 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Hanumantha Reddy Pothula | 64081b7 | 2015-09-11 15:47:32 +0530 | [diff] [blame] | 14393 | const u8 *ssid, size_t ssid_len, const u8 *bssid, |
| 14394 | const u8 *bssid_hint, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14395 | { |
| 14396 | int status = 0; |
| 14397 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 14398 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14399 | v_U32_t roamId; |
| 14400 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14401 | eCsrAuthType RSNAuthType; |
| 14402 | |
| 14403 | ENTER(); |
| 14404 | |
| 14405 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 14406 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14407 | |
| 14408 | status = wlan_hdd_validate_context(pHddCtx); |
| 14409 | if (status) |
| 14410 | { |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 14411 | return status; |
| 14412 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14413 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14414 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 14415 | { |
| 14416 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 14417 | return -EINVAL; |
| 14418 | } |
| 14419 | |
| 14420 | pRoamProfile = &pWextState->roamProfile; |
| 14421 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14422 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14423 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14424 | hdd_station_ctx_t *pHddStaCtx; |
| 14425 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14426 | |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 14427 | wlan_hdd_get_frame_logs(pAdapter, WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR); |
| 14428 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14429 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14430 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 14431 | { |
| 14432 | /*QoS not enabled in cfg file*/ |
| 14433 | pRoamProfile->uapsd_mask = 0; |
| 14434 | } |
| 14435 | else |
| 14436 | { |
| 14437 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14438 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14439 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 14440 | } |
| 14441 | |
| 14442 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 14443 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 14444 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14445 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14446 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 14447 | ssid, ssid_len); |
| 14448 | |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 14449 | vos_mem_zero(pRoamProfile->BSSIDs.bssid, WNI_CFG_BSSID_LEN); |
| 14450 | vos_mem_zero(pRoamProfile->bssid_hint, WNI_CFG_BSSID_LEN); |
| 14451 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14452 | if (bssid) |
| 14453 | { |
| 14454 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 14455 | vos_mem_copy(pRoamProfile->BSSIDs.bssid, bssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14456 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14457 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 14458 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14459 | case of join failure we should send valid BSSID to supplicant |
| 14460 | */ |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 14461 | vos_mem_copy(pWextState->req_bssId, bssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14462 | WNI_CFG_BSSID_LEN); |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 14463 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14464 | } |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 14465 | else if (bssid_hint) |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 14466 | { |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 14467 | /* Store bssid_hint to use in the scan filter. */ |
| 14468 | vos_mem_copy(pRoamProfile->bssid_hint, bssid_hint, |
| 14469 | WNI_CFG_BSSID_LEN); |
| 14470 | /* |
| 14471 | * Save BSSID in seperate variable as well, as RoamProfile |
| 14472 | * BSSID is getting zeroed out in the association process. And in |
| 14473 | * case of join failure we should send valid BSSID to supplicant |
| 14474 | */ |
| 14475 | vos_mem_copy(pWextState->req_bssId, bssid_hint, |
| 14476 | WNI_CFG_BSSID_LEN); |
| 14477 | hddLog(LOG1, FL(" bssid_hint: "MAC_ADDRESS_STR), |
| 14478 | MAC_ADDR_ARRAY(pRoamProfile->bssid_hint)); |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 14479 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14480 | |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 14481 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 14482 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 14483 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14484 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 14485 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14486 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14487 | /*set gen ie*/ |
| 14488 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 14489 | /*set auth*/ |
| 14490 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 14491 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14492 | #ifdef FEATURE_WLAN_WAPI |
| 14493 | if (pAdapter->wapi_info.nWapiMode) |
| 14494 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 14495 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14496 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 14497 | { |
| 14498 | case WAPI_AUTH_MODE_PSK: |
| 14499 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 14500 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14501 | pAdapter->wapi_info.wapiAuthMode); |
| 14502 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 14503 | break; |
| 14504 | } |
| 14505 | case WAPI_AUTH_MODE_CERT: |
| 14506 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 14507 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14508 | pAdapter->wapi_info.wapiAuthMode); |
| 14509 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 14510 | break; |
| 14511 | } |
| 14512 | } // End of switch |
| 14513 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 14514 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 14515 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 14516 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14517 | pRoamProfile->AuthType.numEntries = 1; |
| 14518 | pRoamProfile->EncryptionType.numEntries = 1; |
| 14519 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 14520 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 14521 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 14522 | } |
| 14523 | } |
| 14524 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14525 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 14526 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14527 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 14528 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 14529 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 14530 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 14531 | sizeof (tSirGtkOffloadParams)); |
| 14532 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 14533 | } |
| 14534 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14535 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 14536 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 14537 | if( operatingChannel ) |
| 14538 | { |
| 14539 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 14540 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 14541 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 14542 | else |
| 14543 | { |
| 14544 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 14545 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 14546 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 14547 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 14548 | { |
| 14549 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 14550 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 14551 | |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 14552 | /* |
| 14553 | * Change conn_state to connecting before sme_RoamConnect(), |
| 14554 | * because sme_RoamConnect() has a direct path to call |
| 14555 | * hdd_smeRoamCallback(), which will change the conn_state |
| 14556 | * If direct path, conn_state will be accordingly changed |
| 14557 | * to NotConnected or Associated by either |
| 14558 | * hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() |
| 14559 | * in sme_RoamCallback() |
| 14560 | * if sme_RomConnect is to be queued, |
| 14561 | * Connecting state will remain until it is completed. |
| 14562 | * If connection state is not changed, |
| 14563 | * connection state will remain in eConnectionState_NotConnected state. |
| 14564 | * In hdd_AssociationCompletionHandler, "hddDisconInProgress" is set to true |
| 14565 | * if conn state is eConnectionState_NotConnected. |
| 14566 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 14567 | * informed of connect result indication which is an issue. |
| 14568 | */ |
| 14569 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 14570 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 14571 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 14572 | { |
| 14573 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 14574 | FL("Set HDD connState to eConnectionState_Connecting")); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 14575 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 14576 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 14577 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14578 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14579 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 14580 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 14581 | if ((eHAL_STATUS_SUCCESS != status) && |
| 14582 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 14583 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 14584 | |
| 14585 | { |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 14586 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 14587 | FL("sme_RoamConnect (session %d) failed with status %d. -> NotConnected"), |
| 14588 | pAdapter->sessionId, status); |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 14589 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 14590 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 14591 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 14592 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 14593 | |
| 14594 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 14595 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 14596 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14597 | } |
| 14598 | else |
| 14599 | { |
| 14600 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 14601 | return -EINVAL; |
| 14602 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 14603 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14604 | return status; |
| 14605 | } |
| 14606 | |
| 14607 | /* |
| 14608 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 14609 | * This function is used to set the authentication type (OPEN/SHARED). |
| 14610 | * |
| 14611 | */ |
| 14612 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 14613 | enum nl80211_auth_type auth_type) |
| 14614 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14615 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14616 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 14617 | |
| 14618 | ENTER(); |
| 14619 | |
| 14620 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14621 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14622 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14623 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 14624 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14625 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 14626 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 14627 | break; |
| 14628 | |
| 14629 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 14630 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 14631 | case NL80211_AUTHTYPE_FT: |
| 14632 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14633 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14634 | "%s: set authentication type to OPEN", __func__); |
| 14635 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 14636 | break; |
| 14637 | |
| 14638 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14639 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14640 | "%s: set authentication type to SHARED", __func__); |
| 14641 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 14642 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 14643 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14644 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14645 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14646 | "%s: set authentication type to CCKM WPA", __func__); |
| 14647 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 14648 | break; |
| 14649 | #endif |
| 14650 | |
| 14651 | |
| 14652 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14653 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 14654 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14655 | auth_type); |
| 14656 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 14657 | return -EINVAL; |
| 14658 | } |
| 14659 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14660 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14661 | pHddStaCtx->conn_info.authType; |
| 14662 | return 0; |
| 14663 | } |
| 14664 | |
| 14665 | /* |
| 14666 | * FUNCTION: wlan_hdd_set_akm_suite |
| 14667 | * This function is used to set the key mgmt type(PSK/8021x). |
| 14668 | * |
| 14669 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14670 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14671 | u32 key_mgmt |
| 14672 | ) |
| 14673 | { |
| 14674 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 14675 | ENTER(); |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 14676 | /* Should be in ieee802_11_defs.h */ |
| 14677 | #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05 |
| 14678 | #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14679 | /*set key mgmt type*/ |
| 14680 | switch(key_mgmt) |
| 14681 | { |
| 14682 | case WLAN_AKM_SUITE_PSK: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 14683 | case WLAN_AKM_SUITE_PSK_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 14684 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 14685 | case WLAN_AKM_SUITE_FT_PSK: |
| 14686 | #endif |
| 14687 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14688 | __func__); |
| 14689 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 14690 | break; |
| 14691 | |
| 14692 | case WLAN_AKM_SUITE_8021X: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 14693 | case WLAN_AKM_SUITE_8021X_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 14694 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 14695 | case WLAN_AKM_SUITE_FT_8021X: |
| 14696 | #endif |
| 14697 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14698 | __func__); |
| 14699 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 14700 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 14701 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14702 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 14703 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 14704 | case WLAN_AKM_SUITE_CCKM: |
| 14705 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 14706 | __func__); |
| 14707 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 14708 | break; |
| 14709 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 14710 | #ifndef WLAN_AKM_SUITE_OSEN |
| 14711 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 14712 | case WLAN_AKM_SUITE_OSEN: |
| 14713 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 14714 | __func__); |
| 14715 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 14716 | break; |
| 14717 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14718 | |
| 14719 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14720 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14721 | __func__, key_mgmt); |
| 14722 | return -EINVAL; |
| 14723 | |
| 14724 | } |
| 14725 | return 0; |
| 14726 | } |
| 14727 | |
| 14728 | /* |
| 14729 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14730 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14731 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 14732 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14733 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 14734 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14735 | bool ucast |
| 14736 | ) |
| 14737 | { |
| 14738 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14739 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14740 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 14741 | |
| 14742 | ENTER(); |
| 14743 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14744 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14745 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 14746 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14747 | __func__, cipher); |
| 14748 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 14749 | } |
| 14750 | else |
| 14751 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14752 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14753 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14754 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14755 | { |
| 14756 | case IW_AUTH_CIPHER_NONE: |
| 14757 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 14758 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14759 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14760 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 14761 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14762 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14763 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14764 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 14765 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14766 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14767 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14768 | case WLAN_CIPHER_SUITE_TKIP: |
| 14769 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 14770 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14771 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14772 | case WLAN_CIPHER_SUITE_CCMP: |
| 14773 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 14774 | break; |
| 14775 | #ifdef FEATURE_WLAN_WAPI |
| 14776 | case WLAN_CIPHER_SUITE_SMS4: |
| 14777 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 14778 | break; |
| 14779 | #endif |
| 14780 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 14781 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14782 | case WLAN_CIPHER_SUITE_KRK: |
| 14783 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 14784 | break; |
| 14785 | #endif |
| 14786 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14787 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14788 | __func__, cipher); |
| 14789 | return -EOPNOTSUPP; |
| 14790 | } |
| 14791 | } |
| 14792 | |
| 14793 | if (ucast) |
| 14794 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14795 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14796 | __func__, encryptionType); |
| 14797 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 14798 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14799 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14800 | encryptionType; |
| 14801 | } |
| 14802 | else |
| 14803 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14804 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14805 | __func__, encryptionType); |
| 14806 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 14807 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 14808 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 14809 | } |
| 14810 | |
| 14811 | return 0; |
| 14812 | } |
| 14813 | |
| 14814 | |
| 14815 | /* |
| 14816 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 14817 | * This function is used to parse WPA/RSN IE's. |
| 14818 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14819 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14820 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 14821 | const u8 *ie, |
| 14822 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14823 | u8 *ie, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14824 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14825 | size_t ie_len |
| 14826 | ) |
| 14827 | { |
| 14828 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14829 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 14830 | const u8 *genie = ie; |
| 14831 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14832 | u8 *genie = ie; |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14833 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14834 | v_U16_t remLen = ie_len; |
| 14835 | #ifdef FEATURE_WLAN_WAPI |
| 14836 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 14837 | u16 *tmp; |
| 14838 | v_U16_t akmsuiteCount; |
| 14839 | int *akmlist; |
| 14840 | #endif |
| 14841 | ENTER(); |
| 14842 | |
| 14843 | /* clear previous assocAddIE */ |
| 14844 | pWextState->assocAddIE.length = 0; |
| 14845 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 14846 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14847 | |
| 14848 | while (remLen >= 2) |
| 14849 | { |
| 14850 | v_U16_t eLen = 0; |
| 14851 | v_U8_t elementId; |
| 14852 | elementId = *genie++; |
| 14853 | eLen = *genie++; |
| 14854 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14855 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14856 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14857 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14858 | |
| 14859 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14860 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14861 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14862 | 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] | 14863 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14864 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14865 | "%s: Invalid WPA IE", __func__); |
| 14866 | return -EINVAL; |
| 14867 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14868 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14869 | { |
| 14870 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14871 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14872 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14873 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 14874 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14875 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 14876 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 14877 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14878 | VOS_ASSERT(0); |
| 14879 | return -ENOMEM; |
| 14880 | } |
| 14881 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 14882 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 14883 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14884 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14885 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 14886 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 14887 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 14888 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14889 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 14890 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14891 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 14892 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 14893 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 14894 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 14895 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 14896 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14897 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 14898 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14899 | { |
| 14900 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14901 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14902 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14903 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 14904 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14905 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 14906 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 14907 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14908 | VOS_ASSERT(0); |
| 14909 | return -ENOMEM; |
| 14910 | } |
| 14911 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 14912 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 14913 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14914 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14915 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 14916 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 14917 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14918 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14919 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 14920 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14921 | /*Consider WFD IE, only for P2P Client */ |
| 14922 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 14923 | { |
| 14924 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14925 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14926 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14927 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 14928 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14929 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 14930 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 14931 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14932 | VOS_ASSERT(0); |
| 14933 | return -ENOMEM; |
| 14934 | } |
| 14935 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 14936 | // WPS IE + P2P IE + WFD IE |
| 14937 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 14938 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14939 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14940 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 14941 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 14942 | } |
| 14943 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14944 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14945 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 14946 | HS20_OUI_TYPE_SIZE)) ) |
| 14947 | { |
| 14948 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14949 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 14950 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14951 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 14952 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 14953 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 14954 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 14955 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 14956 | VOS_ASSERT(0); |
| 14957 | return -ENOMEM; |
| 14958 | } |
| 14959 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 14960 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14961 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 14962 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 14963 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 14964 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 14965 | /* Appending OSEN Information Element in Assiciation Request */ |
| 14966 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 14967 | OSEN_OUI_TYPE_SIZE)) ) |
| 14968 | { |
| 14969 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 14970 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 14971 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14972 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 14973 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 14974 | { |
| 14975 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 14976 | "Need bigger buffer space"); |
| 14977 | VOS_ASSERT(0); |
| 14978 | return -ENOMEM; |
| 14979 | } |
| 14980 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 14981 | pWextState->assocAddIE.length += eLen + 2; |
| 14982 | |
| 14983 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 14984 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 14985 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 14986 | } |
| 14987 | |
Abhishek Singh | 4322e62 | 2015-06-10 15:42:54 +0530 | [diff] [blame] | 14988 | /* Update only for WPA IE */ |
| 14989 | if (!memcmp(genie, WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) && |
| 14990 | (WLAN_HDD_IBSS == pAdapter->device_mode)) { |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 14991 | |
| 14992 | /* populating as ADDIE in beacon frames */ |
| 14993 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14994 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, (u8 *)genie - 2, eLen + 2, |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 14995 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 14996 | { |
| 14997 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14998 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 14999 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 15000 | { |
| 15001 | hddLog(LOGE, |
| 15002 | "Coldn't pass " |
| 15003 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 15004 | } |
| 15005 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 15006 | else |
| 15007 | hddLog(LOGE, |
| 15008 | "Could not pass on " |
| 15009 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 15010 | |
| 15011 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 15012 | beaconIE's need to be populated in probe response frames */ |
| 15013 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 15014 | { |
| 15015 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 15016 | u8 probe_rsp_ie_len[3] = {0}; |
| 15017 | u8 counter = 0; |
| 15018 | |
| 15019 | /* Check Probe Resp Length if it is greater then 255 then |
| 15020 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 15021 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 15022 | not able Store More then 255 bytes into One Variable */ |
| 15023 | |
| 15024 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 15025 | { |
| 15026 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 15027 | { |
| 15028 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 15029 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 15030 | } |
| 15031 | else |
| 15032 | { |
| 15033 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 15034 | rem_probe_resp_ie_len = 0; |
| 15035 | } |
| 15036 | } |
| 15037 | |
| 15038 | rem_probe_resp_ie_len = 0; |
| 15039 | |
| 15040 | if (probe_rsp_ie_len[0] > 0) |
| 15041 | { |
| 15042 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15043 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 15044 | (tANI_U8*)(genie - 2), |
| 15045 | probe_rsp_ie_len[0], NULL, |
| 15046 | eANI_BOOLEAN_FALSE) |
| 15047 | == eHAL_STATUS_FAILURE) |
| 15048 | { |
| 15049 | hddLog(LOGE, |
| 15050 | "Could not pass" |
| 15051 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 15052 | } |
| 15053 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 15054 | } |
| 15055 | |
| 15056 | if (probe_rsp_ie_len[1] > 0) |
| 15057 | { |
| 15058 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15059 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 15060 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 15061 | probe_rsp_ie_len[1], NULL, |
| 15062 | eANI_BOOLEAN_FALSE) |
| 15063 | == eHAL_STATUS_FAILURE) |
| 15064 | { |
| 15065 | hddLog(LOGE, |
| 15066 | "Could not pass" |
| 15067 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 15068 | } |
| 15069 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 15070 | } |
| 15071 | |
| 15072 | if (probe_rsp_ie_len[2] > 0) |
| 15073 | { |
| 15074 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15075 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 15076 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 15077 | probe_rsp_ie_len[2], NULL, |
| 15078 | eANI_BOOLEAN_FALSE) |
| 15079 | == eHAL_STATUS_FAILURE) |
| 15080 | { |
| 15081 | hddLog(LOGE, |
| 15082 | "Could not pass" |
| 15083 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 15084 | } |
| 15085 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 15086 | } |
| 15087 | |
| 15088 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15089 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 15090 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 15091 | { |
| 15092 | hddLog(LOGE, |
| 15093 | "Could not pass" |
| 15094 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 15095 | } |
| 15096 | } |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 15097 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15098 | break; |
| 15099 | case DOT11F_EID_RSN: |
| 15100 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 15101 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 15102 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 15103 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 15104 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 15105 | break; |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 15106 | |
Abhishek Singh | b16f356 | 2016-01-20 11:08:32 +0530 | [diff] [blame] | 15107 | /* Appending extended capabilities with Interworking or |
| 15108 | * bsstransition bit set in Assoc Req. |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 15109 | * |
| 15110 | * In assoc req this EXT Cap will only be taken into account if |
Abhishek Singh | b16f356 | 2016-01-20 11:08:32 +0530 | [diff] [blame] | 15111 | * interworkingService or bsstransition bit is set to 1. |
| 15112 | * Driver is only interested in interworkingService and |
| 15113 | * bsstransition capability from supplicant. |
| 15114 | * If in future any other EXT Cap info is |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 15115 | * required from supplicat, it needs to be handled while |
| 15116 | * sending Assoc Req in LIM. |
| 15117 | */ |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 15118 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15119 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 15120 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15121 | 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] | 15122 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15123 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 15124 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 15125 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 15126 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 15127 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 15128 | VOS_ASSERT(0); |
| 15129 | return -ENOMEM; |
| 15130 | } |
| 15131 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 15132 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15133 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 15134 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 15135 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 15136 | break; |
| 15137 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15138 | #ifdef FEATURE_WLAN_WAPI |
| 15139 | case WLAN_EID_WAPI: |
| 15140 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 15141 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15142 | pAdapter->wapi_info.nWapiMode); |
| 15143 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15144 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15145 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 15146 | tmp = tmp + 1; |
| 15147 | akmlist = (int *)(tmp); |
| 15148 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 15149 | { |
| 15150 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 15151 | } |
| 15152 | else |
| 15153 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 15154 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15155 | VOS_ASSERT(0); |
| 15156 | return -EINVAL; |
| 15157 | } |
| 15158 | |
| 15159 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 15160 | { |
| 15161 | 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] | 15162 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15163 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15164 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15165 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15166 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15167 | 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] | 15168 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15169 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 15170 | } |
| 15171 | break; |
| 15172 | #endif |
| 15173 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15174 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15175 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 15176 | /* when Unknown IE is received we should break and continue |
| 15177 | * to the next IE in the buffer instead we were returning |
| 15178 | * so changing this to break */ |
| 15179 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15180 | } |
| 15181 | genie += eLen; |
| 15182 | remLen -= eLen; |
| 15183 | } |
| 15184 | EXIT(); |
| 15185 | return 0; |
| 15186 | } |
| 15187 | |
| 15188 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 15189 | * FUNCTION: hdd_isWPAIEPresent |
| 15190 | * Parse the received IE to find the WPA IE |
| 15191 | * |
| 15192 | */ |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 15193 | static bool hdd_isWPAIEPresent( |
| 15194 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 15195 | const u8 *ie, |
| 15196 | #else |
| 15197 | u8 *ie, |
| 15198 | #endif |
| 15199 | u8 ie_len) |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 15200 | { |
| 15201 | v_U8_t eLen = 0; |
| 15202 | v_U16_t remLen = ie_len; |
| 15203 | v_U8_t elementId = 0; |
| 15204 | |
| 15205 | while (remLen >= 2) |
| 15206 | { |
| 15207 | elementId = *ie++; |
| 15208 | eLen = *ie++; |
| 15209 | remLen -= 2; |
| 15210 | if (eLen > remLen) |
| 15211 | { |
| 15212 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15213 | "%s: IE length is wrong %d", __func__, eLen); |
| 15214 | return FALSE; |
| 15215 | } |
| 15216 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 15217 | { |
| 15218 | /* OUI - 0x00 0X50 0XF2 |
| 15219 | WPA Information Element - 0x01 |
| 15220 | WPA version - 0x01*/ |
| 15221 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 15222 | return TRUE; |
| 15223 | } |
| 15224 | ie += eLen; |
| 15225 | remLen -= eLen; |
| 15226 | } |
| 15227 | return FALSE; |
| 15228 | } |
| 15229 | |
| 15230 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15231 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15232 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15233 | * parameters during connect operation. |
| 15234 | */ |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 15235 | int wlan_hdd_cfg80211_set_privacy(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15236 | struct cfg80211_connect_params *req |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 15237 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15238 | { |
| 15239 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15240 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15241 | ENTER(); |
| 15242 | |
| 15243 | /*set wpa version*/ |
| 15244 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 15245 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15246 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15247 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 15248 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15249 | { |
| 15250 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 15251 | } |
| 15252 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 15253 | { |
| 15254 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 15255 | } |
| 15256 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15257 | |
| 15258 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15259 | pWextState->wpaVersion); |
| 15260 | |
| 15261 | /*set authentication type*/ |
| 15262 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 15263 | |
| 15264 | if (0 > status) |
| 15265 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15266 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15267 | "%s: failed to set authentication type ", __func__); |
| 15268 | return status; |
| 15269 | } |
| 15270 | |
| 15271 | /*set key mgmt type*/ |
| 15272 | if (req->crypto.n_akm_suites) |
| 15273 | { |
| 15274 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 15275 | if (0 > status) |
| 15276 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15277 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15278 | __func__); |
| 15279 | return status; |
| 15280 | } |
| 15281 | } |
| 15282 | |
| 15283 | /*set pairwise cipher type*/ |
| 15284 | if (req->crypto.n_ciphers_pairwise) |
| 15285 | { |
| 15286 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 15287 | req->crypto.ciphers_pairwise[0], true); |
| 15288 | if (0 > status) |
| 15289 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15290 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15291 | "%s: failed to set unicast cipher type", __func__); |
| 15292 | return status; |
| 15293 | } |
| 15294 | } |
| 15295 | else |
| 15296 | { |
| 15297 | /*Reset previous cipher suite to none*/ |
| 15298 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 15299 | if (0 > status) |
| 15300 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15301 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15302 | "%s: failed to set unicast cipher type", __func__); |
| 15303 | return status; |
| 15304 | } |
| 15305 | } |
| 15306 | |
| 15307 | /*set group cipher type*/ |
| 15308 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 15309 | false); |
| 15310 | |
| 15311 | if (0 > status) |
| 15312 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15313 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15314 | __func__); |
| 15315 | return status; |
| 15316 | } |
| 15317 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 15318 | #ifdef WLAN_FEATURE_11W |
| 15319 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 15320 | #endif |
| 15321 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15322 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 15323 | if (req->ie_len) |
| 15324 | { |
| 15325 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 15326 | if ( 0 > status) |
| 15327 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15328 | 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] | 15329 | __func__); |
| 15330 | return status; |
| 15331 | } |
| 15332 | } |
| 15333 | |
| 15334 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15335 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15336 | { |
| 15337 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 15338 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 15339 | ) |
| 15340 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15341 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15342 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 15343 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15344 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15345 | __func__); |
| 15346 | return -EOPNOTSUPP; |
| 15347 | } |
| 15348 | else |
| 15349 | { |
| 15350 | u8 key_len = req->key_len; |
| 15351 | u8 key_idx = req->key_idx; |
| 15352 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15353 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15354 | && (CSR_MAX_NUM_KEY > key_idx) |
| 15355 | ) |
| 15356 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15357 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 15358 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15359 | __func__, key_idx, key_len); |
| 15360 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15361 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15362 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15363 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15364 | (u8)key_len; |
| 15365 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 15366 | } |
| 15367 | } |
| 15368 | } |
| 15369 | } |
| 15370 | |
| 15371 | return status; |
| 15372 | } |
| 15373 | |
| 15374 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15375 | * FUNCTION: wlan_hdd_try_disconnect |
| 15376 | * This function is used to disconnect from previous |
| 15377 | * connection |
| 15378 | */ |
Agrawal Ashish | c407f19 | 2017-01-23 17:18:35 +0530 | [diff] [blame] | 15379 | int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15380 | { |
| 15381 | long ret = 0; |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 15382 | int status, result = 0; |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15383 | hdd_station_ctx_t *pHddStaCtx; |
| 15384 | eMib_dot11DesiredBssType connectedBssType; |
Abhishek Singh | 19a7dd9 | 2015-12-30 16:31:51 +0530 | [diff] [blame] | 15385 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15386 | |
Abhishek Singh | 19a7dd9 | 2015-12-30 16:31:51 +0530 | [diff] [blame] | 15387 | ret = wlan_hdd_validate_context(pHddCtx); |
| 15388 | if (0 != ret) |
| 15389 | { |
| 15390 | return ret; |
| 15391 | } |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15392 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15393 | |
| 15394 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 15395 | |
| 15396 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 15397 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
Abhishek Singh | 630ff59 | 2016-01-07 18:15:53 +0530 | [diff] [blame] | 15398 | (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) || |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15399 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 15400 | { |
Abhishek Singh | 19a7dd9 | 2015-12-30 16:31:51 +0530 | [diff] [blame] | 15401 | spin_lock_bh(&pAdapter->lock_for_active_session); |
| 15402 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 15403 | { |
| 15404 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 15405 | } |
| 15406 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Abhishek Singh | f796258 | 2015-10-23 10:54:06 +0530 | [diff] [blame] | 15407 | hdd_connSetConnectionState(pHddStaCtx, |
| 15408 | eConnectionState_Disconnecting); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15409 | /* Issue disconnect to CSR */ |
| 15410 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 15411 | status = sme_RoamDisconnect(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15412 | pAdapter->sessionId, |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 15413 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 15414 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) { |
| 15415 | hddLog(LOG1, |
| 15416 | FL("Already disconnected or connect was in sme/roam pending list and removed by disconnect")); |
| 15417 | } else if ( 0 != status ) { |
| 15418 | hddLog(LOGE, |
| 15419 | FL("csrRoamDisconnect failure, returned %d"), |
| 15420 | (int)status ); |
| 15421 | result = -EINVAL; |
| 15422 | goto disconnected; |
| 15423 | } |
| 15424 | ret = wait_for_completion_timeout( |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15425 | &pAdapter->disconnect_comp_var, |
| 15426 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 15427 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status)) { |
| 15428 | hddLog(LOGE, |
| 15429 | "%s: Failed to disconnect, timed out", __func__); |
| 15430 | result = -ETIMEDOUT; |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15431 | } |
| 15432 | } |
| 15433 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 15434 | { |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 15435 | ret = wait_for_completion_timeout( |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15436 | &pAdapter->disconnect_comp_var, |
| 15437 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 15438 | if (!ret) |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15439 | { |
| 15440 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 15441 | result = -ETIMEDOUT; |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15442 | } |
| 15443 | } |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 15444 | disconnected: |
| 15445 | hddLog(LOG1, |
| 15446 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 15447 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 15448 | return result; |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15449 | } |
| 15450 | |
Selvaraj, Sridhar | 95e226f | 2016-06-18 12:27:25 +0530 | [diff] [blame] | 15451 | /** |
| 15452 | * wlan_hdd_reassoc_bssid_hint() - Start reassociation if bssid is present |
| 15453 | * @adapter: Pointer to the HDD adapter |
| 15454 | * @req: Pointer to the structure cfg_connect_params receieved from user space |
| 15455 | * |
| 15456 | * This function will start reassociation if bssid hint, channel hint and |
| 15457 | * previous bssid parameters are present in the connect request |
| 15458 | * |
| 15459 | * Return: success if reassociation is happening |
| 15460 | * Error code if reassociation is not permitted or not happening |
| 15461 | */ |
| 15462 | #ifdef CFG80211_CONNECT_PREV_BSSID |
| 15463 | static int wlan_hdd_reassoc_bssid_hint(hdd_adapter_t *adapter, |
| 15464 | struct cfg80211_connect_params *req) |
| 15465 | { |
| 15466 | int status = -EPERM; |
| 15467 | if (req->bssid_hint && req->channel_hint && req->prev_bssid) { |
| 15468 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 15469 | FL("REASSOC Attempt on channel %d to "MAC_ADDRESS_STR), |
| 15470 | req->channel_hint->hw_value, |
| 15471 | MAC_ADDR_ARRAY(req->bssid_hint)); |
| 15472 | status = hdd_reassoc(adapter, req->bssid_hint, |
| 15473 | req->channel_hint->hw_value, |
| 15474 | CONNECT_CMD_USERSPACE); |
| 15475 | } |
| 15476 | return status; |
| 15477 | } |
| 15478 | #else |
| 15479 | static int wlan_hdd_reassoc_bssid_hint(hdd_adapter_t *adapter, |
| 15480 | struct cfg80211_connect_params *req) |
| 15481 | { |
| 15482 | return -EPERM; |
| 15483 | } |
| 15484 | #endif |
| 15485 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15486 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 15487 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 15488 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15489 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 15490 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15491 | struct net_device *ndev, |
| 15492 | struct cfg80211_connect_params *req |
| 15493 | ) |
| 15494 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15495 | int status; |
Sreelakshmi Konamki | e652174 | 2016-03-18 12:44:27 +0530 | [diff] [blame] | 15496 | u16 channel; |
Edhar, Mahesh Kumar | 496c7f7 | 2016-03-18 12:47:44 +0530 | [diff] [blame] | 15497 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) || \ |
| 15498 | defined(CFG80211_BSSID_HINT_BACKPORT) |
Sreelakshmi Konamki | e652174 | 2016-03-18 12:44:27 +0530 | [diff] [blame] | 15499 | const u8 *bssid_hint = req->bssid_hint; |
| 15500 | #else |
| 15501 | const u8 *bssid_hint = NULL; |
| 15502 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15503 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15504 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 15505 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15506 | |
| 15507 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15508 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15509 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15510 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 15511 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15512 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15513 | "%s: device_mode = %s (%d)", __func__, |
| 15514 | hdd_device_modetoString(pAdapter->device_mode), |
| 15515 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15516 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15517 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 15518 | if (!pHddCtx) |
| 15519 | { |
| 15520 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15521 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 15522 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 15523 | } |
| 15524 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15525 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15526 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15527 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15528 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15529 | } |
| 15530 | |
Selvaraj, Sridhar | 95e226f | 2016-06-18 12:27:25 +0530 | [diff] [blame] | 15531 | status = wlan_hdd_reassoc_bssid_hint(pAdapter, req); |
| 15532 | if (0 == status) |
| 15533 | return status; |
| 15534 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 15535 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15536 | #ifdef WLAN_BTAMP_FEATURE |
| 15537 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15538 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15539 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15540 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15541 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 15542 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15543 | } |
| 15544 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15545 | |
| 15546 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 15547 | //P2P Mode will be taken care in Open/close adapter |
| 15548 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 15549 | (vos_concurrent_open_sessions_running())) { |
| 15550 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 15551 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15552 | } |
| 15553 | |
| 15554 | /*Try disconnecting if already in connected state*/ |
| 15555 | status = wlan_hdd_try_disconnect(pAdapter); |
| 15556 | if ( 0 > status) |
| 15557 | { |
| 15558 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 15559 | " connection")); |
| 15560 | return -EALREADY; |
| 15561 | } |
Agrawal Ashish | 559530c | 2015-12-01 18:04:20 +0530 | [diff] [blame] | 15562 | /* Check for max concurrent connections after doing disconnect if any*/ |
| 15563 | if (vos_max_concurrent_connections_reached()) { |
| 15564 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 15565 | return -ECONNREFUSED; |
| 15566 | } |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15567 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15568 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15569 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15570 | |
| 15571 | if ( 0 > status) |
| 15572 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15573 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15574 | __func__); |
| 15575 | return status; |
| 15576 | } |
Sravan Kumar Kairam | 589c572 | 2016-01-27 20:28:53 +0530 | [diff] [blame] | 15577 | |
| 15578 | if (pHddCtx->spoofMacAddr.isEnabled) |
| 15579 | { |
| 15580 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 15581 | "%s: MAC Spoofing enabled ", __func__); |
| 15582 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 15583 | * to fill TxBds for probe request during SSID scan which may happen |
| 15584 | * as part of connect command |
| 15585 | */ |
| 15586 | status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
| 15587 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
| 15588 | if (status != VOS_STATUS_SUCCESS) |
| 15589 | return -ECONNREFUSED; |
| 15590 | } |
| 15591 | |
Sreelakshmi Konamki | e652174 | 2016-03-18 12:44:27 +0530 | [diff] [blame] | 15592 | if (req->channel) |
| 15593 | channel = req->channel->hw_value; |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 15594 | else |
Sreelakshmi Konamki | e652174 | 2016-03-18 12:44:27 +0530 | [diff] [blame] | 15595 | channel = 0; |
Kapil Gupta | 312028a | 2016-10-25 14:15:20 +0530 | [diff] [blame] | 15596 | |
| 15597 | /* Abort if any scan is going on */ |
| 15598 | status = wlan_hdd_scan_abort(pAdapter); |
| 15599 | if (0 != status) |
| 15600 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("scan abort failed")); |
| 15601 | |
Sreelakshmi Konamki | e652174 | 2016-03-18 12:44:27 +0530 | [diff] [blame] | 15602 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 15603 | req->ssid_len, req->bssid, |
| 15604 | bssid_hint, channel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15605 | |
Sushant Kaushik | d708398 | 2015-03-18 14:33:24 +0530 | [diff] [blame] | 15606 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15607 | { |
| 15608 | //ReEnable BMPS if disabled |
| 15609 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 15610 | (NULL != pHddCtx)) |
| 15611 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 15612 | if (pHddCtx->hdd_wlan_suspended) |
| 15613 | { |
| 15614 | hdd_set_pwrparams(pHddCtx); |
| 15615 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15616 | //ReEnable Bmps and Imps back |
| 15617 | hdd_enable_bmps_imps(pHddCtx); |
| 15618 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 15619 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15620 | return status; |
| 15621 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15622 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15623 | EXIT(); |
| 15624 | return status; |
| 15625 | } |
| 15626 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 15627 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 15628 | struct net_device *ndev, |
| 15629 | struct cfg80211_connect_params *req) |
| 15630 | { |
| 15631 | int ret; |
| 15632 | vos_ssr_protect(__func__); |
| 15633 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 15634 | vos_ssr_unprotect(__func__); |
| 15635 | |
| 15636 | return ret; |
| 15637 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15638 | |
| 15639 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 15640 | * FUNCTION: wlan_hdd_disconnect |
| 15641 | * This function is used to issue a disconnect request to SME |
| 15642 | */ |
| 15643 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 15644 | { |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 15645 | int status, result = 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 15646 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15647 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 15648 | long ret; |
Padma, Santhosh Kumar | 5f7d10e | 2016-12-05 18:55:06 +0530 | [diff] [blame] | 15649 | eConnectionState prev_conn_state; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15650 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15651 | ENTER(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15652 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15653 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15654 | if (0 != status) |
| 15655 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15656 | return status; |
| 15657 | } |
Abhishek Singh | 07e4a89 | 2015-11-23 11:29:57 +0530 | [diff] [blame] | 15658 | /* Indicate sme of disconnect so that in progress connection or preauth |
| 15659 | * can be aborted |
| 15660 | */ |
| 15661 | sme_abortConnection(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Sushant Kaushik | b4834d2 | 2015-07-15 15:29:05 +0530 | [diff] [blame] | 15662 | pAdapter->sessionId); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15663 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 15664 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 15665 | /* Need to apply spin lock before decreasing active sessions |
| 15666 | * as there can be chance for double decrement if context switch |
| 15667 | * Calls hdd_DisConnectHandler. |
| 15668 | */ |
| 15669 | |
Padma, Santhosh Kumar | 5f7d10e | 2016-12-05 18:55:06 +0530 | [diff] [blame] | 15670 | prev_conn_state = pHddStaCtx->conn_info.connState; |
| 15671 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 15672 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 15673 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 15674 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 15675 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 15676 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 15677 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 15678 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 15679 | |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 15680 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 15681 | FL( "Set HDD connState to eConnectionState_Disconnecting" )); |
| 15682 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 15683 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15684 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 15685 | /* |
| 15686 | * stop tx queues before deleting STA/BSS context from the firmware. |
| 15687 | * tx has to be disabled because the firmware can get busy dropping |
| 15688 | * the tx frames after BSS/STA has been deleted and will not send |
| 15689 | * back a response resulting in WDI timeout |
| 15690 | */ |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 15691 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 15692 | netif_tx_disable(pAdapter->dev); |
| 15693 | netif_carrier_off(pAdapter->dev); |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 15694 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 15695 | /*issue disconnect*/ |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 15696 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15697 | pAdapter->sessionId, reason); |
Padma, Santhosh Kumar | 5f7d10e | 2016-12-05 18:55:06 +0530 | [diff] [blame] | 15698 | if((eHAL_STATUS_CMD_NOT_QUEUED == status) && |
| 15699 | prev_conn_state != eConnectionState_Connecting) |
| 15700 | { |
| 15701 | hddLog(LOG1, |
| 15702 | FL("status = %d, already disconnected"), status); |
| 15703 | result = 0; |
| 15704 | goto disconnected; |
| 15705 | } |
| 15706 | /* |
| 15707 | * Wait here instead of returning directly, this will block the next |
| 15708 | * connect command and allow processing of the scan for ssid and |
| 15709 | * the previous connect command in CSR. Else we might hit some |
| 15710 | * race conditions leading to SME and HDD out of sync. |
| 15711 | */ |
| 15712 | else if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 15713 | { |
| 15714 | hddLog(LOG1, |
| 15715 | FL("Already disconnected or connect was in sme/roam pending list and removed by disconnect")); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 15716 | } |
| 15717 | else if ( 0 != status ) |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 15718 | { |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 15719 | hddLog(LOGE, |
| 15720 | FL("csrRoamDisconnect failure, returned %d"), |
| 15721 | (int)status); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 15722 | result = -EINVAL; |
| 15723 | goto disconnected; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 15724 | } |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 15725 | ret = wait_for_completion_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 15726 | &pAdapter->disconnect_comp_var, |
| 15727 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 15728 | if (!ret && (eHAL_STATUS_CMD_NOT_QUEUED != status)) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15729 | { |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 15730 | hddLog(LOGE, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 15731 | "%s: Failed to disconnect, timed out", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 15732 | result = -ETIMEDOUT; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 15733 | } |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 15734 | disconnected: |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 15735 | hddLog(LOG1, |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 15736 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 15737 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
Mahesh A Saptasagar | 936ffc3 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 15738 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0) |
| 15739 | /* Sending disconnect event to userspace for kernel version < 3.11 |
| 15740 | * is handled by __cfg80211_disconnect call to __cfg80211_disconnected |
| 15741 | */ |
| 15742 | hddLog(LOG1, FL("Send disconnected event to userspace")); |
| 15743 | |
Mahesh A Saptasagar | f5859b1 | 2016-06-01 17:17:50 +0530 | [diff] [blame] | 15744 | wlan_hdd_cfg80211_indicate_disconnect(pAdapter->dev, true, |
Mahesh A Saptasagar | 936ffc3 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 15745 | WLAN_REASON_UNSPECIFIED); |
| 15746 | #endif |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 15747 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15748 | EXIT(); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 15749 | return result; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 15750 | } |
| 15751 | |
| 15752 | |
| 15753 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 15754 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15755 | * This function is used to issue a disconnect request to SME |
| 15756 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 15757 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15758 | struct net_device *dev, |
| 15759 | u16 reason |
| 15760 | ) |
| 15761 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15762 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15763 | int status; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 15764 | tCsrRoamProfile *pRoamProfile; |
| 15765 | hdd_station_ctx_t *pHddStaCtx; |
| 15766 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 15767 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 15768 | tANI_U8 staIdx; |
| 15769 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15770 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15771 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15772 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 15773 | if (!pAdapter) { |
| 15774 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 15775 | return -EINVAL; |
| 15776 | } |
| 15777 | |
| 15778 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15779 | if (!pHddStaCtx) { |
| 15780 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD STA context is NULL")); |
| 15781 | return -EINVAL; |
| 15782 | } |
| 15783 | |
| 15784 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 15785 | status = wlan_hdd_validate_context(pHddCtx); |
| 15786 | if (0 != status) |
| 15787 | { |
| 15788 | return status; |
| 15789 | } |
| 15790 | |
| 15791 | pRoamProfile = &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
| 15792 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15793 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15794 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 15795 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15796 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 15797 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 15798 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15799 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15800 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 15801 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15802 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15803 | if (NULL != pRoamProfile) |
| 15804 | { |
| 15805 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 15806 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 15807 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15808 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15809 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15810 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 15811 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15812 | switch(reason) |
| 15813 | { |
| 15814 | case WLAN_REASON_MIC_FAILURE: |
| 15815 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 15816 | break; |
| 15817 | |
| 15818 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 15819 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 15820 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 15821 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 15822 | break; |
| 15823 | |
| 15824 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 15825 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 15826 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15827 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 15828 | break; |
| 15829 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15830 | default: |
| 15831 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 15832 | break; |
| 15833 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 15834 | pScanInfo = &pHddCtx->scan_info; |
| 15835 | if (pScanInfo->mScanPending) |
| 15836 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 15837 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 15838 | "Aborting Scan"); |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 15839 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 15840 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 15841 | } |
Agarwal Ashish | c089cec | 2015-08-10 13:10:04 +0530 | [diff] [blame] | 15842 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 15843 | #ifdef FEATURE_WLAN_TDLS |
| 15844 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 15845 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 15846 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 15847 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 15848 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 15849 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 15850 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 15851 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 15852 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15853 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 15854 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 15855 | MAC_ADDR_ARRAY(mac)); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 15856 | status = sme_DeleteTdlsPeerSta( |
| 15857 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15858 | pAdapter->sessionId, |
| 15859 | mac); |
| 15860 | if (status != eHAL_STATUS_SUCCESS) { |
| 15861 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 15862 | return -EPERM; |
| 15863 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 15864 | } |
| 15865 | } |
| 15866 | #endif |
Padma, Santhosh Kumar | 5f7d10e | 2016-12-05 18:55:06 +0530 | [diff] [blame] | 15867 | |
| 15868 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u connState %d"), |
| 15869 | reasonCode, |
| 15870 | pHddStaCtx->conn_info.connState); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 15871 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 15872 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15873 | { |
| 15874 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 15875 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15876 | __func__, (int)status ); |
| 15877 | return -EINVAL; |
| 15878 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15879 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 15880 | else |
| 15881 | { |
| 15882 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 15883 | "called while in %d state", __func__, |
| 15884 | pHddStaCtx->conn_info.connState); |
| 15885 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15886 | } |
| 15887 | else |
| 15888 | { |
| 15889 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 15890 | } |
| 15891 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15892 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15893 | return status; |
| 15894 | } |
| 15895 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 15896 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 15897 | struct net_device *dev, |
| 15898 | u16 reason |
| 15899 | ) |
| 15900 | { |
| 15901 | int ret; |
| 15902 | vos_ssr_protect(__func__); |
| 15903 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 15904 | vos_ssr_unprotect(__func__); |
| 15905 | |
| 15906 | return ret; |
| 15907 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 15908 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15909 | /* |
| 15910 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15911 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15912 | * settings in IBSS mode. |
| 15913 | */ |
| 15914 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15915 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15916 | struct cfg80211_ibss_params *params |
| 15917 | ) |
| 15918 | { |
| 15919 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15920 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15921 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 15922 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15923 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15924 | ENTER(); |
| 15925 | |
| 15926 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 15927 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15928 | |
| 15929 | if (params->ie_len && ( NULL != params->ie) ) |
| 15930 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 15931 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 15932 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15933 | { |
| 15934 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 15935 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 15936 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 15937 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15938 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 15939 | tDot11fIEWPA dot11WPAIE; |
| 15940 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 15941 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 15942 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 15943 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 15944 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 15945 | params->ie_len, DOT11F_EID_WPA); |
| 15946 | if ( NULL != ie ) |
| 15947 | { |
| 15948 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 15949 | // Unpack the WPA IE |
| 15950 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 15951 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 15952 | &ie[2+4], |
| 15953 | ie[1] - 4, |
| 15954 | &dot11WPAIE); |
| 15955 | /*Extract the multicast cipher, the encType for unicast |
| 15956 | cipher for wpa-none is none*/ |
| 15957 | encryptionType = |
| 15958 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 15959 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15960 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 15961 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15962 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 15963 | |
| 15964 | if (0 > status) |
| 15965 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15966 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15967 | __func__); |
| 15968 | return status; |
| 15969 | } |
| 15970 | } |
| 15971 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15972 | pWextState->roamProfile.AuthType.authType[0] = |
| 15973 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15974 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 15975 | |
| 15976 | if (params->privacy) |
| 15977 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15978 | /* Security enabled IBSS, At this time there is no information available |
| 15979 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15980 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15981 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15982 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15983 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15984 | *enable privacy bit in beacons */ |
| 15985 | |
| 15986 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 15987 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 15988 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 15989 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15990 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 15991 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 15992 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15993 | return status; |
| 15994 | } |
| 15995 | |
| 15996 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15997 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15998 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15999 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16000 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16001 | struct net_device *dev, |
| 16002 | struct cfg80211_ibss_params *params |
| 16003 | ) |
| 16004 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16005 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16006 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 16007 | tCsrRoamProfile *pRoamProfile; |
| 16008 | int status; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 16009 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 16010 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16011 | tSirMacAddr bssid; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16012 | |
| 16013 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 16014 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16015 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16016 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 16017 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16018 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 16019 | "%s: device_mode = %s (%d)", __func__, |
| 16020 | hdd_device_modetoString(pAdapter->device_mode), |
| 16021 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16022 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16023 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16024 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16025 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16026 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16027 | } |
| 16028 | |
| 16029 | if (NULL == pWextState) |
| 16030 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16031 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16032 | __func__); |
| 16033 | return -EIO; |
| 16034 | } |
| 16035 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 16036 | if (vos_max_concurrent_connections_reached()) { |
| 16037 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 16038 | return -ECONNREFUSED; |
| 16039 | } |
| 16040 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16041 | /*Try disconnecting if already in connected state*/ |
| 16042 | status = wlan_hdd_try_disconnect(pAdapter); |
| 16043 | if ( 0 > status) |
| 16044 | { |
| 16045 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 16046 | " IBSS connection")); |
| 16047 | return -EALREADY; |
| 16048 | } |
| 16049 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16050 | pRoamProfile = &pWextState->roamProfile; |
| 16051 | |
| 16052 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 16053 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16054 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16055 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16056 | return -EINVAL; |
| 16057 | } |
| 16058 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 16059 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 16060 | if (NULL != params->bssid) { |
| 16061 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 16062 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 16063 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 16064 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 16065 | return -EIO; |
| 16066 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16067 | vos_mem_copy((v_U8_t *)bssid, (v_U8_t *)params->bssid, sizeof(bssid)); |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 16068 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 16069 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 16070 | { |
| 16071 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 16072 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 16073 | { |
| 16074 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 16075 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 16076 | return -EIO; |
| 16077 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16078 | |
| 16079 | vos_mem_copy((v_U8_t *)bssid, |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 16080 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16081 | sizeof(bssid)); |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 16082 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 16083 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16084 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 16085 | if (NULL != |
| 16086 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 16087 | params->chandef.chan) |
| 16088 | #else |
| 16089 | params->channel) |
| 16090 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16091 | { |
| 16092 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 16093 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 16094 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 16095 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16096 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16097 | |
| 16098 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16099 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 16100 | ieee80211_frequency_to_channel( |
| 16101 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 16102 | params->chandef.chan->center_freq); |
| 16103 | #else |
| 16104 | params->channel->center_freq); |
| 16105 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 16106 | |
| 16107 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 16108 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16109 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 16110 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 16111 | __func__); |
| 16112 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16113 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 16114 | |
| 16115 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16116 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 16117 | if (channelNum == validChan[indx]) |
| 16118 | { |
| 16119 | break; |
| 16120 | } |
| 16121 | } |
| 16122 | if (indx >= numChans) |
| 16123 | { |
| 16124 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16125 | __func__, channelNum); |
| 16126 | return -EINVAL; |
| 16127 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 16128 | /* Set the Operational Channel */ |
| 16129 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 16130 | channelNum); |
| 16131 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 16132 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 16133 | pRoamProfile->ChannelInfo.ChannelList = |
| 16134 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16135 | } |
| 16136 | |
| 16137 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16138 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16139 | if (status < 0) |
| 16140 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16141 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16142 | __func__); |
| 16143 | return status; |
| 16144 | } |
| 16145 | |
| 16146 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16147 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Abhishek Singh | 4d92468 | 2015-11-17 15:23:06 +0530 | [diff] [blame] | 16148 | params->ssid_len, (const u8 *)&bssid, NULL, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 16149 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16150 | |
| 16151 | if (0 > status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16152 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16153 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16154 | EXIT(); |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16155 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16156 | } |
| 16157 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16158 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 16159 | struct net_device *dev, |
| 16160 | struct cfg80211_ibss_params *params |
| 16161 | ) |
| 16162 | { |
| 16163 | int ret = 0; |
| 16164 | |
| 16165 | vos_ssr_protect(__func__); |
| 16166 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 16167 | vos_ssr_unprotect(__func__); |
| 16168 | |
| 16169 | return ret; |
| 16170 | } |
| 16171 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16172 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16173 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16174 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16175 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16176 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16177 | struct net_device *dev |
| 16178 | ) |
| 16179 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16180 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 16181 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 16182 | tCsrRoamProfile *pRoamProfile; |
| 16183 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16184 | int status; |
Abhishek Singh | 69de330 | 2016-11-11 16:44:32 +0530 | [diff] [blame] | 16185 | eHalStatus hal_status; |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 16186 | #ifdef WLAN_FEATURE_RMC |
| 16187 | tANI_U8 addIE[WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN] = {0}; |
| 16188 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16189 | |
| 16190 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 16191 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16192 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16193 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 16194 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16195 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16196 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16197 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16198 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16199 | } |
| 16200 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 16201 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 16202 | hdd_device_modetoString(pAdapter->device_mode), |
| 16203 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16204 | if (NULL == pWextState) |
| 16205 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16206 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16207 | __func__); |
| 16208 | return -EIO; |
| 16209 | } |
| 16210 | |
| 16211 | pRoamProfile = &pWextState->roamProfile; |
| 16212 | |
| 16213 | /* Issue disconnect only if interface type is set to IBSS */ |
| 16214 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 16215 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16216 | 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] | 16217 | __func__); |
| 16218 | return -EINVAL; |
| 16219 | } |
| 16220 | |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 16221 | #ifdef WLAN_FEATURE_RMC |
| 16222 | /* Clearing add IE of beacon */ |
| 16223 | if (ccmCfgSetStr(pHddCtx->hHal, |
| 16224 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, &addIE[0], |
| 16225 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN, |
| 16226 | NULL, eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS) |
| 16227 | { |
| 16228 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 16229 | "%s: unable to clear PROBE_RSP_BCN_ADDNIE_DATA", __func__); |
| 16230 | return -EINVAL; |
| 16231 | } |
| 16232 | if (ccmCfgSetInt(pHddCtx->hHal, |
| 16233 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0, NULL, |
| 16234 | eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS) |
| 16235 | { |
| 16236 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 16237 | "%s: unable to clear WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG", |
| 16238 | __func__); |
| 16239 | return -EINVAL; |
| 16240 | } |
| 16241 | |
| 16242 | // Reset WNI_CFG_PROBE_RSP Flags |
| 16243 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 16244 | |
| 16245 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 16246 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 0,NULL, |
| 16247 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 16248 | { |
| 16249 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 16250 | "%s: unable to clear WNI_CFG_PROBE_RSP_ADDNIE_FLAG", |
| 16251 | __func__); |
| 16252 | return -EINVAL; |
| 16253 | } |
| 16254 | #endif |
| 16255 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16256 | /* Issue Disconnect request */ |
| 16257 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Abhishek Singh | 69de330 | 2016-11-11 16:44:32 +0530 | [diff] [blame] | 16258 | hal_status = sme_RoamDisconnect(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 16259 | pAdapter->sessionId, |
| 16260 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 16261 | if (!HAL_STATUS_SUCCESS(hal_status)) { |
| 16262 | hddLog(LOGE, |
| 16263 | FL("sme_RoamDisconnect failed hal_status(%d)"), |
| 16264 | hal_status); |
| 16265 | return -EAGAIN; |
| 16266 | } |
| 16267 | status = wait_for_completion_timeout( |
| 16268 | &pAdapter->disconnect_comp_var, |
| 16269 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 16270 | if (!status) { |
| 16271 | hddLog(LOGE, |
| 16272 | FL("wait on disconnect_comp_var failed")); |
| 16273 | return -ETIMEDOUT; |
| 16274 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16275 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16276 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16277 | return 0; |
| 16278 | } |
| 16279 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16280 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 16281 | struct net_device *dev |
| 16282 | ) |
| 16283 | { |
| 16284 | int ret = 0; |
| 16285 | |
| 16286 | vos_ssr_protect(__func__); |
| 16287 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 16288 | vos_ssr_unprotect(__func__); |
| 16289 | |
| 16290 | return ret; |
| 16291 | } |
| 16292 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16293 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 16294 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16295 | * This function is used to set the phy parameters |
| 16296 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 16297 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 16298 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16299 | u32 changed) |
| 16300 | { |
| 16301 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 16302 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16303 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16304 | |
| 16305 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16306 | |
| 16307 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16308 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 16309 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16310 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16311 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16312 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16313 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16314 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16315 | } |
| 16316 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16317 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 16318 | { |
| 16319 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 16320 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 16321 | wiphy->rts_threshold; |
| 16322 | |
| 16323 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16324 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16325 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16326 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 16327 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16328 | __func__, rts_threshold); |
| 16329 | return -EINVAL; |
| 16330 | } |
| 16331 | |
| 16332 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 16333 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16334 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16335 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16336 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 16337 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16338 | __func__, rts_threshold); |
| 16339 | return -EIO; |
| 16340 | } |
| 16341 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16342 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16343 | rts_threshold); |
| 16344 | } |
| 16345 | |
| 16346 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 16347 | { |
| 16348 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 16349 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 16350 | wiphy->frag_threshold; |
| 16351 | |
| 16352 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16353 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16354 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16355 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 16356 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16357 | frag_threshold); |
| 16358 | return -EINVAL; |
| 16359 | } |
| 16360 | |
| 16361 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 16362 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16363 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16364 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16365 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 16366 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16367 | __func__, frag_threshold); |
| 16368 | return -EIO; |
| 16369 | } |
| 16370 | |
| 16371 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 16372 | frag_threshold); |
| 16373 | } |
| 16374 | |
| 16375 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 16376 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 16377 | { |
| 16378 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 16379 | wiphy->retry_short : |
| 16380 | wiphy->retry_long; |
| 16381 | |
| 16382 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 16383 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 16384 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16385 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16386 | __func__, retry_value); |
| 16387 | return -EINVAL; |
| 16388 | } |
| 16389 | |
| 16390 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 16391 | { |
| 16392 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 16393 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16394 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16395 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16396 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 16397 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16398 | __func__, retry_value); |
| 16399 | return -EIO; |
| 16400 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16401 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16402 | __func__, retry_value); |
| 16403 | } |
| 16404 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 16405 | { |
| 16406 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 16407 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16408 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16409 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16410 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 16411 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16412 | __func__, retry_value); |
| 16413 | return -EIO; |
| 16414 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16415 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16416 | __func__, retry_value); |
| 16417 | } |
| 16418 | } |
| 16419 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16420 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16421 | return 0; |
| 16422 | } |
| 16423 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 16424 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 16425 | u32 changed) |
| 16426 | { |
| 16427 | int ret; |
| 16428 | |
| 16429 | vos_ssr_protect(__func__); |
| 16430 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 16431 | vos_ssr_unprotect(__func__); |
| 16432 | |
| 16433 | return ret; |
| 16434 | } |
| 16435 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16436 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 16437 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16438 | * This function is used to set the txpower |
| 16439 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 16440 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 16441 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 16442 | struct wireless_dev *wdev, |
| 16443 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16444 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16445 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16446 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16447 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16448 | #endif |
| 16449 | int dbm) |
| 16450 | { |
| 16451 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16452 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16453 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 16454 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16455 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16456 | |
| 16457 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16458 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16459 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16460 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 16461 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16462 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16463 | if (0 != status) |
| 16464 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16465 | return status; |
| 16466 | } |
| 16467 | |
| 16468 | hHal = pHddCtx->hHal; |
| 16469 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16470 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 16471 | dbm, ccmCfgSetCallback, |
| 16472 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16473 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16474 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16475 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 16476 | return -EIO; |
| 16477 | } |
| 16478 | |
| 16479 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 16480 | dbm); |
| 16481 | |
| 16482 | switch(type) |
| 16483 | { |
| 16484 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 16485 | /* Fall through */ |
| 16486 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 16487 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 16488 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16489 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 16490 | __func__); |
| 16491 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16492 | } |
| 16493 | break; |
| 16494 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16495 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16496 | __func__); |
| 16497 | return -EOPNOTSUPP; |
| 16498 | break; |
| 16499 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16500 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 16501 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16502 | return -EIO; |
| 16503 | } |
| 16504 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16505 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16506 | return 0; |
| 16507 | } |
| 16508 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 16509 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 16510 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 16511 | struct wireless_dev *wdev, |
| 16512 | #endif |
| 16513 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 16514 | enum tx_power_setting type, |
| 16515 | #else |
| 16516 | enum nl80211_tx_power_setting type, |
| 16517 | #endif |
| 16518 | int dbm) |
| 16519 | { |
| 16520 | int ret; |
| 16521 | vos_ssr_protect(__func__); |
| 16522 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 16523 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 16524 | wdev, |
| 16525 | #endif |
| 16526 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 16527 | type, |
| 16528 | #else |
| 16529 | type, |
| 16530 | #endif |
| 16531 | dbm); |
| 16532 | vos_ssr_unprotect(__func__); |
| 16533 | |
| 16534 | return ret; |
| 16535 | } |
| 16536 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16537 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16538 | * FUNCTION: __wlan_hdd_cfg80211_get_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16539 | * This function is used to read the txpower |
| 16540 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16541 | static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 16542 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 16543 | struct wireless_dev *wdev, |
| 16544 | #endif |
| 16545 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16546 | { |
| 16547 | |
| 16548 | hdd_adapter_t *pAdapter; |
| 16549 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16550 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16551 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16552 | ENTER(); |
| 16553 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16554 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16555 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16556 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16557 | *dbm = 0; |
| 16558 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16559 | } |
| 16560 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16561 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 16562 | if (NULL == pAdapter) |
| 16563 | { |
| 16564 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 16565 | return -ENOENT; |
| 16566 | } |
| 16567 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 16568 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16569 | TRACE_CODE_HDD_CFG80211_GET_TXPOWER, |
| 16570 | pAdapter->sessionId, pAdapter->device_mode)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16571 | wlan_hdd_get_classAstats(pAdapter); |
| 16572 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 16573 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16574 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16575 | return 0; |
| 16576 | } |
| 16577 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16578 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 16579 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 16580 | struct wireless_dev *wdev, |
| 16581 | #endif |
| 16582 | int *dbm) |
| 16583 | { |
| 16584 | int ret; |
| 16585 | |
| 16586 | vos_ssr_protect(__func__); |
| 16587 | ret = __wlan_hdd_cfg80211_get_txpower(wiphy, |
| 16588 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 16589 | wdev, |
| 16590 | #endif |
| 16591 | dbm); |
| 16592 | vos_ssr_unprotect(__func__); |
| 16593 | |
| 16594 | return ret; |
| 16595 | } |
| 16596 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16597 | static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16598 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 16599 | const u8* mac, |
| 16600 | #else |
| 16601 | u8* mac, |
| 16602 | #endif |
| 16603 | struct station_info *sinfo) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16604 | { |
| 16605 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 16606 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 16607 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 16608 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16609 | |
| 16610 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 16611 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16612 | |
| 16613 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 16614 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 16615 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 16616 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 16617 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 16618 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 16619 | tANI_U16 maxRate = 0; |
| 16620 | tANI_U16 myRate; |
| 16621 | tANI_U16 currentRate = 0; |
| 16622 | tANI_U8 maxSpeedMCS = 0; |
| 16623 | tANI_U8 maxMCSIdx = 0; |
| 16624 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 16625 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 16626 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16627 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16628 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16629 | #ifdef WLAN_FEATURE_11AC |
| 16630 | tANI_U32 vht_mcs_map; |
| 16631 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 16632 | #endif /* WLAN_FEATURE_11AC */ |
| 16633 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16634 | ENTER(); |
| 16635 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16636 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 16637 | (0 == ssidlen)) |
| 16638 | { |
| 16639 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 16640 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 16641 | /*To keep GUI happy*/ |
| 16642 | return 0; |
| 16643 | } |
| 16644 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 16645 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 16646 | { |
| 16647 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16648 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
Sachin Ahuja | 81ab181 | 2016-08-19 21:35:58 +0530 | [diff] [blame] | 16649 | /* return a cached value */ |
| 16650 | sinfo->signal = pAdapter->rssi; |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 16651 | return 0; |
| 16652 | } |
| 16653 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16654 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16655 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16656 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16657 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16658 | } |
| 16659 | |
Hanumantha Reddy Pothula | dce6674 | 2015-08-25 18:08:44 +0530 | [diff] [blame] | 16660 | wlan_hdd_get_station_stats(pAdapter); |
| 16661 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16662 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 16663 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 16664 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 16665 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 16666 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 16667 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 16668 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 16669 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 16670 | { |
| 16671 | rate_flags = pAdapter->maxRateFlags; |
| 16672 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 16673 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16674 | //convert to the UI units of 100kbps |
| 16675 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 16676 | |
| 16677 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16678 | 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] | 16679 | sinfo->signal, |
| 16680 | pCfg->reportMaxLinkSpeed, |
| 16681 | myRate, |
| 16682 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 16683 | (int) pCfg->linkSpeedRssiMid, |
| 16684 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16685 | (int) rate_flags, |
| 16686 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16687 | #endif //LINKSPEED_DEBUG_ENABLED |
| 16688 | |
| 16689 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 16690 | { |
| 16691 | // we do not want to necessarily report the current speed |
| 16692 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 16693 | { |
| 16694 | // report the max possible speed |
| 16695 | rssidx = 0; |
| 16696 | } |
| 16697 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 16698 | { |
| 16699 | // report the max possible speed with RSSI scaling |
| 16700 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 16701 | { |
| 16702 | // report the max possible speed |
| 16703 | rssidx = 0; |
| 16704 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 16705 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16706 | { |
| 16707 | // report middle speed |
| 16708 | rssidx = 1; |
| 16709 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 16710 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 16711 | { |
| 16712 | // report middle speed |
| 16713 | rssidx = 2; |
| 16714 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16715 | else |
| 16716 | { |
| 16717 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 16718 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16719 | } |
| 16720 | } |
| 16721 | else |
| 16722 | { |
| 16723 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 16724 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 16725 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 16726 | __func__, pCfg->reportMaxLinkSpeed); |
| 16727 | rssidx = 0; |
| 16728 | } |
| 16729 | |
| 16730 | maxRate = 0; |
| 16731 | |
| 16732 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 16733 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 16734 | OperationalRates, &ORLeng)) |
| 16735 | { |
| 16736 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 16737 | /*To keep GUI happy*/ |
| 16738 | return 0; |
| 16739 | } |
| 16740 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16741 | for (i = 0; i < ORLeng; i++) |
| 16742 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16743 | 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] | 16744 | { |
| 16745 | /* Validate Rate Set */ |
| 16746 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 16747 | { |
| 16748 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 16749 | break; |
| 16750 | } |
| 16751 | } |
| 16752 | /* Update MAX rate */ |
| 16753 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 16754 | } |
| 16755 | |
| 16756 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 16757 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 16758 | ExtendedRates, &ERLeng)) |
| 16759 | { |
| 16760 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 16761 | /*To keep GUI happy*/ |
| 16762 | return 0; |
| 16763 | } |
| 16764 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16765 | for (i = 0; i < ERLeng; i++) |
| 16766 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16767 | 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] | 16768 | { |
| 16769 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 16770 | { |
| 16771 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 16772 | break; |
| 16773 | } |
| 16774 | } |
| 16775 | /* Update MAX rate */ |
| 16776 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 16777 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 16778 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 16779 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 16780 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 16781 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 16782 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16783 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 16784 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 16785 | mode = 2; |
| 16786 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 16787 | mode = 1; |
| 16788 | else |
| 16789 | mode = 0; |
| 16790 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 16791 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 16792 | MCSRates, &MCSLeng)) |
| 16793 | { |
| 16794 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 16795 | /*To keep GUI happy*/ |
| 16796 | return 0; |
| 16797 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16798 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16799 | #ifdef WLAN_FEATURE_11AC |
| 16800 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16801 | 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] | 16802 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16803 | 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] | 16804 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16805 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16806 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16807 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16808 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16809 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16810 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16811 | maxMCSIdx = 7; |
| 16812 | } |
| 16813 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 16814 | { |
| 16815 | maxMCSIdx = 8; |
| 16816 | } |
| 16817 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 16818 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16819 | //VHT20 is supporting 0~8 |
| 16820 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 16821 | maxMCSIdx = 8; |
| 16822 | else |
| 16823 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16824 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16825 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 16826 | if (0 != rssidx)/*check for scaled */ |
| 16827 | { |
| 16828 | //get middle rate MCS index if rssi=1/2 |
| 16829 | for (i=0; i <= maxMCSIdx; i++) |
| 16830 | { |
| 16831 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 16832 | { |
| 16833 | maxMCSIdx = i; |
| 16834 | break; |
| 16835 | } |
| 16836 | } |
| 16837 | } |
| 16838 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16839 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 16840 | { |
| 16841 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 16842 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 16843 | } |
| 16844 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 16845 | { |
| 16846 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 16847 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 16848 | } |
| 16849 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 16850 | { |
| 16851 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 16852 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 16853 | } |
| 16854 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16855 | maxSpeedMCS = 1; |
| 16856 | if (currentRate > maxRate) |
| 16857 | { |
| 16858 | maxRate = currentRate; |
| 16859 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16860 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16861 | } |
| 16862 | else |
| 16863 | #endif /* WLAN_FEATURE_11AC */ |
| 16864 | { |
| 16865 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 16866 | { |
| 16867 | rateFlag |= 1; |
| 16868 | } |
| 16869 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 16870 | { |
| 16871 | rateFlag |= 2; |
| 16872 | } |
| 16873 | |
Girish Gowli | 01abcee | 2014-07-31 20:18:55 +0530 | [diff] [blame] | 16874 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 16875 | if (rssidx == 1 || rssidx == 2) |
| 16876 | { |
| 16877 | //get middle rate MCS index if rssi=1/2 |
| 16878 | for (i=0; i <= 7; i++) |
| 16879 | { |
| 16880 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 16881 | { |
| 16882 | temp = i+1; |
| 16883 | break; |
| 16884 | } |
| 16885 | } |
| 16886 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 16887 | |
| 16888 | for (i = 0; i < MCSLeng; i++) |
| 16889 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16890 | for (j = 0; j < temp; j++) |
| 16891 | { |
| 16892 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 16893 | { |
| 16894 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
Hanumantha Reddy Pothula | fa62374 | 2015-06-16 14:08:24 +0530 | [diff] [blame] | 16895 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16896 | break; |
| 16897 | } |
| 16898 | } |
| 16899 | if ((j < temp) && (currentRate > maxRate)) |
| 16900 | { |
| 16901 | maxRate = currentRate; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16902 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16903 | } |
Hanumantha Reddy Pothula | fa62374 | 2015-06-16 14:08:24 +0530 | [diff] [blame] | 16904 | maxSpeedMCS = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16905 | } |
| 16906 | } |
| 16907 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16908 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 16909 | { |
| 16910 | maxRate = myRate; |
| 16911 | maxSpeedMCS = 1; |
| 16912 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 16913 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16914 | // 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] | 16915 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16916 | { |
| 16917 | maxRate = myRate; |
| 16918 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 16919 | { |
| 16920 | maxSpeedMCS = 0; |
| 16921 | } |
| 16922 | else |
| 16923 | { |
| 16924 | maxSpeedMCS = 1; |
| 16925 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 16926 | } |
| 16927 | } |
| 16928 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16929 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16930 | { |
| 16931 | sinfo->txrate.legacy = maxRate; |
| 16932 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 16933 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 16934 | #endif //LINKSPEED_DEBUG_ENABLED |
| 16935 | } |
| 16936 | else |
| 16937 | { |
| 16938 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16939 | #ifdef WLAN_FEATURE_11AC |
| 16940 | sinfo->txrate.nss = 1; |
| 16941 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 16942 | { |
| 16943 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16944 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16945 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16946 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16947 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16948 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 16949 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 16950 | } |
| 16951 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 16952 | { |
| 16953 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 16954 | } |
| 16955 | #endif /* WLAN_FEATURE_11AC */ |
| 16956 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 16957 | { |
| 16958 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 16959 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 16960 | { |
| 16961 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 16962 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16963 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16964 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 16965 | { |
| 16966 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 16967 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16968 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16969 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 16970 | pr_info("Reporting MCS rate %d flags %x\n", |
| 16971 | sinfo->txrate.mcs, |
| 16972 | sinfo->txrate.flags ); |
| 16973 | #endif //LINKSPEED_DEBUG_ENABLED |
| 16974 | } |
| 16975 | } |
| 16976 | else |
| 16977 | { |
| 16978 | // report current rate instead of max rate |
| 16979 | |
| 16980 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 16981 | { |
| 16982 | //provide to the UI in units of 100kbps |
| 16983 | sinfo->txrate.legacy = myRate; |
| 16984 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 16985 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 16986 | #endif //LINKSPEED_DEBUG_ENABLED |
| 16987 | } |
| 16988 | else |
| 16989 | { |
| 16990 | //must be MCS |
| 16991 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16992 | #ifdef WLAN_FEATURE_11AC |
| 16993 | sinfo->txrate.nss = 1; |
| 16994 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 16995 | { |
| 16996 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 16997 | } |
| 16998 | else |
| 16999 | #endif /* WLAN_FEATURE_11AC */ |
| 17000 | { |
| 17001 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 17002 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17003 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 17004 | { |
| 17005 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 17006 | } |
| 17007 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 17008 | { |
| 17009 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 17010 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 17011 | #ifdef WLAN_FEATURE_11AC |
| 17012 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 17013 | { |
| 17014 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 17015 | } |
| 17016 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17017 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 17018 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 17019 | sinfo->txrate.mcs, |
| 17020 | sinfo->txrate.flags ); |
| 17021 | #endif //LINKSPEED_DEBUG_ENABLED |
| 17022 | } |
| 17023 | } |
| 17024 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 17025 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 17026 | sinfo->tx_packets = |
| 17027 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 17028 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 17029 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 17030 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 17031 | |
| 17032 | sinfo->tx_retries = |
| 17033 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 17034 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 17035 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 17036 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 17037 | |
| 17038 | sinfo->tx_failed = |
| 17039 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 17040 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 17041 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 17042 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 17043 | |
| 17044 | sinfo->filled |= |
| 17045 | STATION_INFO_TX_PACKETS | |
| 17046 | STATION_INFO_TX_RETRIES | |
| 17047 | STATION_INFO_TX_FAILED; |
| 17048 | |
Edhar, Mahesh Kumar | 3cc9f23 | 2015-12-29 14:41:01 +0530 | [diff] [blame] | 17049 | sinfo->rx_packets = pAdapter->hdd_stats.summary_stat.rx_frm_cnt; |
| 17050 | sinfo->filled |= STATION_INFO_RX_PACKETS; |
| 17051 | |
| 17052 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 17053 | hddLog(LOG1, FL("Reporting RSSI:%d legacy rate %d pkt cnt tx %d rx %d"), |
| 17054 | sinfo->signal, sinfo->txrate.legacy, sinfo->tx_packets, |
| 17055 | sinfo->rx_packets); |
| 17056 | else |
| 17057 | hddLog(LOG1, |
| 17058 | FL("Reporting RSSI:%d MCS rate %d flags 0x%x pkt cnt tx %d rx %d"), |
| 17059 | sinfo->signal, sinfo->txrate.mcs, sinfo->txrate.flags, |
| 17060 | sinfo->tx_packets, sinfo->rx_packets); |
| 17061 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17062 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17063 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 17064 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 17065 | EXIT(); |
| 17066 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17067 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 17068 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 17069 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 17070 | const u8* mac, struct station_info *sinfo) |
| 17071 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17072 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 17073 | u8* mac, struct station_info *sinfo) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 17074 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17075 | { |
| 17076 | int ret; |
| 17077 | |
| 17078 | vos_ssr_protect(__func__); |
| 17079 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 17080 | vos_ssr_unprotect(__func__); |
| 17081 | |
| 17082 | return ret; |
| 17083 | } |
| 17084 | |
| 17085 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 17086 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17087 | { |
| 17088 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 17089 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17090 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17091 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17092 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 17093 | ENTER(); |
| 17094 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17095 | if (NULL == pAdapter) |
| 17096 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 17097 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17098 | return -ENODEV; |
| 17099 | } |
| 17100 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17101 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17102 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 17103 | pAdapter->sessionId, timeout)); |
| 17104 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 17105 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17106 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17107 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17108 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17109 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17110 | } |
| 17111 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 17112 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 17113 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 17114 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 17115 | (eConnectionState_Associated == |
| 17116 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 17117 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 17118 | |
| 17119 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 17120 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 17121 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 17122 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 17123 | { |
| 17124 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 17125 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 17126 | __func__, vos_status); |
| 17127 | } |
| 17128 | } |
| 17129 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17130 | /**The get power cmd from the supplicant gets updated by the nl only |
| 17131 | *on successful execution of the function call |
| 17132 | *we are oppositely mapped w.r.t mode in the driver |
| 17133 | **/ |
| 17134 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 17135 | |
| 17136 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 17137 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 17138 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17139 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17140 | return -EINVAL; |
| 17141 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17142 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17143 | return 0; |
| 17144 | } |
| 17145 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17146 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 17147 | struct net_device *dev, bool mode, int timeout) |
| 17148 | { |
| 17149 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17150 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17151 | vos_ssr_protect(__func__); |
| 17152 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 17153 | vos_ssr_unprotect(__func__); |
| 17154 | |
| 17155 | return ret; |
| 17156 | } |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 17157 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17158 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17159 | static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 17160 | struct net_device *netdev, |
| 17161 | u8 key_index) |
| 17162 | { |
| 17163 | ENTER(); |
| 17164 | return 0; |
| 17165 | } |
| 17166 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17167 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17168 | struct net_device *netdev, |
| 17169 | u8 key_index) |
| 17170 | { |
| 17171 | int ret; |
| 17172 | vos_ssr_protect(__func__); |
| 17173 | ret = __wlan_hdd_set_default_mgmt_key(wiphy, netdev, key_index); |
| 17174 | vos_ssr_unprotect(__func__); |
| 17175 | return ret; |
| 17176 | } |
| 17177 | #endif //LINUX_VERSION_CODE |
| 17178 | |
| 17179 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 17180 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 17181 | struct net_device *dev, |
| 17182 | struct ieee80211_txq_params *params) |
| 17183 | { |
| 17184 | ENTER(); |
| 17185 | return 0; |
| 17186 | } |
| 17187 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 17188 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 17189 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17190 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 17191 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17192 | return 0; |
| 17193 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17194 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17195 | |
| 17196 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 17197 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17198 | struct net_device *dev, |
| 17199 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17200 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17201 | int ret; |
| 17202 | |
| 17203 | vos_ssr_protect(__func__); |
| 17204 | ret = __wlan_hdd_set_txq_params(wiphy, dev, params); |
| 17205 | vos_ssr_unprotect(__func__); |
| 17206 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17207 | } |
| 17208 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 17209 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 17210 | struct ieee80211_txq_params *params) |
| 17211 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17212 | int ret; |
| 17213 | |
| 17214 | vos_ssr_protect(__func__); |
| 17215 | ret = __wlan_hdd_set_txq_params(wiphy, params); |
| 17216 | vos_ssr_unprotect(__func__); |
| 17217 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17218 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17219 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17220 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 17221 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17222 | struct net_device *dev, |
| 17223 | struct tagCsrDelStaParams *pDelStaParams) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17224 | { |
| 17225 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17226 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 17227 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17228 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 17229 | v_U8_t staId; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 17230 | v_CONTEXT_t pVosContext = NULL; |
| 17231 | ptSapContext pSapCtx = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17232 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 17233 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17234 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17235 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17236 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17237 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17238 | return -EINVAL; |
| 17239 | } |
| 17240 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17241 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17242 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 17243 | pAdapter->sessionId, pAdapter->device_mode)); |
| 17244 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17245 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 17246 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17247 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17248 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17249 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17250 | } |
| 17251 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17252 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17253 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17254 | ) |
| 17255 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 17256 | pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 17257 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 17258 | if(pSapCtx == NULL){ |
| 17259 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17260 | FL("psapCtx is NULL")); |
| 17261 | return -ENOENT; |
| 17262 | } |
Agrawal Ashish | 306b75f | 2017-01-11 19:16:25 +0530 | [diff] [blame] | 17263 | if (pHddCtx->cfg_ini->enable_sap_auth_offload) |
| 17264 | { |
| 17265 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, |
| 17266 | "Change reason code to eSIR_MAC_DISASSOC_LEAVING_BSS_REASON in sap auth offload"); |
| 17267 | pDelStaParams->reason_code = eSIR_MAC_DISASSOC_LEAVING_BSS_REASON; |
| 17268 | } |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17269 | if (vos_is_macaddr_broadcast((v_MACADDR_t *)pDelStaParams->peerMacAddr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17270 | { |
| 17271 | v_U16_t i; |
| 17272 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 17273 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 17274 | if ((pSapCtx->aStaInfo[i].isUsed) && |
| 17275 | (!pSapCtx->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17276 | { |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17277 | vos_mem_copy(pDelStaParams->peerMacAddr, |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 17278 | pSapCtx->aStaInfo[i].macAddrSTA.bytes, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17279 | ETHER_ADDR_LEN); |
| 17280 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17281 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 17282 | "%s: Delete STA with MAC::" |
| 17283 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17284 | __func__, |
| 17285 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
| 17286 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 17287 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 17288 | pSapCtx->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17289 | } |
| 17290 | } |
| 17291 | } |
| 17292 | else |
| 17293 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 17294 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17295 | vos_status = hdd_softap_GetStaId(pAdapter, |
| 17296 | (v_MACADDR_t *)pDelStaParams->peerMacAddr, &staId); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 17297 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 17298 | { |
| 17299 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 17300 | "%s: Skip this DEL STA as this is not used::" |
| 17301 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17302 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 17303 | return -ENOENT; |
| 17304 | } |
| 17305 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 17306 | if( pSapCtx->aStaInfo[staId].isDeauthInProgress == TRUE) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 17307 | { |
| 17308 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 17309 | "%s: Skip this DEL STA as deauth is in progress::" |
| 17310 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17311 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 17312 | return -ENOENT; |
| 17313 | } |
| 17314 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 17315 | pSapCtx->aStaInfo[staId].isDeauthInProgress = TRUE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 17316 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17317 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 17318 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 17319 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17320 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17321 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 17322 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17323 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 17324 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 17325 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 17326 | pSapCtx->aStaInfo[staId].isDeauthInProgress = FALSE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 17327 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 17328 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 17329 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 17330 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17331 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 17332 | return -ENOENT; |
| 17333 | } |
| 17334 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17335 | } |
| 17336 | } |
| 17337 | |
| 17338 | EXIT(); |
| 17339 | |
| 17340 | return 0; |
| 17341 | } |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 17342 | |
| 17343 | #ifdef CFG80211_DEL_STA_V2 |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 17344 | int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 17345 | struct net_device *dev, |
| 17346 | struct station_del_parameters *param) |
| 17347 | #else |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 17348 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 17349 | int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 17350 | struct net_device *dev, const u8 *mac) |
| 17351 | #else |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 17352 | int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17353 | struct net_device *dev, u8 *mac) |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 17354 | #endif |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 17355 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17356 | { |
| 17357 | int ret; |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17358 | struct tagCsrDelStaParams delStaParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17359 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17360 | vos_ssr_protect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17361 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 17362 | #ifdef CFG80211_DEL_STA_V2 |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17363 | if (NULL == param) { |
| 17364 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid argumet passed", __func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17365 | vos_ssr_unprotect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17366 | return -EINVAL; |
| 17367 | } |
| 17368 | |
| 17369 | WLANSAP_PopulateDelStaParams(param->mac, param->reason_code, |
| 17370 | param->subtype, &delStaParams); |
| 17371 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 17372 | #else |
Sushant Kaushik | 4cd28f6 | 2014-12-26 14:23:50 +0530 | [diff] [blame] | 17373 | WLANSAP_PopulateDelStaParams(mac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17374 | (SIR_MAC_MGMT_DEAUTH >> 4), &delStaParams); |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 17375 | #endif |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 17376 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, &delStaParams); |
| 17377 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17378 | vos_ssr_unprotect(__func__); |
| 17379 | |
| 17380 | return ret; |
| 17381 | } |
| 17382 | |
| 17383 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 17384 | struct net_device *dev, |
| 17385 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 17386 | const u8 *mac, |
| 17387 | #else |
| 17388 | u8 *mac, |
| 17389 | #endif |
| 17390 | struct station_parameters *params) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17391 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 17392 | hdd_adapter_t *pAdapter; |
| 17393 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17394 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17395 | #ifdef FEATURE_WLAN_TDLS |
| 17396 | u32 mask, set; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 17397 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17398 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17399 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 17400 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 17401 | if (NULL == pAdapter) |
| 17402 | { |
| 17403 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17404 | "%s: Adapter is NULL",__func__); |
| 17405 | return -EINVAL; |
| 17406 | } |
| 17407 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 17408 | status = wlan_hdd_validate_context(pHddCtx); |
| 17409 | if (0 != status) |
| 17410 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 17411 | return status; |
| 17412 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 17413 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17414 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17415 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 17416 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17417 | mask = params->sta_flags_mask; |
| 17418 | |
| 17419 | set = params->sta_flags_set; |
| 17420 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 17421 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 17422 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 17423 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17424 | |
| 17425 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 17426 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 17427 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17428 | } |
| 17429 | } |
| 17430 | #endif |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17431 | EXIT(); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17432 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17433 | } |
| 17434 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 17435 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 17436 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 17437 | struct net_device *dev, const u8 *mac, |
| 17438 | struct station_parameters *params) |
| 17439 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17440 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 17441 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 17442 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17443 | { |
| 17444 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17445 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17446 | vos_ssr_protect(__func__); |
| 17447 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 17448 | vos_ssr_unprotect(__func__); |
| 17449 | |
| 17450 | return ret; |
| 17451 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17452 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17453 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 17454 | 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] | 17455 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17456 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17457 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 17458 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17459 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17460 | int status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17461 | hdd_context_t *pHddCtx; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 17462 | tPmkidCacheInfo pmk_id; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 17463 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17464 | ENTER(); |
| 17465 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17466 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17467 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17468 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17469 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17470 | return -EINVAL; |
| 17471 | } |
| 17472 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 17473 | if (!pmksa) { |
| 17474 | hddLog(LOGE, FL("pmksa is NULL")); |
| 17475 | return -EINVAL; |
| 17476 | } |
| 17477 | |
| 17478 | if (!pmksa->bssid || !pmksa->pmkid) { |
| 17479 | hddLog(LOGE, FL("pmksa->bssid(%p) or pmksa->pmkid(%p) is NULL"), |
| 17480 | pmksa->bssid, pmksa->pmkid); |
| 17481 | return -EINVAL; |
| 17482 | } |
| 17483 | |
| 17484 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 17485 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 17486 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17487 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 17488 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17489 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17490 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17491 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17492 | } |
| 17493 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17494 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17495 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 17496 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 17497 | vos_mem_copy(pmk_id.BSSID, pmksa->bssid, ETHER_ADDR_LEN); |
| 17498 | vos_mem_copy(pmk_id.PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17499 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 17500 | /* Add to the PMKSA ID Cache in CSR */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17501 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 17502 | &pmk_id, 1, FALSE); |
| 17503 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17504 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17505 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 17506 | pAdapter->sessionId, result)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 17507 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17508 | EXIT(); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 17509 | return HAL_STATUS_SUCCESS(result) ? 0 : -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17510 | } |
| 17511 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 17512 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 17513 | struct cfg80211_pmksa *pmksa) |
| 17514 | { |
| 17515 | int ret; |
| 17516 | |
| 17517 | vos_ssr_protect(__func__); |
| 17518 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 17519 | vos_ssr_unprotect(__func__); |
| 17520 | |
| 17521 | return ret; |
| 17522 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17523 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17524 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 17525 | 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] | 17526 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17527 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17528 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 17529 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17530 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 17531 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17532 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17533 | ENTER(); |
| 17534 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17535 | /* Validate pAdapter */ |
| 17536 | if (NULL == pAdapter) |
| 17537 | { |
| 17538 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 17539 | return -EINVAL; |
| 17540 | } |
| 17541 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 17542 | if (!pmksa) { |
| 17543 | hddLog(LOGE, FL("pmksa is NULL")); |
| 17544 | return -EINVAL; |
| 17545 | } |
| 17546 | |
| 17547 | if (!pmksa->bssid) { |
| 17548 | hddLog(LOGE, FL("pmksa->bssid is NULL")); |
| 17549 | return -EINVAL; |
| 17550 | } |
| 17551 | |
Kiet Lam | 98c46a1 | 2014-10-31 15:34:57 -0700 | [diff] [blame] | 17552 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 17553 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 17554 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17555 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 17556 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17557 | if (0 != status) |
| 17558 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17559 | return status; |
| 17560 | } |
| 17561 | |
| 17562 | /*Retrieve halHandle*/ |
| 17563 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 17564 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 17565 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17566 | TRACE_CODE_HDD_CFG80211_DEL_PMKSA, |
| 17567 | pAdapter->sessionId, 0)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 17568 | /* Delete the PMKID CSR cache */ |
| 17569 | if (eHAL_STATUS_SUCCESS != |
| 17570 | sme_RoamDelPMKIDfromCache(halHandle, |
| 17571 | pAdapter->sessionId, pmksa->bssid, FALSE)) { |
| 17572 | hddLog(LOGE, FL("Failed to delete PMKSA for "MAC_ADDRESS_STR), |
| 17573 | MAC_ADDR_ARRAY(pmksa->bssid)); |
| 17574 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17575 | } |
| 17576 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17577 | EXIT(); |
| 17578 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17579 | } |
| 17580 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17581 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 17582 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 17583 | struct cfg80211_pmksa *pmksa) |
| 17584 | { |
| 17585 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17586 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 17587 | vos_ssr_protect(__func__); |
| 17588 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 17589 | vos_ssr_unprotect(__func__); |
| 17590 | |
| 17591 | return ret; |
| 17592 | |
| 17593 | } |
| 17594 | |
| 17595 | 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] | 17596 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17597 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 17598 | tHalHandle halHandle; |
| 17599 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 17600 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17601 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17602 | ENTER(); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17603 | |
| 17604 | /* Validate pAdapter */ |
| 17605 | if (NULL == pAdapter) |
| 17606 | { |
| 17607 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 17608 | "%s: Invalid Adapter" ,__func__); |
| 17609 | return -EINVAL; |
| 17610 | } |
| 17611 | |
| 17612 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 17613 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17614 | if (0 != status) |
| 17615 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17616 | return status; |
| 17617 | } |
| 17618 | |
| 17619 | /*Retrieve halHandle*/ |
| 17620 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 17621 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 17622 | /* Flush the PMKID cache in CSR */ |
| 17623 | if (eHAL_STATUS_SUCCESS != |
| 17624 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, NULL, TRUE)) { |
| 17625 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Cannot flush PMKIDCache")); |
| 17626 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 17627 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17628 | EXIT(); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 17629 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17630 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 17631 | |
| 17632 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 17633 | { |
| 17634 | int ret; |
| 17635 | |
| 17636 | vos_ssr_protect(__func__); |
| 17637 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 17638 | vos_ssr_unprotect(__func__); |
| 17639 | |
| 17640 | return ret; |
| 17641 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17642 | #endif |
| 17643 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 17644 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17645 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 17646 | struct net_device *dev, |
| 17647 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 17648 | { |
| 17649 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 17650 | hdd_station_ctx_t *pHddStaCtx; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 17651 | hdd_context_t *pHddCtx; |
| 17652 | int ret = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 17653 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17654 | ENTER(); |
| 17655 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 17656 | if (NULL == pAdapter) |
| 17657 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 17658 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 17659 | return -ENODEV; |
| 17660 | } |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 17661 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 17662 | ret = wlan_hdd_validate_context(pHddCtx); |
| 17663 | if (0 != ret) |
| 17664 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 17665 | return ret; |
| 17666 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 17667 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 17668 | if (NULL == pHddStaCtx) |
| 17669 | { |
| 17670 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: STA Context is NULL", __func__); |
| 17671 | return -EINVAL; |
| 17672 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 17673 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17674 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17675 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 17676 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 17677 | // Added for debug on reception of Re-assoc Req. |
| 17678 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 17679 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 17680 | 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] | 17681 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 17682 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 17683 | } |
| 17684 | |
| 17685 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 17686 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 17687 | ftie->ie_len); |
| 17688 | #endif |
| 17689 | |
| 17690 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 17691 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 17692 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 17693 | ftie->ie_len); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17694 | |
| 17695 | EXIT(); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 17696 | return 0; |
| 17697 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17698 | |
| 17699 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 17700 | struct net_device *dev, |
| 17701 | struct cfg80211_update_ft_ies_params *ftie) |
| 17702 | { |
| 17703 | int ret; |
| 17704 | |
| 17705 | vos_ssr_protect(__func__); |
| 17706 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 17707 | vos_ssr_unprotect(__func__); |
| 17708 | |
| 17709 | return ret; |
| 17710 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 17711 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17712 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17713 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 17714 | |
| 17715 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 17716 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 17717 | { |
| 17718 | int ret; |
| 17719 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 17720 | hdd_context_t *pHddCtx; |
| 17721 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 17722 | ENTER(); |
| 17723 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17724 | if (NULL == pAdapter) |
| 17725 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 17726 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17727 | "%s: HDD adapter is Null", __func__); |
| 17728 | return ; |
| 17729 | } |
| 17730 | |
| 17731 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 17732 | if (NULL == pHddCtx) |
| 17733 | { |
| 17734 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17735 | "%s: HDD context is Null!!!", __func__); |
| 17736 | return ; |
| 17737 | } |
| 17738 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 17739 | spin_lock(&pHddCtx->schedScan_lock); |
| 17740 | if (TRUE == pHddCtx->isWiphySuspended) |
| 17741 | { |
| 17742 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 17743 | spin_unlock(&pHddCtx->schedScan_lock); |
| 17744 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 17745 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 17746 | return ; |
| 17747 | } |
| 17748 | spin_unlock(&pHddCtx->schedScan_lock); |
| 17749 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17750 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 17751 | |
| 17752 | if (0 > ret) |
| 17753 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | fb49cdd | 2015-10-16 18:41:59 +0530 | [diff] [blame] | 17754 | else |
| 17755 | { |
| 17756 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 17757 | * immediatly after the driver gets connect request(i.e after pno) |
| 17758 | * from supplicant, this result in app's is suspending and not able |
| 17759 | * to process the connect request to AP */ |
| 17760 | hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_SCAN); |
| 17761 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17762 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 17763 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17764 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17765 | } |
| 17766 | |
| 17767 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 17768 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 17769 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 17770 | */ |
| 17771 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 17772 | { |
| 17773 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 17774 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 17775 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 17776 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 17777 | int status = 0; |
Agrawal Ashish | cff3169 | 2016-12-16 17:17:50 +0530 | [diff] [blame] | 17778 | |
| 17779 | if (WLAN_HDD_INFRA_STATION != pAdapter->device_mode) |
| 17780 | { |
| 17781 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17782 | "%s: PNO is allowed only in STA interface", __func__); |
| 17783 | return eHAL_STATUS_FAILURE; |
| 17784 | } |
| 17785 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 17786 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 17787 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 17788 | /* The current firmware design does not allow PNO during any |
Agrawal Ashish | cff3169 | 2016-12-16 17:17:50 +0530 | [diff] [blame] | 17789 | * active sessions. PNO is allowed only in case when sap session |
| 17790 | * is present and sapo auth offload feature enabled in firmare. |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 17791 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 17792 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 17793 | { |
| 17794 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 17795 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 17796 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 17797 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 17798 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 17799 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 17800 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
Agrawal Ashish | cff3169 | 2016-12-16 17:17:50 +0530 | [diff] [blame] | 17801 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode && |
| 17802 | !pHddCtx->cfg_ini->enable_sap_auth_offload) |
Siddharth Bhal | 63a19a7 | 2014-11-07 14:31:56 +0530 | [diff] [blame] | 17803 | || (WLAN_HDD_TM_LEVEL_4 == pHddCtx->tmInfo.currentTmLevel) |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 17804 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 17805 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 17806 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 17807 | } |
| 17808 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 17809 | pAdapterNode = pNext; |
| 17810 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 17811 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 17812 | } |
| 17813 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17814 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 17815 | { |
| 17816 | hdd_adapter_t *pAdapter = callbackContext; |
| 17817 | hdd_context_t *pHddCtx; |
| 17818 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17819 | ENTER(); |
| 17820 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17821 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 17822 | { |
| 17823 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17824 | FL("Invalid adapter or adapter has invalid magic")); |
| 17825 | return; |
| 17826 | } |
| 17827 | |
| 17828 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 17829 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 17830 | { |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17831 | return; |
| 17832 | } |
| 17833 | |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 17834 | if (VOS_STATUS_SUCCESS != status) |
| 17835 | { |
| 17836 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17837 | FL("PNO enable response status = %d"), status); |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 17838 | pHddCtx->isPnoEnable = FALSE; |
| 17839 | } |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17840 | |
| 17841 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 17842 | complete(&pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17843 | EXIT(); |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17844 | } |
| 17845 | |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 17846 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)) || \ |
| 17847 | defined (CFG80211_MULTI_SCAN_PLAN_BACKPORT) |
| 17848 | /** |
| 17849 | * hdd_config_sched_scan_plan() - configures the sched scan plans |
| 17850 | * from the framework. |
| 17851 | * @pno_req: pointer to PNO scan request |
| 17852 | * @request: pointer to scan request from framework |
| 17853 | * |
| 17854 | * Return: None |
| 17855 | */ |
| 17856 | static void hdd_config_sched_scan_plan(tpSirPNOScanReq pno_req, |
| 17857 | struct cfg80211_sched_scan_request *request, |
| 17858 | hdd_context_t *hdd_ctx) |
| 17859 | { |
| 17860 | v_U32_t i = 0; |
| 17861 | |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 17862 | pno_req->scanTimers.ucScanTimersCount = request->n_scan_plans; |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 17863 | for (i = 0; i < request->n_scan_plans; i++) |
| 17864 | { |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 17865 | pno_req->scanTimers.aTimerValues[i].uTimerRepeat = |
| 17866 | request->scan_plans[i].iterations; |
| 17867 | pno_req->scanTimers.aTimerValues[i].uTimerValue = |
| 17868 | request->scan_plans[i].interval; |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 17869 | } |
| 17870 | } |
| 17871 | #else |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 17872 | static void hdd_config_sched_scan_plan(tpSirPNOScanReq pno_req, |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 17873 | struct cfg80211_sched_scan_request *request, |
| 17874 | hdd_context_t *hdd_ctx) |
| 17875 | { |
| 17876 | v_U32_t i, temp_int; |
| 17877 | /* Driver gets only one time interval which is hardcoded in |
| 17878 | * supplicant for 10000ms. Taking power consumption into account 6 |
| 17879 | * timers will be used, Timervalue is increased exponentially |
| 17880 | * i.e 10,20,40, 80,160,320 secs. And number of scan cycle for each |
| 17881 | * timer is configurable through INI param gPNOScanTimerRepeatValue. |
| 17882 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 17883 | * will be repeated after each interval specified by supplicant |
| 17884 | * till PNO is disabled. |
| 17885 | */ |
| 17886 | if (0 == hdd_ctx->cfg_ini->configPNOScanTimerRepeatValue) |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 17887 | pno_req->scanTimers.ucScanTimersCount = |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 17888 | HDD_PNO_SCAN_TIMERS_SET_ONE; |
| 17889 | else |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 17890 | pno_req->scanTimers.ucScanTimersCount = |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 17891 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 17892 | |
| 17893 | temp_int = (request->interval)/1000; |
| 17894 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17895 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 17896 | temp_int, hdd_ctx->cfg_ini->configPNOScanTimerRepeatValue); |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 17897 | for ( i = 0; i < pno_req->scanTimers.ucScanTimersCount; i++) |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 17898 | { |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 17899 | pno_req->scanTimers.aTimerValues[i].uTimerRepeat = |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 17900 | hdd_ctx->cfg_ini->configPNOScanTimerRepeatValue; |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 17901 | pno_req->scanTimers.aTimerValues[i].uTimerValue = temp_int; |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 17902 | temp_int *= 2; |
| 17903 | } |
| 17904 | //Repeat last timer until pno disabled. |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 17905 | pno_req->scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 17906 | } |
| 17907 | #endif |
| 17908 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 17909 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 17910 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 17911 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17912 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 17913 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17914 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 17915 | { |
| 17916 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17917 | tSirPNOScanReq pnoRequest = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17918 | hdd_context_t *pHddCtx; |
| 17919 | tHalHandle hHal; |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 17920 | v_U32_t i, indx, num_ch, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 17921 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 17922 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17923 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 17924 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17925 | int ret = 0; |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 17926 | hdd_config_t *pConfig = NULL; |
| 17927 | v_U32_t num_ignore_dfs_ch = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17928 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17929 | ENTER(); |
| 17930 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17931 | if (NULL == pAdapter) |
| 17932 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 17933 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17934 | "%s: HDD adapter is Null", __func__); |
| 17935 | return -ENODEV; |
| 17936 | } |
| 17937 | |
| 17938 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 17939 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17940 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 17941 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17942 | { |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17943 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17944 | } |
| 17945 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 17946 | pConfig = pHddCtx->cfg_ini; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17947 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 17948 | if (NULL == hHal) |
| 17949 | { |
| 17950 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17951 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 17952 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17953 | } |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 17954 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17955 | TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START, |
| 17956 | pAdapter->sessionId, pAdapter->device_mode)); |
Sushant Kaushik | 2fe8993 | 2014-09-03 10:58:09 +0530 | [diff] [blame] | 17957 | sme_ScanFlushResult(hHal, pAdapter->sessionId); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 17958 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 17959 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 17960 | { |
| 17961 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17962 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 17963 | return -EBUSY; |
| 17964 | } |
| 17965 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 17966 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 17967 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 17968 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 17969 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 17970 | return -EBUSY; |
| 17971 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17972 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 17973 | if (TRUE == pHddCtx->isPnoEnable) |
| 17974 | { |
| 17975 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 17976 | FL("already PNO is enabled")); |
| 17977 | return -EBUSY; |
| 17978 | } |
c_hpothu | 225aa7c | 2014-10-22 17:45:13 +0530 | [diff] [blame] | 17979 | |
| 17980 | if (VOS_STATUS_SUCCESS != wlan_hdd_cancel_remain_on_channel(pHddCtx)) |
| 17981 | { |
| 17982 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17983 | "%s: abort ROC failed ", __func__); |
| 17984 | return -EBUSY; |
| 17985 | } |
| 17986 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 17987 | pHddCtx->isPnoEnable = TRUE; |
| 17988 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17989 | pnoRequest.enable = 1; /*Enable PNO */ |
| 17990 | pnoRequest.ucNetworksCount = request->n_match_sets; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17991 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17992 | if (( !pnoRequest.ucNetworksCount ) || |
| 17993 | ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17994 | { |
| 17995 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 17996 | "%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] | 17997 | __func__, pnoRequest.ucNetworksCount, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 17998 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17999 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18000 | goto error; |
| 18001 | } |
| 18002 | |
| 18003 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 18004 | { |
| 18005 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 18006 | "%s: Incorrect number of channels %d", |
| 18007 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 18008 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18009 | goto error; |
| 18010 | } |
| 18011 | |
| 18012 | /* Framework provides one set of channels(all) |
| 18013 | * common for all saved profile */ |
| 18014 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 18015 | channels_allowed, &num_channels_allowed)) |
| 18016 | { |
| 18017 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18018 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 18019 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18020 | goto error; |
| 18021 | } |
| 18022 | /* Checking each channel against allowed channel list */ |
| 18023 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 18024 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18025 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 18026 | char chList [(request->n_channels*5)+1]; |
| 18027 | int len; |
| 18028 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18029 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 18030 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18031 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 18032 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 18033 | { |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 18034 | if ((!pConfig->enableDFSPnoChnlScan) && |
| 18035 | (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channels_allowed[indx]))) |
| 18036 | { |
| 18037 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18038 | "%s : Dropping DFS channel : %d", |
| 18039 | __func__,channels_allowed[indx]); |
| 18040 | num_ignore_dfs_ch++; |
| 18041 | break; |
| 18042 | } |
| 18043 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 18044 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 18045 | len += snprintf(chList+len, 5, "%d ", |
| 18046 | request->channels[i]->hw_value); |
| 18047 | break ; |
| 18048 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18049 | } |
| 18050 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 18051 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18052 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 18053 | /*If all channels are DFS and dropped, then ignore the PNO request*/ |
| 18054 | if (num_ignore_dfs_ch == request->n_channels) |
| 18055 | { |
| 18056 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18057 | "%s : All requested channels are DFS channels", __func__); |
| 18058 | ret = -EINVAL; |
| 18059 | goto error; |
| 18060 | } |
| 18061 | } |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18062 | |
| 18063 | pnoRequest.aNetworks = |
| 18064 | vos_mem_malloc(sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 18065 | if (pnoRequest.aNetworks == NULL) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18066 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18067 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 18068 | FL("failed to allocate memory aNetworks %u"), |
| 18069 | (uint32)sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 18070 | goto error; |
| 18071 | } |
| 18072 | vos_mem_zero(pnoRequest.aNetworks, |
| 18073 | sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 18074 | |
| 18075 | /* Filling per profile params */ |
| 18076 | for (i = 0; i < pnoRequest.ucNetworksCount; i++) |
| 18077 | { |
| 18078 | pnoRequest.aNetworks[i].ssId.length = |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18079 | request->match_sets[i].ssid.ssid_len; |
| 18080 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18081 | if (( 0 == pnoRequest.aNetworks[i].ssId.length ) || |
| 18082 | ( pnoRequest.aNetworks[i].ssId.length > 32 ) ) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18083 | { |
| 18084 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 18085 | "%s: SSID Len %d is not correct for network %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18086 | __func__, pnoRequest.aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 18087 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18088 | goto error; |
| 18089 | } |
| 18090 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18091 | memcpy(pnoRequest.aNetworks[i].ssId.ssId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18092 | request->match_sets[i].ssid.ssid, |
| 18093 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 18094 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18095 | "%s: SSID of network %d is %s ", __func__, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18096 | i, pnoRequest.aNetworks[i].ssId.ssId); |
| 18097 | pnoRequest.aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 18098 | pnoRequest.aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 18099 | pnoRequest.aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18100 | |
| 18101 | /*Copying list of valid channel into request */ |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18102 | memcpy(pnoRequest.aNetworks[i].aChannels, valid_ch, num_ch); |
| 18103 | pnoRequest.aNetworks[i].ucChannelCount = num_ch; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18104 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18105 | pnoRequest.aNetworks[i].rssiThreshold = 0; //Default value |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18106 | } |
| 18107 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 18108 | for (i = 0; i < request->n_ssids; i++) |
| 18109 | { |
| 18110 | j = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18111 | while (j < pnoRequest.ucNetworksCount) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 18112 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18113 | if ((pnoRequest.aNetworks[j].ssId.length == |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 18114 | request->ssids[i].ssid_len) && |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18115 | (0 == memcmp(pnoRequest.aNetworks[j].ssId.ssId, |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 18116 | request->ssids[i].ssid, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18117 | pnoRequest.aNetworks[j].ssId.length))) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 18118 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18119 | pnoRequest.aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 18120 | break; |
| 18121 | } |
| 18122 | j++; |
| 18123 | } |
| 18124 | } |
| 18125 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18126 | "Number of hidden networks being Configured = %d", |
| 18127 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 18128 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 18129 | "request->ie_len = %zu", request->ie_len); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18130 | |
| 18131 | pnoRequest.p24GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 18132 | if (pnoRequest.p24GProbeTemplate == NULL) |
| 18133 | { |
| 18134 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 18135 | FL("failed to allocate memory p24GProbeTemplate %u"), |
| 18136 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 18137 | goto error; |
| 18138 | } |
| 18139 | |
| 18140 | pnoRequest.p5GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 18141 | if (pnoRequest.p5GProbeTemplate == NULL) |
| 18142 | { |
| 18143 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 18144 | FL("failed to allocate memory p5GProbeTemplate %u"), |
| 18145 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 18146 | goto error; |
| 18147 | } |
| 18148 | |
| 18149 | vos_mem_zero(pnoRequest.p24GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 18150 | vos_mem_zero(pnoRequest.p5GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 18151 | |
Hanumantha Reddy Pothula | 06e87b2 | 2015-03-02 18:02:23 +0530 | [diff] [blame] | 18152 | if ((0 < request->ie_len) && (request->ie_len <= SIR_PNO_MAX_PB_REQ_SIZE) && |
| 18153 | (NULL != request->ie)) |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 18154 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18155 | pnoRequest.us24GProbeTemplateLen = request->ie_len; |
| 18156 | memcpy(pnoRequest.p24GProbeTemplate, request->ie, |
| 18157 | pnoRequest.us24GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 18158 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18159 | pnoRequest.us5GProbeTemplateLen = request->ie_len; |
| 18160 | memcpy(pnoRequest.p5GProbeTemplate, request->ie, |
| 18161 | pnoRequest.us5GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 18162 | } |
| 18163 | |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 18164 | hdd_config_sched_scan_plan(&pnoRequest, request, pHddCtx); |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 18165 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18166 | pnoRequest.modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18167 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 18168 | INIT_COMPLETION(pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18169 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 18170 | pnoRequest.callbackContext = pAdapter; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 18171 | pAdapter->pno_req_status = 0; |
| 18172 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 18173 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18174 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18175 | pAdapter->sessionId, pnoRequest.enable, pnoRequest.modePNO, |
| 18176 | pnoRequest.scanTimers.ucScanTimersCount); |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 18177 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18178 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18179 | &pnoRequest, pAdapter->sessionId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18180 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 18181 | if (eHAL_STATUS_SUCCESS != status) |
| 18182 | { |
| 18183 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 18184 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 18185 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18186 | goto error; |
| 18187 | } |
| 18188 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 18189 | ret = wait_for_completion_timeout( |
| 18190 | &pAdapter->pno_comp_var, |
| 18191 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 18192 | if (0 >= ret) |
| 18193 | { |
| 18194 | // Did not receive the response for PNO enable in time. |
| 18195 | // Assuming the PNO enable was success. |
| 18196 | // Returning error from here, because we timeout, results |
| 18197 | // in side effect of Wifi (Wifi Setting) not to work. |
| 18198 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18199 | FL("Timed out waiting for PNO to be Enabled")); |
| 18200 | ret = 0; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 18201 | } |
| 18202 | |
| 18203 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 18204 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18205 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18206 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 18207 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18208 | FL("PNO scanRequest offloaded ret = %d"), ret); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 18209 | pHddCtx->isPnoEnable = FALSE; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18210 | if (pnoRequest.aNetworks) |
| 18211 | vos_mem_free(pnoRequest.aNetworks); |
| 18212 | if (pnoRequest.p24GProbeTemplate) |
| 18213 | vos_mem_free(pnoRequest.p24GProbeTemplate); |
| 18214 | if (pnoRequest.p5GProbeTemplate) |
| 18215 | vos_mem_free(pnoRequest.p5GProbeTemplate); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18216 | |
| 18217 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 18218 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18219 | } |
| 18220 | |
| 18221 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 18222 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 18223 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18224 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 18225 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 18226 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 18227 | { |
| 18228 | int ret; |
| 18229 | |
| 18230 | vos_ssr_protect(__func__); |
| 18231 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 18232 | vos_ssr_unprotect(__func__); |
| 18233 | |
| 18234 | return ret; |
| 18235 | } |
| 18236 | |
| 18237 | /* |
| 18238 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 18239 | * Function to disable PNO |
| 18240 | */ |
| 18241 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18242 | struct net_device *dev) |
| 18243 | { |
| 18244 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 18245 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 18246 | hdd_context_t *pHddCtx; |
| 18247 | tHalHandle hHal; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18248 | tSirPNOScanReq pnoRequest = {0}; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 18249 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18250 | |
| 18251 | ENTER(); |
| 18252 | |
| 18253 | if (NULL == pAdapter) |
| 18254 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 18255 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18256 | "%s: HDD adapter is Null", __func__); |
| 18257 | return -ENODEV; |
| 18258 | } |
| 18259 | |
| 18260 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18261 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 18262 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18263 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18264 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 18265 | "%s: HDD context is Null", __func__); |
| 18266 | return -ENODEV; |
| 18267 | } |
| 18268 | |
| 18269 | /* The return 0 is intentional when isLogpInProgress and |
| 18270 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 18271 | * failure in sched_scan_stop , especially for a case where the unload |
| 18272 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 18273 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 18274 | * success. If it returns a failure , then its next invocation due to the |
| 18275 | * clean up of the second interface will have the dev pointer corresponding |
| 18276 | * to the first one leading to a crash. |
| 18277 | */ |
| 18278 | if (pHddCtx->isLogpInProgress) |
| 18279 | { |
| 18280 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18281 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Mahesh A Saptasagar | 0c11d82 | 2015-10-08 19:54:08 +0530 | [diff] [blame] | 18282 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 18283 | return ret; |
| 18284 | } |
| 18285 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 18286 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 18287 | { |
| 18288 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18289 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 18290 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18291 | } |
| 18292 | |
| 18293 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 18294 | if (NULL == hHal) |
| 18295 | { |
| 18296 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18297 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18298 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18299 | } |
| 18300 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18301 | pnoRequest.enable = 0; /* Disable PNO */ |
| 18302 | pnoRequest.ucNetworksCount = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18303 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 18304 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 18305 | TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP, |
| 18306 | pAdapter->sessionId, pAdapter->device_mode)); |
Hanumantha Reddy Pothula | 0e408dc | 2015-11-23 12:04:53 +0530 | [diff] [blame] | 18307 | |
| 18308 | INIT_COMPLETION(pAdapter->pno_comp_var); |
| 18309 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 18310 | pnoRequest.callbackContext = pAdapter; |
| 18311 | pAdapter->pno_req_status = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 18312 | status = sme_SetPreferredNetworkList(hHal, &pnoRequest, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18313 | pAdapter->sessionId, |
| 18314 | NULL, pAdapter); |
| 18315 | if (eHAL_STATUS_SUCCESS != status) |
| 18316 | { |
| 18317 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18318 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 18319 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 18320 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18321 | } |
Hanumantha Reddy Pothula | 0e408dc | 2015-11-23 12:04:53 +0530 | [diff] [blame] | 18322 | ret = wait_for_completion_timeout( |
| 18323 | &pAdapter->pno_comp_var, |
| 18324 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 18325 | if (0 >= ret) |
| 18326 | { |
| 18327 | // Did not receive the response for PNO disable in time. |
| 18328 | // Assuming the PNO disable was success. |
| 18329 | // Returning error from here, because we timeout, results |
| 18330 | // in side effect of Wifi (Wifi Setting) not to work. |
Anurag Chouhan | 96b41cb | 2016-09-28 18:54:47 +0530 | [diff] [blame] | 18331 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hanumantha Reddy Pothula | 0e408dc | 2015-11-23 12:04:53 +0530 | [diff] [blame] | 18332 | FL("Timed out waiting for PNO to be disabled")); |
| 18333 | ret = 0; |
| 18334 | } |
| 18335 | |
| 18336 | ret = pAdapter->pno_req_status; |
| 18337 | pHddCtx->isPnoEnable = (ret == 0) ? FALSE : TRUE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18338 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 18339 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18340 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 18341 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18342 | |
| 18343 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 18344 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18345 | } |
| 18346 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 18347 | /* |
| 18348 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 18349 | * NL interface to disable PNO |
| 18350 | */ |
| 18351 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 18352 | struct net_device *dev) |
| 18353 | { |
| 18354 | int ret; |
| 18355 | |
| 18356 | vos_ssr_protect(__func__); |
| 18357 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 18358 | vos_ssr_unprotect(__func__); |
| 18359 | |
| 18360 | return ret; |
| 18361 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 18362 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 18363 | |
| 18364 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18365 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 18366 | #if TDLS_MGMT_VERSION2 |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 18367 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 18368 | struct net_device *dev, |
| 18369 | u8 *peer, u8 action_code, |
| 18370 | u8 dialog_token, |
| 18371 | u16 status_code, u32 peer_capability, |
| 18372 | const u8 *buf, size_t len) |
| 18373 | #else /* TDLS_MGMT_VERSION2 */ |
| 18374 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS) |
| 18375 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 18376 | struct net_device *dev, |
| 18377 | const u8 *peer, u8 action_code, |
| 18378 | u8 dialog_token, u16 status_code, |
| 18379 | u32 peer_capability, bool initiator, |
| 18380 | const u8 *buf, size_t len) |
| 18381 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) |
| 18382 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 18383 | struct net_device *dev, |
| 18384 | const u8 *peer, u8 action_code, |
| 18385 | u8 dialog_token, u16 status_code, |
| 18386 | u32 peer_capability, const u8 *buf, |
| 18387 | size_t len) |
| 18388 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 18389 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 18390 | struct net_device *dev, |
| 18391 | u8 *peer, u8 action_code, |
| 18392 | u8 dialog_token, |
| 18393 | u16 status_code, u32 peer_capability, |
| 18394 | const u8 *buf, size_t len) |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 18395 | #else |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 18396 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 18397 | struct net_device *dev, |
| 18398 | u8 *peer, u8 action_code, |
| 18399 | u8 dialog_token, |
| 18400 | u16 status_code, const u8 *buf, |
| 18401 | size_t len) |
| 18402 | #endif |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 18403 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18404 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 18405 | hdd_adapter_t *pAdapter; |
| 18406 | hdd_context_t *pHddCtx; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18407 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 18408 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 18409 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 18410 | long rc; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 18411 | int ret; |
Masti, Narayanraddi | 3b68193 | 2015-10-08 19:22:25 +0530 | [diff] [blame] | 18412 | hddTdlsPeer_t *pTdlsPeer; |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 18413 | #if !(TDLS_MGMT_VERSION2) && (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)) |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 18414 | u32 peer_capability = 0; |
| 18415 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 18416 | tANI_U16 numCurrTdlsPeers; |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 18417 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 18418 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 18419 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 18420 | if (NULL == pAdapter) |
| 18421 | { |
| 18422 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18423 | "%s: Adapter is NULL",__func__); |
| 18424 | return -EINVAL; |
| 18425 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 18426 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 18427 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 18428 | pAdapter->sessionId, action_code)); |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 18429 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 18430 | pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 18431 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18432 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 18433 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18434 | "Invalid arguments"); |
| 18435 | return -EINVAL; |
| 18436 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 18437 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 18438 | if (pHddCtx->isLogpInProgress) |
| 18439 | { |
| 18440 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18441 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18442 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 18443 | peer, |
| 18444 | eTDLS_LINK_IDLE, |
| 18445 | eTDLS_LINK_UNSPECIFIED); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 18446 | return -EBUSY; |
| 18447 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 18448 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 18449 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
| 18450 | { |
| 18451 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18452 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 18453 | return -EAGAIN; |
| 18454 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 18455 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 18456 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18457 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 18458 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 18459 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 18460 | MAC_ADDRESS_STR " action %d declined.", |
| 18461 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18462 | return -ENOTSUPP; |
| 18463 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18464 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 18465 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 18466 | |
| 18467 | if( NULL == pHddStaCtx ) |
| 18468 | { |
| 18469 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18470 | "%s: HDD station context NULL ",__func__); |
| 18471 | return -EINVAL; |
| 18472 | } |
| 18473 | |
| 18474 | /* STA should be connected and authenticated |
| 18475 | * before sending any TDLS frames |
| 18476 | */ |
| 18477 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 18478 | (FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 18479 | { |
| 18480 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18481 | "STA is not connected or unauthenticated. " |
| 18482 | "connState %u, uIsAuthenticated %u", |
| 18483 | pHddStaCtx->conn_info.connState, |
| 18484 | pHddStaCtx->conn_info.uIsAuthenticated); |
| 18485 | return -EAGAIN; |
| 18486 | } |
| 18487 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 18488 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 18489 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 18490 | { |
| 18491 | /* if tdls_mode is disabled to respond to peer's request */ |
| 18492 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 18493 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 18494 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 18495 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 18496 | " TDLS mode is disabled. action %d declined.", |
| 18497 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 18498 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 18499 | return -ENOTSUPP; |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 18500 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 18501 | |
| 18502 | if (vos_max_concurrent_connections_reached()) |
| 18503 | { |
| 18504 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 18505 | return -EINVAL; |
| 18506 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 18507 | } |
| 18508 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 18509 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 18510 | { |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 18511 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 18512 | { |
| 18513 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 18514 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 18515 | " TDLS setup is ongoing. action %d declined.", |
| 18516 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 18517 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 18518 | } |
| 18519 | } |
| 18520 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 18521 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 18522 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18523 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 18524 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 18525 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18526 | { |
| 18527 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 18528 | we return error code at 'add_station()'. Hence we have this |
| 18529 | check again in addtion to add_station(). |
| 18530 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 18531 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18532 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 18533 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18534 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 18535 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 18536 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 18537 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 18538 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18539 | } |
| 18540 | else |
| 18541 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 18542 | /* maximum reached. tweak to send error code to peer and return |
| 18543 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18544 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 18545 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18546 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 18547 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 18548 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 18549 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 18550 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 18551 | /* fall through to send setup resp with failure status |
| 18552 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18553 | } |
| 18554 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 18555 | else |
| 18556 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18557 | mutex_lock(&pHddCtx->tdls_lock); |
| 18558 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 18559 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 18560 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18561 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 18562 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 18563 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 18564 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 18565 | return -EPERM; |
| 18566 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18567 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 18568 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18569 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18570 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 18571 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 18572 | "%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] | 18573 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 18574 | action_code, dialog_token, status_code, len); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18575 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 18576 | /*Except teardown responder will not be used so just make 0*/ |
| 18577 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 18578 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 18579 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 18580 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18581 | mutex_lock(&pHddCtx->tdls_lock); |
| 18582 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 18583 | |
| 18584 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 18585 | responder = pTdlsPeer->is_responder; |
| 18586 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 18587 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 18588 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 18589 | "%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] | 18590 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 18591 | dialog_token, status_code, len); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18592 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 18593 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 18594 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18595 | mutex_unlock(&pHddCtx->tdls_lock); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18596 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18597 | |
Masti, Narayanraddi | 3b68193 | 2015-10-08 19:22:25 +0530 | [diff] [blame] | 18598 | /* Discard TDLS setup if peer is removed by user app */ |
| 18599 | if ((pHddCtx->cfg_ini->fTDLSExternalControl) && |
| 18600 | ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 18601 | (SIR_MAC_TDLS_SETUP_CNF == action_code) || |
| 18602 | (SIR_MAC_TDLS_DIS_REQ == action_code))) { |
| 18603 | |
| 18604 | mutex_lock(&pHddCtx->tdls_lock); |
| 18605 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 18606 | if (pTdlsPeer && (FALSE == pTdlsPeer->isForcedPeer)) { |
| 18607 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18608 | hddLog(LOGE, FL("TDLS External Control enabled, but peer " |
| 18609 | MAC_ADDRESS_STR " is not forced, so reject the action code %d"), |
| 18610 | MAC_ADDR_ARRAY(peer), action_code); |
| 18611 | return -EINVAL; |
| 18612 | } |
| 18613 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18614 | } |
| 18615 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 18616 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 18617 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 18618 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Deepthi Gowri | f78f1f7 | 2016-03-21 13:13:28 +0530 | [diff] [blame] | 18619 | (SIR_MAC_TDLS_SETUP_CNF== action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 18620 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 18621 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 18622 | { |
| 18623 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 18624 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 18625 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 18626 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18627 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 18628 | if (status != VOS_STATUS_SUCCESS) { |
| 18629 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
| 18630 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 18631 | } |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18632 | if (SIR_MAC_TDLS_DIS_REQ != action_code) { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 18633 | if (0 != wlan_hdd_tdls_set_cap(pAdapter, peer, eTDLS_CAP_SUPPORTED)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18634 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS capabilities")); |
| 18635 | } |
| 18636 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 18637 | } |
| 18638 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 18639 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 18640 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 18641 | { |
| 18642 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 18643 | "%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] | 18644 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 18645 | ret = -EBUSY; |
| 18646 | goto tx_failed; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 18647 | } |
| 18648 | |
| 18649 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 18650 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 18651 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 18652 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 18653 | pAdapter->sessionId, peer, action_code, dialog_token, |
| 18654 | status_code, peer_capability, (tANI_U8 *)buf, len, |
| 18655 | responder); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18656 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 18657 | if (VOS_STATUS_SUCCESS != status) |
| 18658 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18659 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18660 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 18661 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 18662 | ret = -EINVAL; |
| 18663 | goto tx_failed; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18664 | } |
| 18665 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 18666 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18667 | "%s: Wait for tdls_mgmt_comp. Timeout %u ms", __func__, |
| 18668 | WAIT_TIME_TDLS_MGMT); |
| 18669 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 18670 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 18671 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 18672 | |
| 18673 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 18674 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 18675 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 18676 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 18677 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 18678 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 18679 | |
| 18680 | if (pHddCtx->isLogpInProgress) |
| 18681 | { |
| 18682 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18683 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 18684 | return -EAGAIN; |
| 18685 | } |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 18686 | if (rc <= 0) |
| 18687 | vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL, |
| 18688 | WLAN_LOG_INDICATOR_HOST_DRIVER, |
| 18689 | WLAN_LOG_REASON_HDD_TIME_OUT, |
| 18690 | TRUE, TRUE); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 18691 | |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 18692 | ret = -EINVAL; |
| 18693 | goto tx_failed; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 18694 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 18695 | else |
| 18696 | { |
| 18697 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18698 | "%s: Mgmt Tx Completion status %ld TxCompletion %u", |
| 18699 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
| 18700 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 18701 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 18702 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 18703 | { |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 18704 | ret = max_sta_failed; |
| 18705 | goto tx_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 18706 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 18707 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 18708 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 18709 | { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 18710 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peer, TRUE)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18711 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 18712 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 18713 | } |
| 18714 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 18715 | { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 18716 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peer, FALSE)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18717 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 18718 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 18719 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18720 | |
| 18721 | return 0; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 18722 | |
| 18723 | tx_failed: |
| 18724 | /* add_station will be called before sending TDLS_SETUP_REQ and |
| 18725 | * TDLS_SETUP_RSP and as part of add_station driver will enable |
| 18726 | * BMPS. NL80211_TDLS_DISABLE_LINK will be called if the tx of |
| 18727 | * TDLS_SETUP_REQ or TDLS_SETUP_RSP fails. BMPS will be enabled |
| 18728 | * as part of processing NL80211_TDLS_DISABLE_LINK. So need to |
| 18729 | * enable BMPS for TDLS_SETUP_REQ and TDLS_SETUP_RSP if tx fails. |
| 18730 | */ |
| 18731 | |
| 18732 | if ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 18733 | (SIR_MAC_TDLS_SETUP_RSP == action_code)) |
| 18734 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 18735 | return ret; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18736 | } |
| 18737 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18738 | #if TDLS_MGMT_VERSION2 |
| 18739 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 18740 | u8 *peer, u8 action_code, u8 dialog_token, |
| 18741 | u16 status_code, u32 peer_capability, |
| 18742 | const u8 *buf, size_t len) |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 18743 | #else /* TDLS_MGMT_VERSION2 */ |
| 18744 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) |
| 18745 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 18746 | struct net_device *dev, |
| 18747 | const u8 *peer, u8 action_code, |
| 18748 | u8 dialog_token, u16 status_code, |
| 18749 | u32 peer_capability, bool initiator, |
| 18750 | const u8 *buf, size_t len) |
| 18751 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 18752 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 18753 | struct net_device *dev, |
| 18754 | const u8 *peer, u8 action_code, |
| 18755 | u8 dialog_token, u16 status_code, |
| 18756 | u32 peer_capability, const u8 *buf, |
| 18757 | size_t len) |
| 18758 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 18759 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 18760 | struct net_device *dev, |
| 18761 | u8 *peer, u8 action_code, |
| 18762 | u8 dialog_token, |
| 18763 | u16 status_code, u32 peer_capability, |
| 18764 | const u8 *buf, size_t len) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18765 | #else |
| 18766 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 18767 | u8 *peer, u8 action_code, u8 dialog_token, |
| 18768 | u16 status_code, const u8 *buf, size_t len) |
| 18769 | #endif |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 18770 | #endif |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18771 | { |
| 18772 | int ret; |
| 18773 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 18774 | vos_ssr_protect(__func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18775 | #if TDLS_MGMT_VERSION2 |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 18776 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 18777 | dialog_token, status_code, |
| 18778 | peer_capability, buf, len); |
| 18779 | #else /* TDLS_MGMT_VERSION2 */ |
| 18780 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS) |
| 18781 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 18782 | dialog_token, status_code, |
| 18783 | peer_capability, initiator, |
| 18784 | buf, len); |
| 18785 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) |
| 18786 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 18787 | dialog_token, status_code, |
| 18788 | peer_capability, buf, len); |
| 18789 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 18790 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 18791 | dialog_token, status_code, |
| 18792 | peer_capability, buf, len); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18793 | #else |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 18794 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 18795 | dialog_token, status_code, buf, len); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18796 | #endif |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 18797 | #endif |
| 18798 | vos_ssr_unprotect(__func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18799 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 18800 | return ret; |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18801 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18802 | |
| 18803 | int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 18804 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 18805 | const u8 *peer, |
| 18806 | #else |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18807 | u8 *peer, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 18808 | #endif |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18809 | tdls_req_params_t *tdls_peer_params, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18810 | cfg80211_exttdls_callback callback) |
| 18811 | { |
| 18812 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18813 | hddTdlsPeer_t *pTdlsPeer = NULL; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18814 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 18815 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18816 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18817 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 18818 | __func__, MAC_ADDR_ARRAY(peer)); |
| 18819 | |
| 18820 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 18821 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 18822 | |
| 18823 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18824 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 18825 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 18826 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18827 | return -ENOTSUPP; |
| 18828 | } |
| 18829 | |
| 18830 | /* To cater the requirement of establishing the TDLS link |
| 18831 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 18832 | */ |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 18833 | mutex_lock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18834 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 18835 | if (pTdlsPeer == NULL) { |
| 18836 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18837 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 18838 | __func__, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 18839 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18840 | return -EINVAL; |
| 18841 | } |
| 18842 | |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 18843 | /* check FW TDLS Off Channel capability */ |
| 18844 | if ((TRUE == sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)) && |
Pradeep Reddy POTTETI | 0cb99bc | 2015-06-08 12:59:09 +0530 | [diff] [blame] | 18845 | (TRUE == pHddCtx->cfg_ini->fEnableTDLSOffChannel) && |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 18846 | (NULL != tdls_peer_params)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18847 | { |
| 18848 | pTdlsPeer->peerParams.channel = tdls_peer_params->channel; |
| 18849 | pTdlsPeer->peerParams.global_operating_class = |
| 18850 | tdls_peer_params->global_operating_class; |
| 18851 | pTdlsPeer->peerParams.max_latency_ms = tdls_peer_params->max_latency_ms; |
| 18852 | pTdlsPeer->peerParams.min_bandwidth_kbps = |
| 18853 | tdls_peer_params->min_bandwidth_kbps; |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 18854 | /* check configured channel is valid, non dfs and |
| 18855 | * not current operating channel */ |
| 18856 | if ((sme_IsTdlsOffChannelValid(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 18857 | tdls_peer_params->channel)) && |
| 18858 | (pHddStaCtx) && |
| 18859 | (tdls_peer_params->channel != |
| 18860 | pHddStaCtx->conn_info.operationChannel)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18861 | { |
| 18862 | pTdlsPeer->isOffChannelConfigured = TRUE; |
| 18863 | } |
| 18864 | else |
| 18865 | { |
| 18866 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 18867 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18868 | "%s: Configured Tdls Off Channel is not valid", __func__); |
| 18869 | |
| 18870 | } |
| 18871 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 18872 | "%s: tdls_off_channel %d isOffChannelConfigured %d " |
| 18873 | "current operating channel %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18874 | __func__, pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 18875 | pTdlsPeer->isOffChannelConfigured, |
| 18876 | (pHddStaCtx ? pHddStaCtx->conn_info.operationChannel : 0)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18877 | } |
| 18878 | else |
| 18879 | { |
| 18880 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pradeep Reddy POTTETI | 0cb99bc | 2015-06-08 12:59:09 +0530 | [diff] [blame] | 18881 | "%s: TDLS off channel FW capability %d, " |
| 18882 | "host capab %d or Invalid TDLS Peer Params", __func__, |
| 18883 | sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL), |
| 18884 | pHddCtx->cfg_ini->fEnableTDLSOffChannel); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18885 | } |
| 18886 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18887 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 18888 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18889 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18890 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18891 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18892 | " %s TDLS Add Force Peer Failed", |
| 18893 | __func__); |
| 18894 | return -EINVAL; |
| 18895 | } |
| 18896 | /*EXT TDLS*/ |
| 18897 | |
| 18898 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18899 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18900 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18901 | " %s TDLS set callback Failed", |
| 18902 | __func__); |
| 18903 | return -EINVAL; |
| 18904 | } |
| 18905 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18906 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18907 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18908 | return(0); |
| 18909 | |
| 18910 | } |
| 18911 | |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 18912 | int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, |
| 18913 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 18914 | const u8 *peer |
| 18915 | #else |
| 18916 | u8 *peer |
| 18917 | #endif |
| 18918 | ) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18919 | { |
| 18920 | |
| 18921 | hddTdlsPeer_t *pTdlsPeer; |
| 18922 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | ff7c2f9 | 2016-01-05 15:28:12 +0530 | [diff] [blame] | 18923 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18924 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18925 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 18926 | __func__, MAC_ADDR_ARRAY(peer)); |
| 18927 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 18928 | if (0 != wlan_hdd_validate_context(pHddCtx)) { |
| 18929 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is NULL")); |
| 18930 | return -EINVAL; |
| 18931 | } |
| 18932 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18933 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 18934 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 18935 | |
| 18936 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18937 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 18938 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 18939 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18940 | return -ENOTSUPP; |
| 18941 | } |
| 18942 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18943 | mutex_lock(&pHddCtx->tdls_lock); |
| 18944 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18945 | |
| 18946 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18947 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18948 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 18949 | " peer not existing", |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18950 | __func__, MAC_ADDR_ARRAY(peer)); |
| 18951 | return -EINVAL; |
| 18952 | } |
| 18953 | else { |
| 18954 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 18955 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
Abhishek Singh | ff7c2f9 | 2016-01-05 15:28:12 +0530 | [diff] [blame] | 18956 | hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_EXT_CTRL, |
| 18957 | pTdlsPeer->peerMac); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18958 | /* if channel switch is configured, reset |
| 18959 | the channel for this peer */ |
| 18960 | if (TRUE == pTdlsPeer->isOffChannelConfigured) |
| 18961 | { |
| 18962 | pTdlsPeer->peerParams.channel = 0; |
| 18963 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 18964 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18965 | } |
| 18966 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18967 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18968 | mutex_unlock(&pHddCtx->tdls_lock); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18969 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set force peer")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18970 | return -EINVAL; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18971 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18972 | |
| 18973 | /*EXT TDLS*/ |
| 18974 | |
| 18975 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18976 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18977 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18978 | " %s TDLS set callback Failed", |
| 18979 | __func__); |
| 18980 | return -EINVAL; |
| 18981 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18982 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18983 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18984 | |
| 18985 | return(0); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18986 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18987 | static int __wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 18988 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 18989 | const u8 *peer, |
| 18990 | #else |
| 18991 | u8 *peer, |
| 18992 | #endif |
| 18993 | enum nl80211_tdls_operation oper) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18994 | { |
| 18995 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 18996 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18997 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 18998 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 18999 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19000 | ENTER(); |
| 19001 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 19002 | if (!pAdapter) { |
| 19003 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 19004 | return -EINVAL; |
| 19005 | } |
| 19006 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 19007 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 19008 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 19009 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19010 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19011 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 19012 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 19013 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19014 | return -EINVAL; |
| 19015 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 19016 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19017 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19018 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 19019 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19020 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 19021 | } |
| 19022 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19023 | |
| 19024 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 19025 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19026 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 19027 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 19028 | "TDLS Disabled in INI (%d) OR not enabled in FW (%d) " |
| 19029 | "Cannot process TDLS commands", |
| 19030 | pHddCtx->cfg_ini->fEnableTDLSSupport, |
| 19031 | sme_IsFeatureSupportedByFW(TDLS)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19032 | return -ENOTSUPP; |
| 19033 | } |
| 19034 | |
| 19035 | switch (oper) { |
| 19036 | case NL80211_TDLS_ENABLE_LINK: |
| 19037 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19038 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 19039 | long ret; |
Hanumantha Reddy Pothula | da38949 | 2016-02-11 17:29:27 +0530 | [diff] [blame] | 19040 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams = { {0}, 0, |
| 19041 | 0, 0, 0, 0, 0, 0, {0}, 0, {0} }; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 19042 | WLAN_STADescType staDesc; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19043 | tANI_U16 numCurrTdlsPeers = 0; |
| 19044 | hddTdlsPeer_t *connPeer = NULL; |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 19045 | tANI_U8 suppChannelLen = 0; |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19046 | tSirMacAddr peerMac; |
| 19047 | int channel; |
| 19048 | tTDLSLinkStatus peer_status = eTDLS_LINK_IDLE; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19049 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 19050 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19051 | " %s : NL80211_TDLS_ENABLE_LINK for " MAC_ADDRESS_STR, |
| 19052 | __func__, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 19053 | |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19054 | mutex_lock(&pHddCtx->tdls_lock); |
| 19055 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 19056 | memset(&staDesc, 0, sizeof(staDesc)); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 19057 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19058 | mutex_unlock(&pHddCtx->tdls_lock); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 19059 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 19060 | " (oper %d) not exsting. ignored", |
| 19061 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 19062 | return -EINVAL; |
| 19063 | } |
| 19064 | |
| 19065 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19066 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 19067 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 19068 | "NL80211_TDLS_ENABLE_LINK"); |
| 19069 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 19070 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 19071 | { |
| 19072 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 19073 | MAC_ADDRESS_STR " failed", |
| 19074 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19075 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 19076 | return -EINVAL; |
| 19077 | } |
| 19078 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 19079 | /* before starting tdls connection, set tdls |
| 19080 | * off channel established status to default value */ |
| 19081 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19082 | |
| 19083 | mutex_unlock(&pHddCtx->tdls_lock); |
| 19084 | |
Deepthi Gowri | 2d85bbf | 2016-07-25 15:43:31 +0530 | [diff] [blame] | 19085 | wlan_hdd_tdls_set_cap(pAdapter, peer, eTDLS_CAP_SUPPORTED); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19086 | /* TDLS Off Channel, Disable tdls channel switch, |
| 19087 | when there are more than one tdls link */ |
| 19088 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 19089 | if (numCurrTdlsPeers == 2) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19090 | { |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19091 | mutex_lock(&pHddCtx->tdls_lock); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19092 | /* get connected peer and send disable tdls off chan */ |
| 19093 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 19094 | if ((connPeer) && |
| 19095 | (connPeer->isOffChannelSupported == TRUE) && |
| 19096 | (connPeer->isOffChannelConfigured == TRUE)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19097 | { |
| 19098 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19099 | "%s: More then one peer connected, Disable " |
| 19100 | "TDLS channel switch", __func__); |
| 19101 | |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 19102 | connPeer->isOffChannelEstablished = FALSE; |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19103 | vos_mem_copy(peerMac, connPeer->peerMac, sizeof (tSirMacAddr)); |
| 19104 | channel = connPeer->peerParams.channel; |
| 19105 | |
| 19106 | mutex_unlock(&pHddCtx->tdls_lock); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 19107 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 19108 | ret = sme_SendTdlsChanSwitchReq( |
| 19109 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19110 | pAdapter->sessionId, |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19111 | peerMac, |
| 19112 | channel, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19113 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 19114 | TDLS_CHANNEL_SWITCH_DISABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 19115 | if (ret != VOS_STATUS_SUCCESS) { |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 19116 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 19117 | FL("Failed to send TDLS switch channel request")); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 19118 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19119 | } |
| 19120 | else |
| 19121 | { |
| 19122 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19123 | "%s: No TDLS Connected Peer or " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 19124 | "isOffChannelSupported %d " |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19125 | "isOffChannelConfigured %d", |
| 19126 | __func__, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 19127 | (connPeer ? (connPeer->isOffChannelSupported) |
| 19128 | : -1), |
| 19129 | (connPeer ? (connPeer->isOffChannelConfigured) |
| 19130 | : -1)); |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19131 | mutex_unlock(&pHddCtx->tdls_lock); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19132 | } |
| 19133 | } |
| 19134 | |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19135 | mutex_lock(&pHddCtx->tdls_lock); |
| 19136 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 19137 | if ( NULL == pTdlsPeer ) { |
| 19138 | mutex_unlock(&pHddCtx->tdls_lock); |
| 19139 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19140 | "%s: " MAC_ADDRESS_STR |
| 19141 | " (oper %d) peer got freed in other context. ignored", |
| 19142 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 19143 | return -EINVAL; |
| 19144 | } |
| 19145 | peer_status = pTdlsPeer->link_status; |
| 19146 | mutex_unlock(&pHddCtx->tdls_lock); |
| 19147 | |
| 19148 | if (eTDLS_LINK_CONNECTED != peer_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 19149 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 19150 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 19151 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 19152 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 19153 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 19154 | 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] | 19155 | return -EINVAL; |
| 19156 | } |
| 19157 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 19158 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 19159 | ret = sme_SendTdlsLinkEstablishParams( |
| 19160 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 19161 | pAdapter->sessionId, peer, |
| 19162 | &tdlsLinkEstablishParams); |
| 19163 | if (ret != VOS_STATUS_SUCCESS) { |
| 19164 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send link establishment params")); |
| 19165 | } |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 19166 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 19167 | * register with the TL on after the response for this operation |
| 19168 | * is received . |
| 19169 | */ |
| 19170 | ret = wait_for_completion_interruptible_timeout( |
| 19171 | &pAdapter->tdls_link_establish_req_comp, |
| 19172 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
Masti, Narayanraddi | e1892a5 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 19173 | |
| 19174 | mutex_lock(&pHddCtx->tdls_lock); |
| 19175 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 19176 | if ( NULL == pTdlsPeer ) { |
| 19177 | mutex_unlock(&pHddCtx->tdls_lock); |
| 19178 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19179 | "%s %d: " MAC_ADDRESS_STR |
| 19180 | " (oper %d) peer got freed in other context. ignored", |
| 19181 | __func__, __LINE__, MAC_ADDR_ARRAY(peer), |
| 19182 | (int)oper); |
| 19183 | return -EINVAL; |
| 19184 | } |
| 19185 | peer_status = pTdlsPeer->link_status; |
| 19186 | mutex_unlock(&pHddCtx->tdls_lock); |
| 19187 | |
| 19188 | if (ret <= 0 || (peer_status == eTDLS_LINK_TEARING)) |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 19189 | { |
| 19190 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 19191 | FL("Link Establish Request Failed Status %ld"), |
| 19192 | ret); |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 19193 | return -EINVAL; |
| 19194 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 19195 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 19196 | |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19197 | mutex_lock(&pHddCtx->tdls_lock); |
| 19198 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 19199 | if ( NULL == pTdlsPeer ) { |
| 19200 | mutex_unlock(&pHddCtx->tdls_lock); |
| 19201 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19202 | "%s: " MAC_ADDRESS_STR |
| 19203 | " (oper %d) peer got freed in other context. ignored", |
| 19204 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 19205 | return -EINVAL; |
| 19206 | } |
| 19207 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 19208 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 19209 | eTDLS_LINK_CONNECTED, |
| 19210 | eTDLS_LINK_SUCCESS); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 19211 | staDesc.ucSTAId = pTdlsPeer->staId; |
| 19212 | staDesc.ucQosEnabled = tdlsLinkEstablishParams.qos; |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 19213 | |
| 19214 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19215 | "%s: tdlsLinkEstablishParams of peer " |
| 19216 | MAC_ADDRESS_STR "uapsdQueues: %d" |
| 19217 | "qos: %d maxSp: %d isBufSta: %d isOffChannelSupported: %d" |
| 19218 | "isResponder: %d peerstaId: %d", |
| 19219 | __func__, |
| 19220 | MAC_ADDR_ARRAY(tdlsLinkEstablishParams.peerMac), |
| 19221 | tdlsLinkEstablishParams.uapsdQueues, |
| 19222 | tdlsLinkEstablishParams.qos, |
| 19223 | tdlsLinkEstablishParams.maxSp, |
| 19224 | tdlsLinkEstablishParams.isBufSta, |
| 19225 | tdlsLinkEstablishParams.isOffChannelSupported, |
| 19226 | tdlsLinkEstablishParams.isResponder, |
| 19227 | pTdlsPeer->staId); |
| 19228 | |
| 19229 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19230 | "%s: StaDesc ucSTAId: %d ucQosEnabled: %d", |
| 19231 | __func__, |
| 19232 | staDesc.ucSTAId, |
| 19233 | staDesc.ucQosEnabled); |
| 19234 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 19235 | ret = WLANTL_UpdateTdlsSTAClient( |
| 19236 | pHddCtx->pvosContext, |
| 19237 | &staDesc); |
| 19238 | if (ret != VOS_STATUS_SUCCESS) { |
| 19239 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to update TDLS STA params")); |
| 19240 | } |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 19241 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 19242 | /* Mark TDLS client Authenticated .*/ |
| 19243 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 19244 | pTdlsPeer->staId, |
| 19245 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 19246 | if (VOS_STATUS_SUCCESS == status) |
| 19247 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 19248 | if (pTdlsPeer->is_responder == 0) |
| 19249 | { |
| 19250 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
Ganesh Kondabattini | cbfdc39 | 2015-09-11 19:12:59 +0530 | [diff] [blame] | 19251 | tdlsConnInfo_t *tdlsInfo; |
| 19252 | |
| 19253 | tdlsInfo = wlan_hdd_get_conn_info(pHddCtx, staId); |
| 19254 | |
Hanumantha Reddy Pothula | c823840 | 2016-03-24 18:02:23 +0530 | [diff] [blame] | 19255 | if (!vos_timer_is_initialized( |
| 19256 | &pTdlsPeer->initiatorWaitTimeoutTimer)) |
| 19257 | { |
| 19258 | /* Initialize initiator wait callback */ |
| 19259 | vos_timer_init( |
Ganesh Kondabattini | cbfdc39 | 2015-09-11 19:12:59 +0530 | [diff] [blame] | 19260 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 19261 | VOS_TIMER_TYPE_SW, |
| 19262 | wlan_hdd_tdls_initiator_wait_cb, |
| 19263 | tdlsInfo); |
Hanumantha Reddy Pothula | c823840 | 2016-03-24 18:02:23 +0530 | [diff] [blame] | 19264 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 19265 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 19266 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 19267 | WAIT_TIME_TDLS_INITIATOR); |
| 19268 | /* suspend initiator TX until it receives direct packet from the |
| 19269 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 19270 | ret = WLANTL_SuspendDataTx( |
| 19271 | (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 19272 | &staId, NULL); |
| 19273 | if (ret != VOS_STATUS_SUCCESS) { |
| 19274 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to suspend data tx")); |
| 19275 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 19276 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19277 | |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 19278 | if ((TRUE == pTdlsPeer->isOffChannelSupported) && |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 19279 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 19280 | { |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 19281 | suppChannelLen = |
| 19282 | tdlsLinkEstablishParams.supportedChannelsLen; |
| 19283 | |
| 19284 | if ((suppChannelLen > 0) && |
| 19285 | (suppChannelLen <= SIR_MAC_MAX_SUPP_CHANNELS)) |
| 19286 | { |
| 19287 | tANI_U8 suppPeerChannel = 0; |
| 19288 | int i = 0; |
| 19289 | for (i = 0U; i < suppChannelLen; i++) |
| 19290 | { |
| 19291 | suppPeerChannel = |
| 19292 | tdlsLinkEstablishParams.supportedChannels[i]; |
| 19293 | |
| 19294 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 19295 | if (suppPeerChannel == |
| 19296 | pTdlsPeer->peerParams.channel) |
| 19297 | { |
| 19298 | pTdlsPeer->isOffChannelSupported = TRUE; |
| 19299 | break; |
| 19300 | } |
| 19301 | } |
| 19302 | } |
| 19303 | else |
| 19304 | { |
| 19305 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 19306 | } |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 19307 | } |
| 19308 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19309 | "%s: TDLS channel switch request for channel " |
| 19310 | "%d isOffChannelConfigured %d suppChannelLen " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 19311 | "%d isOffChannelSupported %d", __func__, |
| 19312 | pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 19313 | pTdlsPeer->isOffChannelConfigured, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 19314 | suppChannelLen, |
| 19315 | pTdlsPeer->isOffChannelSupported); |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 19316 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19317 | /* TDLS Off Channel, Enable tdls channel switch, |
| 19318 | when their is only one tdls link and it supports */ |
| 19319 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 19320 | if ((numCurrTdlsPeers == 1) && |
| 19321 | (TRUE == pTdlsPeer->isOffChannelSupported) && |
| 19322 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
| 19323 | { |
| 19324 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19325 | "%s: Send TDLS channel switch request for channel %d", |
| 19326 | __func__, pTdlsPeer->peerParams.channel); |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 19327 | |
| 19328 | pTdlsPeer->isOffChannelEstablished = TRUE; |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19329 | vos_mem_copy(peerMac, pTdlsPeer->peerMac, sizeof (tSirMacAddr)); |
| 19330 | channel = pTdlsPeer->peerParams.channel; |
| 19331 | |
| 19332 | mutex_unlock(&pHddCtx->tdls_lock); |
| 19333 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19334 | ret = sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 19335 | pAdapter->sessionId, |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19336 | peerMac, |
| 19337 | channel, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19338 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 19339 | TDLS_CHANNEL_SWITCH_ENABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 19340 | if (ret != VOS_STATUS_SUCCESS) { |
| 19341 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS offchannel: Failed to send TDLS switch channel req")); |
| 19342 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19343 | } |
| 19344 | else |
| 19345 | { |
| 19346 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19347 | "%s: TDLS channel switch request not sent" |
| 19348 | " numCurrTdlsPeers %d " |
| 19349 | "isOffChannelSupported %d " |
| 19350 | "isOffChannelConfigured %d", |
| 19351 | __func__, numCurrTdlsPeers, |
| 19352 | pTdlsPeer->isOffChannelSupported, |
| 19353 | pTdlsPeer->isOffChannelConfigured); |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19354 | mutex_unlock(&pHddCtx->tdls_lock); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19355 | } |
| 19356 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 19357 | } |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19358 | else |
| 19359 | mutex_unlock(&pHddCtx->tdls_lock); |
| 19360 | |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 19361 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 19362 | |
| 19363 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 19364 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 19365 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 19366 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 19367 | int ac; |
| 19368 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 19369 | WLANTL_AC_VI, |
| 19370 | WLANTL_AC_BK, |
| 19371 | WLANTL_AC_BE }; |
| 19372 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 19373 | for(ac=0; ac < 4; ac++) |
| 19374 | { |
| 19375 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 19376 | pTdlsPeer->staId, ucAc[ac], |
| 19377 | tlTid[ac], tlTid[ac], 0, 0, |
| 19378 | WLANTL_BI_DIR ); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 19379 | if (status != VOS_STATUS_SUCCESS) { |
| 19380 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to enable UAPSD for AC")); |
| 19381 | } |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 19382 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 19383 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 19384 | } |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 19385 | |
Bhargav Shah | 6689679 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 19386 | /* stop TCP delack timer if TDLS is enable */ |
| 19387 | set_bit(WLAN_TDLS_MODE, &pHddCtx->mode); |
| 19388 | hdd_manage_delack_timer(pHddCtx); |
Abhishek Singh | 67fa6bc | 2016-01-05 15:57:19 +0530 | [diff] [blame] | 19389 | hdd_wlan_tdls_enable_link_event(peer, |
| 19390 | pTdlsPeer->isOffChannelSupported, |
| 19391 | pTdlsPeer->isOffChannelConfigured, |
| 19392 | pTdlsPeer->isOffChannelEstablished); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19393 | } |
| 19394 | break; |
| 19395 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 19396 | { |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19397 | tANI_U16 numCurrTdlsPeers = 0; |
| 19398 | hddTdlsPeer_t *connPeer = NULL; |
| 19399 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 19400 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19401 | " %s : NL80211_TDLS_DISABLE_LINK for " MAC_ADDRESS_STR, |
| 19402 | __func__, MAC_ADDR_ARRAY(peer)); |
| 19403 | |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 19404 | mutex_lock(&pHddCtx->tdls_lock); |
| 19405 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 19406 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 19407 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 19408 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 19409 | mutex_unlock(&pHddCtx->tdls_lock); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 19410 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 19411 | " (oper %d) not exsting. ignored", |
| 19412 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 19413 | return -EINVAL; |
| 19414 | } |
| 19415 | |
| 19416 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19417 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 19418 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 19419 | "NL80211_TDLS_DISABLE_LINK"); |
| 19420 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 19421 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 19422 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 19423 | long status; |
| 19424 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 19425 | /* set tdls off channel status to false for this peer */ |
| 19426 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 19427 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 19428 | eTDLS_LINK_TEARING, |
| 19429 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 19430 | eTDLS_LINK_UNSPECIFIED: |
| 19431 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 19432 | mutex_unlock(&pHddCtx->tdls_lock); |
| 19433 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 19434 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 19435 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 19436 | status = sme_DeleteTdlsPeerSta( |
| 19437 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 19438 | pAdapter->sessionId, peer ); |
| 19439 | if (status != VOS_STATUS_SUCCESS) { |
| 19440 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 19441 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 19442 | |
| 19443 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 19444 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 19445 | |
| 19446 | mutex_lock(&pHddCtx->tdls_lock); |
| 19447 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 19448 | if ( NULL == pTdlsPeer ) { |
| 19449 | mutex_unlock(&pHddCtx->tdls_lock); |
| 19450 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 19451 | " peer was freed in other context", |
| 19452 | __func__, MAC_ADDR_ARRAY(peer)); |
| 19453 | return -EINVAL; |
| 19454 | } |
| 19455 | |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 19456 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
Atul Mittal | 454664b | 2014-10-10 11:03:46 +0530 | [diff] [blame] | 19457 | eTDLS_LINK_IDLE, |
| 19458 | eTDLS_LINK_UNSPECIFIED); |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 19459 | mutex_unlock(&pHddCtx->tdls_lock); |
| 19460 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 19461 | if (status <= 0) |
| 19462 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 19463 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19464 | "%s: Del station failed status %ld", |
| 19465 | __func__, status); |
| 19466 | return -EPERM; |
| 19467 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19468 | |
| 19469 | /* TDLS Off Channel, Enable tdls channel switch, |
| 19470 | when their is only one tdls link and it supports */ |
| 19471 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 19472 | if (numCurrTdlsPeers == 1) |
| 19473 | { |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 19474 | tSirMacAddr peerMac; |
| 19475 | int channel; |
Masti, Narayanraddi | 3818aea | 2015-10-17 15:20:28 +0530 | [diff] [blame] | 19476 | |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 19477 | mutex_lock(&pHddCtx->tdls_lock); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19478 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
Masti, Narayanraddi | 3818aea | 2015-10-17 15:20:28 +0530 | [diff] [blame] | 19479 | |
| 19480 | if (connPeer == NULL) { |
| 19481 | mutex_unlock(&pHddCtx->tdls_lock); |
| 19482 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 19483 | "%s connPeer is NULL", __func__); |
| 19484 | return -EINVAL; |
| 19485 | } |
| 19486 | |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 19487 | vos_mem_copy(peerMac, connPeer->peerMac, sizeof(tSirMacAddr)); |
| 19488 | channel = connPeer->peerParams.channel; |
| 19489 | |
| 19490 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19491 | "%s: TDLS channel switch " |
| 19492 | "isOffChannelSupported %d " |
| 19493 | "isOffChannelConfigured %d " |
| 19494 | "isOffChannelEstablished %d", |
| 19495 | __func__, |
| 19496 | (connPeer ? connPeer->isOffChannelSupported : -1), |
| 19497 | (connPeer ? connPeer->isOffChannelConfigured : -1), |
| 19498 | (connPeer ? connPeer->isOffChannelEstablished : -1)); |
| 19499 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19500 | if ((connPeer) && |
| 19501 | (connPeer->isOffChannelSupported == TRUE) && |
| 19502 | (connPeer->isOffChannelConfigured == TRUE)) |
| 19503 | { |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 19504 | connPeer->isOffChannelEstablished = TRUE; |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 19505 | mutex_unlock(&pHddCtx->tdls_lock); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 19506 | status = sme_SendTdlsChanSwitchReq( |
| 19507 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 19508 | pAdapter->sessionId, |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 19509 | peerMac, |
| 19510 | channel, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 19511 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 19512 | TDLS_CHANNEL_SWITCH_ENABLE); |
| 19513 | if (status != VOS_STATUS_SUCCESS) { |
| 19514 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel req")); |
| 19515 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19516 | } |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 19517 | else |
| 19518 | mutex_unlock(&pHddCtx->tdls_lock); |
| 19519 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19520 | else |
| 19521 | { |
| 19522 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19523 | "%s: TDLS channel switch request not sent " |
| 19524 | "numCurrTdlsPeers %d ", |
| 19525 | __func__, numCurrTdlsPeers); |
| 19526 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 19527 | } |
| 19528 | else |
| 19529 | { |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 19530 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 19531 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19532 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 19533 | } |
Bhargav Shah | 6689679 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 19534 | if (numCurrTdlsPeers == 0) { |
| 19535 | /* start TCP delack timer if TDLS is disable */ |
| 19536 | clear_bit(WLAN_TDLS_MODE, &pHddCtx->mode); |
| 19537 | hdd_manage_delack_timer(pHddCtx); |
| 19538 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 19539 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 19540 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19541 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 19542 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 19543 | status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 19544 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 19545 | if (0 != status) |
| 19546 | { |
| 19547 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 19548 | FL("Error in TDLS Teardown")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 19549 | return status; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 19550 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 19551 | break; |
| 19552 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19553 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 19554 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 19555 | status = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 19556 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 19557 | NULL, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 19558 | NULL); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 19559 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 19560 | if (0 != status) |
| 19561 | { |
| 19562 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 19563 | FL("Error in TDLS Setup")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 19564 | return status; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 19565 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 19566 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 19567 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19568 | case NL80211_TDLS_DISCOVERY_REQ: |
| 19569 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 19570 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 19571 | "%s: Driver doesn't support in-driver setup/teardown/discovery " |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 19572 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19573 | return -ENOTSUPP; |
| 19574 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 19575 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19576 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19577 | return -ENOTSUPP; |
| 19578 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19579 | |
| 19580 | EXIT(); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19581 | return 0; |
| 19582 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 19583 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19584 | static int wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 19585 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 19586 | const u8 *peer, |
| 19587 | #else |
| 19588 | u8 *peer, |
| 19589 | #endif |
| 19590 | enum nl80211_tdls_operation oper) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19591 | { |
| 19592 | int ret; |
| 19593 | |
| 19594 | vos_ssr_protect(__func__); |
| 19595 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 19596 | vos_ssr_unprotect(__func__); |
| 19597 | |
| 19598 | return ret; |
| 19599 | } |
| 19600 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 19601 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 19602 | struct net_device *dev, u8 *peer) |
| 19603 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 19604 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 19605 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 19606 | MAC_ADDR_ARRAY(peer)); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 19607 | #if TDLS_MGMT_VERSION2 |
| 19608 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 19609 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 19610 | #else |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 19611 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) |
| 19612 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 19613 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, 0, NULL, 0); |
| 19614 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 19615 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 19616 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 19617 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 19618 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 19619 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 19620 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 19621 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 19622 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 19623 | #endif |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 19624 | #endif /* KERNEL_VERSION */ |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 19625 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19626 | #endif |
| 19627 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19628 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 19629 | /* |
| 19630 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 19631 | * Callback rountine called upon receiving response for |
| 19632 | * get offload info |
| 19633 | */ |
| 19634 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 19635 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 19636 | { |
| 19637 | |
| 19638 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 19639 | tANI_U8 tempReplayCounter[8]; |
| 19640 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19641 | |
| 19642 | ENTER(); |
| 19643 | |
| 19644 | if (NULL == pAdapter) |
| 19645 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 19646 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19647 | "%s: HDD adapter is Null", __func__); |
| 19648 | return ; |
| 19649 | } |
| 19650 | |
| 19651 | if (NULL == pGtkOffloadGetInfoRsp) |
| 19652 | { |
| 19653 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19654 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 19655 | return ; |
| 19656 | } |
| 19657 | |
| 19658 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 19659 | { |
| 19660 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19661 | "%s: wlan Failed to get replay counter value", |
| 19662 | __func__); |
| 19663 | return ; |
| 19664 | } |
| 19665 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 19666 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 19667 | /* Update replay counter */ |
| 19668 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 19669 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 19670 | |
| 19671 | { |
| 19672 | /* changing from little to big endian since supplicant |
| 19673 | * works on big endian format |
| 19674 | */ |
| 19675 | int i; |
| 19676 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 19677 | |
| 19678 | for (i = 0; i < 8; i++) |
| 19679 | { |
| 19680 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 19681 | } |
| 19682 | } |
| 19683 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19684 | /* Update replay counter to NL */ |
| 19685 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 19686 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19687 | } |
| 19688 | |
| 19689 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19690 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19691 | * This function is used to offload GTK rekeying job to the firmware. |
| 19692 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19693 | 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] | 19694 | struct cfg80211_gtk_rekey_data *data) |
| 19695 | { |
| 19696 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 19697 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 19698 | hdd_station_ctx_t *pHddStaCtx; |
| 19699 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19700 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 19701 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19702 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 19703 | |
| 19704 | ENTER(); |
| 19705 | |
| 19706 | if (NULL == pAdapter) |
| 19707 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 19708 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19709 | "%s: HDD adapter is Null", __func__); |
| 19710 | return -ENODEV; |
| 19711 | } |
| 19712 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 19713 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 19714 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 19715 | pAdapter->sessionId, pAdapter->device_mode)); |
| 19716 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19717 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19718 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19719 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19720 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19721 | } |
| 19722 | |
| 19723 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 19724 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 19725 | if (NULL == hHal) |
| 19726 | { |
| 19727 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19728 | "%s: HAL context is Null!!!", __func__); |
| 19729 | return -EAGAIN; |
| 19730 | } |
| 19731 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 19732 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 19733 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 19734 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 19735 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19736 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 19737 | { |
| 19738 | /* changing from big to little endian since driver |
| 19739 | * works on little endian format |
| 19740 | */ |
| 19741 | tANI_U8 *p = |
| 19742 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 19743 | int i; |
| 19744 | |
| 19745 | for (i = 0; i < 8; i++) |
| 19746 | { |
| 19747 | p[7-i] = data->replay_ctr[i]; |
| 19748 | } |
| 19749 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19750 | |
| 19751 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 19752 | { |
| 19753 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 19754 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 19755 | sizeof (tSirGtkOffloadParams)); |
| 19756 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19757 | pAdapter->sessionId); |
| 19758 | |
| 19759 | if (eHAL_STATUS_SUCCESS != status) |
| 19760 | { |
| 19761 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19762 | "%s: sme_SetGTKOffload failed, returned %d", |
| 19763 | __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 19764 | |
| 19765 | /* Need to clear any trace of key value in the memory. |
| 19766 | * Thus zero out the memory even though it is local |
| 19767 | * variable. |
| 19768 | */ |
| 19769 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 19770 | sizeof(hddGtkOffloadReqParams)); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19771 | return status; |
| 19772 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19773 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19774 | "%s: sme_SetGTKOffload successfull", __func__); |
| 19775 | } |
| 19776 | else |
| 19777 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19778 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19779 | "%s: wlan not suspended GTKOffload request is stored", |
| 19780 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19781 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 19782 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 19783 | /* Need to clear any trace of key value in the memory. |
| 19784 | * Thus zero out the memory even though it is local |
| 19785 | * variable. |
| 19786 | */ |
| 19787 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 19788 | sizeof(hddGtkOffloadReqParams)); |
| 19789 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19790 | EXIT(); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 19791 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19792 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19793 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19794 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 19795 | struct cfg80211_gtk_rekey_data *data) |
| 19796 | { |
| 19797 | int ret; |
| 19798 | |
| 19799 | vos_ssr_protect(__func__); |
| 19800 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 19801 | vos_ssr_unprotect(__func__); |
| 19802 | |
| 19803 | return ret; |
| 19804 | } |
| 19805 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 19806 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 19807 | * FUNCTION: __wlan_hdd_cfg80211_set_mac_acl |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 19808 | * This function is used to set access control policy |
| 19809 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 19810 | static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 19811 | struct net_device *dev, |
| 19812 | const struct cfg80211_acl_data *params) |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 19813 | { |
| 19814 | int i; |
| 19815 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 19816 | hdd_hostapd_state_t *pHostapdState; |
| 19817 | tsap_Config_t *pConfig; |
| 19818 | v_CONTEXT_t pVosContext = NULL; |
| 19819 | hdd_context_t *pHddCtx; |
| 19820 | int status; |
| 19821 | |
| 19822 | ENTER(); |
| 19823 | |
| 19824 | if (NULL == pAdapter) |
| 19825 | { |
| 19826 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 19827 | "%s: HDD adapter is Null", __func__); |
| 19828 | return -ENODEV; |
| 19829 | } |
| 19830 | |
| 19831 | if (NULL == params) |
| 19832 | { |
| 19833 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 19834 | "%s: params is Null", __func__); |
| 19835 | return -EINVAL; |
| 19836 | } |
| 19837 | |
| 19838 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 19839 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 19840 | if (0 != status) |
| 19841 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 19842 | return status; |
| 19843 | } |
| 19844 | |
| 19845 | pVosContext = pHddCtx->pvosContext; |
| 19846 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 19847 | |
| 19848 | if (NULL == pHostapdState) |
| 19849 | { |
| 19850 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 19851 | "%s: pHostapdState is Null", __func__); |
| 19852 | return -EINVAL; |
| 19853 | } |
| 19854 | |
| 19855 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 19856 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 19857 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 19858 | TRACE_CODE_HDD_CFG80211_SET_MAC_ACL, |
| 19859 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 19860 | |
| 19861 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 19862 | { |
| 19863 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 19864 | |
| 19865 | /* default value */ |
| 19866 | pConfig->num_accept_mac = 0; |
| 19867 | pConfig->num_deny_mac = 0; |
| 19868 | |
| 19869 | /** |
| 19870 | * access control policy |
| 19871 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 19872 | * listed in hostapd.deny file. |
| 19873 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 19874 | * listed in hostapd.accept file. |
| 19875 | */ |
| 19876 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 19877 | { |
| 19878 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 19879 | } |
| 19880 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 19881 | { |
| 19882 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 19883 | } |
| 19884 | else |
| 19885 | { |
| 19886 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19887 | "%s:Acl Policy : %d is not supported", |
| 19888 | __func__, params->acl_policy); |
| 19889 | return -ENOTSUPP; |
| 19890 | } |
| 19891 | |
| 19892 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 19893 | { |
| 19894 | pConfig->num_accept_mac = params->n_acl_entries; |
| 19895 | for (i = 0; i < params->n_acl_entries; i++) |
| 19896 | { |
| 19897 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19898 | "** Add ACL MAC entry %i in WhiletList :" |
| 19899 | MAC_ADDRESS_STR, i, |
| 19900 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 19901 | |
| 19902 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 19903 | sizeof(qcmacaddr)); |
| 19904 | } |
| 19905 | } |
| 19906 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 19907 | { |
| 19908 | pConfig->num_deny_mac = params->n_acl_entries; |
| 19909 | for (i = 0; i < params->n_acl_entries; i++) |
| 19910 | { |
| 19911 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19912 | "** Add ACL MAC entry %i in BlackList :" |
| 19913 | MAC_ADDRESS_STR, i, |
| 19914 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 19915 | |
| 19916 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 19917 | sizeof(qcmacaddr)); |
| 19918 | } |
| 19919 | } |
| 19920 | |
| 19921 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 19922 | { |
| 19923 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19924 | "%s: SAP Set Mac Acl fail", __func__); |
| 19925 | return -EINVAL; |
| 19926 | } |
| 19927 | } |
| 19928 | else |
| 19929 | { |
| 19930 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 19931 | "%s: Invalid device_mode = %s (%d)", |
| 19932 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 19933 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 19934 | return -EINVAL; |
| 19935 | } |
| 19936 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19937 | EXIT(); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 19938 | return 0; |
| 19939 | } |
| 19940 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 19941 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 19942 | struct net_device *dev, |
| 19943 | const struct cfg80211_acl_data *params) |
| 19944 | { |
| 19945 | int ret; |
| 19946 | vos_ssr_protect(__func__); |
| 19947 | ret = __wlan_hdd_cfg80211_set_mac_acl(wiphy, dev, params); |
| 19948 | vos_ssr_unprotect(__func__); |
| 19949 | |
| 19950 | return ret; |
| 19951 | } |
| 19952 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19953 | #ifdef WLAN_NL80211_TESTMODE |
| 19954 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 19955 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19956 | ( |
| 19957 | void *pAdapter, |
| 19958 | void *indCont |
| 19959 | ) |
| 19960 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 19961 | tSirLPHBInd *lphbInd; |
| 19962 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 19963 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19964 | |
| 19965 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 19966 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19967 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 19968 | if (pAdapter == NULL) |
| 19969 | { |
| 19970 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19971 | "%s: pAdapter is NULL\n",__func__); |
| 19972 | return; |
| 19973 | } |
| 19974 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19975 | if (NULL == indCont) |
| 19976 | { |
| 19977 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 19978 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19979 | return; |
| 19980 | } |
| 19981 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 19982 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 19983 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19984 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 19985 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 19986 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19987 | GFP_ATOMIC); |
| 19988 | if (!skb) |
| 19989 | { |
| 19990 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19991 | "LPHB timeout, NL buffer alloc fail"); |
| 19992 | return; |
| 19993 | } |
| 19994 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 19995 | 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] | 19996 | { |
| 19997 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19998 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 19999 | goto nla_put_failure; |
| 20000 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 20001 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 20002 | { |
| 20003 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20004 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 20005 | goto nla_put_failure; |
| 20006 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 20007 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 20008 | sizeof(tSirLPHBInd), lphbInd)) |
| 20009 | { |
| 20010 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20011 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 20012 | goto nla_put_failure; |
| 20013 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 20014 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 20015 | return; |
| 20016 | |
| 20017 | nla_put_failure: |
| 20018 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20019 | "NLA Put fail"); |
| 20020 | kfree_skb(skb); |
| 20021 | |
| 20022 | return; |
| 20023 | } |
| 20024 | #endif /* FEATURE_WLAN_LPHB */ |
| 20025 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 20026 | 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] | 20027 | { |
| 20028 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 20029 | int err = 0; |
| 20030 | #ifdef FEATURE_WLAN_LPHB |
| 20031 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 20032 | eHalStatus smeStatus; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 20033 | |
| 20034 | ENTER(); |
| 20035 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 20036 | err = wlan_hdd_validate_context(pHddCtx); |
| 20037 | if (0 != err) |
| 20038 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 20039 | return err; |
| 20040 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 20041 | #endif /* FEATURE_WLAN_LPHB */ |
| 20042 | |
| 20043 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 20044 | if (err) |
| 20045 | { |
| 20046 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20047 | "%s Testmode INV ATTR", __func__); |
| 20048 | return err; |
| 20049 | } |
| 20050 | |
| 20051 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 20052 | { |
| 20053 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20054 | "%s Testmode INV CMD", __func__); |
| 20055 | return -EINVAL; |
| 20056 | } |
| 20057 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 20058 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 20059 | TRACE_CODE_HDD_CFG80211_TESTMODE, |
| 20060 | NO_SESSION, nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD]))); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 20061 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 20062 | { |
| 20063 | #ifdef FEATURE_WLAN_LPHB |
| 20064 | /* Low Power Heartbeat configuration request */ |
| 20065 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 20066 | { |
| 20067 | int buf_len; |
| 20068 | void *buf; |
| 20069 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 20070 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 20071 | |
| 20072 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 20073 | { |
| 20074 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20075 | "%s Testmode INV DATA", __func__); |
| 20076 | return -EINVAL; |
| 20077 | } |
| 20078 | |
| 20079 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 20080 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 20081 | |
Manjeet Singh | 3c57744 | 2017-02-10 19:03:38 +0530 | [diff] [blame] | 20082 | if (buf_len > sizeof(*hb_params)) { |
| 20083 | hddLog(LOGE, FL("buf_len=%d exceeded hb_params size limit"), |
| 20084 | buf_len); |
| 20085 | return -ERANGE; |
| 20086 | } |
| 20087 | |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 20088 | hb_params_temp =(tSirLPHBReq *)buf; |
| 20089 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 20090 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 20091 | return -EINVAL; |
| 20092 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 20093 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 20094 | if (NULL == hb_params) |
| 20095 | { |
| 20096 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20097 | "%s Request Buffer Alloc Fail", __func__); |
| 20098 | return -EINVAL; |
| 20099 | } |
| 20100 | |
| 20101 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 20102 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 20103 | hb_params, |
| 20104 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 20105 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 20106 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 20107 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20108 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 20109 | vos_mem_free(hb_params); |
| 20110 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 20111 | return 0; |
| 20112 | } |
| 20113 | #endif /* FEATURE_WLAN_LPHB */ |
| 20114 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 20115 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20116 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 20117 | return -EOPNOTSUPP; |
| 20118 | } |
| 20119 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 20120 | EXIT(); |
| 20121 | return err; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 20122 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 20123 | |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 20124 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, |
| 20125 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) |
| 20126 | struct wireless_dev *wdev, |
| 20127 | #endif |
| 20128 | void *data, int len) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 20129 | { |
| 20130 | int ret; |
| 20131 | |
| 20132 | vos_ssr_protect(__func__); |
| 20133 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 20134 | vos_ssr_unprotect(__func__); |
| 20135 | |
| 20136 | return ret; |
| 20137 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 20138 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 20139 | |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 20140 | extern void hdd_set_wlan_suspend_mode(bool suspend); |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 20141 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 20142 | struct net_device *dev, |
| 20143 | int idx, struct survey_info *survey) |
| 20144 | { |
| 20145 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 20146 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 20147 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 20148 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 20149 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 20150 | v_S7_t snr,rssi; |
| 20151 | int status, i, j, filled = 0; |
| 20152 | |
| 20153 | ENTER(); |
| 20154 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 20155 | if (NULL == pAdapter) |
| 20156 | { |
| 20157 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 20158 | "%s: HDD adapter is Null", __func__); |
| 20159 | return -ENODEV; |
| 20160 | } |
| 20161 | |
| 20162 | if (NULL == wiphy) |
| 20163 | { |
| 20164 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 20165 | "%s: wiphy is Null", __func__); |
| 20166 | return -ENODEV; |
| 20167 | } |
| 20168 | |
| 20169 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 20170 | status = wlan_hdd_validate_context(pHddCtx); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 20171 | if (0 != status) |
| 20172 | { |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 20173 | return status; |
| 20174 | } |
| 20175 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 20176 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 20177 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 20178 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 20179 | 0 != pAdapter->survey_idx || |
| 20180 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 20181 | { |
| 20182 | /* The survey dump ops when implemented completely is expected to |
| 20183 | * return a survey of all channels and the ops is called by the |
| 20184 | * kernel with incremental values of the argument 'idx' till it |
| 20185 | * returns -ENONET. But we can only support the survey for the |
| 20186 | * operating channel for now. survey_idx is used to track |
| 20187 | * that the ops is called only once and then return -ENONET for |
| 20188 | * the next iteration |
| 20189 | */ |
| 20190 | pAdapter->survey_idx = 0; |
| 20191 | return -ENONET; |
| 20192 | } |
| 20193 | |
Mukul Sharma | 9d5233b | 2015-06-11 20:28:20 +0530 | [diff] [blame] | 20194 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 20195 | { |
| 20196 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20197 | "%s: Roaming in progress, hence return ", __func__); |
| 20198 | return -ENONET; |
| 20199 | } |
| 20200 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 20201 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 20202 | |
| 20203 | wlan_hdd_get_snr(pAdapter, &snr); |
| 20204 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 20205 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 20206 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 20207 | TRACE_CODE_HDD_CFG80211_DUMP_SURVEY, |
| 20208 | pAdapter->sessionId, pAdapter->device_mode)); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 20209 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 20210 | hdd_wlan_get_freq(channel, &freq); |
| 20211 | |
| 20212 | |
| 20213 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 20214 | { |
| 20215 | if (NULL == wiphy->bands[i]) |
| 20216 | { |
| 20217 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 20218 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 20219 | continue; |
| 20220 | } |
| 20221 | |
| 20222 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 20223 | { |
| 20224 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 20225 | |
| 20226 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 20227 | { |
| 20228 | survey->channel = &band->channels[j]; |
| 20229 | /* The Rx BDs contain SNR values in dB for the received frames |
| 20230 | * while the supplicant expects noise. So we calculate and |
| 20231 | * return the value of noise (dBm) |
| 20232 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 20233 | */ |
| 20234 | survey->noise = rssi - snr; |
| 20235 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 20236 | filled = 1; |
| 20237 | } |
| 20238 | } |
| 20239 | } |
| 20240 | |
| 20241 | if (filled) |
| 20242 | pAdapter->survey_idx = 1; |
| 20243 | else |
| 20244 | { |
| 20245 | pAdapter->survey_idx = 0; |
| 20246 | return -ENONET; |
| 20247 | } |
| 20248 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 20249 | EXIT(); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 20250 | return 0; |
| 20251 | } |
| 20252 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 20253 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 20254 | struct net_device *dev, |
| 20255 | int idx, struct survey_info *survey) |
| 20256 | { |
| 20257 | int ret; |
| 20258 | |
| 20259 | vos_ssr_protect(__func__); |
| 20260 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 20261 | vos_ssr_unprotect(__func__); |
| 20262 | |
| 20263 | return ret; |
| 20264 | } |
| 20265 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20266 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 20267 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20268 | * this is called when cfg80211 driver resume |
| 20269 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 20270 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 20271 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20272 | { |
| 20273 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 20274 | hdd_adapter_t *pAdapter; |
| 20275 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 20276 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 20277 | |
| 20278 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 20279 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 20280 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20281 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20282 | return 0; |
| 20283 | } |
| 20284 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 20285 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_CFG80211_RESUME_WLAN, |
| 20286 | NO_SESSION, pHddCtx->isWiphySuspended)); |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 20287 | |
Nishank Aggarwal | c11826c | 2016-12-15 18:54:10 +0530 | [diff] [blame] | 20288 | if (pHddCtx->is_ap_mode_wow_supported) |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 20289 | { |
| 20290 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20291 | "%s: Resume SoftAP", __func__); |
| 20292 | hdd_set_wlan_suspend_mode(false); |
| 20293 | } |
| 20294 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20295 | spin_lock(&pHddCtx->schedScan_lock); |
| 20296 | pHddCtx->isWiphySuspended = FALSE; |
| 20297 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 20298 | { |
| 20299 | spin_unlock(&pHddCtx->schedScan_lock); |
| 20300 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20301 | "%s: Return resume is not due to PNO indication", __func__); |
| 20302 | return 0; |
| 20303 | } |
| 20304 | // Reset flag to avoid updatating cfg80211 data old results again |
| 20305 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 20306 | spin_unlock(&pHddCtx->schedScan_lock); |
| 20307 | |
| 20308 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 20309 | |
| 20310 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 20311 | { |
| 20312 | pAdapter = pAdapterNode->pAdapter; |
| 20313 | if ( (NULL != pAdapter) && |
| 20314 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 20315 | { |
| 20316 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 20317 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20318 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 20319 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 20320 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20321 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 20322 | { |
| 20323 | /* Acquire wakelock to handle the case where APP's tries to |
| 20324 | * suspend immediately after updating the scan results. Whis |
| 20325 | * results in app's is in suspended state and not able to |
| 20326 | * process the connect request to AP |
| 20327 | */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 20328 | hdd_prevent_suspend_timeout(2000, |
| 20329 | WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20330 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 20331 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20332 | |
| 20333 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20334 | "%s : cfg80211 scan result database updated", __func__); |
| 20335 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 20336 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20337 | return 0; |
| 20338 | |
| 20339 | } |
| 20340 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 20341 | pAdapterNode = pNext; |
| 20342 | } |
| 20343 | |
| 20344 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20345 | "%s: Failed to find Adapter", __func__); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 20346 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20347 | return 0; |
| 20348 | } |
| 20349 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 20350 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 20351 | { |
| 20352 | int ret; |
| 20353 | |
| 20354 | vos_ssr_protect(__func__); |
| 20355 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 20356 | vos_ssr_unprotect(__func__); |
| 20357 | |
| 20358 | return ret; |
| 20359 | } |
| 20360 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20361 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 20362 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20363 | * this is called when cfg80211 driver suspends |
| 20364 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 20365 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20366 | struct cfg80211_wowlan *wow) |
| 20367 | { |
| 20368 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 20369 | int ret = 0; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20370 | |
| 20371 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 20372 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 20373 | ret = wlan_hdd_validate_context(pHddCtx); |
| 20374 | if (0 != ret) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20375 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 20376 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20377 | } |
| 20378 | |
Nishank Aggarwal | c11826c | 2016-12-15 18:54:10 +0530 | [diff] [blame] | 20379 | if (pHddCtx->is_ap_mode_wow_supported) { |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 20380 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20381 | "%s: Suspend SoftAP", __func__); |
| 20382 | hdd_set_wlan_suspend_mode(true); |
| 20383 | } |
| 20384 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 20385 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 20386 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 20387 | TRACE_CODE_HDD_CFG80211_SUSPEND_WLAN, |
| 20388 | NO_SESSION, pHddCtx->isWiphySuspended)); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20389 | pHddCtx->isWiphySuspended = TRUE; |
| 20390 | |
| 20391 | EXIT(); |
| 20392 | |
| 20393 | return 0; |
| 20394 | } |
| 20395 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 20396 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 20397 | struct cfg80211_wowlan *wow) |
| 20398 | { |
| 20399 | int ret; |
| 20400 | |
| 20401 | vos_ssr_protect(__func__); |
| 20402 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 20403 | vos_ssr_unprotect(__func__); |
| 20404 | |
| 20405 | return ret; |
| 20406 | } |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 20407 | |
| 20408 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 20409 | static void wlan_hdd_cfg80211_oem_data_rsp_ind_new(void *ctx, |
Padma, Santhosh Kumar | f75c37b | 2016-01-25 10:36:08 +0530 | [diff] [blame] | 20410 | void *pMsg, tANI_U32 evLen) |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 20411 | { |
| 20412 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 20413 | |
| 20414 | ENTER(); |
| 20415 | |
| 20416 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 20417 | return; |
| 20418 | } |
| 20419 | if (!pMsg) |
| 20420 | { |
| 20421 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 20422 | return; |
| 20423 | } |
| 20424 | |
Padma, Santhosh Kumar | f75c37b | 2016-01-25 10:36:08 +0530 | [diff] [blame] | 20425 | send_oem_data_rsp_msg(evLen, pMsg); |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 20426 | |
| 20427 | EXIT(); |
| 20428 | return; |
| 20429 | |
| 20430 | } |
| 20431 | |
| 20432 | void wlan_hdd_cfg80211_oemdata_callback(void *ctx, const tANI_U16 evType, |
Padma, Santhosh Kumar | f75c37b | 2016-01-25 10:36:08 +0530 | [diff] [blame] | 20433 | void *pMsg, tANI_U32 evLen) |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 20434 | { |
| 20435 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 20436 | |
| 20437 | ENTER(); |
| 20438 | |
| 20439 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 20440 | return; |
| 20441 | } |
| 20442 | |
Padma, Santhosh Kumar | f75c37b | 2016-01-25 10:36:08 +0530 | [diff] [blame] | 20443 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d) evLen %d"), evType, evLen); |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 20444 | |
| 20445 | switch(evType) { |
| 20446 | case SIR_HAL_START_OEM_DATA_RSP_IND_NEW: |
Padma, Santhosh Kumar | f75c37b | 2016-01-25 10:36:08 +0530 | [diff] [blame] | 20447 | wlan_hdd_cfg80211_oem_data_rsp_ind_new(ctx, pMsg, evLen); |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 20448 | break; |
| 20449 | default: |
| 20450 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 20451 | break; |
| 20452 | } |
| 20453 | EXIT(); |
| 20454 | } |
| 20455 | #endif |
| 20456 | |
Kanchanapally, Vidyullatha | 740d64e | 2016-05-03 15:25:54 +0530 | [diff] [blame] | 20457 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)) || \ |
| 20458 | defined(CFG80211_ABORT_SCAN) |
Kanchanapally, Vidyullatha | c473516 | 2016-02-09 17:49:39 +0530 | [diff] [blame] | 20459 | /** |
| 20460 | * __wlan_hdd_cfg80211_abort_scan() - cfg80211 abort scan api |
| 20461 | * @wiphy: Pointer to wiphy |
| 20462 | * @wdev: Pointer to wireless device structure |
| 20463 | * |
| 20464 | * This function is used to abort an ongoing scan |
| 20465 | * |
| 20466 | * Return: None |
| 20467 | */ |
| 20468 | static void __wlan_hdd_cfg80211_abort_scan(struct wiphy *wiphy, |
| 20469 | struct wireless_dev *wdev) |
| 20470 | { |
| 20471 | struct net_device *dev = wdev->netdev; |
| 20472 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 20473 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 20474 | int ret; |
| 20475 | |
| 20476 | ENTER(); |
| 20477 | |
| 20478 | if (NULL == adapter) { |
| 20479 | hddLog(VOS_TRACE_LEVEL_FATAL, FL("HDD adapter is NULL")); |
| 20480 | return; |
| 20481 | } |
| 20482 | |
| 20483 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 20484 | if (0 != ret) |
| 20485 | return; |
| 20486 | |
| 20487 | wlan_hdd_scan_abort(adapter); |
| 20488 | |
| 20489 | return; |
| 20490 | } |
| 20491 | |
| 20492 | /** |
| 20493 | * wlan_hdd_cfg80211_abort_scan - cfg80211 abort scan api |
| 20494 | * @wiphy: Pointer to wiphy |
| 20495 | * @wdev: Pointer to wireless device structure |
| 20496 | * |
| 20497 | * Return: None |
| 20498 | */ |
| 20499 | void wlan_hdd_cfg80211_abort_scan(struct wiphy *wiphy, |
| 20500 | struct wireless_dev *wdev) |
| 20501 | { |
| 20502 | vos_ssr_protect(__func__); |
| 20503 | __wlan_hdd_cfg80211_abort_scan(wiphy, wdev); |
| 20504 | vos_ssr_unprotect(__func__); |
| 20505 | |
| 20506 | return; |
| 20507 | } |
Kanchanapally, Vidyullatha | 740d64e | 2016-05-03 15:25:54 +0530 | [diff] [blame] | 20508 | #endif |
Kanchanapally, Vidyullatha | c473516 | 2016-02-09 17:49:39 +0530 | [diff] [blame] | 20509 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 20510 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 20511 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 20512 | { |
| 20513 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 20514 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 20515 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 20516 | .change_station = wlan_hdd_change_station, |
| 20517 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 20518 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 20519 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 20520 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 20521 | #else |
| 20522 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 20523 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 20524 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 20525 | #endif |
| 20526 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 20527 | .add_key = wlan_hdd_cfg80211_add_key, |
| 20528 | .get_key = wlan_hdd_cfg80211_get_key, |
| 20529 | .del_key = wlan_hdd_cfg80211_del_key, |
| 20530 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 20531 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 20532 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 20533 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 20534 | .scan = wlan_hdd_cfg80211_scan, |
| 20535 | .connect = wlan_hdd_cfg80211_connect, |
| 20536 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 20537 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 20538 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 20539 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 20540 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 20541 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 20542 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 20543 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 20544 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 20545 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 20546 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 20547 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 20548 | .set_txq_params = wlan_hdd_set_txq_params, |
| 20549 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 20550 | .get_station = wlan_hdd_cfg80211_get_station, |
| 20551 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 20552 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 20553 | .add_station = wlan_hdd_cfg80211_add_station, |
| 20554 | #ifdef FEATURE_WLAN_LFR |
| 20555 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 20556 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 20557 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 20558 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 20559 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 20560 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 20561 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20562 | #ifdef FEATURE_WLAN_TDLS |
| 20563 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 20564 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 20565 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 20566 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 20567 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 20568 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 20569 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 20570 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 20571 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 20572 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 20573 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 20574 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 20575 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 20576 | #ifdef WLAN_NL80211_TESTMODE |
| 20577 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 20578 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 20579 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Kanchanapally, Vidyullatha | 740d64e | 2016-05-03 15:25:54 +0530 | [diff] [blame] | 20580 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)) || \ |
| 20581 | defined(CFG80211_ABORT_SCAN) |
Kanchanapally, Vidyullatha | c473516 | 2016-02-09 17:49:39 +0530 | [diff] [blame] | 20582 | .abort_scan = wlan_hdd_cfg80211_abort_scan, |
Kanchanapally, Vidyullatha | 740d64e | 2016-05-03 15:25:54 +0530 | [diff] [blame] | 20583 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 20584 | }; |
| 20585 | |