Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Hanumanth Reddy Pothula | 14bc86d | 2018-01-02 20:02:02 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2018 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> |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 66 | #include <linux/etherdevice.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 67 | #include <wlan_hdd_includes.h> |
| 68 | #include <net/arp.h> |
| 69 | #include <net/cfg80211.h> |
| 70 | #include <linux/wireless.h> |
| 71 | #include <wlan_hdd_wowl.h> |
| 72 | #include <aniGlobal.h> |
| 73 | #include "ccmApi.h" |
| 74 | #include "sirParams.h" |
| 75 | #include "dot11f.h" |
| 76 | #include "wlan_hdd_assoc.h" |
| 77 | #include "wlan_hdd_wext.h" |
| 78 | #include "sme_Api.h" |
| 79 | #include "wlan_hdd_p2p.h" |
| 80 | #include "wlan_hdd_cfg80211.h" |
| 81 | #include "wlan_hdd_hostapd.h" |
| 82 | #include "sapInternal.h" |
| 83 | #include "wlan_hdd_softap_tx_rx.h" |
| 84 | #include "wlan_hdd_main.h" |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 85 | #include "wlan_hdd_assoc.h" |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 86 | #include "wlan_hdd_power.h" |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 87 | #include "wlan_hdd_trace.h" |
| 88 | #include "vos_types.h" |
| 89 | #include "vos_trace.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 90 | #ifdef WLAN_BTAMP_FEATURE |
| 91 | #include "bap_hdd_misc.h" |
| 92 | #endif |
| 93 | #include <qc_sap_ioctl.h> |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 94 | #include "wlan_hdd_tdls.h" |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 95 | #include "wlan_hdd_wmm.h" |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 96 | #include "wlan_qct_wda.h" |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 97 | #include "wlan_nv.h" |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 98 | #include "wlan_hdd_dev_pwr.h" |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 99 | #include "qwlan_version.h" |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 100 | #include "wlan_logging_sock_svc.h" |
Agrawal Ashish | cfe8328 | 2016-09-29 13:03:45 +0530 | [diff] [blame] | 101 | #include "wlan_hdd_misc.h" |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 102 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 103 | |
| 104 | #define g_mode_rates_size (12) |
| 105 | #define a_mode_rates_size (8) |
| 106 | #define FREQ_BASE_80211G (2407) |
| 107 | #define FREQ_BAND_DIFF_80211G (5) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 108 | #define MAX_SCAN_SSID 9 |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 109 | #define MAX_PENDING_LOG 5 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 110 | #define GET_IE_LEN_IN_BSS_DESC(lenInBss) ( lenInBss + sizeof(lenInBss) - \ |
krunal soni | 2a6a906 | 2014-02-11 14:14:23 -0800 | [diff] [blame] | 111 | ((uintptr_t)OFFSET_OF( tSirBssDescription, ieFields))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 112 | |
| 113 | #define HDD2GHZCHAN(freq, chan, flag) { \ |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 114 | .band = HDD_NL80211_BAND_2GHZ, \ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 115 | .center_freq = (freq), \ |
| 116 | .hw_value = (chan),\ |
| 117 | .flags = (flag), \ |
| 118 | .max_antenna_gain = 0 ,\ |
| 119 | .max_power = 30, \ |
| 120 | } |
| 121 | |
| 122 | #define HDD5GHZCHAN(freq, chan, flag) { \ |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 123 | .band = HDD_NL80211_BAND_5GHZ, \ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 124 | .center_freq = (freq), \ |
| 125 | .hw_value = (chan),\ |
| 126 | .flags = (flag), \ |
| 127 | .max_antenna_gain = 0 ,\ |
| 128 | .max_power = 30, \ |
| 129 | } |
| 130 | |
| 131 | #define HDD_G_MODE_RATETAB(rate, rate_id, flag)\ |
| 132 | {\ |
| 133 | .bitrate = rate, \ |
| 134 | .hw_value = rate_id, \ |
| 135 | .flags = flag, \ |
| 136 | } |
| 137 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 138 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 139 | #define WLAN_AKM_SUITE_FT_8021X 0x000FAC03 |
| 140 | #define WLAN_AKM_SUITE_FT_PSK 0x000FAC04 |
| 141 | #endif |
| 142 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 143 | #define HDD_CHANNEL_14 14 |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 144 | #define WLAN_HDD_MAX_FEATURE_SET 8 |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 145 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 146 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 147 | /* |
| 148 | * Used to allocate the size of 4096 for the link layer stats. |
| 149 | * The size of 4096 is considered assuming that all data per |
| 150 | * respective event fit with in the limit.Please take a call |
| 151 | * on the limit based on the data requirements on link layer |
| 152 | * statistics. |
| 153 | */ |
| 154 | #define LL_STATS_EVENT_BUF_SIZE 4096 |
| 155 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 156 | #ifdef WLAN_FEATURE_EXTSCAN |
| 157 | /* |
| 158 | * Used to allocate the size of 4096 for the EXTScan NL data. |
| 159 | * The size of 4096 is considered assuming that all data per |
| 160 | * respective event fit with in the limit.Please take a call |
| 161 | * on the limit based on the data requirements. |
| 162 | */ |
| 163 | |
| 164 | #define EXTSCAN_EVENT_BUF_SIZE 4096 |
| 165 | #define EXTSCAN_MAX_CACHED_RESULTS_PER_IND 32 |
| 166 | #endif |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 167 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 168 | /*EXT TDLS*/ |
| 169 | /* |
| 170 | * Used to allocate the size of 4096 for the TDLS. |
| 171 | * The size of 4096 is considered assuming that all data per |
| 172 | * respective event fit with in the limit.Please take a call |
| 173 | * on the limit based on the data requirements on link layer |
| 174 | * statistics. |
| 175 | */ |
| 176 | #define EXTTDLS_EVENT_BUF_SIZE 4096 |
| 177 | |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 178 | /* |
| 179 | * Values for Mac spoofing feature |
| 180 | * |
| 181 | */ |
| 182 | #define MAC_ADDR_SPOOFING_FW_HOST_DISABLE 0 |
| 183 | #define MAC_ADDR_SPOOFING_FW_HOST_ENABLE 1 |
| 184 | #define MAC_ADDR_SPOOFING_FW_ENABLE_HOST_DISABLE 2 |
Padma, Santhosh Kumar | db2d75b | 2015-11-17 12:18:10 +0530 | [diff] [blame] | 185 | #define MAC_ADDR_SPOOFING_DEFER_INTERVAL 10 //in ms |
| 186 | |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 187 | /* |
| 188 | * max_sched_scan_plans defined to 10 |
| 189 | */ |
| 190 | #define MAX_SCHED_SCAN_PLANS 10 |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 191 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 192 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 193 | { |
| 194 | WLAN_CIPHER_SUITE_WEP40, |
| 195 | WLAN_CIPHER_SUITE_WEP104, |
| 196 | WLAN_CIPHER_SUITE_TKIP, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 197 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 198 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 199 | WLAN_CIPHER_SUITE_KRK, |
| 200 | WLAN_CIPHER_SUITE_CCMP, |
| 201 | #else |
| 202 | WLAN_CIPHER_SUITE_CCMP, |
| 203 | #endif |
| 204 | #ifdef FEATURE_WLAN_WAPI |
| 205 | WLAN_CIPHER_SUITE_SMS4, |
| 206 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 207 | #ifdef WLAN_FEATURE_11W |
| 208 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 209 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 210 | }; |
| 211 | |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 212 | const static struct ieee80211_channel hdd_channels_2_4_GHZ[] = |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 213 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 214 | HDD2GHZCHAN(2412, 1, 0) , |
| 215 | HDD2GHZCHAN(2417, 2, 0) , |
| 216 | HDD2GHZCHAN(2422, 3, 0) , |
| 217 | HDD2GHZCHAN(2427, 4, 0) , |
| 218 | HDD2GHZCHAN(2432, 5, 0) , |
| 219 | HDD2GHZCHAN(2437, 6, 0) , |
| 220 | HDD2GHZCHAN(2442, 7, 0) , |
| 221 | HDD2GHZCHAN(2447, 8, 0) , |
| 222 | HDD2GHZCHAN(2452, 9, 0) , |
| 223 | HDD2GHZCHAN(2457, 10, 0) , |
| 224 | HDD2GHZCHAN(2462, 11, 0) , |
| 225 | HDD2GHZCHAN(2467, 12, 0) , |
| 226 | HDD2GHZCHAN(2472, 13, 0) , |
| 227 | HDD2GHZCHAN(2484, 14, 0) , |
| 228 | }; |
| 229 | |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 230 | const static struct ieee80211_channel hdd_channels_5_GHZ[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 231 | { |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 232 | HDD5GHZCHAN(4920, 240, 0) , |
| 233 | HDD5GHZCHAN(4940, 244, 0) , |
| 234 | HDD5GHZCHAN(4960, 248, 0) , |
| 235 | HDD5GHZCHAN(4980, 252, 0) , |
| 236 | HDD5GHZCHAN(5040, 208, 0) , |
| 237 | HDD5GHZCHAN(5060, 212, 0) , |
| 238 | HDD5GHZCHAN(5080, 216, 0) , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 239 | HDD5GHZCHAN(5180, 36, 0) , |
| 240 | HDD5GHZCHAN(5200, 40, 0) , |
| 241 | HDD5GHZCHAN(5220, 44, 0) , |
| 242 | HDD5GHZCHAN(5240, 48, 0) , |
| 243 | HDD5GHZCHAN(5260, 52, 0) , |
| 244 | HDD5GHZCHAN(5280, 56, 0) , |
| 245 | HDD5GHZCHAN(5300, 60, 0) , |
| 246 | HDD5GHZCHAN(5320, 64, 0) , |
| 247 | HDD5GHZCHAN(5500,100, 0) , |
| 248 | HDD5GHZCHAN(5520,104, 0) , |
| 249 | HDD5GHZCHAN(5540,108, 0) , |
| 250 | HDD5GHZCHAN(5560,112, 0) , |
| 251 | HDD5GHZCHAN(5580,116, 0) , |
| 252 | HDD5GHZCHAN(5600,120, 0) , |
| 253 | HDD5GHZCHAN(5620,124, 0) , |
| 254 | HDD5GHZCHAN(5640,128, 0) , |
| 255 | HDD5GHZCHAN(5660,132, 0) , |
| 256 | HDD5GHZCHAN(5680,136, 0) , |
| 257 | HDD5GHZCHAN(5700,140, 0) , |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 258 | #ifdef FEATURE_WLAN_CH144 |
| 259 | HDD5GHZCHAN(5720,144, 0) , |
| 260 | #endif /* FEATURE_WLAN_CH144 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 261 | HDD5GHZCHAN(5745,149, 0) , |
| 262 | HDD5GHZCHAN(5765,153, 0) , |
| 263 | HDD5GHZCHAN(5785,157, 0) , |
| 264 | HDD5GHZCHAN(5805,161, 0) , |
| 265 | HDD5GHZCHAN(5825,165, 0) , |
| 266 | }; |
| 267 | |
| 268 | static struct ieee80211_rate g_mode_rates[] = |
| 269 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 270 | HDD_G_MODE_RATETAB(10, 0x1, 0), |
| 271 | HDD_G_MODE_RATETAB(20, 0x2, 0), |
| 272 | HDD_G_MODE_RATETAB(55, 0x4, 0), |
| 273 | HDD_G_MODE_RATETAB(110, 0x8, 0), |
| 274 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 275 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 276 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 277 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 278 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 279 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 280 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 281 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 282 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 283 | |
| 284 | static struct ieee80211_rate a_mode_rates[] = |
| 285 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 286 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 287 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 288 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 289 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 290 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 291 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 292 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 293 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
| 294 | }; |
| 295 | |
| 296 | static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ = |
| 297 | { |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 298 | .channels = NULL, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 299 | .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ), |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 300 | .band = HDD_NL80211_BAND_2GHZ, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 301 | .bitrates = g_mode_rates, |
| 302 | .n_bitrates = g_mode_rates_size, |
| 303 | .ht_cap.ht_supported = 1, |
| 304 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 305 | | IEEE80211_HT_CAP_GRN_FLD |
| 306 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 307 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 308 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 309 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 310 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 311 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 312 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 313 | }; |
| 314 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 315 | static struct ieee80211_supported_band wlan_hdd_band_5_GHZ = |
| 316 | { |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 317 | .channels = NULL, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 318 | .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ), |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 319 | .band = HDD_NL80211_BAND_5GHZ, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 320 | .bitrates = a_mode_rates, |
| 321 | .n_bitrates = a_mode_rates_size, |
| 322 | .ht_cap.ht_supported = 1, |
| 323 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 324 | | IEEE80211_HT_CAP_GRN_FLD |
| 325 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 326 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT |
| 327 | | IEEE80211_HT_CAP_SGI_40 |
| 328 | | IEEE80211_HT_CAP_SUP_WIDTH_20_40, |
| 329 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 330 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 331 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 332 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 333 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 334 | }; |
| 335 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 336 | /* This structure contain information what kind of frame are expected in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 337 | TX/RX direction for each kind of interface */ |
| 338 | static const struct ieee80211_txrx_stypes |
| 339 | wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = { |
| 340 | [NL80211_IFTYPE_STATION] = { |
| 341 | .tx = 0xffff, |
| 342 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 343 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 344 | }, |
| 345 | [NL80211_IFTYPE_AP] = { |
| 346 | .tx = 0xffff, |
| 347 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 348 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 349 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 350 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 351 | BIT(SIR_MAC_MGMT_AUTH) | |
| 352 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 353 | BIT(SIR_MAC_MGMT_ACTION), |
| 354 | }, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 355 | [NL80211_IFTYPE_ADHOC] = { |
| 356 | .tx = 0xffff, |
| 357 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 358 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 359 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 360 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 361 | BIT(SIR_MAC_MGMT_AUTH) | |
| 362 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 363 | BIT(SIR_MAC_MGMT_ACTION), |
| 364 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 365 | [NL80211_IFTYPE_P2P_CLIENT] = { |
| 366 | .tx = 0xffff, |
| 367 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 368 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 369 | }, |
| 370 | [NL80211_IFTYPE_P2P_GO] = { |
| 371 | /* This is also same as for SoftAP */ |
| 372 | .tx = 0xffff, |
| 373 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 374 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 375 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 376 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 377 | BIT(SIR_MAC_MGMT_AUTH) | |
| 378 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 379 | BIT(SIR_MAC_MGMT_ACTION), |
| 380 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 381 | }; |
| 382 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 383 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 384 | static const struct ieee80211_iface_limit |
| 385 | wlan_hdd_iface_limit[] = { |
| 386 | { |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 387 | /* max = 3 ; Our driver create two interfaces during driver init |
| 388 | * wlan0 and p2p0 interfaces. p2p0 is considered as station |
| 389 | * interface until a group is formed. In JB architecture, once the |
| 390 | * group is formed, interface type of p2p0 is changed to P2P GO or |
| 391 | * Client. |
| 392 | * When supplicant remove the group, it first issue a set interface |
| 393 | * cmd to change the mode back to Station. In JB this works fine as |
| 394 | * we advertize two station type interface during driver init. |
| 395 | * Some vendors create separate interface for P2P GO/Client, |
| 396 | * after group formation(Third one). But while group remove |
| 397 | * supplicant first tries to change the mode(3rd interface) to STATION |
| 398 | * But as we advertized only two sta type interfaces nl80211 was |
| 399 | * returning error for the third one which was leading to failure in |
| 400 | * delete interface. Ideally while removing the group, supplicant |
| 401 | * should not try to change the 3rd interface mode to Station type. |
| 402 | * Till we get a fix in wpa_supplicant, we advertize max STA |
| 403 | * interface type to 3 |
| 404 | */ |
| 405 | .max = 3, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 406 | .types = BIT(NL80211_IFTYPE_STATION), |
| 407 | }, |
| 408 | { |
| 409 | .max = 1, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 410 | .types = BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP), |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 411 | }, |
| 412 | { |
| 413 | .max = 1, |
| 414 | .types = BIT(NL80211_IFTYPE_P2P_GO) | |
| 415 | BIT(NL80211_IFTYPE_P2P_CLIENT), |
| 416 | }, |
| 417 | }; |
| 418 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 419 | /* interface limits for sta + monitor SCC */ |
| 420 | static const struct ieee80211_iface_limit |
| 421 | wlan_hdd_iface_sta_mon_limit[] = { |
| 422 | { |
| 423 | .max = 1, |
| 424 | .types = BIT(NL80211_IFTYPE_STATION), |
| 425 | }, |
| 426 | { |
| 427 | .max = 1, /* Monitor interface */ |
| 428 | .types = BIT(NL80211_IFTYPE_MONITOR), |
| 429 | }, |
| 430 | }; |
| 431 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 432 | /* By default, only single channel concurrency is allowed */ |
| 433 | static struct ieee80211_iface_combination |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 434 | wlan_hdd_iface_combination[] = { |
| 435 | { |
| 436 | .limits = wlan_hdd_iface_limit, |
| 437 | .num_different_channels = 1, |
| 438 | /* |
| 439 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 440 | * and p2p0 interfaces during driver init |
| 441 | * Some vendors create separate interface for P2P operations. |
| 442 | * wlan0: STA interface |
| 443 | * p2p0: P2P Device interface, action frames goes |
| 444 | * through this interface. |
| 445 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 446 | * created for p2p operations(GO/CLIENT interface). |
| 447 | */ |
| 448 | .max_interfaces = WLAN_MAX_INTERFACES, |
| 449 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 450 | .beacon_int_infra_match = false, |
| 451 | }, |
| 452 | { |
| 453 | .limits = wlan_hdd_iface_sta_mon_limit, |
| 454 | .num_different_channels = 1, |
| 455 | .max_interfaces = WLAN_STA_AND_MON_INTERFACES, |
| 456 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_sta_mon_limit), |
| 457 | .beacon_int_infra_match = false, |
| 458 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 459 | }; |
| 460 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 461 | |
Nachiket Kukade | 5b2e733 | 2018-04-06 14:40:22 +0530 | [diff] [blame] | 462 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) || defined(WITH_BACKPORTS) |
| 463 | static const struct wiphy_wowlan_support wowlan_support_cfg80211_init = { |
Nachiket Kukade | 1e1b90e | 2018-05-10 15:26:13 +0530 | [diff] [blame] | 464 | .flags = WIPHY_WOWLAN_ANY | |
| 465 | WIPHY_WOWLAN_MAGIC_PKT, |
Nachiket Kukade | 5b2e733 | 2018-04-06 14:40:22 +0530 | [diff] [blame] | 466 | .n_patterns = WOWL_MAX_PTRNS_ALLOWED, |
| 467 | .pattern_min_len = 1, |
| 468 | .pattern_max_len = WOWL_PTRN_MAX_SIZE, |
| 469 | }; |
| 470 | #endif |
| 471 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 472 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 473 | |
| 474 | /* Data rate 100KBPS based on IE Index */ |
| 475 | struct index_data_rate_type |
| 476 | { |
| 477 | v_U8_t beacon_rate_index; |
| 478 | v_U16_t supported_rate[4]; |
| 479 | }; |
| 480 | |
| 481 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 482 | The IDX field is the rate index |
| 483 | The HI field is the rate when RSSI is strong or being ignored |
| 484 | (in this case we report actual rate) |
| 485 | The MID field is the rate when RSSI is moderate |
| 486 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 487 | The LO field is the rate when RSSI is low |
| 488 | (in this case we don't report rates, actual current rate used) |
| 489 | */ |
| 490 | static const struct |
| 491 | { |
| 492 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 493 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 494 | } supported_data_rate[] = |
| 495 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 496 | /* IDX HI HM LM LO (RSSI-based index */ |
| 497 | {2, { 10, 10, 10, 0}}, |
| 498 | {4, { 20, 20, 10, 0}}, |
| 499 | {11, { 55, 20, 10, 0}}, |
| 500 | {12, { 60, 55, 20, 0}}, |
| 501 | {18, { 90, 55, 20, 0}}, |
| 502 | {22, {110, 55, 20, 0}}, |
| 503 | {24, {120, 90, 60, 0}}, |
| 504 | {36, {180, 120, 60, 0}}, |
| 505 | {44, {220, 180, 60, 0}}, |
| 506 | {48, {240, 180, 90, 0}}, |
| 507 | {66, {330, 180, 90, 0}}, |
| 508 | {72, {360, 240, 90, 0}}, |
| 509 | {96, {480, 240, 120, 0}}, |
| 510 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 511 | }; |
| 512 | |
| 513 | /* MCS Based rate table */ |
| 514 | static struct index_data_rate_type supported_mcs_rate[] = |
| 515 | { |
| 516 | /* MCS L20 L40 S20 S40 */ |
| 517 | {0, {65, 135, 72, 150}}, |
| 518 | {1, {130, 270, 144, 300}}, |
| 519 | {2, {195, 405, 217, 450}}, |
| 520 | {3, {260, 540, 289, 600}}, |
| 521 | {4, {390, 810, 433, 900}}, |
| 522 | {5, {520, 1080, 578, 1200}}, |
| 523 | {6, {585, 1215, 650, 1350}}, |
| 524 | {7, {650, 1350, 722, 1500}} |
| 525 | }; |
| 526 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 527 | #ifdef WLAN_FEATURE_11AC |
| 528 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 529 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 530 | |
| 531 | struct index_vht_data_rate_type |
| 532 | { |
| 533 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 534 | v_U16_t supported_VHT80_rate[2]; |
| 535 | v_U16_t supported_VHT40_rate[2]; |
| 536 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 537 | }; |
| 538 | |
| 539 | typedef enum |
| 540 | { |
| 541 | DATA_RATE_11AC_MAX_MCS_7, |
| 542 | DATA_RATE_11AC_MAX_MCS_8, |
| 543 | DATA_RATE_11AC_MAX_MCS_9, |
| 544 | DATA_RATE_11AC_MAX_MCS_NA |
| 545 | } eDataRate11ACMaxMcs; |
| 546 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 547 | /* SSID broadcast type */ |
| 548 | typedef enum eSSIDBcastType |
| 549 | { |
| 550 | eBCAST_UNKNOWN = 0, |
| 551 | eBCAST_NORMAL = 1, |
| 552 | eBCAST_HIDDEN = 2, |
| 553 | } tSSIDBcastType; |
| 554 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 555 | /* MCS Based VHT rate table */ |
| 556 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 557 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 558 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 559 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 560 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 561 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 562 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 563 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 564 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 565 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 566 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 567 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 568 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 569 | }; |
| 570 | #endif /* WLAN_FEATURE_11AC */ |
| 571 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 572 | /*array index points to MCS and array value points respective rssi*/ |
| 573 | static int rssiMcsTbl[][10] = |
| 574 | { |
| 575 | /*MCS 0 1 2 3 4 5 6 7 8 9*/ |
| 576 | {-82, -79, -77, -74, -70, -66, -65, -64, -59, -57}, //20 |
| 577 | {-79, -76, -74, -71, -67, -63, -62, -61, -56, -54}, //40 |
| 578 | {-76, -73, -71, -68, -64, -60, -59, -58, -53, -51} //80 |
| 579 | }; |
| 580 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 581 | extern struct net_device_ops net_ops_struct; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 582 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 583 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter); |
| 584 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 585 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 586 | #ifdef WLAN_NL80211_TESTMODE |
| 587 | enum wlan_hdd_tm_attr |
| 588 | { |
| 589 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 590 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 591 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 592 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 593 | /* keep last */ |
| 594 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 595 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 596 | }; |
| 597 | |
| 598 | enum wlan_hdd_tm_cmd |
| 599 | { |
| 600 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 601 | }; |
| 602 | |
| 603 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 604 | |
| 605 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 606 | { |
| 607 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 608 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 609 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 610 | }; |
| 611 | #endif /* WLAN_NL80211_TESTMODE */ |
| 612 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 613 | #ifdef FEATURE_WLAN_CH_AVOID |
| 614 | /* |
| 615 | * FUNCTION: wlan_hdd_send_avoid_freq_event |
| 616 | * This is called when wlan driver needs to send vendor specific |
| 617 | * avoid frequency range event to userspace |
| 618 | */ |
| 619 | int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx, |
| 620 | tHddAvoidFreqList *pAvoidFreqList) |
| 621 | { |
| 622 | struct sk_buff *vendor_event; |
| 623 | |
| 624 | ENTER(); |
| 625 | |
| 626 | if (!pHddCtx) |
| 627 | { |
| 628 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 629 | "%s: HDD context is null", __func__); |
| 630 | return -1; |
| 631 | } |
| 632 | |
| 633 | if (!pAvoidFreqList) |
| 634 | { |
| 635 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 636 | "%s: pAvoidFreqList is null", __func__); |
| 637 | return -1; |
| 638 | } |
| 639 | |
| 640 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 641 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 642 | NULL, |
| 643 | #endif |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 644 | sizeof(tHddAvoidFreqList), |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 645 | QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 646 | GFP_KERNEL); |
| 647 | if (!vendor_event) |
| 648 | { |
| 649 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 650 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 651 | return -1; |
| 652 | } |
| 653 | |
| 654 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 655 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 656 | |
| 657 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 658 | |
| 659 | EXIT(); |
| 660 | return 0; |
| 661 | } |
| 662 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 663 | |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 664 | /* |
Anurag Chouhan | f0d0ba1 | 2018-02-09 15:13:43 +0530 | [diff] [blame] | 665 | * define short names for the global vendor params |
| 666 | * used by QCA_NL80211_VENDOR_SUBCMD_HANG |
| 667 | */ |
| 668 | #define HANG_REASON_INDEX QCA_NL80211_VENDOR_SUBCMD_HANG_REASON_INDEX |
| 669 | |
| 670 | /** |
| 671 | * hdd_convert_hang_reason() - Convert cds recovery reason to vendor specific |
| 672 | * hang reason |
| 673 | * @reason: cds recovery reason |
| 674 | * |
| 675 | * Return: Vendor specific reason code |
| 676 | */ |
| 677 | static enum qca_wlan_vendor_hang_reason |
| 678 | hdd_convert_hang_reason(enum vos_hang_reason reason) |
| 679 | { |
| 680 | unsigned int ret_val; |
| 681 | |
| 682 | switch (reason) { |
| 683 | case VOS_GET_MSG_BUFF_FAILURE: |
| 684 | ret_val = QCA_WLAN_HANG_GET_MSG_BUFF_FAILURE; |
| 685 | break; |
| 686 | case VOS_ACTIVE_LIST_TIMEOUT: |
| 687 | ret_val = QCA_WLAN_HANG_ACTIVE_LIST_TIMEOUT; |
| 688 | break; |
| 689 | case VOS_SCAN_REQ_EXPIRED: |
| 690 | ret_val = QCA_WLAN_HANG_SCAN_REQ_EXPIRED; |
| 691 | break; |
| 692 | case VOS_TRANSMISSIONS_TIMEOUT: |
| 693 | ret_val = QCA_WLAN_HANG_TRANSMISSIONS_TIMEOUT; |
| 694 | break; |
| 695 | case VOS_DXE_FAILURE: |
| 696 | ret_val = QCA_WLAN_HANG_DXE_FAILURE; |
| 697 | break; |
| 698 | case VOS_WDI_FAILURE: |
| 699 | ret_val = QCA_WLAN_HANG_WDI_FAILURE; |
| 700 | break; |
| 701 | case VOS_REASON_UNSPECIFIED: |
| 702 | default: |
| 703 | ret_val = QCA_WLAN_HANG_REASON_UNSPECIFIED; |
| 704 | } |
| 705 | return ret_val; |
| 706 | } |
| 707 | |
| 708 | /** |
| 709 | * wlan_hdd_send_hang_reason_event() - Send hang reason to the userspace |
| 710 | * @hdd_ctx: Pointer to hdd context |
| 711 | * @reason: cds recovery reason |
| 712 | * |
| 713 | * Return: 0 on success or failure reason |
| 714 | */ |
| 715 | int wlan_hdd_send_hang_reason_event(hdd_context_t *hdd_ctx, |
| 716 | enum vos_hang_reason reason) |
| 717 | { |
| 718 | struct sk_buff *vendor_event; |
| 719 | enum qca_wlan_vendor_hang_reason hang_reason; |
| 720 | |
| 721 | ENTER(); |
| 722 | |
| 723 | if (!hdd_ctx) { |
| 724 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 725 | "HDD context is null"); |
| 726 | return -EINVAL; |
| 727 | } |
| 728 | |
| 729 | vendor_event = cfg80211_vendor_event_alloc(hdd_ctx->wiphy, |
| 730 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 731 | NULL, |
| 732 | #endif |
| 733 | sizeof(unsigned int), |
| 734 | HANG_REASON_INDEX, |
| 735 | GFP_KERNEL); |
| 736 | if (!vendor_event) { |
| 737 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 738 | "cfg80211_vendor_event_alloc failed"); |
| 739 | return -ENOMEM; |
| 740 | } |
| 741 | |
| 742 | hang_reason = hdd_convert_hang_reason(reason); |
| 743 | |
| 744 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_HANG_REASON, |
| 745 | (unsigned int) hang_reason)) { |
| 746 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 747 | "QCA_WLAN_VENDOR_ATTR_HANG_REASON put fail"); |
| 748 | kfree_skb(vendor_event); |
| 749 | return -EINVAL; |
| 750 | } |
| 751 | |
| 752 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 753 | |
| 754 | EXIT(); |
| 755 | return 0; |
| 756 | } |
| 757 | #undef HANG_REASON_INDEX |
| 758 | |
| 759 | /* |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 760 | * FUNCTION: __wlan_hdd_cfg80211_nan_request |
| 761 | * This is called when wlan driver needs to send vendor specific |
| 762 | * nan request event. |
| 763 | */ |
| 764 | static int __wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 765 | struct wireless_dev *wdev, |
| 766 | const void *data, int data_len) |
| 767 | { |
| 768 | tNanRequestReq nan_req; |
| 769 | VOS_STATUS status; |
| 770 | int ret_val = -1; |
Srinivas Dasari | a3f11c0 | 2015-03-20 13:15:20 +0530 | [diff] [blame] | 771 | struct net_device *dev = wdev->netdev; |
| 772 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 773 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 774 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 775 | |
| 776 | if (0 == data_len) |
| 777 | { |
| 778 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 779 | FL("NAN - Invalid Request, length = 0")); |
| 780 | return ret_val; |
| 781 | } |
| 782 | |
| 783 | if (NULL == data) |
| 784 | { |
| 785 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 786 | FL("NAN - Invalid Request, data is NULL")); |
| 787 | return ret_val; |
| 788 | } |
| 789 | |
| 790 | status = wlan_hdd_validate_context(pHddCtx); |
| 791 | if (0 != status) |
| 792 | { |
| 793 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 794 | FL("HDD context is not valid")); |
| 795 | return -EINVAL; |
| 796 | } |
| 797 | |
| 798 | hddLog(LOG1, FL("Received NAN command")); |
| 799 | vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 800 | (tANI_U8 *)data, data_len); |
| 801 | |
| 802 | /* check the NAN Capability */ |
| 803 | if (TRUE != sme_IsFeatureSupportedByFW(NAN)) |
| 804 | { |
| 805 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 806 | FL("NAN is not supported by Firmware")); |
| 807 | return -EINVAL; |
| 808 | } |
| 809 | |
| 810 | nan_req.request_data_len = data_len; |
| 811 | nan_req.request_data = data; |
| 812 | |
Srinivas Dasari | a3f11c0 | 2015-03-20 13:15:20 +0530 | [diff] [blame] | 813 | status = sme_NanRequest(hHal, &nan_req, pAdapter->sessionId); |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 814 | if (VOS_STATUS_SUCCESS == status) |
| 815 | { |
| 816 | ret_val = 0; |
| 817 | } |
| 818 | return ret_val; |
| 819 | } |
| 820 | |
| 821 | /* |
| 822 | * FUNCTION: wlan_hdd_cfg80211_nan_request |
| 823 | * Wrapper to protect the nan vendor command from ssr |
| 824 | */ |
| 825 | static int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 826 | struct wireless_dev *wdev, |
| 827 | const void *data, int data_len) |
| 828 | { |
| 829 | int ret; |
| 830 | |
| 831 | vos_ssr_protect(__func__); |
| 832 | ret = __wlan_hdd_cfg80211_nan_request(wiphy, wdev, data, data_len); |
| 833 | vos_ssr_unprotect(__func__); |
| 834 | |
| 835 | return ret; |
| 836 | } |
| 837 | |
| 838 | /* |
| 839 | * FUNCTION: wlan_hdd_cfg80211_nan_callback |
| 840 | * This is a callback function and it gets called |
| 841 | * when we need to report nan response event to |
| 842 | * upper layers. |
| 843 | */ |
| 844 | static void wlan_hdd_cfg80211_nan_callback(void* ctx, tSirNanEvent* msg) |
| 845 | { |
| 846 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 847 | struct sk_buff *vendor_event; |
| 848 | int status; |
| 849 | tSirNanEvent *data; |
| 850 | |
| 851 | ENTER(); |
| 852 | if (NULL == msg) |
| 853 | { |
| 854 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 855 | FL(" msg received here is null")); |
| 856 | return; |
| 857 | } |
| 858 | data = msg; |
| 859 | |
| 860 | status = wlan_hdd_validate_context(pHddCtx); |
| 861 | |
| 862 | if (0 != status) |
| 863 | { |
| 864 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 865 | FL("HDD context is not valid")); |
| 866 | return; |
| 867 | } |
| 868 | |
| 869 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 870 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 871 | NULL, |
| 872 | #endif |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 873 | data->event_data_len + |
| 874 | NLMSG_HDRLEN, |
| 875 | QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX, |
| 876 | GFP_KERNEL); |
| 877 | |
| 878 | if (!vendor_event) |
| 879 | { |
| 880 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 881 | FL("cfg80211_vendor_event_alloc failed")); |
| 882 | return; |
| 883 | } |
| 884 | if (nla_put(vendor_event, QCA_WLAN_VENDOR_ATTR_NAN, |
| 885 | data->event_data_len, data->event_data)) |
| 886 | { |
| 887 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 888 | FL("QCA_WLAN_VENDOR_ATTR_NAN put fail")); |
| 889 | kfree_skb(vendor_event); |
| 890 | return; |
| 891 | } |
| 892 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 893 | EXIT(); |
| 894 | } |
| 895 | |
| 896 | /* |
| 897 | * FUNCTION: wlan_hdd_cfg80211_nan_init |
| 898 | * This function is called to register the callback to sme layer |
| 899 | */ |
| 900 | inline void wlan_hdd_cfg80211_nan_init(hdd_context_t *pHddCtx) |
| 901 | { |
| 902 | sme_NanRegisterCallback(pHddCtx->hHal, wlan_hdd_cfg80211_nan_callback); |
| 903 | } |
| 904 | |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 905 | /* |
| 906 | * define short names for the global vendor params |
| 907 | * used by __wlan_hdd_cfg80211_get_station_cmd() |
| 908 | */ |
| 909 | #define STATION_INVALID \ |
| 910 | QCA_WLAN_VENDOR_ATTR_GET_STATION_INVALID |
| 911 | #define STATION_INFO \ |
| 912 | QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO |
| 913 | #define STATION_ASSOC_FAIL_REASON \ |
| 914 | QCA_WLAN_VENDOR_ATTR_GET_STATION_ASSOC_FAIL_REASON |
Hanumanth Reddy Pothula | a35c487 | 2017-12-14 20:47:59 +0530 | [diff] [blame] | 915 | #define STATION_REMOTE \ |
| 916 | QCA_WLAN_VENDOR_ATTR_GET_STATION_REMOTE |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 917 | #define STATION_MAX \ |
| 918 | QCA_WLAN_VENDOR_ATTR_GET_STATION_MAX |
| 919 | |
| 920 | static const struct nla_policy |
| 921 | hdd_get_station_policy[STATION_MAX + 1] = { |
| 922 | [STATION_INFO] = {.type = NLA_FLAG}, |
| 923 | [STATION_ASSOC_FAIL_REASON] = {.type = NLA_FLAG}, |
| 924 | }; |
| 925 | |
| 926 | /** |
| 927 | * hdd_get_station_assoc_fail() - Handle get station assoc fail |
| 928 | * @hdd_ctx: HDD context within host driver |
| 929 | * @wdev: wireless device |
| 930 | * |
| 931 | * Handles QCA_NL80211_VENDOR_SUBCMD_GET_STATION_ASSOC_FAIL. |
| 932 | * Validate cmd attributes and send the station info to upper layers. |
| 933 | * |
| 934 | * Return: Success(0) or reason code for failure |
| 935 | */ |
| 936 | static int hdd_get_station_assoc_fail(hdd_context_t *hdd_ctx, |
| 937 | hdd_adapter_t *adapter) |
| 938 | { |
| 939 | struct sk_buff *skb = NULL; |
| 940 | uint32_t nl_buf_len; |
| 941 | hdd_station_ctx_t *hdd_sta_ctx; |
| 942 | |
| 943 | nl_buf_len = NLMSG_HDRLEN; |
| 944 | nl_buf_len += sizeof(uint32_t); |
| 945 | skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len); |
| 946 | |
| 947 | if (!skb) { |
| 948 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"cfg80211_vendor_cmd_alloc_reply_skb failed"); |
| 949 | return -ENOMEM; |
| 950 | } |
| 951 | |
| 952 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 953 | |
| 954 | if (nla_put_u32(skb, INFO_ASSOC_FAIL_REASON, |
| 955 | hdd_sta_ctx->conn_info.assoc_status_code)) { |
| 956 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 957 | goto fail; |
| 958 | } |
| 959 | return cfg80211_vendor_cmd_reply(skb); |
| 960 | fail: |
| 961 | if (skb) |
| 962 | kfree_skb(skb); |
| 963 | return -EINVAL; |
| 964 | } |
| 965 | |
| 966 | /** |
| 967 | * hdd_map_auth_type() - transform auth type specific to |
| 968 | * vendor command |
| 969 | * @auth_type: csr auth type |
| 970 | * |
| 971 | * Return: Success(0) or reason code for failure |
| 972 | */ |
| 973 | static int hdd_convert_auth_type(uint32_t auth_type) |
| 974 | { |
| 975 | uint32_t ret_val; |
| 976 | |
| 977 | switch (auth_type) { |
| 978 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 979 | ret_val = QCA_WLAN_AUTH_TYPE_OPEN; |
| 980 | break; |
| 981 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 982 | ret_val = QCA_WLAN_AUTH_TYPE_SHARED; |
| 983 | break; |
| 984 | case eCSR_AUTH_TYPE_WPA: |
| 985 | ret_val = QCA_WLAN_AUTH_TYPE_WPA; |
| 986 | break; |
| 987 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 988 | ret_val = QCA_WLAN_AUTH_TYPE_WPA_PSK; |
| 989 | break; |
| 990 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 991 | ret_val = QCA_WLAN_AUTH_TYPE_AUTOSWITCH; |
| 992 | break; |
| 993 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 994 | ret_val = QCA_WLAN_AUTH_TYPE_WPA_NONE; |
| 995 | break; |
| 996 | case eCSR_AUTH_TYPE_RSN: |
| 997 | ret_val = QCA_WLAN_AUTH_TYPE_RSN; |
| 998 | break; |
| 999 | case eCSR_AUTH_TYPE_RSN_PSK: |
| 1000 | ret_val = QCA_WLAN_AUTH_TYPE_RSN_PSK; |
| 1001 | break; |
| 1002 | case eCSR_AUTH_TYPE_FT_RSN: |
| 1003 | ret_val = QCA_WLAN_AUTH_TYPE_FT; |
| 1004 | break; |
| 1005 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
| 1006 | ret_val = QCA_WLAN_AUTH_TYPE_FT_PSK; |
| 1007 | break; |
| 1008 | case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE: |
| 1009 | ret_val = QCA_WLAN_AUTH_TYPE_WAI; |
| 1010 | break; |
| 1011 | case eCSR_AUTH_TYPE_WAPI_WAI_PSK: |
| 1012 | ret_val = QCA_WLAN_AUTH_TYPE_WAI_PSK; |
| 1013 | break; |
| 1014 | #ifdef FEATURE_WLAN_ESE |
| 1015 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 1016 | ret_val = QCA_WLAN_AUTH_TYPE_CCKM_WPA; |
| 1017 | break; |
| 1018 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 1019 | ret_val = QCA_WLAN_AUTH_TYPE_CCKM_RSN; |
| 1020 | break; |
| 1021 | #endif |
| 1022 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 1023 | ret_val = QCA_WLAN_AUTH_TYPE_SHA256_PSK; |
| 1024 | break; |
| 1025 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
| 1026 | ret_val = QCA_WLAN_AUTH_TYPE_SHA256; |
| 1027 | break; |
| 1028 | case eCSR_NUM_OF_SUPPORT_AUTH_TYPE: |
| 1029 | case eCSR_AUTH_TYPE_FAILED: |
| 1030 | case eCSR_AUTH_TYPE_NONE: |
| 1031 | default: |
| 1032 | ret_val = QCA_WLAN_AUTH_TYPE_INVALID; |
| 1033 | break; |
| 1034 | } |
| 1035 | return ret_val; |
| 1036 | } |
| 1037 | |
| 1038 | /** |
| 1039 | * hdd_map_dot_11_mode() - transform dot11mode type specific to |
| 1040 | * vendor command |
| 1041 | * @dot11mode: dot11mode |
| 1042 | * |
| 1043 | * Return: Success(0) or reason code for failure |
| 1044 | */ |
| 1045 | static int hdd_convert_dot11mode(uint32_t dot11mode) |
| 1046 | { |
| 1047 | uint32_t ret_val; |
| 1048 | |
| 1049 | switch (dot11mode) { |
| 1050 | case eCSR_CFG_DOT11_MODE_11A: |
| 1051 | ret_val = QCA_WLAN_802_11_MODE_11A; |
| 1052 | break; |
| 1053 | case eCSR_CFG_DOT11_MODE_11B: |
| 1054 | ret_val = QCA_WLAN_802_11_MODE_11B; |
| 1055 | break; |
| 1056 | case eCSR_CFG_DOT11_MODE_11G: |
| 1057 | ret_val = QCA_WLAN_802_11_MODE_11G; |
| 1058 | break; |
| 1059 | case eCSR_CFG_DOT11_MODE_11N: |
| 1060 | ret_val = QCA_WLAN_802_11_MODE_11N; |
| 1061 | break; |
| 1062 | case eCSR_CFG_DOT11_MODE_11AC: |
| 1063 | ret_val = QCA_WLAN_802_11_MODE_11AC; |
| 1064 | break; |
| 1065 | case eCSR_CFG_DOT11_MODE_AUTO: |
| 1066 | case eCSR_CFG_DOT11_MODE_ABG: |
| 1067 | default: |
| 1068 | ret_val = QCA_WLAN_802_11_MODE_INVALID; |
| 1069 | } |
| 1070 | return ret_val; |
| 1071 | } |
| 1072 | |
| 1073 | /** |
| 1074 | * hdd_add_tx_bitrate() - add tx bitrate attribute |
| 1075 | * @skb: pointer to sk buff |
| 1076 | * @hdd_sta_ctx: pointer to hdd station context |
| 1077 | * @idx: attribute index |
| 1078 | * |
| 1079 | * Return: Success(0) or reason code for failure |
| 1080 | */ |
| 1081 | static int32_t hdd_add_tx_bitrate(struct sk_buff *skb, |
| 1082 | hdd_station_ctx_t *hdd_sta_ctx, |
| 1083 | int idx) |
| 1084 | { |
| 1085 | struct nlattr *nla_attr; |
| 1086 | uint32_t bitrate, bitrate_compat; |
| 1087 | |
| 1088 | nla_attr = nla_nest_start(skb, idx); |
| 1089 | if (!nla_attr) |
| 1090 | goto fail; |
| 1091 | /* cfg80211_calculate_bitrate will return 0 for mcs >= 32 */ |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1092 | bitrate = cfg80211_calculate_bitrate( |
| 1093 | &hdd_sta_ctx->cache_conn_info.txrate); |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1094 | |
| 1095 | /* report 16-bit bitrate only if we can */ |
| 1096 | bitrate_compat = bitrate < (1UL << 16) ? bitrate : 0; |
| 1097 | if (bitrate > 0 && |
| 1098 | nla_put_u32(skb, NL80211_RATE_INFO_BITRATE32, bitrate)) { |
| 1099 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 1100 | goto fail; |
| 1101 | } |
| 1102 | if (bitrate_compat > 0 && |
| 1103 | nla_put_u16(skb, NL80211_RATE_INFO_BITRATE, bitrate_compat)) { |
| 1104 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 1105 | goto fail; |
| 1106 | } |
| 1107 | if (nla_put_u8(skb, NL80211_RATE_INFO_VHT_NSS, |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1108 | hdd_sta_ctx->cache_conn_info.txrate.nss)) { |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1109 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 1110 | goto fail; |
| 1111 | } |
| 1112 | nla_nest_end(skb, nla_attr); |
| 1113 | return 0; |
| 1114 | fail: |
| 1115 | return -EINVAL; |
| 1116 | } |
| 1117 | |
| 1118 | /** |
| 1119 | * hdd_add_sta_info() - add station info attribute |
| 1120 | * @skb: pointer to sk buff |
| 1121 | * @hdd_sta_ctx: pointer to hdd station context |
| 1122 | * @idx: attribute index |
| 1123 | * |
| 1124 | * Return: Success(0) or reason code for failure |
| 1125 | */ |
| 1126 | static int32_t hdd_add_sta_info(struct sk_buff *skb, |
| 1127 | hdd_station_ctx_t *hdd_sta_ctx, int idx) |
| 1128 | { |
| 1129 | struct nlattr *nla_attr; |
| 1130 | |
| 1131 | nla_attr = nla_nest_start(skb, idx); |
| 1132 | if (!nla_attr) |
| 1133 | goto fail; |
| 1134 | if (nla_put_u8(skb, NL80211_STA_INFO_SIGNAL, |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1135 | (hdd_sta_ctx->cache_conn_info.signal + 100))) { |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1136 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 1137 | goto fail; |
| 1138 | } |
| 1139 | if (hdd_add_tx_bitrate(skb, hdd_sta_ctx, NL80211_STA_INFO_TX_BITRATE)) |
| 1140 | goto fail; |
| 1141 | nla_nest_end(skb, nla_attr); |
| 1142 | return 0; |
| 1143 | fail: |
| 1144 | return -EINVAL; |
| 1145 | } |
| 1146 | |
| 1147 | /** |
| 1148 | * hdd_add_survey_info() - add survey info attribute |
| 1149 | * @skb: pointer to sk buff |
| 1150 | * @hdd_sta_ctx: pointer to hdd station context |
| 1151 | * @idx: attribute index |
| 1152 | * |
| 1153 | * Return: Success(0) or reason code for failure |
| 1154 | */ |
| 1155 | static int32_t hdd_add_survey_info(struct sk_buff *skb, |
| 1156 | hdd_station_ctx_t *hdd_sta_ctx, |
| 1157 | int idx) |
| 1158 | { |
| 1159 | struct nlattr *nla_attr; |
| 1160 | |
| 1161 | nla_attr = nla_nest_start(skb, idx); |
| 1162 | if (!nla_attr) |
| 1163 | goto fail; |
| 1164 | if (nla_put_u32(skb, NL80211_SURVEY_INFO_FREQUENCY, |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1165 | hdd_sta_ctx->cache_conn_info.freq) || |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1166 | nla_put_u8(skb, NL80211_SURVEY_INFO_NOISE, |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1167 | (hdd_sta_ctx->cache_conn_info.noise + 100))) { |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1168 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 1169 | goto fail; |
| 1170 | } |
| 1171 | nla_nest_end(skb, nla_attr); |
| 1172 | return 0; |
| 1173 | fail: |
| 1174 | return -EINVAL; |
| 1175 | } |
| 1176 | |
| 1177 | /** |
| 1178 | * hdd_add_link_standard_info() - add link info attribute |
| 1179 | * @skb: pointer to sk buff |
| 1180 | * @hdd_sta_ctx: pointer to hdd station context |
| 1181 | * @idx: attribute index |
| 1182 | * |
| 1183 | * Return: Success(0) or reason code for failure |
| 1184 | */ |
| 1185 | static int32_t |
| 1186 | hdd_add_link_standard_info(struct sk_buff *skb, |
| 1187 | hdd_station_ctx_t *hdd_sta_ctx, int idx) |
| 1188 | { |
| 1189 | struct nlattr *nla_attr; |
| 1190 | |
| 1191 | nla_attr = nla_nest_start(skb, idx); |
| 1192 | if (!nla_attr) |
| 1193 | goto fail; |
| 1194 | if (nla_put(skb, |
| 1195 | NL80211_ATTR_SSID, |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1196 | hdd_sta_ctx->cache_conn_info.SSID.SSID.length, |
| 1197 | hdd_sta_ctx->cache_conn_info.SSID.SSID.ssId)) { |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1198 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 1199 | goto fail; |
| 1200 | } |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1201 | if (nla_put(skb, NL80211_ATTR_MAC, VOS_MAC_ADDR_SIZE, |
| 1202 | hdd_sta_ctx->cache_conn_info.bssId)) |
| 1203 | goto fail; |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1204 | if (hdd_add_survey_info(skb, hdd_sta_ctx, NL80211_ATTR_SURVEY_INFO)) |
| 1205 | goto fail; |
| 1206 | if (hdd_add_sta_info(skb, hdd_sta_ctx, NL80211_ATTR_STA_INFO)) |
| 1207 | goto fail; |
| 1208 | nla_nest_end(skb, nla_attr); |
| 1209 | return 0; |
| 1210 | fail: |
| 1211 | return -EINVAL; |
| 1212 | } |
| 1213 | |
| 1214 | /** |
| 1215 | * hdd_add_ap_standard_info() - add ap info attribute |
| 1216 | * @skb: pointer to sk buff |
| 1217 | * @hdd_sta_ctx: pointer to hdd station context |
| 1218 | * @idx: attribute index |
| 1219 | * |
| 1220 | * Return: Success(0) or reason code for failure |
| 1221 | */ |
| 1222 | static int32_t |
| 1223 | hdd_add_ap_standard_info(struct sk_buff *skb, |
| 1224 | hdd_station_ctx_t *hdd_sta_ctx, int idx) |
| 1225 | { |
| 1226 | struct nlattr *nla_attr; |
| 1227 | |
| 1228 | nla_attr = nla_nest_start(skb, idx); |
| 1229 | if (!nla_attr) |
| 1230 | goto fail; |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1231 | if (hdd_sta_ctx->cache_conn_info.conn_flag.vht_present) |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1232 | if (nla_put(skb, NL80211_ATTR_VHT_CAPABILITY, |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1233 | sizeof(hdd_sta_ctx->cache_conn_info.vht_caps), |
| 1234 | &hdd_sta_ctx->cache_conn_info.vht_caps)) { |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1235 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 1236 | goto fail; |
| 1237 | } |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1238 | if (hdd_sta_ctx->cache_conn_info.conn_flag.ht_present) |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1239 | if (nla_put(skb, NL80211_ATTR_HT_CAPABILITY, |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1240 | sizeof(hdd_sta_ctx->cache_conn_info.ht_caps), |
| 1241 | &hdd_sta_ctx->cache_conn_info.ht_caps)) { |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1242 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 1243 | goto fail; |
| 1244 | } |
| 1245 | nla_nest_end(skb, nla_attr); |
| 1246 | return 0; |
| 1247 | fail: |
| 1248 | return -EINVAL; |
| 1249 | } |
| 1250 | |
| 1251 | /** |
| 1252 | * hdd_get_station_info() - send BSS information to supplicant |
| 1253 | * @hdd_ctx: pointer to hdd context |
| 1254 | * @adapter: pointer to adapter |
| 1255 | * |
| 1256 | * Return: 0 if success else error status |
| 1257 | */ |
| 1258 | static int hdd_get_station_info(hdd_context_t *hdd_ctx, |
| 1259 | hdd_adapter_t *adapter) |
| 1260 | { |
| 1261 | struct sk_buff *skb = NULL; |
| 1262 | uint8_t *tmp_hs20 = NULL; |
| 1263 | uint32_t nl_buf_len; |
| 1264 | hdd_station_ctx_t *hdd_sta_ctx; |
| 1265 | |
| 1266 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 1267 | |
| 1268 | nl_buf_len = NLMSG_HDRLEN; |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1269 | |
| 1270 | nl_buf_len += sizeof(hdd_sta_ctx->cache_conn_info.SSID.SSID.length) + |
| 1271 | VOS_MAC_ADDR_SIZE + |
| 1272 | sizeof(hdd_sta_ctx->cache_conn_info.freq) + |
| 1273 | sizeof(hdd_sta_ctx->cache_conn_info.noise) + |
| 1274 | sizeof(hdd_sta_ctx->cache_conn_info.signal) + |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1275 | (sizeof(uint32_t) * 2) + |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1276 | sizeof(hdd_sta_ctx->cache_conn_info.txrate.nss) + |
| 1277 | sizeof(hdd_sta_ctx->cache_conn_info.roam_count) + |
| 1278 | sizeof(hdd_sta_ctx->cache_conn_info.authType) + |
| 1279 | sizeof(hdd_sta_ctx->cache_conn_info.dot11Mode); |
| 1280 | if (hdd_sta_ctx->cache_conn_info.conn_flag.vht_present) |
| 1281 | nl_buf_len += sizeof(hdd_sta_ctx->cache_conn_info.vht_caps); |
| 1282 | if (hdd_sta_ctx->cache_conn_info.conn_flag.ht_present) |
| 1283 | nl_buf_len += sizeof(hdd_sta_ctx->cache_conn_info.ht_caps); |
| 1284 | if (hdd_sta_ctx->cache_conn_info.conn_flag.hs20_present) { |
| 1285 | tmp_hs20 = (uint8_t *)&(hdd_sta_ctx-> |
| 1286 | cache_conn_info.hs20vendor_ie); |
| 1287 | nl_buf_len += |
| 1288 | (sizeof(hdd_sta_ctx->cache_conn_info.hs20vendor_ie) - |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1289 | 1); |
| 1290 | } |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1291 | if (hdd_sta_ctx->cache_conn_info.conn_flag.ht_op_present) |
| 1292 | nl_buf_len += sizeof(hdd_sta_ctx->cache_conn_info.ht_operation); |
| 1293 | if (hdd_sta_ctx->cache_conn_info.conn_flag.vht_op_present) |
| 1294 | nl_buf_len += |
| 1295 | sizeof(hdd_sta_ctx->cache_conn_info.vht_operation); |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1296 | |
| 1297 | |
| 1298 | skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len); |
| 1299 | if (!skb) { |
| 1300 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: %d cfg80211_vendor_cmd_alloc_reply_skb failed", |
| 1301 | __func__, __LINE__); |
| 1302 | return -ENOMEM; |
| 1303 | } |
| 1304 | |
| 1305 | if (hdd_add_link_standard_info(skb, hdd_sta_ctx, |
| 1306 | LINK_INFO_STANDARD_NL80211_ATTR)) { |
| 1307 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 1308 | goto fail; |
| 1309 | } |
| 1310 | if (hdd_add_ap_standard_info(skb, hdd_sta_ctx, |
| 1311 | AP_INFO_STANDARD_NL80211_ATTR)) { |
| 1312 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 1313 | goto fail; |
| 1314 | } |
| 1315 | if (nla_put_u32(skb, INFO_ROAM_COUNT, |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1316 | hdd_sta_ctx->cache_conn_info.roam_count) || |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1317 | nla_put_u32(skb, INFO_AKM, |
| 1318 | hdd_convert_auth_type( |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1319 | hdd_sta_ctx->cache_conn_info.authType)) || |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1320 | nla_put_u32(skb, WLAN802_11_MODE, |
| 1321 | hdd_convert_dot11mode( |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1322 | hdd_sta_ctx->cache_conn_info.dot11Mode))) { |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1323 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 1324 | goto fail; |
| 1325 | } |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1326 | if (hdd_sta_ctx->cache_conn_info.conn_flag.ht_op_present) |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1327 | if (nla_put(skb, HT_OPERATION, |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1328 | (sizeof(hdd_sta_ctx->cache_conn_info.ht_operation)), |
| 1329 | &hdd_sta_ctx->cache_conn_info.ht_operation)) { |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1330 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 1331 | goto fail; |
| 1332 | } |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1333 | if (hdd_sta_ctx->cache_conn_info.conn_flag.vht_op_present) |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1334 | if (nla_put(skb, VHT_OPERATION, |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1335 | (sizeof(hdd_sta_ctx-> |
| 1336 | cache_conn_info.vht_operation)), |
| 1337 | &hdd_sta_ctx->cache_conn_info.vht_operation)) { |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1338 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 1339 | goto fail; |
| 1340 | } |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1341 | if (hdd_sta_ctx->cache_conn_info.conn_flag.hs20_present) |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1342 | if (nla_put(skb, AP_INFO_HS20_INDICATION, |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 1343 | (sizeof(hdd_sta_ctx->cache_conn_info.hs20vendor_ie) |
| 1344 | - 1), tmp_hs20 + 1)) { |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1345 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"put fail"); |
| 1346 | goto fail; |
| 1347 | } |
| 1348 | |
| 1349 | return cfg80211_vendor_cmd_reply(skb); |
| 1350 | fail: |
| 1351 | if (skb) |
| 1352 | kfree_skb(skb); |
| 1353 | return -EINVAL; |
| 1354 | } |
| 1355 | |
| 1356 | /** |
Hanumanth Reddy Pothula | a35c487 | 2017-12-14 20:47:59 +0530 | [diff] [blame] | 1357 | * hdd_add_survey_info_sap_get_len - get data length used in |
| 1358 | * hdd_add_survey_info_sap() |
| 1359 | * |
| 1360 | * This function calculates the data length used in hdd_add_survey_info_sap() |
| 1361 | * |
| 1362 | * Return: total data length used in hdd_add_survey_info_sap() |
| 1363 | */ |
| 1364 | static uint32_t hdd_add_survey_info_sap_get_len(void) |
| 1365 | { |
| 1366 | return ((NLA_HDRLEN) + (sizeof(uint32_t) + NLA_HDRLEN)); |
| 1367 | } |
| 1368 | |
| 1369 | /** |
| 1370 | * hdd_add_survey_info - add survey info attribute |
| 1371 | * @skb: pointer to response skb buffer |
| 1372 | * @stainfo: station information |
| 1373 | * @idx: attribute type index for nla_next_start() |
| 1374 | * |
| 1375 | * This function adds survey info attribute to response skb buffer |
| 1376 | * |
| 1377 | * Return : 0 on success and errno on failure |
| 1378 | */ |
| 1379 | static int32_t hdd_add_survey_info_sap(struct sk_buff *skb, |
| 1380 | struct hdd_cache_sta_info *stainfo, |
| 1381 | int idx) |
| 1382 | { |
| 1383 | struct nlattr *nla_attr; |
| 1384 | |
| 1385 | nla_attr = nla_nest_start(skb, idx); |
| 1386 | if (!nla_attr) |
| 1387 | goto fail; |
| 1388 | if (nla_put_u32(skb, NL80211_SURVEY_INFO_FREQUENCY, |
| 1389 | stainfo->freq)) { |
| 1390 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1391 | FL("put fail")); |
| 1392 | goto fail; |
| 1393 | } |
| 1394 | nla_nest_end(skb, nla_attr); |
| 1395 | return 0; |
| 1396 | fail: |
| 1397 | return -EINVAL; |
| 1398 | } |
| 1399 | |
| 1400 | /** |
| 1401 | * hdd_add_tx_bitrate_sap_get_len - get data length used in |
| 1402 | * hdd_add_tx_bitrate_sap() |
| 1403 | * |
| 1404 | * This function calculates the data length used in hdd_add_tx_bitrate_sap() |
| 1405 | * |
| 1406 | * Return: total data length used in hdd_add_tx_bitrate_sap() |
| 1407 | */ |
| 1408 | static uint32_t hdd_add_tx_bitrate_sap_get_len(void) |
| 1409 | { |
| 1410 | return ((NLA_HDRLEN) + (sizeof(uint8_t) + NLA_HDRLEN)); |
| 1411 | } |
| 1412 | |
| 1413 | /** |
| 1414 | * hdd_add_tx_bitrate_sap - add vht nss info attribute |
| 1415 | * @skb: pointer to response skb buffer |
| 1416 | * @stainfo: station information |
| 1417 | * @idx: attribute type index for nla_next_start() |
| 1418 | * |
| 1419 | * This function adds vht nss attribute to response skb buffer |
| 1420 | * |
| 1421 | * Return : 0 on success and errno on failure |
| 1422 | */ |
| 1423 | static int hdd_add_tx_bitrate_sap(struct sk_buff *skb, |
| 1424 | struct hdd_cache_sta_info *stainfo, |
| 1425 | int idx) |
| 1426 | { |
| 1427 | struct nlattr *nla_attr; |
| 1428 | |
| 1429 | nla_attr = nla_nest_start(skb, idx); |
| 1430 | if (!nla_attr) |
| 1431 | goto fail; |
| 1432 | |
| 1433 | if (nla_put_u8(skb, NL80211_RATE_INFO_VHT_NSS, |
| 1434 | stainfo->nss)) { |
| 1435 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1436 | FL("put fail")); |
| 1437 | goto fail; |
| 1438 | } |
| 1439 | nla_nest_end(skb, nla_attr); |
| 1440 | return 0; |
| 1441 | fail: |
| 1442 | return -EINVAL; |
| 1443 | } |
| 1444 | |
| 1445 | /** |
| 1446 | * hdd_add_sta_info_sap_get_len - get data length used in |
| 1447 | * hdd_add_sta_info_sap() |
| 1448 | * |
| 1449 | * This function calculates the data length used in hdd_add_sta_info_sap() |
| 1450 | * |
| 1451 | * Return: total data length used in hdd_add_sta_info_sap() |
| 1452 | */ |
| 1453 | static uint32_t hdd_add_sta_info_sap_get_len(void) |
| 1454 | { |
| 1455 | return ((NLA_HDRLEN) + (sizeof(uint8_t) + NLA_HDRLEN) + |
| 1456 | hdd_add_tx_bitrate_sap_get_len()); |
| 1457 | } |
| 1458 | |
| 1459 | /** |
| 1460 | * hdd_add_sta_info_sap - add sta signal info attribute |
| 1461 | * @skb: pointer to response skb buffer |
| 1462 | * @rssi: peer rssi value |
| 1463 | * @stainfo: station information |
| 1464 | * @idx: attribute type index for nla_next_start() |
| 1465 | * |
| 1466 | * This function adds sta signal attribute to response skb buffer |
| 1467 | * |
| 1468 | * Return : 0 on success and errno on failure |
| 1469 | */ |
| 1470 | static int32_t hdd_add_sta_info_sap(struct sk_buff *skb, int8_t rssi, |
| 1471 | struct hdd_cache_sta_info *stainfo, int idx) |
| 1472 | { |
| 1473 | struct nlattr *nla_attr; |
| 1474 | |
| 1475 | nla_attr = nla_nest_start(skb, idx); |
| 1476 | if (!nla_attr) |
| 1477 | goto fail; |
| 1478 | |
Hanumanth Reddy Pothula | 14bc86d | 2018-01-02 20:02:02 +0530 | [diff] [blame] | 1479 | /* upperlayer expects positive rssi value */ |
| 1480 | if (nla_put_u8(skb, NL80211_STA_INFO_SIGNAL, (rssi + 96))) { |
Hanumanth Reddy Pothula | a35c487 | 2017-12-14 20:47:59 +0530 | [diff] [blame] | 1481 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1482 | FL("put fail")); |
| 1483 | goto fail; |
| 1484 | } |
| 1485 | if (hdd_add_tx_bitrate_sap(skb, stainfo, NL80211_STA_INFO_TX_BITRATE)) { |
| 1486 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1487 | FL("put fail")); |
| 1488 | goto fail; |
| 1489 | } |
| 1490 | |
| 1491 | nla_nest_end(skb, nla_attr); |
| 1492 | return 0; |
| 1493 | fail: |
| 1494 | return -EINVAL; |
| 1495 | } |
| 1496 | |
| 1497 | /** |
| 1498 | * hdd_add_link_standard_info_sap_get_len - get data length used in |
| 1499 | * hdd_add_link_standard_info_sap() |
| 1500 | * |
| 1501 | * This function calculates the data length used in |
| 1502 | * hdd_add_link_standard_info_sap() |
| 1503 | * |
| 1504 | * Return: total data length used in hdd_add_link_standard_info_sap() |
| 1505 | */ |
| 1506 | static uint32_t hdd_add_link_standard_info_sap_get_len(void) |
| 1507 | { |
| 1508 | return ((NLA_HDRLEN) + |
| 1509 | hdd_add_survey_info_sap_get_len() + |
| 1510 | hdd_add_sta_info_sap_get_len() + |
| 1511 | (sizeof(uint32_t) + NLA_HDRLEN)); |
| 1512 | } |
| 1513 | |
| 1514 | /** |
| 1515 | * hdd_add_link_standard_info_sap - add add link info attribut |
| 1516 | * @skb: pointer to response skb buffer |
| 1517 | * @stainfo: station information |
| 1518 | * @idx: attribute type index for nla_next_start() |
| 1519 | * |
| 1520 | * This function adds link info attribut to response skb buffer |
| 1521 | * |
| 1522 | * Return : 0 on success and errno on failure |
| 1523 | */ |
| 1524 | static int hdd_add_link_standard_info_sap(struct sk_buff *skb, int8_t rssi, |
| 1525 | struct hdd_cache_sta_info *stainfo, |
| 1526 | int idx) |
| 1527 | { |
| 1528 | struct nlattr *nla_attr; |
| 1529 | |
| 1530 | nla_attr = nla_nest_start(skb, idx); |
| 1531 | if (!nla_attr) |
| 1532 | goto fail; |
| 1533 | if (hdd_add_survey_info_sap(skb, stainfo, NL80211_ATTR_SURVEY_INFO)) |
| 1534 | goto fail; |
| 1535 | if (hdd_add_sta_info_sap(skb, rssi, stainfo, NL80211_ATTR_STA_INFO)) |
| 1536 | goto fail; |
| 1537 | |
| 1538 | if (nla_put_u32(skb, NL80211_ATTR_REASON_CODE, stainfo->reason_code)) { |
| 1539 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1540 | FL("put fail")); |
| 1541 | goto fail; |
| 1542 | } |
| 1543 | |
| 1544 | nla_nest_end(skb, nla_attr); |
| 1545 | return 0; |
| 1546 | fail: |
| 1547 | return -EINVAL; |
| 1548 | } |
| 1549 | |
| 1550 | /** |
| 1551 | * hdd_add_ap_standard_info_sap_get_len - get data length used in |
| 1552 | * hdd_add_ap_standard_info_sap() |
| 1553 | * @stainfo: station information |
| 1554 | * |
| 1555 | * This function calculates the data length used in |
| 1556 | * hdd_add_ap_standard_info_sap() |
| 1557 | * |
| 1558 | * Return: total data length used in hdd_add_ap_standard_info_sap() |
| 1559 | */ |
| 1560 | static uint32_t hdd_add_ap_standard_info_sap_get_len( |
| 1561 | struct hdd_cache_sta_info *stainfo) |
| 1562 | { |
| 1563 | uint32_t len; |
| 1564 | |
| 1565 | len = NLA_HDRLEN; |
| 1566 | if (stainfo->vht_present) |
| 1567 | len += (sizeof(stainfo->vht_caps) + NLA_HDRLEN); |
| 1568 | if (stainfo->ht_present) |
| 1569 | len += (sizeof(stainfo->ht_caps) + NLA_HDRLEN); |
| 1570 | |
| 1571 | return len; |
| 1572 | } |
| 1573 | |
| 1574 | /** |
| 1575 | * hdd_add_ap_standard_info_sap - add HT and VHT info attributes |
| 1576 | * @skb: pointer to response skb buffer |
| 1577 | * @stainfo: station information |
| 1578 | * @idx: attribute type index for nla_next_start() |
| 1579 | * |
| 1580 | * This function adds HT and VHT info attributes to response skb buffer |
| 1581 | * |
| 1582 | * Return : 0 on success and errno on failure |
| 1583 | */ |
| 1584 | static int hdd_add_ap_standard_info_sap(struct sk_buff *skb, |
| 1585 | struct hdd_cache_sta_info *stainfo, |
| 1586 | int idx) |
| 1587 | { |
| 1588 | struct nlattr *nla_attr; |
| 1589 | |
| 1590 | nla_attr = nla_nest_start(skb, idx); |
| 1591 | if (!nla_attr) |
| 1592 | goto fail; |
| 1593 | |
| 1594 | if (stainfo->vht_present) { |
| 1595 | if (nla_put(skb, NL80211_ATTR_VHT_CAPABILITY, |
| 1596 | sizeof(stainfo->vht_caps), |
| 1597 | &stainfo->vht_caps)) { |
| 1598 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1599 | FL("put fail")); |
| 1600 | goto fail; |
| 1601 | } |
| 1602 | } |
| 1603 | if (stainfo->ht_present) { |
| 1604 | if (nla_put(skb, NL80211_ATTR_HT_CAPABILITY, |
| 1605 | sizeof(stainfo->ht_caps), |
| 1606 | &stainfo->ht_caps)) { |
| 1607 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1608 | FL("put fail")); |
| 1609 | goto fail; |
| 1610 | } |
| 1611 | } |
| 1612 | nla_nest_end(skb, nla_attr); |
| 1613 | return 0; |
| 1614 | fail: |
| 1615 | return -EINVAL; |
| 1616 | } |
| 1617 | |
| 1618 | /** |
| 1619 | * hdd_decode_ch_width - decode channel band width based |
| 1620 | * @ch_width: encoded enum value holding channel band width |
| 1621 | * |
| 1622 | * This function decodes channel band width from the given encoded enum value. |
| 1623 | * |
| 1624 | * Returns: decoded channel band width. |
| 1625 | */ |
| 1626 | static uint8_t hdd_decode_ch_width(tSirMacHTChannelWidth ch_width) |
| 1627 | { |
| 1628 | switch (ch_width) { |
| 1629 | case 0: |
| 1630 | return 20; |
| 1631 | case 1: |
| 1632 | return 40; |
| 1633 | case 2: |
| 1634 | return 80; |
| 1635 | default: |
| 1636 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1637 | "invalid enum: %d", ch_width); |
| 1638 | return 20; |
| 1639 | } |
| 1640 | } |
| 1641 | |
| 1642 | /** |
| 1643 | * hdd_get_cached_station_remote() - get cached(deleted) peer's info |
| 1644 | * @hdd_ctx: hdd context |
| 1645 | * @adapter: hostapd interface |
| 1646 | * @mac_addr: mac address of requested peer |
| 1647 | * |
| 1648 | * This function collect and indicate the cached(deleted) peer's info |
| 1649 | * |
| 1650 | * Return: 0 on success, otherwise error value |
| 1651 | */ |
| 1652 | static int hdd_get_cached_station_remote(hdd_context_t *hdd_ctx, |
| 1653 | hdd_adapter_t *adapter, |
| 1654 | v_MACADDR_t mac_addr) |
| 1655 | { |
| 1656 | struct hdd_cache_sta_info *stainfo; |
| 1657 | struct sk_buff *skb = NULL; |
| 1658 | uint32_t nl_buf_len; |
| 1659 | uint8_t cw; |
| 1660 | ptSapContext sap_ctx; |
| 1661 | v_CONTEXT_t vos_ctx = (WLAN_HDD_GET_CTX(adapter))->pvosContext; |
| 1662 | |
| 1663 | sap_ctx = VOS_GET_SAP_CB(vos_ctx); |
| 1664 | if(sap_ctx == NULL){ |
| 1665 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1666 | FL("psapCtx is NULL")); |
| 1667 | return -ENOENT; |
| 1668 | } |
| 1669 | |
| 1670 | stainfo = hdd_get_cache_stainfo(sap_ctx->cache_sta_info, |
| 1671 | mac_addr.bytes); |
| 1672 | if (!stainfo) { |
| 1673 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1674 | "peer " MAC_ADDRESS_STR " not found", |
| 1675 | MAC_ADDR_ARRAY(mac_addr.bytes)); |
| 1676 | return -EINVAL; |
| 1677 | } |
| 1678 | if (sap_ctx->aStaInfo[stainfo->ucSTAId].isUsed == TRUE) { |
| 1679 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1680 | "peer " MAC_ADDRESS_STR " is in connected state", |
| 1681 | MAC_ADDR_ARRAY(mac_addr.bytes)); |
| 1682 | return -EINVAL; |
| 1683 | } |
| 1684 | |
| 1685 | |
| 1686 | nl_buf_len = NLMSG_HDRLEN + hdd_add_link_standard_info_sap_get_len() + |
| 1687 | hdd_add_ap_standard_info_sap_get_len(stainfo) + |
| 1688 | (sizeof(stainfo->dot11_mode) + NLA_HDRLEN) + |
| 1689 | (sizeof(cw) + NLA_HDRLEN) + |
| 1690 | (sizeof(stainfo->rx_rate) + NLA_HDRLEN); |
| 1691 | |
| 1692 | skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len); |
| 1693 | if (!skb) { |
| 1694 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "cfg80211_vendor_cmd_alloc_reply_skb failed"); |
| 1695 | return -ENOMEM; |
| 1696 | } |
| 1697 | |
| 1698 | if (hdd_add_link_standard_info_sap(skb, stainfo->rssi, stainfo, |
| 1699 | LINK_INFO_STANDARD_NL80211_ATTR)) { |
| 1700 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "link standard put fail"); |
| 1701 | goto fail; |
| 1702 | } |
| 1703 | |
| 1704 | if (hdd_add_ap_standard_info_sap(skb, stainfo, |
| 1705 | AP_INFO_STANDARD_NL80211_ATTR)) { |
| 1706 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "ap standard put fail"); |
| 1707 | goto fail; |
| 1708 | } |
| 1709 | |
| 1710 | /* upper layer expects decoded channel BW */ |
| 1711 | cw = hdd_decode_ch_width(stainfo->ch_width); |
| 1712 | if (nla_put_u32(skb, REMOTE_SUPPORTED_MODE, stainfo->dot11_mode) || |
| 1713 | nla_put_u8(skb, REMOTE_CH_WIDTH, cw)) { |
| 1714 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "remote ch put fail"); |
| 1715 | goto fail; |
| 1716 | } |
Hanumanth Reddy Pothula | 504fe15 | 2018-01-02 20:41:03 +0530 | [diff] [blame] | 1717 | if (nla_put_u32(skb, REMOTE_LAST_RX_RATE, (stainfo->rx_rate * 100))) { |
Hanumanth Reddy Pothula | a35c487 | 2017-12-14 20:47:59 +0530 | [diff] [blame] | 1718 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "rx rate put fail"); |
| 1719 | goto fail; |
| 1720 | } |
| 1721 | |
| 1722 | vos_mem_zero(stainfo, sizeof(*stainfo)); |
| 1723 | |
| 1724 | return cfg80211_vendor_cmd_reply(skb); |
| 1725 | fail: |
| 1726 | if (skb) |
| 1727 | kfree_skb(skb); |
| 1728 | |
| 1729 | return -EINVAL; |
| 1730 | } |
| 1731 | |
| 1732 | /** |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1733 | * __hdd_cfg80211_get_station_cmd() - Handle get station vendor cmd |
| 1734 | * @wiphy: corestack handler |
| 1735 | * @wdev: wireless device |
| 1736 | * @data: data |
| 1737 | * @data_len: data length |
| 1738 | * |
| 1739 | * Handles QCA_NL80211_VENDOR_SUBCMD_GET_STATION. |
| 1740 | * Validate cmd attributes and send the station info to upper layers. |
| 1741 | * |
| 1742 | * Return: Success(0) or reason code for failure |
| 1743 | */ |
| 1744 | static int32_t |
| 1745 | __hdd_cfg80211_get_station_cmd(struct wiphy *wiphy, |
| 1746 | struct wireless_dev *wdev, |
| 1747 | const void *data, |
| 1748 | int data_len) |
| 1749 | { |
| 1750 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 1751 | struct net_device *dev = wdev->netdev; |
| 1752 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1753 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_GET_STATION_MAX + 1]; |
| 1754 | int32_t status; |
| 1755 | |
| 1756 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"Enter"); |
| 1757 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 1758 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"Command not allowed in FTM mode"); |
| 1759 | status = -EPERM; |
| 1760 | goto out; |
| 1761 | } |
| 1762 | |
| 1763 | status = wlan_hdd_validate_context(hdd_ctx); |
| 1764 | if (0 != status) |
| 1765 | goto out; |
| 1766 | |
| 1767 | |
| 1768 | status = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_GET_STATION_MAX, |
| 1769 | data, data_len, NULL); |
| 1770 | if (status) { |
| 1771 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"Invalid ATTR"); |
| 1772 | goto out; |
| 1773 | } |
| 1774 | |
| 1775 | /* Parse and fetch Command Type*/ |
| 1776 | if (tb[STATION_INFO]) { |
| 1777 | status = hdd_get_station_info(hdd_ctx, adapter); |
| 1778 | } else if (tb[STATION_ASSOC_FAIL_REASON]) { |
| 1779 | status = hdd_get_station_assoc_fail(hdd_ctx, adapter); |
Hanumanth Reddy Pothula | a35c487 | 2017-12-14 20:47:59 +0530 | [diff] [blame] | 1780 | } else if (tb[STATION_REMOTE]) { |
| 1781 | v_MACADDR_t mac_addr; |
| 1782 | |
| 1783 | if (adapter->device_mode != WLAN_HDD_SOFTAP && |
| 1784 | adapter->device_mode != WLAN_HDD_P2P_GO) { |
| 1785 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"invalid device_mode:%d", |
| 1786 | adapter->device_mode); |
| 1787 | status = -EINVAL; |
| 1788 | goto out; |
| 1789 | } |
| 1790 | |
| 1791 | nla_memcpy(mac_addr.bytes, tb[STATION_REMOTE], |
| 1792 | VOS_MAC_ADDRESS_LEN); |
| 1793 | |
| 1794 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "STATION_REMOTE "MAC_ADDRESS_STR"", |
| 1795 | MAC_ADDR_ARRAY(mac_addr.bytes)); |
| 1796 | |
| 1797 | status = hdd_get_cached_station_remote(hdd_ctx, adapter, |
| 1798 | mac_addr); |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 1799 | } else { |
| 1800 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"get station info cmd type failed"); |
| 1801 | status = -EINVAL; |
| 1802 | goto out; |
| 1803 | } |
| 1804 | EXIT(); |
| 1805 | out: |
| 1806 | return status; |
| 1807 | } |
| 1808 | |
| 1809 | /** |
| 1810 | * wlan_hdd_cfg80211_get_station_cmd() - Handle get station vendor cmd |
| 1811 | * @wiphy: corestack handler |
| 1812 | * @wdev: wireless device |
| 1813 | * @data: data |
| 1814 | * @data_len: data length |
| 1815 | * |
| 1816 | * Handles QCA_NL80211_VENDOR_SUBCMD_GET_STATION. |
| 1817 | * Validate cmd attributes and send the station info to upper layers. |
| 1818 | * |
| 1819 | * Return: Success(0) or reason code for failure |
| 1820 | */ |
| 1821 | static int32_t |
| 1822 | hdd_cfg80211_get_station_cmd(struct wiphy *wiphy, |
| 1823 | struct wireless_dev *wdev, |
| 1824 | const void *data, |
| 1825 | int data_len) |
| 1826 | { |
| 1827 | int ret; |
| 1828 | |
| 1829 | vos_ssr_protect(__func__); |
| 1830 | ret = __hdd_cfg80211_get_station_cmd(wiphy, wdev, data, data_len); |
| 1831 | vos_ssr_unprotect(__func__); |
| 1832 | |
| 1833 | return ret; |
| 1834 | } |
| 1835 | |
| 1836 | /* |
| 1837 | * undef short names defined for get station command |
| 1838 | * used by __wlan_hdd_cfg80211_get_station_cmd() |
| 1839 | */ |
| 1840 | #undef STATION_INVALID |
| 1841 | #undef STATION_INFO |
| 1842 | #undef STATION_ASSOC_FAIL_REASON |
| 1843 | #undef STATION_MAX |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 1844 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1845 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 1846 | |
| 1847 | static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats, |
| 1848 | struct sk_buff *vendor_event) |
| 1849 | { |
| 1850 | if (nla_put_u8(vendor_event, |
| 1851 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_PREAMBLE, |
| 1852 | stats->rate.preamble) || |
| 1853 | nla_put_u8(vendor_event, |
| 1854 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_NSS, |
| 1855 | stats->rate.nss) || |
| 1856 | nla_put_u8(vendor_event, |
| 1857 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BW, |
| 1858 | stats->rate.bw) || |
| 1859 | nla_put_u8(vendor_event, |
| 1860 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX, |
| 1861 | stats->rate.rateMcsIdx) || |
| 1862 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE, |
| 1863 | stats->rate.bitrate ) || |
| 1864 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU, |
| 1865 | stats->txMpdu ) || |
| 1866 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU, |
| 1867 | stats->rxMpdu ) || |
| 1868 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST, |
| 1869 | stats->mpduLost ) || |
| 1870 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES, |
| 1871 | stats->retries) || |
| 1872 | nla_put_u32(vendor_event, |
| 1873 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT, |
| 1874 | stats->retriesShort ) || |
| 1875 | nla_put_u32(vendor_event, |
| 1876 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG, |
| 1877 | stats->retriesLong)) |
| 1878 | { |
| 1879 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1880 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1881 | return FALSE; |
| 1882 | } |
| 1883 | return TRUE; |
| 1884 | } |
| 1885 | |
| 1886 | static v_BOOL_t put_wifi_peer_info( tpSirWifiPeerInfo stats, |
| 1887 | struct sk_buff *vendor_event) |
| 1888 | { |
| 1889 | u32 i = 0; |
| 1890 | struct nlattr *rateInfo; |
| 1891 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE, |
| 1892 | stats->type) || |
| 1893 | nla_put(vendor_event, |
| 1894 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS, |
| 1895 | VOS_MAC_ADDR_SIZE, &stats->peerMacAddress[0]) || |
| 1896 | nla_put_u32(vendor_event, |
| 1897 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES, |
| 1898 | stats->capabilities) || |
| 1899 | nla_put_u32(vendor_event, |
| 1900 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES, |
| 1901 | stats->numRate)) |
| 1902 | { |
| 1903 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1904 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1905 | goto error; |
| 1906 | } |
| 1907 | |
| 1908 | rateInfo = nla_nest_start(vendor_event, |
| 1909 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1910 | if(!rateInfo) |
| 1911 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1912 | for (i = 0; i < stats->numRate; i++) |
| 1913 | { |
| 1914 | struct nlattr *rates; |
| 1915 | tpSirWifiRateStat pRateStats = (tpSirWifiRateStat )((uint8 *) |
| 1916 | stats->rateStats + |
| 1917 | (i * sizeof(tSirWifiRateStat))); |
| 1918 | rates = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1919 | if(!rates) |
| 1920 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1921 | |
| 1922 | if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event)) |
| 1923 | { |
| 1924 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1925 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1926 | return FALSE; |
| 1927 | } |
| 1928 | nla_nest_end(vendor_event, rates); |
| 1929 | } |
| 1930 | nla_nest_end(vendor_event, rateInfo); |
| 1931 | |
| 1932 | return TRUE; |
| 1933 | error: |
| 1934 | return FALSE; |
| 1935 | } |
| 1936 | |
| 1937 | static v_BOOL_t put_wifi_wmm_ac_stat( tpSirWifiWmmAcStat stats, |
| 1938 | struct sk_buff *vendor_event) |
| 1939 | { |
| 1940 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_AC, |
| 1941 | stats->ac ) || |
| 1942 | nla_put_u32(vendor_event, |
| 1943 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MPDU, |
| 1944 | stats->txMpdu ) || |
| 1945 | nla_put_u32(vendor_event, |
| 1946 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MPDU, |
| 1947 | stats->rxMpdu ) || |
| 1948 | nla_put_u32(vendor_event, |
| 1949 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MCAST, |
| 1950 | stats->txMcast ) || |
| 1951 | nla_put_u32(vendor_event, |
| 1952 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MCAST, |
| 1953 | stats->rxMcast ) || |
| 1954 | nla_put_u32(vendor_event, |
| 1955 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_AMPDU, |
| 1956 | stats->rxAmpdu ) || |
| 1957 | nla_put_u32(vendor_event, |
| 1958 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_AMPDU, |
| 1959 | stats->txAmpdu ) || |
| 1960 | nla_put_u32(vendor_event, |
| 1961 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_MPDU_LOST, |
| 1962 | stats->mpduLost )|| |
| 1963 | nla_put_u32(vendor_event, |
| 1964 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES, |
| 1965 | stats->retries ) || |
| 1966 | nla_put_u32(vendor_event, |
| 1967 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_SHORT, |
| 1968 | stats->retriesShort ) || |
| 1969 | nla_put_u32(vendor_event, |
| 1970 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_LONG, |
| 1971 | stats->retriesLong ) || |
| 1972 | nla_put_u32(vendor_event, |
| 1973 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MIN, |
| 1974 | stats->contentionTimeMin ) || |
| 1975 | nla_put_u32(vendor_event, |
| 1976 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MAX, |
| 1977 | stats->contentionTimeMax ) || |
| 1978 | nla_put_u32(vendor_event, |
| 1979 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_AVG, |
| 1980 | stats->contentionTimeAvg ) || |
| 1981 | nla_put_u32(vendor_event, |
| 1982 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_NUM_SAMPLES, |
| 1983 | stats->contentionNumSamples )) |
| 1984 | { |
| 1985 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1986 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 1987 | return FALSE; |
| 1988 | } |
| 1989 | return TRUE; |
| 1990 | } |
| 1991 | |
| 1992 | static v_BOOL_t put_wifi_interface_info(tpSirWifiInterfaceInfo stats, |
| 1993 | struct sk_buff *vendor_event) |
| 1994 | { |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 1995 | if (nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1996 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE, stats->mode ) || |
| 1997 | nla_put(vendor_event, |
| 1998 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MAC_ADDR, |
| 1999 | VOS_MAC_ADDR_SIZE, stats->macAddr) || |
| 2000 | nla_put_u32(vendor_event, |
| 2001 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_STATE, |
| 2002 | stats->state ) || |
| 2003 | nla_put_u32(vendor_event, |
| 2004 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_ROAMING, |
| 2005 | stats->roaming ) || |
| 2006 | nla_put_u32(vendor_event, |
| 2007 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_CAPABILITIES, |
| 2008 | stats->capabilities ) || |
| 2009 | nla_put(vendor_event, |
| 2010 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_SSID, |
| 2011 | strlen(stats->ssid), stats->ssid) || |
| 2012 | nla_put(vendor_event, |
| 2013 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_BSSID, |
| 2014 | WNI_CFG_BSSID_LEN, stats->bssid) || |
| 2015 | nla_put(vendor_event, |
| 2016 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_AP_COUNTRY_STR, |
| 2017 | WNI_CFG_COUNTRY_CODE_LEN, stats->apCountryStr) || |
| 2018 | nla_put(vendor_event, |
| 2019 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_COUNTRY_STR, |
| 2020 | WNI_CFG_COUNTRY_CODE_LEN, stats->countryStr) |
| 2021 | ) |
| 2022 | { |
| 2023 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2024 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 2025 | return FALSE; |
| 2026 | } |
| 2027 | return TRUE; |
| 2028 | } |
| 2029 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2030 | static v_BOOL_t put_wifi_iface_stats(hdd_adapter_t *pAdapter, |
| 2031 | tpSirWifiIfaceStat pWifiIfaceStat, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2032 | struct sk_buff *vendor_event) |
| 2033 | { |
| 2034 | int i = 0; |
| 2035 | struct nlattr *wmmInfo; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2036 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2037 | WLANTL_InterfaceStatsType *pWifiIfaceStatTL = NULL; |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 2038 | tSirWifiWmmAcStat accessclassStats; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2039 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2040 | if (FALSE == put_wifi_interface_info( |
| 2041 | &pWifiIfaceStat->info, |
| 2042 | vendor_event)) |
| 2043 | { |
| 2044 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2045 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 2046 | return FALSE; |
| 2047 | |
| 2048 | } |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2049 | pWifiIfaceStatTL = (WLANTL_InterfaceStatsType *) |
| 2050 | vos_mem_malloc(sizeof(WLANTL_InterfaceStatsType)); |
| 2051 | if (NULL == pWifiIfaceStatTL) |
| 2052 | { |
| 2053 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 2054 | return FALSE; |
| 2055 | } |
| 2056 | |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 2057 | accessclassStats = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK]; |
| 2058 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK] = |
| 2059 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE]; |
| 2060 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE] = accessclassStats; |
| 2061 | |
| 2062 | accessclassStats.ac = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac; |
| 2063 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac = |
| 2064 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac; |
| 2065 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac = accessclassStats.ac; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2066 | |
| 2067 | if ( pWifiIfaceStat->info.state == WIFI_ASSOCIATED) |
| 2068 | { |
| 2069 | if (VOS_STATUS_SUCCESS == |
| 2070 | WLANTL_CollectInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 2071 | pHddStaCtx->conn_info.staId[0], pWifiIfaceStatTL)) |
| 2072 | { |
| 2073 | /* mgmtRx, MgmtActionRx, rxMcast, rxMpdu, rxAmpdu, rssiData are |
| 2074 | * obtained from TL structure |
| 2075 | */ |
| 2076 | |
| 2077 | pWifiIfaceStat->mgmtRx = pWifiIfaceStat->beaconRx + |
| 2078 | pWifiIfaceStatTL->mgmtRx; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2079 | pWifiIfaceStat->rssiData = pWifiIfaceStatTL->rssiData; |
| 2080 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 2081 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMcast |
| 2082 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMcast; |
| 2083 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMcast |
| 2084 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMcast; |
| 2085 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMcast |
| 2086 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMcast; |
| 2087 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMcast |
| 2088 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMcast; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2089 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 2090 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMpdu |
| 2091 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMpdu; |
| 2092 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMpdu |
| 2093 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMpdu; |
| 2094 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMpdu |
| 2095 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMpdu; |
| 2096 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMpdu |
| 2097 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2098 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 2099 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxAmpdu |
| 2100 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxAmpdu; |
| 2101 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxAmpdu |
| 2102 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxAmpdu; |
| 2103 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxAmpdu |
| 2104 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxAmpdu; |
| 2105 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxAmpdu |
| 2106 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxAmpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2107 | } |
| 2108 | else |
| 2109 | { |
| 2110 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in getting stats from TL")); |
| 2111 | } |
| 2112 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2113 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].txMcast = |
| 2114 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO]; |
| 2115 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].txMcast = |
| 2116 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI]; |
| 2117 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].txMcast = |
| 2118 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE]; |
| 2119 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].txMcast = |
| 2120 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK]; |
| 2121 | } |
| 2122 | else |
| 2123 | { |
| 2124 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Interface not Associated")); |
| 2125 | } |
| 2126 | |
| 2127 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2128 | |
| 2129 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2130 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 2131 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_IFACE) || |
| 2132 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2133 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX, |
| 2134 | pWifiIfaceStat->beaconRx) || |
| 2135 | nla_put_u32(vendor_event, |
| 2136 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_RX, |
| 2137 | pWifiIfaceStat->mgmtRx) || |
| 2138 | nla_put_u32(vendor_event, |
| 2139 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_RX, |
| 2140 | pWifiIfaceStat->mgmtActionRx) || |
| 2141 | nla_put_u32(vendor_event, |
| 2142 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_TX, |
| 2143 | pWifiIfaceStat->mgmtActionTx) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2144 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2145 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_MGMT, |
| 2146 | pWifiIfaceStat->rssiMgmt) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2147 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2148 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_DATA, |
| 2149 | pWifiIfaceStat->rssiData) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2150 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2151 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_ACK, |
| 2152 | pWifiIfaceStat->rssiAck)) |
| 2153 | { |
| 2154 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mukul Sharma | f1bd932 | 2015-10-20 16:03:42 +0530 | [diff] [blame] | 2155 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 2156 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2157 | return FALSE; |
| 2158 | } |
| 2159 | |
Mukul Sharma | f1bd932 | 2015-10-20 16:03:42 +0530 | [diff] [blame] | 2160 | #ifdef FEATURE_EXT_LL_STAT |
| 2161 | /* |
| 2162 | * Ensure when EXT_LL_STAT is supported by both host and fwr, |
| 2163 | * then host should send Leaky AP stats to upper layer, |
| 2164 | * otherwise no need to send these stats. |
| 2165 | */ |
| 2166 | if(sme_IsFeatureSupportedByFW(EXT_LL_STAT) && |
| 2167 | sme_IsFeatureSupportedByDriver(EXT_LL_STAT) |
| 2168 | ) |
| 2169 | { |
| 2170 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2171 | FL("EXT_LL_STAT is supported by fwr and host %u %u %u %llu"), |
| 2172 | pWifiIfaceStat->leakyApStat.is_leaky_ap, |
| 2173 | pWifiIfaceStat->leakyApStat.avg_rx_frms_leaked, |
| 2174 | pWifiIfaceStat->leakyApStat.rx_leak_window, |
| 2175 | pWifiIfaceStat->leakyApStat.avg_bcn_spread); |
| 2176 | if (nla_put_u32(vendor_event, |
| 2177 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_DETECTED, |
| 2178 | pWifiIfaceStat->leakyApStat.is_leaky_ap) || |
| 2179 | nla_put_u32(vendor_event, |
| 2180 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_AVG_NUM_FRAMES_LEAKED, |
| 2181 | pWifiIfaceStat->leakyApStat.avg_rx_frms_leaked) || |
| 2182 | nla_put_u32(vendor_event, |
| 2183 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_GUARD_TIME, |
| 2184 | pWifiIfaceStat->leakyApStat.rx_leak_window) || |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 2185 | hdd_wlan_nla_put_u64(vendor_event, |
Mukul Sharma | f1bd932 | 2015-10-20 16:03:42 +0530 | [diff] [blame] | 2186 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_AVERAGE_TSF_OFFSET, |
| 2187 | pWifiIfaceStat->leakyApStat.avg_bcn_spread)) |
| 2188 | { |
| 2189 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2190 | FL("EXT_LL_STAT put fail")); |
| 2191 | vos_mem_free(pWifiIfaceStatTL); |
| 2192 | return FALSE; |
| 2193 | } |
| 2194 | } |
| 2195 | #endif |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2196 | wmmInfo = nla_nest_start(vendor_event, |
| 2197 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 2198 | if(!wmmInfo) |
| 2199 | { |
| 2200 | vos_mem_free(pWifiIfaceStatTL); |
| 2201 | return FALSE; |
| 2202 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2203 | for (i = 0; i < WIFI_AC_MAX; i++) |
| 2204 | { |
| 2205 | struct nlattr *wmmStats; |
| 2206 | wmmStats = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 2207 | if(!wmmStats) |
| 2208 | { |
| 2209 | vos_mem_free(pWifiIfaceStatTL); |
| 2210 | return FALSE; |
| 2211 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2212 | if (FALSE == put_wifi_wmm_ac_stat( |
| 2213 | &pWifiIfaceStat->AccessclassStats[i], |
| 2214 | vendor_event)) |
| 2215 | { |
| 2216 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2217 | FL("QCA_WLAN_VENDOR_ATTR put Fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2218 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2219 | return FALSE; |
| 2220 | } |
| 2221 | |
| 2222 | nla_nest_end(vendor_event, wmmStats); |
| 2223 | } |
| 2224 | nla_nest_end(vendor_event, wmmInfo); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2225 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2226 | return TRUE; |
| 2227 | } |
| 2228 | |
| 2229 | static tSirWifiInterfaceMode |
| 2230 | hdd_map_device_to_ll_iface_mode ( int deviceMode ) |
| 2231 | { |
| 2232 | switch (deviceMode) |
| 2233 | { |
| 2234 | case WLAN_HDD_INFRA_STATION: |
| 2235 | return WIFI_INTERFACE_STA; |
| 2236 | case WLAN_HDD_SOFTAP: |
| 2237 | return WIFI_INTERFACE_SOFTAP; |
| 2238 | case WLAN_HDD_P2P_CLIENT: |
| 2239 | return WIFI_INTERFACE_P2P_CLIENT; |
| 2240 | case WLAN_HDD_P2P_GO: |
| 2241 | return WIFI_INTERFACE_P2P_GO; |
| 2242 | case WLAN_HDD_IBSS: |
| 2243 | return WIFI_INTERFACE_IBSS; |
| 2244 | default: |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 2245 | return WIFI_INTERFACE_UNKNOWN; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2246 | } |
| 2247 | } |
| 2248 | |
| 2249 | static v_BOOL_t hdd_get_interface_info(hdd_adapter_t *pAdapter, |
| 2250 | tpSirWifiInterfaceInfo pInfo) |
| 2251 | { |
| 2252 | v_U8_t *staMac = NULL; |
| 2253 | hdd_station_ctx_t *pHddStaCtx; |
| 2254 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2255 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2256 | |
| 2257 | pInfo->mode = hdd_map_device_to_ll_iface_mode(pAdapter->device_mode); |
| 2258 | |
| 2259 | vos_mem_copy(pInfo->macAddr, |
| 2260 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 2261 | |
| 2262 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 2263 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 2264 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))) |
| 2265 | { |
| 2266 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2267 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) |
| 2268 | { |
| 2269 | pInfo->state = WIFI_DISCONNECTED; |
| 2270 | } |
| 2271 | if (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) |
| 2272 | { |
| 2273 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2274 | "%s: Session ID %d, Connection is in progress", __func__, |
| 2275 | pAdapter->sessionId); |
| 2276 | pInfo->state = WIFI_ASSOCIATING; |
| 2277 | } |
| 2278 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 2279 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 2280 | { |
| 2281 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 2282 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2283 | "%s: client " MAC_ADDRESS_STR |
| 2284 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 2285 | MAC_ADDR_ARRAY(staMac)); |
| 2286 | pInfo->state = WIFI_AUTHENTICATING; |
| 2287 | } |
| 2288 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 2289 | { |
| 2290 | pInfo->state = WIFI_ASSOCIATED; |
| 2291 | vos_mem_copy(pInfo->bssid, |
| 2292 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 2293 | vos_mem_copy(pInfo->ssid, |
| 2294 | pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 2295 | pHddStaCtx->conn_info.SSID.SSID.length); |
| 2296 | //NULL Terminate the string. |
| 2297 | pInfo->ssid[pHddStaCtx->conn_info.SSID.SSID.length] = 0; |
| 2298 | } |
| 2299 | } |
| 2300 | vos_mem_copy(pInfo->countryStr, |
| 2301 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 2302 | |
| 2303 | vos_mem_copy(pInfo->apCountryStr, |
| 2304 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 2305 | |
| 2306 | return TRUE; |
| 2307 | } |
| 2308 | |
| 2309 | /* |
| 2310 | * hdd_link_layer_process_peer_stats () - This function is called after |
| 2311 | * receiving Link Layer Peer statistics from FW.This function converts |
| 2312 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 2313 | * layers. |
| 2314 | */ |
| 2315 | static v_VOID_t hdd_link_layer_process_peer_stats(hdd_adapter_t *pAdapter, |
| 2316 | v_VOID_t *pData) |
| 2317 | { |
| 2318 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2319 | tpSirWifiPeerStat pWifiPeerStat; |
| 2320 | tpSirWifiPeerInfo pWifiPeerInfo; |
| 2321 | struct nlattr *peerInfo; |
| 2322 | struct sk_buff *vendor_event; |
| 2323 | int status, i; |
| 2324 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2325 | ENTER(); |
| 2326 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2327 | status = wlan_hdd_validate_context(pHddCtx); |
| 2328 | if (0 != status) |
| 2329 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2330 | return; |
| 2331 | } |
| 2332 | |
| 2333 | pWifiPeerStat = (tpSirWifiPeerStat) pData; |
| 2334 | |
| 2335 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2336 | "LL_STATS_PEER_ALL : numPeers %u", |
| 2337 | pWifiPeerStat->numPeers); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2338 | /* |
| 2339 | * Allocate a size of 4096 for the peer stats comprising |
| 2340 | * each of size = sizeof (tSirWifiPeerInfo) + numRate * |
| 2341 | * sizeof (tSirWifiRateStat).Each field is put with an |
| 2342 | * NL attribute.The size of 4096 is considered assuming |
| 2343 | * that number of rates shall not exceed beyond 50 with |
| 2344 | * the sizeof (tSirWifiRateStat) being 32. |
| 2345 | */ |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2346 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 2347 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2348 | if (!vendor_event) |
| 2349 | { |
| 2350 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2351 | "%s: cfg80211_vendor_cmd_alloc_reply_skb failed", |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2352 | __func__); |
| 2353 | return; |
| 2354 | } |
| 2355 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2356 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 2357 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_PEER) || |
| 2358 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2359 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS, |
| 2360 | pWifiPeerStat->numPeers)) |
| 2361 | { |
| 2362 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2363 | "%s: QCA_WLAN_VENDOR_ATTR put fail", __func__); |
| 2364 | kfree_skb(vendor_event); |
| 2365 | return; |
| 2366 | } |
| 2367 | |
| 2368 | peerInfo = nla_nest_start(vendor_event, |
| 2369 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 2370 | if(!peerInfo) |
| 2371 | { |
| 2372 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2373 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO put fail", |
| 2374 | __func__); |
| 2375 | kfree_skb(vendor_event); |
| 2376 | return; |
| 2377 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2378 | |
| 2379 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 2380 | pWifiPeerStat->peerInfo); |
| 2381 | |
| 2382 | for (i = 1; i <= pWifiPeerStat->numPeers; i++) |
| 2383 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2384 | int numRate = pWifiPeerInfo->numRate; |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 2385 | struct nlattr *peers = nla_nest_start(vendor_event, i); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2386 | |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 2387 | if(!peers) |
| 2388 | { |
| 2389 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2390 | "%s: peer stats put fail", |
| 2391 | __func__); |
| 2392 | kfree_skb(vendor_event); |
| 2393 | return; |
| 2394 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2395 | if (FALSE == put_wifi_peer_info( |
| 2396 | pWifiPeerInfo, vendor_event)) |
| 2397 | { |
| 2398 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2399 | "%s: put_wifi_peer_info put fail", __func__); |
| 2400 | kfree_skb(vendor_event); |
| 2401 | return; |
| 2402 | } |
| 2403 | |
| 2404 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 2405 | pWifiPeerStat->peerInfo + |
| 2406 | (i * sizeof(tSirWifiPeerInfo)) + |
| 2407 | (numRate * sizeof (tSirWifiRateStat))); |
| 2408 | nla_nest_end(vendor_event, peers); |
| 2409 | } |
| 2410 | nla_nest_end(vendor_event, peerInfo); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2411 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2412 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2413 | } |
| 2414 | |
| 2415 | /* |
| 2416 | * hdd_link_layer_process_iface_stats () - This function is called after |
| 2417 | * receiving Link Layer Interface statistics from FW.This function converts |
| 2418 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 2419 | * layers. |
| 2420 | */ |
| 2421 | static v_VOID_t hdd_link_layer_process_iface_stats(hdd_adapter_t *pAdapter, |
| 2422 | v_VOID_t *pData) |
| 2423 | { |
| 2424 | tpSirWifiIfaceStat pWifiIfaceStat; |
| 2425 | struct sk_buff *vendor_event; |
| 2426 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2427 | int status; |
| 2428 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2429 | ENTER(); |
| 2430 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2431 | status = wlan_hdd_validate_context(pHddCtx); |
| 2432 | if (0 != status) |
| 2433 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2434 | return; |
| 2435 | } |
| 2436 | /* |
| 2437 | * Allocate a size of 4096 for the interface stats comprising |
| 2438 | * sizeof (tpSirWifiIfaceStat).The size of 4096 is considered |
| 2439 | * assuming that all these fit with in the limit.Please take |
| 2440 | * a call on the limit based on the data requirements on |
| 2441 | * interface statistics. |
| 2442 | */ |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2443 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 2444 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2445 | if (!vendor_event) |
| 2446 | { |
| 2447 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2448 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed") ); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2449 | return; |
| 2450 | } |
| 2451 | |
| 2452 | pWifiIfaceStat = (tpSirWifiIfaceStat) pData; |
| 2453 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 2454 | |
| 2455 | if (FALSE == hdd_get_interface_info( pAdapter, |
| 2456 | &pWifiIfaceStat->info)) |
| 2457 | { |
| 2458 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2459 | FL("hdd_get_interface_info get fail") ); |
| 2460 | kfree_skb(vendor_event); |
| 2461 | return; |
| 2462 | } |
| 2463 | |
| 2464 | if (FALSE == put_wifi_iface_stats( pAdapter, pWifiIfaceStat, |
| 2465 | vendor_event)) |
| 2466 | { |
| 2467 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2468 | FL("put_wifi_iface_stats fail") ); |
| 2469 | kfree_skb(vendor_event); |
| 2470 | return; |
| 2471 | } |
| 2472 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2473 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2474 | "WMI_LINK_STATS_IFACE Data"); |
| 2475 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2476 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2477 | |
| 2478 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2479 | } |
| 2480 | |
| 2481 | /* |
| 2482 | * hdd_link_layer_process_radio_stats () - This function is called after |
| 2483 | * receiving Link Layer Radio statistics from FW.This function converts |
| 2484 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 2485 | * layers. |
| 2486 | */ |
| 2487 | static v_VOID_t hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, |
| 2488 | v_VOID_t *pData) |
| 2489 | { |
| 2490 | int status, i; |
| 2491 | tpSirWifiRadioStat pWifiRadioStat; |
| 2492 | tpSirWifiChannelStats pWifiChannelStats; |
| 2493 | struct sk_buff *vendor_event; |
| 2494 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2495 | struct nlattr *chList; |
| 2496 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2497 | ENTER(); |
| 2498 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2499 | status = wlan_hdd_validate_context(pHddCtx); |
| 2500 | if (0 != status) |
| 2501 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2502 | return; |
| 2503 | } |
| 2504 | pWifiRadioStat = (tpSirWifiRadioStat) pData; |
| 2505 | |
| 2506 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 2507 | "LL_STATS_RADIO" |
Ravi Kumar Bokka | 9306592 | 2016-10-27 13:52:34 +0530 | [diff] [blame] | 2508 | " number of radios = %u" |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2509 | " radio is %d onTime is %u " |
| 2510 | " txTime is %u rxTime is %u " |
| 2511 | " onTimeScan is %u onTimeNbd is %u " |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2512 | " onTimeEXTScan is %u onTimeRoamScan is %u " |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2513 | " onTimePnoScan is %u onTimeHs20 is %u " |
| 2514 | " numChannels is %u", |
Ravi Kumar Bokka | 9306592 | 2016-10-27 13:52:34 +0530 | [diff] [blame] | 2515 | NUM_RADIOS, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2516 | pWifiRadioStat->radio, pWifiRadioStat->onTime, |
| 2517 | pWifiRadioStat->txTime, pWifiRadioStat->rxTime, |
| 2518 | pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2519 | pWifiRadioStat->onTimeEXTScan, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2520 | pWifiRadioStat->onTimeRoamScan, |
| 2521 | pWifiRadioStat->onTimePnoScan, |
| 2522 | pWifiRadioStat->onTimeHs20, |
| 2523 | pWifiRadioStat->numChannels); |
| 2524 | /* |
| 2525 | * Allocate a size of 4096 for the Radio stats comprising |
| 2526 | * sizeof (tSirWifiRadioStat) + numChannels * sizeof |
| 2527 | * (tSirWifiChannelStats).Each channel data is put with an |
| 2528 | * NL attribute.The size of 4096 is considered assuming that |
| 2529 | * number of channels shall not exceed beyond 60 with the |
| 2530 | * sizeof (tSirWifiChannelStats) being 24 bytes. |
| 2531 | */ |
| 2532 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2533 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 2534 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2535 | if (!vendor_event) |
| 2536 | { |
| 2537 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2538 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed") ); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2539 | return; |
| 2540 | } |
| 2541 | |
| 2542 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2543 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 2544 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_RADIO) || |
| 2545 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2546 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID, |
| 2547 | pWifiRadioStat->radio) || |
| 2548 | nla_put_u32(vendor_event, |
Ravi Kumar Bokka | 9306592 | 2016-10-27 13:52:34 +0530 | [diff] [blame] | 2549 | QCA_WLAN_VENDOR_ATTR_LL_STATS_NUM_RADIOS, |
| 2550 | NUM_RADIOS) || |
| 2551 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2552 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME, |
| 2553 | pWifiRadioStat->onTime) || |
| 2554 | nla_put_u32(vendor_event, |
| 2555 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME, |
| 2556 | pWifiRadioStat->txTime) || |
| 2557 | nla_put_u32(vendor_event, |
| 2558 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME, |
| 2559 | pWifiRadioStat->rxTime) || |
| 2560 | nla_put_u32(vendor_event, |
| 2561 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN, |
| 2562 | pWifiRadioStat->onTimeScan) || |
| 2563 | nla_put_u32(vendor_event, |
| 2564 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD, |
| 2565 | pWifiRadioStat->onTimeNbd) || |
| 2566 | nla_put_u32(vendor_event, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2567 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_EXTSCAN, |
| 2568 | pWifiRadioStat->onTimeEXTScan)|| |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2569 | nla_put_u32(vendor_event, |
| 2570 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN, |
| 2571 | pWifiRadioStat->onTimeRoamScan) || |
| 2572 | nla_put_u32(vendor_event, |
| 2573 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN, |
| 2574 | pWifiRadioStat->onTimePnoScan) || |
| 2575 | nla_put_u32(vendor_event, |
| 2576 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20, |
| 2577 | pWifiRadioStat->onTimeHs20) || |
| 2578 | nla_put_u32(vendor_event, |
| 2579 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS, |
| 2580 | pWifiRadioStat->numChannels)) |
| 2581 | { |
| 2582 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2583 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 2584 | kfree_skb(vendor_event); |
| 2585 | return ; |
| 2586 | } |
| 2587 | |
| 2588 | chList = nla_nest_start(vendor_event, |
| 2589 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 2590 | if(!chList) |
| 2591 | { |
| 2592 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2593 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO put fail", |
| 2594 | __func__); |
| 2595 | kfree_skb(vendor_event); |
| 2596 | return; |
| 2597 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2598 | for (i = 0; i < pWifiRadioStat->numChannels; i++) |
| 2599 | { |
| 2600 | struct nlattr *chInfo; |
| 2601 | |
| 2602 | pWifiChannelStats = (tpSirWifiChannelStats) ((uint8*) |
| 2603 | pWifiRadioStat->channels + |
| 2604 | (i * sizeof(tSirWifiChannelStats))); |
| 2605 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2606 | chInfo = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 2607 | if(!chInfo) |
| 2608 | { |
| 2609 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2610 | "%s: failed to put chInfo", |
| 2611 | __func__); |
| 2612 | kfree_skb(vendor_event); |
| 2613 | return; |
| 2614 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2615 | |
| 2616 | if (nla_put_u32(vendor_event, |
| 2617 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH, |
| 2618 | pWifiChannelStats->channel.width) || |
| 2619 | nla_put_u32(vendor_event, |
| 2620 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ, |
| 2621 | pWifiChannelStats->channel.centerFreq) || |
| 2622 | nla_put_u32(vendor_event, |
| 2623 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ0, |
| 2624 | pWifiChannelStats->channel.centerFreq0) || |
| 2625 | nla_put_u32(vendor_event, |
| 2626 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ1, |
| 2627 | pWifiChannelStats->channel.centerFreq1) || |
| 2628 | nla_put_u32(vendor_event, |
| 2629 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME, |
| 2630 | pWifiChannelStats->onTime) || |
| 2631 | nla_put_u32(vendor_event, |
| 2632 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME, |
| 2633 | pWifiChannelStats->ccaBusyTime)) |
| 2634 | { |
| 2635 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2636 | FL("cfg80211_vendor_event_alloc failed") ); |
| 2637 | kfree_skb(vendor_event); |
| 2638 | return ; |
| 2639 | } |
| 2640 | nla_nest_end(vendor_event, chInfo); |
| 2641 | } |
| 2642 | nla_nest_end(vendor_event, chList); |
| 2643 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2644 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2645 | |
| 2646 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2647 | return; |
| 2648 | } |
| 2649 | |
| 2650 | /* |
| 2651 | * hdd_link_layer_stats_ind_callback () - This function is called after |
| 2652 | * receiving Link Layer indications from FW.This callback converts the firmware |
| 2653 | * data to the NL data and send the same to the kernel/upper layers. |
| 2654 | */ |
| 2655 | static void hdd_link_layer_stats_ind_callback ( void *pCtx, |
| 2656 | int indType, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2657 | void *pRsp, u8 *macAddr) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2658 | { |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2659 | hdd_context_t *pHddCtx = (hdd_context_t *)pCtx; |
| 2660 | hdd_adapter_t *pAdapter = NULL; |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2661 | struct hdd_ll_stats_context *context; |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2662 | tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults)pRsp; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2663 | int status; |
| 2664 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2665 | ENTER(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2666 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2667 | status = wlan_hdd_validate_context(pHddCtx); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2668 | if (0 != status) |
| 2669 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2670 | return; |
| 2671 | } |
| 2672 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2673 | pAdapter = hdd_get_adapter_by_macaddr(pHddCtx, macAddr); |
| 2674 | if (NULL == pAdapter) |
| 2675 | { |
| 2676 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2677 | FL(" MAC address %pM does not exist with host"), |
| 2678 | macAddr); |
| 2679 | return; |
| 2680 | } |
| 2681 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2682 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2683 | "%s: Interface: %s LLStats indType: %d", __func__, |
| 2684 | pAdapter->dev->name, indType); |
| 2685 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2686 | switch (indType) |
| 2687 | { |
| 2688 | case SIR_HAL_LL_STATS_RESULTS_RSP: |
| 2689 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2690 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 2691 | "LL_STATS RESP paramID = 0x%x, ifaceId = %u MAC: %pM " |
| 2692 | "respId = %u, moreResultToFollow = %u", |
| 2693 | linkLayerStatsResults->paramId, linkLayerStatsResults->ifaceId, |
| 2694 | macAddr, linkLayerStatsResults->respId, |
| 2695 | linkLayerStatsResults->moreResultToFollow); |
| 2696 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2697 | spin_lock(&hdd_context_lock); |
| 2698 | context = &pHddCtx->ll_stats_context; |
| 2699 | /* validate response received from target */ |
| 2700 | if ((context->request_id != linkLayerStatsResults->respId) || |
| 2701 | !(context->request_bitmap & linkLayerStatsResults->paramId)) |
| 2702 | { |
| 2703 | spin_unlock(&hdd_context_lock); |
| 2704 | hddLog(LOGE, |
| 2705 | FL("Error : Request id %d response id %d request bitmap 0x%x" |
| 2706 | "response bitmap 0x%x"), |
| 2707 | context->request_id, linkLayerStatsResults->respId, |
| 2708 | context->request_bitmap, linkLayerStatsResults->paramId); |
| 2709 | return; |
| 2710 | } |
| 2711 | spin_unlock(&hdd_context_lock); |
| 2712 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2713 | if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO ) |
| 2714 | { |
| 2715 | hdd_link_layer_process_radio_stats(pAdapter, |
| 2716 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2717 | spin_lock(&hdd_context_lock); |
| 2718 | context->request_bitmap &= ~(WMI_LINK_STATS_RADIO); |
| 2719 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2720 | } |
| 2721 | else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE ) |
| 2722 | { |
| 2723 | hdd_link_layer_process_iface_stats(pAdapter, |
| 2724 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2725 | spin_lock(&hdd_context_lock); |
| 2726 | context->request_bitmap &= ~(WMI_LINK_STATS_IFACE); |
| 2727 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2728 | } |
| 2729 | else if ( linkLayerStatsResults->paramId & |
| 2730 | WMI_LINK_STATS_ALL_PEER ) |
| 2731 | { |
| 2732 | hdd_link_layer_process_peer_stats(pAdapter, |
| 2733 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2734 | spin_lock(&hdd_context_lock); |
| 2735 | context->request_bitmap &= ~(WMI_LINK_STATS_ALL_PEER); |
| 2736 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2737 | } /* WMI_LINK_STATS_ALL_PEER */ |
| 2738 | else |
| 2739 | { |
| 2740 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2741 | FL("INVALID LL_STATS_NOTIFY RESPONSE ***********")); |
| 2742 | } |
| 2743 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2744 | spin_lock(&hdd_context_lock); |
| 2745 | /* complete response event if all requests are completed */ |
| 2746 | if (0 == context->request_bitmap) |
| 2747 | complete(&context->response_event); |
| 2748 | spin_unlock(&hdd_context_lock); |
| 2749 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2750 | break; |
| 2751 | } |
| 2752 | default: |
| 2753 | hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType); |
| 2754 | break; |
| 2755 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2756 | |
| 2757 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2758 | return; |
| 2759 | } |
| 2760 | |
| 2761 | const struct |
| 2762 | nla_policy |
| 2763 | qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX +1] = |
| 2764 | { |
| 2765 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = |
| 2766 | { .type = NLA_U32 }, |
| 2767 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = |
| 2768 | { .type = NLA_U32 }, |
| 2769 | }; |
| 2770 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2771 | static int __wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 2772 | struct wireless_dev *wdev, |
| 2773 | const void *data, |
| 2774 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2775 | { |
| 2776 | int status; |
| 2777 | 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] | 2778 | tSirLLStatsSetReq linkLayerStatsSetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2779 | struct net_device *dev = wdev->netdev; |
| 2780 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2781 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 2782 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2783 | ENTER(); |
| 2784 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2785 | status = wlan_hdd_validate_context(pHddCtx); |
| 2786 | if (0 != status) |
| 2787 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2788 | return -EINVAL; |
| 2789 | } |
| 2790 | |
| 2791 | if (NULL == pAdapter) |
| 2792 | { |
| 2793 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2794 | FL("HDD adapter is Null")); |
| 2795 | return -ENODEV; |
| 2796 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2797 | /* check the LLStats Capability */ |
| 2798 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 2799 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 2800 | { |
Anurag Chouhan | 65ea6dc | 2016-10-25 19:59:14 +0530 | [diff] [blame] | 2801 | hddLog(VOS_TRACE_LEVEL_WARN, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2802 | FL("Link Layer Statistics not supported by Firmware")); |
| 2803 | return -EINVAL; |
| 2804 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2805 | |
| 2806 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, |
| 2807 | (struct nlattr *)data, |
| 2808 | data_len, qca_wlan_vendor_ll_set_policy)) |
| 2809 | { |
| 2810 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 2811 | return -EINVAL; |
| 2812 | } |
| 2813 | if (!tb_vendor |
| 2814 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]) |
| 2815 | { |
| 2816 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MPDU size Not present")); |
| 2817 | return -EINVAL; |
| 2818 | } |
| 2819 | if (!tb_vendor[ |
| 2820 | QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]) |
| 2821 | { |
| 2822 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Stats Gathering Not Present")); |
| 2823 | return -EINVAL; |
| 2824 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2825 | // 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] | 2826 | linkLayerStatsSetReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2827 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2828 | linkLayerStatsSetReq.mpduSizeThreshold = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2829 | nla_get_u32( |
| 2830 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]); |
| 2831 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2832 | linkLayerStatsSetReq.aggressiveStatisticsGathering = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2833 | nla_get_u32( |
| 2834 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]); |
| 2835 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2836 | vos_mem_copy(linkLayerStatsSetReq.macAddr, |
| 2837 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2838 | |
| 2839 | |
| 2840 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 2841 | "LL_STATS_SET reqId = %d, MAC = %pM, mpduSizeThreshold = %d " |
| 2842 | "Statistics Gathering = %d ", |
| 2843 | linkLayerStatsSetReq.reqId, linkLayerStatsSetReq.macAddr, |
| 2844 | linkLayerStatsSetReq.mpduSizeThreshold, |
| 2845 | linkLayerStatsSetReq.aggressiveStatisticsGathering); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2846 | |
| 2847 | if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB( |
| 2848 | pHddCtx->hHal, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2849 | hdd_link_layer_stats_ind_callback)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2850 | { |
| 2851 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2852 | "sme_SetLinkLayerStatsIndCB Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2853 | return -EINVAL; |
| 2854 | |
| 2855 | } |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 2856 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2857 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2858 | &linkLayerStatsSetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2859 | { |
| 2860 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2861 | "sme_LLStatsSetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2862 | return -EINVAL; |
| 2863 | } |
| 2864 | |
| 2865 | pAdapter->isLinkLayerStatsSet = 1; |
| 2866 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2867 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2868 | return 0; |
| 2869 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2870 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 2871 | struct wireless_dev *wdev, |
| 2872 | const void *data, |
| 2873 | int data_len) |
| 2874 | { |
| 2875 | int ret = 0; |
| 2876 | |
| 2877 | vos_ssr_protect(__func__); |
| 2878 | ret = __wlan_hdd_cfg80211_ll_stats_set(wiphy, wdev, data, data_len); |
| 2879 | vos_ssr_unprotect(__func__); |
| 2880 | |
| 2881 | return ret; |
| 2882 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2883 | |
| 2884 | const struct |
| 2885 | nla_policy |
| 2886 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 2887 | { |
| 2888 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 2889 | * command. When reporting |
| 2890 | * the stats results, the driver uses the same value to indicate |
| 2891 | * which GET request the results |
| 2892 | * correspond to. |
| 2893 | */ |
| 2894 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 2895 | |
| 2896 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 2897 | requested for retrieval */ |
| 2898 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 2899 | }; |
| 2900 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2901 | static int __wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 2902 | struct wireless_dev *wdev, |
| 2903 | const void *data, |
| 2904 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2905 | { |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 2906 | unsigned long rc; |
| 2907 | struct hdd_ll_stats_context *context; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2908 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 2909 | 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] | 2910 | tSirLLStatsGetReq linkLayerStatsGetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2911 | struct net_device *dev = wdev->netdev; |
| 2912 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 2913 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2914 | int status; |
| 2915 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2916 | ENTER(); |
| 2917 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2918 | status = wlan_hdd_validate_context(pHddCtx); |
| 2919 | if (0 != status) |
| 2920 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2921 | return -EINVAL ; |
| 2922 | } |
| 2923 | |
| 2924 | if (NULL == pAdapter) |
| 2925 | { |
| 2926 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2927 | "%s: HDD adapter is Null", __func__); |
| 2928 | return -ENODEV; |
| 2929 | } |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 2930 | |
| 2931 | if (pHddStaCtx == NULL) |
| 2932 | { |
| 2933 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2934 | "%s: HddStaCtx is Null", __func__); |
| 2935 | return -ENODEV; |
| 2936 | } |
| 2937 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2938 | /* check the LLStats Capability */ |
| 2939 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 2940 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 2941 | { |
| 2942 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2943 | FL("Link Layer Statistics not supported by Firmware")); |
| 2944 | return -EINVAL; |
| 2945 | } |
| 2946 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2947 | |
| 2948 | if (!pAdapter->isLinkLayerStatsSet) |
| 2949 | { |
Sushant Kaushik | dc3184b | 2015-10-09 12:00:21 +0530 | [diff] [blame] | 2950 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2951 | "%s: isLinkLayerStatsSet : %d", |
| 2952 | __func__, pAdapter->isLinkLayerStatsSet); |
| 2953 | return -EINVAL; |
| 2954 | } |
| 2955 | |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 2956 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 2957 | { |
| 2958 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2959 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 2960 | return -EBUSY; |
| 2961 | } |
| 2962 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2963 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 2964 | (struct nlattr *)data, |
| 2965 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 2966 | { |
| 2967 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 2968 | return -EINVAL; |
| 2969 | } |
| 2970 | |
| 2971 | if (!tb_vendor |
| 2972 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 2973 | { |
| 2974 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 2975 | return -EINVAL; |
| 2976 | } |
| 2977 | |
| 2978 | if (!tb_vendor |
| 2979 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 2980 | { |
| 2981 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 2982 | return -EINVAL; |
| 2983 | } |
| 2984 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2985 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2986 | linkLayerStatsGetReq.reqId = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2987 | nla_get_u32( tb_vendor[ |
| 2988 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2989 | linkLayerStatsGetReq.paramIdMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2990 | nla_get_u32( tb_vendor[ |
| 2991 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 2992 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2993 | vos_mem_copy(linkLayerStatsGetReq.macAddr, |
| 2994 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2995 | |
| 2996 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 2997 | "LL_STATS_GET reqId = %d, MAC = %pM, paramIdMask = %d", |
| 2998 | linkLayerStatsGetReq.reqId, linkLayerStatsGetReq.macAddr, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2999 | linkLayerStatsGetReq.paramIdMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3000 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 3001 | spin_lock(&hdd_context_lock); |
| 3002 | context = &pHddCtx->ll_stats_context; |
| 3003 | context->request_id = linkLayerStatsGetReq.reqId; |
| 3004 | context->request_bitmap = linkLayerStatsGetReq.paramIdMask; |
| 3005 | INIT_COMPLETION(context->response_event); |
| 3006 | spin_unlock(&hdd_context_lock); |
| 3007 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3008 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 3009 | &linkLayerStatsGetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3010 | { |
| 3011 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 3012 | "sme_LLStatsGetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3013 | return -EINVAL; |
| 3014 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3015 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 3016 | rc = wait_for_completion_timeout(&context->response_event, |
| 3017 | msecs_to_jiffies(WLAN_WAIT_TIME_LL_STATS)); |
| 3018 | if (!rc) |
| 3019 | { |
| 3020 | hddLog(LOGE, |
| 3021 | FL("Target response timed out request id %d request bitmap 0x%x"), |
| 3022 | context->request_id, context->request_bitmap); |
| 3023 | return -ETIMEDOUT; |
| 3024 | } |
| 3025 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3026 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3027 | return 0; |
| 3028 | } |
| 3029 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3030 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 3031 | struct wireless_dev *wdev, |
| 3032 | const void *data, |
| 3033 | int data_len) |
| 3034 | { |
| 3035 | int ret = 0; |
| 3036 | |
| 3037 | vos_ssr_protect(__func__); |
| 3038 | ret = __wlan_hdd_cfg80211_ll_stats_get(wiphy, wdev, data, data_len); |
| 3039 | vos_ssr_unprotect(__func__); |
| 3040 | |
| 3041 | return ret; |
| 3042 | } |
| 3043 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3044 | const struct |
| 3045 | nla_policy |
| 3046 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 3047 | { |
| 3048 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 3049 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 3050 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 3051 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 3052 | }; |
| 3053 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3054 | static int __wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 3055 | struct wireless_dev *wdev, |
| 3056 | const void *data, |
| 3057 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3058 | { |
| 3059 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3060 | 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] | 3061 | tSirLLStatsClearReq linkLayerStatsClearReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3062 | struct net_device *dev = wdev->netdev; |
| 3063 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3064 | u32 statsClearReqMask; |
| 3065 | u8 stopReq; |
| 3066 | int status; |
| 3067 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3068 | ENTER(); |
| 3069 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3070 | status = wlan_hdd_validate_context(pHddCtx); |
| 3071 | if (0 != status) |
| 3072 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3073 | return -EINVAL; |
| 3074 | } |
| 3075 | |
| 3076 | if (NULL == pAdapter) |
| 3077 | { |
| 3078 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 3079 | "%s: HDD adapter is Null", __func__); |
| 3080 | return -ENODEV; |
| 3081 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 3082 | /* check the LLStats Capability */ |
| 3083 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 3084 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 3085 | { |
| 3086 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3087 | FL("Enable LLStats Capability")); |
| 3088 | return -EINVAL; |
| 3089 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3090 | |
| 3091 | if (!pAdapter->isLinkLayerStatsSet) |
| 3092 | { |
| 3093 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 3094 | "%s: isLinkLayerStatsSet : %d", |
| 3095 | __func__, pAdapter->isLinkLayerStatsSet); |
| 3096 | return -EINVAL; |
| 3097 | } |
| 3098 | |
| 3099 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 3100 | (struct nlattr *)data, |
| 3101 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 3102 | { |
| 3103 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 3104 | return -EINVAL; |
| 3105 | } |
| 3106 | |
| 3107 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 3108 | |
| 3109 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 3110 | { |
| 3111 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 3112 | return -EINVAL; |
| 3113 | |
| 3114 | } |
| 3115 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3116 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 3117 | statsClearReqMask = linkLayerStatsClearReq.statsClearReqMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3118 | nla_get_u32( |
| 3119 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 3120 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 3121 | stopReq = linkLayerStatsClearReq.stopReq = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3122 | nla_get_u8( |
| 3123 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 3124 | |
| 3125 | // 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] | 3126 | linkLayerStatsClearReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3127 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 3128 | vos_mem_copy(linkLayerStatsClearReq.macAddr, |
| 3129 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3130 | |
| 3131 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 3132 | "LL_STATS_CLEAR reqId = %d, MAC = %pM," |
| 3133 | "statsClearReqMask = 0x%X, stopReq = %d", |
| 3134 | linkLayerStatsClearReq.reqId, |
| 3135 | linkLayerStatsClearReq.macAddr, |
| 3136 | linkLayerStatsClearReq.statsClearReqMask, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 3137 | linkLayerStatsClearReq.stopReq); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3138 | |
| 3139 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 3140 | &linkLayerStatsClearReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3141 | { |
| 3142 | struct sk_buff *temp_skbuff; |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 3143 | hdd_station_ctx_t *pHddStaCtx; |
| 3144 | |
| 3145 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3146 | if (VOS_STATUS_SUCCESS != |
| 3147 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 3148 | pHddStaCtx->conn_info.staId[0], statsClearReqMask)) |
| 3149 | { |
| 3150 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 3151 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 3152 | return -EINVAL; |
| 3153 | } |
| 3154 | if ((statsClearReqMask & WIFI_STATS_IFACE_AC) || |
| 3155 | (statsClearReqMask & WIFI_STATS_IFACE)) { |
| 3156 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 3157 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 3158 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 3159 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 3160 | } |
| 3161 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3162 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 3163 | 2 * sizeof(u32) + |
| 3164 | NLMSG_HDRLEN); |
| 3165 | |
| 3166 | if (temp_skbuff != NULL) |
| 3167 | { |
| 3168 | |
| 3169 | if (nla_put_u32(temp_skbuff, |
| 3170 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 3171 | statsClearReqMask) || |
| 3172 | nla_put_u32(temp_skbuff, |
| 3173 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 3174 | stopReq)) |
| 3175 | { |
| 3176 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 3177 | kfree_skb(temp_skbuff); |
| 3178 | return -EINVAL; |
| 3179 | } |
| 3180 | /* If the ask is to stop the stats collection as part of clear |
| 3181 | * (stopReq = 1) , ensure that no further requests of get |
| 3182 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 3183 | * However it the stopReq as part of the clear request is 0 , |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 3184 | * the request to get the statistics are honoured as in this |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3185 | * case the firmware is just asked to clear the statistics. |
| 3186 | */ |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 3187 | if (linkLayerStatsClearReq.stopReq == 1) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3188 | pAdapter->isLinkLayerStatsSet = 0; |
| 3189 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 3190 | } |
| 3191 | return -ENOMEM; |
| 3192 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3193 | |
| 3194 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3195 | return -EINVAL; |
| 3196 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3197 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 3198 | struct wireless_dev *wdev, |
| 3199 | const void *data, |
| 3200 | int data_len) |
| 3201 | { |
| 3202 | int ret = 0; |
| 3203 | |
| 3204 | vos_ssr_protect(__func__); |
| 3205 | ret = __wlan_hdd_cfg80211_ll_stats_clear(wiphy, wdev, data, data_len); |
| 3206 | vos_ssr_unprotect(__func__); |
| 3207 | |
| 3208 | return ret; |
| 3209 | |
| 3210 | |
| 3211 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 3212 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 3213 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3214 | #ifdef WLAN_FEATURE_EXTSCAN |
| 3215 | static const struct nla_policy |
| 3216 | wlan_hdd_extscan_config_policy |
| 3217 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = |
| 3218 | { |
| 3219 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = |
| 3220 | { .type = NLA_U32 }, |
| 3221 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = |
| 3222 | { .type = NLA_U32 }, |
SaidiReddy Yenuga | f214592 | 2017-05-26 18:19:31 +0530 | [diff] [blame] | 3223 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS] = |
| 3224 | { .type = NLA_U32 }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3225 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 }, |
| 3226 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = |
| 3227 | { .type = NLA_U32 }, |
| 3228 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = { .type = NLA_U8 }, |
| 3229 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = { .type = NLA_U8 }, |
| 3230 | |
| 3231 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = { .type = NLA_U8 }, |
| 3232 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = { .type = NLA_U8 }, |
| 3233 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 }, |
| 3234 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = |
| 3235 | { .type = NLA_U8 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 3236 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD] = |
| 3237 | { .type = NLA_U32 }, |
| 3238 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT] = |
| 3239 | { .type = NLA_U32 }, |
| 3240 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT] = |
| 3241 | { .type = NLA_U32 }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3242 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = |
| 3243 | { .type = NLA_U32 }, |
| 3244 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = |
| 3245 | { .type = NLA_U32 }, |
| 3246 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = |
| 3247 | { .type = NLA_U32 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 3248 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT] = |
| 3249 | { .type = NLA_U8 }, |
| 3250 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS] = |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3251 | { .type = NLA_U8 }, |
| 3252 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = |
| 3253 | { .type = NLA_U8 }, |
| 3254 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = |
| 3255 | { .type = NLA_U8 }, |
| 3256 | |
| 3257 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = |
| 3258 | { .type = NLA_U32 }, |
Jeff Johnson | da8c3a7 | 2017-06-23 15:59:08 +0530 | [diff] [blame] | 3259 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = { |
| 3260 | .type = NLA_UNSPEC, |
| 3261 | .len = HDD_MAC_ADDR_LEN}, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3262 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = |
| 3263 | { .type = NLA_S32 }, |
| 3264 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = |
| 3265 | { .type = NLA_S32 }, |
| 3266 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = |
| 3267 | { .type = NLA_U32 }, |
| 3268 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = |
| 3269 | { .type = NLA_U32 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 3270 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE] = |
| 3271 | { .type = NLA_U32 }, |
| 3272 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_SSID] = |
| 3273 | { .type = NLA_BINARY, |
| 3274 | .len = IEEE80211_MAX_SSID_LEN + 1 }, |
| 3275 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_LOST_SSID_SAMPLE_SIZE] = |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3276 | { .type = NLA_U32 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 3277 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_NUM_SSID] = |
| 3278 | { .type = NLA_U32 }, |
| 3279 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_BAND] = |
| 3280 | { .type = NLA_U8 }, |
| 3281 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_LOW] = |
| 3282 | { .type = NLA_S32 }, |
| 3283 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_HIGH] = |
| 3284 | { .type = NLA_S32 }, |
| 3285 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CONFIGURATION_FLAGS] = |
| 3286 | { .type = NLA_U32 }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3287 | }; |
| 3288 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3289 | /** |
| 3290 | * wlan_hdd_cfg80211_extscan_get_capabilities_rsp() - response from target |
| 3291 | * @ctx: hdd global context |
| 3292 | * @data: capabilities data |
| 3293 | * |
| 3294 | * Return: none |
| 3295 | */ |
| 3296 | static void |
| 3297 | wlan_hdd_cfg80211_extscan_get_capabilities_rsp(void *ctx, void *pMsg) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3298 | { |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3299 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3300 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3301 | tSirEXTScanCapabilitiesEvent *data = |
| 3302 | (tSirEXTScanCapabilitiesEvent *) pMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3303 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3304 | ENTER(); |
| 3305 | |
| 3306 | if (wlan_hdd_validate_context(pHddCtx)) |
| 3307 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3308 | return; |
| 3309 | } |
| 3310 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3311 | if (!pMsg) |
| 3312 | { |
| 3313 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 3314 | return; |
| 3315 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3316 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3317 | vos_spin_lock_acquire(&hdd_context_lock); |
| 3318 | |
| 3319 | context = &pHddCtx->ext_scan_context; |
| 3320 | /* validate response received from target*/ |
| 3321 | if (context->request_id != data->requestId) |
| 3322 | { |
| 3323 | vos_spin_lock_release(&hdd_context_lock); |
| 3324 | hddLog(LOGE, |
| 3325 | FL("Target response id did not match: request_id %d resposne_id %d"), |
| 3326 | context->request_id, data->requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3327 | return; |
| 3328 | } |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3329 | else |
| 3330 | { |
| 3331 | context->capability_response = *data; |
| 3332 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3333 | } |
| 3334 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3335 | vos_spin_lock_release(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3336 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3337 | return; |
| 3338 | } |
| 3339 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3340 | /* |
| 3341 | * define short names for the global vendor params |
| 3342 | * used by wlan_hdd_send_ext_scan_capability() |
| 3343 | */ |
| 3344 | #define PARAM_REQUEST_ID \ |
| 3345 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID |
| 3346 | #define PARAM_STATUS \ |
| 3347 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS |
| 3348 | #define MAX_SCAN_CACHE_SIZE \ |
| 3349 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE |
| 3350 | #define MAX_SCAN_BUCKETS \ |
| 3351 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS |
| 3352 | #define MAX_AP_CACHE_PER_SCAN \ |
| 3353 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN |
| 3354 | #define MAX_RSSI_SAMPLE_SIZE \ |
| 3355 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE |
| 3356 | #define MAX_SCAN_RPT_THRHOLD \ |
| 3357 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD |
| 3358 | #define MAX_HOTLIST_BSSIDS \ |
| 3359 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_BSSIDS |
| 3360 | #define MAX_BSSID_HISTORY_ENTRIES \ |
| 3361 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES |
| 3362 | #define MAX_HOTLIST_SSIDS \ |
| 3363 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_SSIDS |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 3364 | #define MAX_SIGNIFICANT_WIFI_CHANGE_APS \ |
| 3365 | 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] | 3366 | |
| 3367 | static int wlan_hdd_send_ext_scan_capability(void *ctx) |
| 3368 | { |
| 3369 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3370 | struct sk_buff *skb = NULL; |
| 3371 | int ret; |
| 3372 | tSirEXTScanCapabilitiesEvent *data; |
| 3373 | tANI_U32 nl_buf_len; |
| 3374 | |
| 3375 | ret = wlan_hdd_validate_context(pHddCtx); |
| 3376 | if (0 != ret) |
| 3377 | { |
| 3378 | return ret; |
| 3379 | } |
| 3380 | |
| 3381 | data = &(pHddCtx->ext_scan_context.capability_response); |
| 3382 | |
| 3383 | nl_buf_len = NLMSG_HDRLEN; |
| 3384 | nl_buf_len += (sizeof(data->requestId) + NLA_HDRLEN) + |
| 3385 | (sizeof(data->status) + NLA_HDRLEN) + |
| 3386 | (sizeof(data->scanCacheSize) + NLA_HDRLEN) + |
| 3387 | (sizeof(data->scanBuckets) + NLA_HDRLEN) + |
| 3388 | (sizeof(data->maxApPerScan) + NLA_HDRLEN) + |
| 3389 | (sizeof(data->maxRssiSampleSize) + NLA_HDRLEN) + |
| 3390 | (sizeof(data->maxScanReportingThreshold) + NLA_HDRLEN) + |
| 3391 | (sizeof(data->maxHotlistAPs) + NLA_HDRLEN) + |
| 3392 | (sizeof(data->maxBsidHistoryEntries) + NLA_HDRLEN) + |
| 3393 | (sizeof(data->maxHotlistSSIDs) + NLA_HDRLEN); |
| 3394 | |
| 3395 | skb = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, nl_buf_len); |
| 3396 | |
| 3397 | if (!skb) |
| 3398 | { |
| 3399 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 3400 | return -ENOMEM; |
| 3401 | } |
| 3402 | |
| 3403 | hddLog(LOG1, "Req Id (%u) Status (%u)", data->requestId, data->status); |
| 3404 | hddLog(LOG1, "Scan cache size (%u) Scan buckets (%u) Max AP per scan (%u)", |
| 3405 | data->scanCacheSize, data->scanBuckets, data->maxApPerScan); |
| 3406 | hddLog(LOG1, "max_rssi_sample_size (%u) max_scan_reporting_threshold (%u)", |
| 3407 | data->maxRssiSampleSize, data->maxScanReportingThreshold); |
| 3408 | hddLog(LOG1, "max_hotlist_bssids (%u) max_bssid_history_entries (%u)" |
| 3409 | "max_hotlist_ssids (%u)", data->maxHotlistAPs, |
| 3410 | data->maxBsidHistoryEntries, data->maxHotlistSSIDs); |
| 3411 | |
| 3412 | if (nla_put_u32(skb, PARAM_REQUEST_ID, data->requestId) || |
| 3413 | nla_put_u32(skb, PARAM_STATUS, data->status) || |
| 3414 | nla_put_u32(skb, MAX_SCAN_CACHE_SIZE, data->scanCacheSize) || |
| 3415 | nla_put_u32(skb, MAX_SCAN_BUCKETS, data->scanBuckets) || |
| 3416 | nla_put_u32(skb, MAX_AP_CACHE_PER_SCAN, |
| 3417 | data->maxApPerScan) || |
| 3418 | nla_put_u32(skb, MAX_RSSI_SAMPLE_SIZE, |
| 3419 | data->maxRssiSampleSize) || |
| 3420 | nla_put_u32(skb, MAX_SCAN_RPT_THRHOLD, |
| 3421 | data->maxScanReportingThreshold) || |
| 3422 | nla_put_u32(skb, MAX_HOTLIST_BSSIDS, data->maxHotlistAPs) || |
| 3423 | nla_put_u32(skb, MAX_BSSID_HISTORY_ENTRIES, |
| 3424 | data->maxBsidHistoryEntries) || |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 3425 | nla_put_u32(skb, MAX_HOTLIST_SSIDS, data->maxHotlistSSIDs) || |
| 3426 | nla_put_u32(skb, MAX_SIGNIFICANT_WIFI_CHANGE_APS, 0)) |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3427 | { |
| 3428 | hddLog(LOGE, FL("nla put fail")); |
| 3429 | goto nla_put_failure; |
| 3430 | } |
| 3431 | |
| 3432 | cfg80211_vendor_cmd_reply(skb); |
| 3433 | return 0; |
| 3434 | |
| 3435 | nla_put_failure: |
| 3436 | kfree_skb(skb); |
| 3437 | return -EINVAL;; |
| 3438 | } |
| 3439 | |
| 3440 | /* |
| 3441 | * done with short names for the global vendor params |
| 3442 | * used by wlan_hdd_send_ext_scan_capability() |
| 3443 | */ |
| 3444 | #undef PARAM_REQUEST_ID |
| 3445 | #undef PARAM_STATUS |
| 3446 | #undef MAX_SCAN_CACHE_SIZE |
| 3447 | #undef MAX_SCAN_BUCKETS |
| 3448 | #undef MAX_AP_CACHE_PER_SCAN |
| 3449 | #undef MAX_RSSI_SAMPLE_SIZE |
| 3450 | #undef MAX_SCAN_RPT_THRHOLD |
| 3451 | #undef MAX_HOTLIST_BSSIDS |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3452 | #undef MAX_BSSID_HISTORY_ENTRIES |
| 3453 | #undef MAX_HOTLIST_SSIDS |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3454 | |
| 3455 | static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg) |
| 3456 | { |
| 3457 | tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg; |
| 3458 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3459 | tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal ); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 3460 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3461 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3462 | ENTER(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3463 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 3464 | if (wlan_hdd_validate_context(pHddCtx)) |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3465 | return; |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 3466 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3467 | if (!pMsg) |
| 3468 | { |
| 3469 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3470 | return; |
| 3471 | } |
| 3472 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3473 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 3474 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 3475 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 3476 | context = &pHddCtx->ext_scan_context; |
| 3477 | spin_lock(&hdd_context_lock); |
| 3478 | if (context->request_id == pData->requestId) { |
| 3479 | context->response_status = pData->status ? -EINVAL : 0; |
| 3480 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3481 | } |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 3482 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3483 | |
| 3484 | /* |
| 3485 | * Store the Request ID for comparing with the requestID obtained |
| 3486 | * in other requests.HDD shall return a failure is the extscan_stop |
| 3487 | * request is issued with a different requestId as that of the |
| 3488 | * extscan_start request. Also, This requestId shall be used while |
| 3489 | * indicating the full scan results to the upper layers. |
| 3490 | * The requestId is stored with the assumption that the firmware |
| 3491 | * shall return the ext scan start request's requestId in ext scan |
| 3492 | * start response. |
| 3493 | */ |
| 3494 | if (pData->status == 0) |
| 3495 | pMac->sme.extScanStartReqId = pData->requestId; |
| 3496 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3497 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3498 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3499 | } |
| 3500 | |
| 3501 | |
| 3502 | static void wlan_hdd_cfg80211_extscan_stop_rsp(void *ctx, void *pMsg) |
| 3503 | { |
| 3504 | tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg; |
| 3505 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 3506 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3507 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3508 | ENTER(); |
| 3509 | |
| 3510 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 3511 | return; |
| 3512 | } |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 3513 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3514 | if (!pMsg) |
| 3515 | { |
| 3516 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3517 | return; |
| 3518 | } |
| 3519 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 3520 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 3521 | pData->status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3522 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 3523 | context = &pHddCtx->ext_scan_context; |
| 3524 | spin_lock(&hdd_context_lock); |
| 3525 | if (context->request_id == pData->requestId) { |
| 3526 | context->response_status = pData->status ? -EINVAL : 0; |
| 3527 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3528 | } |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 3529 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3530 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3531 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3532 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3533 | } |
| 3534 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3535 | static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx, |
| 3536 | void *pMsg) |
| 3537 | { |
| 3538 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3539 | tpSirEXTScanSetBssidHotListRspParams pData = |
| 3540 | (tpSirEXTScanSetBssidHotListRspParams) pMsg; |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3541 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3542 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3543 | ENTER(); |
| 3544 | |
| 3545 | if (wlan_hdd_validate_context(pHddCtx)){ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3546 | return; |
| 3547 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3548 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3549 | if (!pMsg) |
| 3550 | { |
| 3551 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 3552 | return; |
| 3553 | } |
| 3554 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3555 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 3556 | pData->status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3557 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3558 | context = &pHddCtx->ext_scan_context; |
| 3559 | spin_lock(&hdd_context_lock); |
| 3560 | if (context->request_id == pData->requestId) { |
| 3561 | context->response_status = pData->status ? -EINVAL : 0; |
| 3562 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3563 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3564 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3565 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3566 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3567 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3568 | } |
| 3569 | |
| 3570 | static void wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(void *ctx, |
| 3571 | void *pMsg) |
| 3572 | { |
| 3573 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3574 | tpSirEXTScanResetBssidHotlistRspParams pData = |
| 3575 | (tpSirEXTScanResetBssidHotlistRspParams) pMsg; |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 3576 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3577 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3578 | ENTER(); |
| 3579 | |
| 3580 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 3581 | return; |
| 3582 | } |
| 3583 | if (!pMsg) |
| 3584 | { |
| 3585 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3586 | return; |
| 3587 | } |
| 3588 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 3589 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 3590 | pData->status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3591 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 3592 | context = &pHddCtx->ext_scan_context; |
| 3593 | spin_lock(&hdd_context_lock); |
| 3594 | if (context->request_id == pData->requestId) { |
| 3595 | context->response_status = pData->status ? -EINVAL : 0; |
| 3596 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3597 | } |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 3598 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3599 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3600 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3601 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3602 | } |
| 3603 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3604 | static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx, |
| 3605 | void *pMsg) |
| 3606 | { |
| 3607 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3608 | struct sk_buff *skb = NULL; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3609 | tANI_U32 i = 0, j, resultsPerEvent, scan_id_index; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3610 | tANI_S32 totalResults; |
| 3611 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3612 | tpSirWifiScanResult pSirWifiScanResult, head_ptr; |
| 3613 | struct hdd_ext_scan_context *context; |
| 3614 | bool ignore_cached_results = false; |
| 3615 | tExtscanCachedScanResult *result; |
| 3616 | struct nlattr *nla_results; |
| 3617 | tANI_U16 ieLength= 0; |
| 3618 | tANI_U8 *ie = NULL; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3619 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3620 | ENTER(); |
| 3621 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3622 | if (wlan_hdd_validate_context(pHddCtx)) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3623 | return; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3624 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3625 | if (!pMsg) |
| 3626 | { |
| 3627 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 3628 | return; |
| 3629 | } |
| 3630 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3631 | spin_lock(&hdd_context_lock); |
| 3632 | context = &pHddCtx->ext_scan_context; |
| 3633 | ignore_cached_results = context->ignore_cached_results; |
| 3634 | spin_unlock(&hdd_context_lock); |
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 | if (ignore_cached_results) { |
| 3637 | hddLog(LOGE, |
| 3638 | FL("Ignore the cached results received after timeout")); |
| 3639 | return; |
| 3640 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3641 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3642 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u More Data %u No of scan ids %u", |
| 3643 | pData->requestId, pData->moreData, pData->scanResultSize); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3644 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3645 | result = (tExtscanCachedScanResult *)&(pData->result); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3646 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3647 | for (scan_id_index = 0; scan_id_index < pData->scanResultSize; |
| 3648 | scan_id_index++) { |
| 3649 | result+= scan_id_index; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3650 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3651 | totalResults = result->num_results; |
| 3652 | hddLog(VOS_TRACE_LEVEL_INFO, "scan_id %u flags %u Num results %u", |
| 3653 | result->scan_id, result->flags, totalResults); |
| 3654 | i = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3655 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3656 | do{ |
| 3657 | resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ? |
| 3658 | EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults); |
| 3659 | totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3660 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3661 | skb = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 3662 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN); |
| 3663 | |
| 3664 | if (!skb) { |
| 3665 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3666 | FL("cfg80211_vendor_event_alloc failed")); |
| 3667 | return; |
| 3668 | } |
| 3669 | |
| 3670 | hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent); |
| 3671 | |
| 3672 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3673 | pData->requestId) || |
| 3674 | nla_put_u32(skb, |
| 3675 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3676 | resultsPerEvent)) { |
| 3677 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3678 | goto fail; |
| 3679 | } |
| 3680 | if (nla_put_u8(skb, |
| 3681 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 3682 | pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 ))) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3683 | { |
| 3684 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3685 | goto fail; |
| 3686 | } |
| 3687 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3688 | if (nla_put_u32(skb, |
| 3689 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_SCAN_ID, |
| 3690 | result->scan_id)) { |
| 3691 | hddLog(LOGE, FL("put fail")); |
| 3692 | goto fail; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3693 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3694 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3695 | nla_results = nla_nest_start(skb, |
| 3696 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_LIST); |
| 3697 | if (!nla_results) |
| 3698 | goto fail; |
| 3699 | |
| 3700 | if (resultsPerEvent) { |
| 3701 | struct nlattr *aps; |
| 3702 | struct nlattr *nla_result; |
| 3703 | |
| 3704 | nla_result = nla_nest_start(skb, scan_id_index); |
| 3705 | if(!nla_result) |
| 3706 | goto fail; |
| 3707 | |
| 3708 | if (nla_put_u32(skb, |
| 3709 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_SCAN_ID, |
| 3710 | result->scan_id) || |
| 3711 | nla_put_u32(skb, |
| 3712 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_FLAGS, |
| 3713 | result->flags) || |
| 3714 | nla_put_u32(skb, |
| 3715 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3716 | totalResults)) { |
| 3717 | hddLog(LOGE, FL("put fail")); |
| 3718 | goto fail; |
| 3719 | } |
| 3720 | |
| 3721 | aps = nla_nest_start(skb, |
| 3722 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 3723 | if (!aps) |
| 3724 | { |
| 3725 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3726 | goto fail; |
| 3727 | } |
| 3728 | |
| 3729 | head_ptr = (tpSirWifiScanResult) &(result->ap); |
| 3730 | |
| 3731 | for (j = 0; j < resultsPerEvent; j++, i++) { |
| 3732 | struct nlattr *ap; |
| 3733 | pSirWifiScanResult = head_ptr + i; |
| 3734 | |
| 3735 | /* |
Srinivas Dasari | 91727c1 | 2016-03-23 17:59:06 +0530 | [diff] [blame] | 3736 | * Firmware returns timestamp from extscan_start till |
| 3737 | * BSSID was cached (in micro seconds). Add this with |
| 3738 | * time gap between system boot up to extscan_start |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3739 | * to derive the time since boot when the |
| 3740 | * BSSID was cached. |
| 3741 | */ |
Srinivas Dasari | 91727c1 | 2016-03-23 17:59:06 +0530 | [diff] [blame] | 3742 | pSirWifiScanResult->ts += |
| 3743 | pHddCtx->extscan_start_time_since_boot; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3744 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) " |
| 3745 | "Ssid (%s)" |
| 3746 | "Bssid: %pM " |
| 3747 | "Channel (%u)" |
| 3748 | "Rssi (%d)" |
| 3749 | "RTT (%u)" |
| 3750 | "RTT_SD (%u)" |
| 3751 | "Beacon Period %u" |
| 3752 | "Capability 0x%x " |
| 3753 | "Ie length %d", |
| 3754 | i, |
| 3755 | pSirWifiScanResult->ts, |
| 3756 | pSirWifiScanResult->ssid, |
| 3757 | pSirWifiScanResult->bssid, |
| 3758 | pSirWifiScanResult->channel, |
| 3759 | pSirWifiScanResult->rssi, |
| 3760 | pSirWifiScanResult->rtt, |
| 3761 | pSirWifiScanResult->rtt_sd, |
| 3762 | pSirWifiScanResult->beaconPeriod, |
| 3763 | pSirWifiScanResult->capability, |
| 3764 | ieLength); |
| 3765 | |
| 3766 | ap = nla_nest_start(skb, j + 1); |
| 3767 | if (!ap) |
| 3768 | { |
| 3769 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3770 | goto fail; |
| 3771 | } |
| 3772 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 3773 | if (hdd_wlan_nla_put_u64(skb, |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3774 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 3775 | pSirWifiScanResult->ts) ) |
| 3776 | { |
| 3777 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3778 | goto fail; |
| 3779 | } |
| 3780 | if (nla_put(skb, |
| 3781 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 3782 | sizeof(pSirWifiScanResult->ssid), |
| 3783 | pSirWifiScanResult->ssid) ) |
| 3784 | { |
| 3785 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3786 | goto fail; |
| 3787 | } |
| 3788 | if (nla_put(skb, |
| 3789 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 3790 | sizeof(pSirWifiScanResult->bssid), |
| 3791 | pSirWifiScanResult->bssid) ) |
| 3792 | { |
| 3793 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3794 | goto fail; |
| 3795 | } |
| 3796 | if (nla_put_u32(skb, |
| 3797 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 3798 | pSirWifiScanResult->channel) ) |
| 3799 | { |
| 3800 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3801 | goto fail; |
| 3802 | } |
| 3803 | if (nla_put_s32(skb, |
| 3804 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 3805 | pSirWifiScanResult->rssi) ) |
| 3806 | { |
| 3807 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3808 | goto fail; |
| 3809 | } |
| 3810 | if (nla_put_u32(skb, |
| 3811 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 3812 | pSirWifiScanResult->rtt) ) |
| 3813 | { |
| 3814 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3815 | goto fail; |
| 3816 | } |
| 3817 | if (nla_put_u32(skb, |
| 3818 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 3819 | pSirWifiScanResult->rtt_sd)) |
| 3820 | { |
| 3821 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3822 | goto fail; |
| 3823 | } |
| 3824 | if (nla_put_u32(skb, |
| 3825 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 3826 | pSirWifiScanResult->beaconPeriod)) |
| 3827 | { |
| 3828 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3829 | goto fail; |
| 3830 | } |
| 3831 | if (nla_put_u32(skb, |
| 3832 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 3833 | pSirWifiScanResult->capability)) |
| 3834 | { |
| 3835 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3836 | goto fail; |
| 3837 | } |
| 3838 | if (nla_put_u32(skb, |
| 3839 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
| 3840 | ieLength)) |
| 3841 | { |
| 3842 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3843 | goto fail; |
| 3844 | } |
| 3845 | |
| 3846 | if (ieLength) |
| 3847 | if (nla_put(skb, |
| 3848 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 3849 | ieLength, ie)) { |
| 3850 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3851 | goto fail; |
| 3852 | } |
| 3853 | |
| 3854 | nla_nest_end(skb, ap); |
| 3855 | } |
| 3856 | nla_nest_end(skb, aps); |
| 3857 | nla_nest_end(skb, nla_result); |
| 3858 | } |
| 3859 | |
| 3860 | nla_nest_end(skb, nla_results); |
| 3861 | |
| 3862 | cfg80211_vendor_cmd_reply(skb); |
| 3863 | |
| 3864 | } while (totalResults > 0); |
| 3865 | } |
| 3866 | |
| 3867 | if (!pData->moreData) { |
| 3868 | spin_lock(&hdd_context_lock); |
| 3869 | context->response_status = 0; |
| 3870 | complete(&context->response_event); |
| 3871 | spin_unlock(&hdd_context_lock); |
| 3872 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3873 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3874 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3875 | return; |
| 3876 | fail: |
| 3877 | kfree_skb(skb); |
| 3878 | return; |
| 3879 | } |
| 3880 | |
| 3881 | static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx, |
| 3882 | void *pMsg) |
| 3883 | { |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3884 | tpSirEXTScanHotlistMatch pData = (tpSirEXTScanHotlistMatch) pMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3885 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3886 | struct sk_buff *skb = NULL; |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3887 | tANI_U32 i, index; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3888 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3889 | ENTER(); |
| 3890 | |
| 3891 | if (wlan_hdd_validate_context(pHddCtx)) { |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3892 | hddLog(LOGE, |
| 3893 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3894 | return; |
| 3895 | } |
| 3896 | if (!pMsg) |
| 3897 | { |
| 3898 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3899 | return; |
| 3900 | } |
| 3901 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3902 | if (pData->bss_found) |
| 3903 | index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX; |
| 3904 | else |
| 3905 | index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST_INDEX; |
| 3906 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3907 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 3908 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3909 | NULL, |
| 3910 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3911 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3912 | index, GFP_KERNEL); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3913 | |
| 3914 | if (!skb) { |
| 3915 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3916 | FL("cfg80211_vendor_event_alloc failed")); |
| 3917 | return; |
| 3918 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3919 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3920 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 3921 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numHotlistBss); |
| 3922 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 3923 | hddLog(VOS_TRACE_LEVEL_INFO, "ap_found %u", pData->bss_found); |
| 3924 | |
| 3925 | for (i = 0; i < pData->numHotlistBss; i++) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3926 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) " |
| 3927 | "Ssid (%s) " |
| 3928 | "Bssid (" MAC_ADDRESS_STR ") " |
| 3929 | "Channel (%u) " |
| 3930 | "Rssi (%d) " |
| 3931 | "RTT (%u) " |
| 3932 | "RTT_SD (%u) ", |
| 3933 | i, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3934 | pData->bssHotlist[i].ts, |
| 3935 | pData->bssHotlist[i].ssid, |
| 3936 | MAC_ADDR_ARRAY(pData->bssHotlist[i].bssid), |
| 3937 | pData->bssHotlist[i].channel, |
| 3938 | pData->bssHotlist[i].rssi, |
| 3939 | pData->bssHotlist[i].rtt, |
| 3940 | pData->bssHotlist[i].rtt_sd); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3941 | } |
| 3942 | |
| 3943 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3944 | pData->requestId) || |
| 3945 | nla_put_u32(skb, |
| 3946 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3947 | pData->numHotlistBss)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3948 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 3949 | goto fail; |
| 3950 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3951 | if (pData->numHotlistBss) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3952 | struct nlattr *aps; |
| 3953 | |
| 3954 | aps = nla_nest_start(skb, |
| 3955 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 3956 | if (!aps) |
| 3957 | goto fail; |
| 3958 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3959 | for (i = 0; i < pData->numHotlistBss; i++) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3960 | struct nlattr *ap; |
| 3961 | |
| 3962 | ap = nla_nest_start(skb, i + 1); |
| 3963 | if (!ap) |
| 3964 | goto fail; |
| 3965 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 3966 | if (hdd_wlan_nla_put_u64(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3967 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3968 | pData->bssHotlist[i].ts) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3969 | nla_put(skb, |
| 3970 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3971 | sizeof(pData->bssHotlist[i].ssid), |
| 3972 | pData->bssHotlist[i].ssid) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3973 | nla_put(skb, |
| 3974 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3975 | sizeof(pData->bssHotlist[i].bssid), |
| 3976 | pData->bssHotlist[i].bssid) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3977 | nla_put_u32(skb, |
| 3978 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3979 | pData->bssHotlist[i].channel) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3980 | nla_put_s32(skb, |
| 3981 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3982 | pData->bssHotlist[i].rssi) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3983 | nla_put_u32(skb, |
| 3984 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3985 | pData->bssHotlist[i].rtt) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3986 | nla_put_u32(skb, |
| 3987 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3988 | pData->bssHotlist[i].rtt_sd)) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3989 | goto fail; |
| 3990 | |
| 3991 | nla_nest_end(skb, ap); |
| 3992 | } |
| 3993 | nla_nest_end(skb, aps); |
| 3994 | |
| 3995 | if (nla_put_u8(skb, |
| 3996 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 3997 | pData->moreData)) |
| 3998 | goto fail; |
| 3999 | } |
| 4000 | |
| 4001 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4002 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4003 | return; |
| 4004 | |
| 4005 | fail: |
| 4006 | kfree_skb(skb); |
| 4007 | return; |
| 4008 | |
| 4009 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4010 | |
| 4011 | static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx, |
| 4012 | void *pMsg) |
| 4013 | { |
| 4014 | struct sk_buff *skb; |
| 4015 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 4016 | tpSirWifiFullScanResultEvent pData = |
| 4017 | (tpSirWifiFullScanResultEvent) (pMsg); |
| 4018 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4019 | ENTER(); |
| 4020 | |
| 4021 | if (wlan_hdd_validate_context(pHddCtx)) { |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 4022 | hddLog(LOGE, |
| 4023 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4024 | return; |
| 4025 | } |
| 4026 | if (!pMsg) |
| 4027 | { |
| 4028 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4029 | return; |
| 4030 | } |
| 4031 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 4032 | /* |
| 4033 | * If the full scan result including IE data exceeds NL 4K size |
| 4034 | * limitation, drop that beacon/probe rsp frame. |
| 4035 | */ |
| 4036 | if ((sizeof(*pData) + pData->ieLength) >= EXTSCAN_EVENT_BUF_SIZE) { |
| 4037 | hddLog(LOGE, FL("Frame exceeded NL size limilation, drop it!")); |
| 4038 | return; |
| 4039 | } |
| 4040 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4041 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 4042 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 4043 | NULL, |
| 4044 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4045 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 4046 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX, |
| 4047 | GFP_KERNEL); |
| 4048 | |
| 4049 | if (!skb) { |
| 4050 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4051 | FL("cfg80211_vendor_event_alloc failed")); |
| 4052 | return; |
| 4053 | } |
| 4054 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4055 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId); |
| 4056 | hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData); |
| 4057 | hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) " |
| 4058 | "Ssid (%s)" |
| 4059 | "Bssid (" MAC_ADDRESS_STR ")" |
| 4060 | "Channel (%u)" |
| 4061 | "Rssi (%d)" |
| 4062 | "RTT (%u)" |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 4063 | "RTT_SD (%u)" |
| 4064 | "Bcn Period %d" |
| 4065 | "Capability 0x%X "), |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4066 | pData->ap.ts, |
| 4067 | pData->ap.ssid, |
| 4068 | MAC_ADDR_ARRAY(pData->ap.bssid), |
| 4069 | pData->ap.channel, |
| 4070 | pData->ap.rssi, |
| 4071 | pData->ap.rtt, |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 4072 | pData->ap.rtt_sd, |
| 4073 | pData->ap.beaconPeriod, |
| 4074 | pData->ap.capability); |
| 4075 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4076 | hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength); |
| 4077 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 4078 | pData->requestId) || |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 4079 | hdd_wlan_nla_put_u64(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4080 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 4081 | pData->ap.ts) || |
| 4082 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 4083 | sizeof(pData->ap.ssid), |
| 4084 | pData->ap.ssid) || |
| 4085 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 4086 | WNI_CFG_BSSID_LEN, |
| 4087 | pData->ap.bssid) || |
| 4088 | nla_put_u32(skb, |
| 4089 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 4090 | pData->ap.channel) || |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 4091 | 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] | 4092 | pData->ap.rssi) || |
| 4093 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 4094 | pData->ap.rtt) || |
| 4095 | nla_put_u32(skb, |
| 4096 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 4097 | pData->ap.rtt_sd) || |
| 4098 | nla_put_u16(skb, |
| 4099 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 4100 | pData->ap.beaconPeriod) || |
| 4101 | nla_put_u16(skb, |
| 4102 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 4103 | pData->ap.capability) || |
| 4104 | nla_put_u32(skb, |
| 4105 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 4106 | pData->ieLength) || |
| 4107 | nla_put_u8(skb, |
| 4108 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 4109 | pData->moreData)) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4110 | { |
| 4111 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4112 | goto nla_put_failure; |
| 4113 | } |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 4114 | |
| 4115 | if (pData->ieLength) { |
| 4116 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 4117 | pData->ieLength, |
| 4118 | pData->ie)) |
| 4119 | { |
| 4120 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4121 | goto nla_put_failure; |
| 4122 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4123 | } |
| 4124 | |
| 4125 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4126 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4127 | return; |
| 4128 | |
| 4129 | nla_put_failure: |
| 4130 | kfree_skb(skb); |
| 4131 | return; |
| 4132 | } |
| 4133 | |
| 4134 | static void wlan_hdd_cfg80211_extscan_scan_res_available_event(void *ctx, |
| 4135 | void *pMsg) |
| 4136 | { |
| 4137 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 4138 | struct sk_buff *skb = NULL; |
| 4139 | tpSirEXTScanResultsAvailableIndParams pData = |
| 4140 | (tpSirEXTScanResultsAvailableIndParams) pMsg; |
| 4141 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4142 | ENTER(); |
| 4143 | |
| 4144 | if (wlan_hdd_validate_context(pHddCtx)){ |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 4145 | hddLog(LOGE, |
| 4146 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4147 | return; |
| 4148 | } |
| 4149 | if (!pMsg) |
| 4150 | { |
| 4151 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4152 | return; |
| 4153 | } |
| 4154 | |
| 4155 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 4156 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 4157 | NULL, |
| 4158 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4159 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 4160 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX, |
| 4161 | GFP_KERNEL); |
| 4162 | |
| 4163 | if (!skb) { |
| 4164 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4165 | FL("cfg80211_vendor_event_alloc failed")); |
| 4166 | return; |
| 4167 | } |
| 4168 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4169 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 4170 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", |
| 4171 | pData->numResultsAvailable); |
| 4172 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 4173 | pData->requestId) || |
| 4174 | nla_put_u32(skb, |
| 4175 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 4176 | pData->numResultsAvailable)) { |
| 4177 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4178 | goto nla_put_failure; |
| 4179 | } |
| 4180 | |
| 4181 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4182 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4183 | return; |
| 4184 | |
| 4185 | nla_put_failure: |
| 4186 | kfree_skb(skb); |
| 4187 | return; |
| 4188 | } |
| 4189 | |
| 4190 | static void wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx, void *pMsg) |
| 4191 | { |
| 4192 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 4193 | struct sk_buff *skb = NULL; |
| 4194 | tpSirEXTScanProgressIndParams pData = |
| 4195 | (tpSirEXTScanProgressIndParams) pMsg; |
| 4196 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4197 | ENTER(); |
| 4198 | |
| 4199 | if (wlan_hdd_validate_context(pHddCtx)){ |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 4200 | hddLog(LOGE, |
| 4201 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4202 | return; |
| 4203 | } |
| 4204 | if (!pMsg) |
| 4205 | { |
| 4206 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4207 | return; |
| 4208 | } |
| 4209 | |
| 4210 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 4211 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 4212 | NULL, |
| 4213 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4214 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 4215 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX, |
| 4216 | GFP_KERNEL); |
| 4217 | |
| 4218 | if (!skb) { |
| 4219 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4220 | FL("cfg80211_vendor_event_alloc failed")); |
| 4221 | return; |
| 4222 | } |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 4223 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Request Id (%u) "), pData->requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4224 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)", |
| 4225 | pData->extScanEventType); |
| 4226 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)", |
| 4227 | pData->status); |
| 4228 | |
| 4229 | if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE, |
| 4230 | pData->extScanEventType) || |
| 4231 | nla_put_u32(skb, |
Dasari Srinivas | 5a28865 | 2014-06-30 17:13:22 +0530 | [diff] [blame] | 4232 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 4233 | pData->requestId) || |
| 4234 | nla_put_u32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4235 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS, |
| 4236 | pData->status)) { |
| 4237 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4238 | goto nla_put_failure; |
| 4239 | } |
| 4240 | |
| 4241 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4242 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4243 | return; |
| 4244 | |
| 4245 | nla_put_failure: |
| 4246 | kfree_skb(skb); |
| 4247 | return; |
| 4248 | } |
| 4249 | |
| 4250 | void wlan_hdd_cfg80211_extscan_callback(void *ctx, const tANI_U16 evType, |
| 4251 | void *pMsg) |
| 4252 | { |
| 4253 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 4254 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4255 | ENTER(); |
| 4256 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4257 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4258 | return; |
| 4259 | } |
| 4260 | |
| 4261 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 4262 | |
| 4263 | |
| 4264 | switch(evType) { |
| 4265 | case SIR_HAL_EXTSCAN_START_RSP: |
| 4266 | wlan_hdd_cfg80211_extscan_start_rsp(ctx, pMsg); |
| 4267 | break; |
| 4268 | |
| 4269 | case SIR_HAL_EXTSCAN_STOP_RSP: |
| 4270 | wlan_hdd_cfg80211_extscan_stop_rsp(ctx, pMsg); |
| 4271 | break; |
| 4272 | case SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP: |
| 4273 | /* There is no need to send this response to upper layer |
| 4274 | Just log the message */ |
| 4275 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4276 | FL("Rcvd SIR_HAL_EXTSCAN_CACHED_RESULTS_RSP")); |
| 4277 | break; |
| 4278 | case SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP: |
| 4279 | wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(ctx, pMsg); |
| 4280 | break; |
| 4281 | |
| 4282 | case SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP: |
| 4283 | wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg); |
| 4284 | break; |
| 4285 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4286 | case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP: |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 4287 | wlan_hdd_cfg80211_extscan_get_capabilities_rsp(ctx, pMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4288 | break; |
| 4289 | case SIR_HAL_EXTSCAN_PROGRESS_IND: |
| 4290 | wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg); |
| 4291 | break; |
| 4292 | case SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND: |
| 4293 | wlan_hdd_cfg80211_extscan_scan_res_available_event(ctx, pMsg); |
| 4294 | break; |
| 4295 | case SIR_HAL_EXTSCAN_SCAN_RESULT_IND: |
| 4296 | wlan_hdd_cfg80211_extscan_cached_results_ind(ctx, pMsg); |
| 4297 | break; |
| 4298 | case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND: |
| 4299 | wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg); |
| 4300 | break; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4301 | case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 4302 | wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg); |
| 4303 | break; |
| 4304 | default: |
| 4305 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 4306 | break; |
| 4307 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4308 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4309 | } |
| 4310 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4311 | static int __wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 4312 | struct wireless_dev *wdev, |
| 4313 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4314 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4315 | tSirGetEXTScanCapabilitiesReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4316 | struct net_device *dev = wdev->netdev; |
| 4317 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4318 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4319 | struct nlattr |
| 4320 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4321 | eHalStatus status; |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 4322 | struct hdd_ext_scan_context *context; |
| 4323 | unsigned long rc; |
| 4324 | int ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4325 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4326 | ENTER(); |
| 4327 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4328 | status = wlan_hdd_validate_context(pHddCtx); |
| 4329 | if (0 != status) |
| 4330 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4331 | return -EINVAL; |
| 4332 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4333 | /* check the EXTScan Capability */ |
| 4334 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4335 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4336 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4337 | { |
| 4338 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4339 | FL("EXTScan not enabled/supported by Firmware")); |
| 4340 | return -EINVAL; |
| 4341 | } |
| 4342 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4343 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4344 | data, dataLen, |
| 4345 | wlan_hdd_extscan_config_policy)) { |
| 4346 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4347 | return -EINVAL; |
| 4348 | } |
| 4349 | |
| 4350 | /* Parse and fetch request Id */ |
| 4351 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4352 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4353 | return -EINVAL; |
| 4354 | } |
| 4355 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4356 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4357 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4358 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4359 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4360 | reqMsg.sessionId = pAdapter->sessionId; |
| 4361 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4362 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 4363 | vos_spin_lock_acquire(&hdd_context_lock); |
| 4364 | context = &pHddCtx->ext_scan_context; |
| 4365 | context->request_id = reqMsg.requestId; |
| 4366 | INIT_COMPLETION(context->response_event); |
| 4367 | vos_spin_lock_release(&hdd_context_lock); |
| 4368 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4369 | status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4370 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4371 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4372 | FL("sme_EXTScanGetCapabilities failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4373 | return -EINVAL; |
| 4374 | } |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 4375 | |
| 4376 | rc = wait_for_completion_timeout(&context->response_event, |
| 4377 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 4378 | if (!rc) { |
| 4379 | hddLog(LOGE, FL("Target response timed out")); |
| 4380 | return -ETIMEDOUT; |
| 4381 | } |
| 4382 | |
| 4383 | ret = wlan_hdd_send_ext_scan_capability(pHddCtx); |
| 4384 | if (ret) |
| 4385 | hddLog(LOGE, FL("Failed to send ext scan capability to user space")); |
| 4386 | |
| 4387 | return ret; |
| 4388 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4389 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4390 | return 0; |
| 4391 | } |
| 4392 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4393 | static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 4394 | struct wireless_dev *wdev, |
| 4395 | const void *data, int dataLen) |
| 4396 | { |
| 4397 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4398 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4399 | vos_ssr_protect(__func__); |
| 4400 | ret = __wlan_hdd_cfg80211_extscan_get_capabilities(wiphy, wdev, data, dataLen); |
| 4401 | vos_ssr_unprotect(__func__); |
| 4402 | |
| 4403 | return ret; |
| 4404 | } |
| 4405 | |
| 4406 | static int __wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 4407 | struct wireless_dev *wdev, |
| 4408 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4409 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4410 | tSirEXTScanGetCachedResultsReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4411 | struct net_device *dev = wdev->netdev; |
| 4412 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4413 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4414 | struct nlattr |
| 4415 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4416 | eHalStatus status; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 4417 | struct hdd_ext_scan_context *context; |
| 4418 | unsigned long rc; |
| 4419 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4420 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4421 | ENTER(); |
| 4422 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 4423 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 4424 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 4425 | return -EINVAL; |
| 4426 | } |
| 4427 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4428 | status = wlan_hdd_validate_context(pHddCtx); |
| 4429 | if (0 != status) |
| 4430 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4431 | return -EINVAL; |
| 4432 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4433 | /* check the EXTScan Capability */ |
| 4434 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4435 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4436 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4437 | { |
| 4438 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4439 | FL("EXTScan not enabled/supported by Firmware")); |
| 4440 | return -EINVAL; |
| 4441 | } |
| 4442 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4443 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4444 | data, dataLen, |
| 4445 | wlan_hdd_extscan_config_policy)) { |
| 4446 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4447 | return -EINVAL; |
| 4448 | } |
| 4449 | /* Parse and fetch request Id */ |
| 4450 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4451 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4452 | return -EINVAL; |
| 4453 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4454 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4455 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4456 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 4457 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4458 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4459 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4460 | reqMsg.sessionId = pAdapter->sessionId; |
| 4461 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4462 | |
| 4463 | /* Parse and fetch flush parameter */ |
| 4464 | if (!tb |
| 4465 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]) |
| 4466 | { |
| 4467 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed")); |
| 4468 | goto failed; |
| 4469 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4470 | reqMsg.flush = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4471 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]); |
| 4472 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4473 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4474 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 4475 | spin_lock(&hdd_context_lock); |
| 4476 | context = &pHddCtx->ext_scan_context; |
| 4477 | context->request_id = reqMsg.requestId; |
| 4478 | context->ignore_cached_results = false; |
| 4479 | INIT_COMPLETION(context->response_event); |
| 4480 | spin_unlock(&hdd_context_lock); |
| 4481 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4482 | status = sme_getCachedResults(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4483 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4484 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4485 | FL("sme_getCachedResults failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4486 | return -EINVAL; |
| 4487 | } |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 4488 | |
| 4489 | rc = wait_for_completion_timeout(&context->response_event, |
| 4490 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 4491 | if (!rc) { |
| 4492 | hddLog(LOGE, FL("Target response timed out")); |
| 4493 | retval = -ETIMEDOUT; |
| 4494 | spin_lock(&hdd_context_lock); |
| 4495 | context->ignore_cached_results = true; |
| 4496 | spin_unlock(&hdd_context_lock); |
| 4497 | } else { |
| 4498 | spin_lock(&hdd_context_lock); |
| 4499 | retval = context->response_status; |
| 4500 | spin_unlock(&hdd_context_lock); |
| 4501 | } |
| 4502 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4503 | EXIT(); |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 4504 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4505 | |
| 4506 | failed: |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4507 | return -EINVAL; |
| 4508 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4509 | static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 4510 | struct wireless_dev *wdev, |
| 4511 | const void *data, int dataLen) |
| 4512 | { |
| 4513 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4514 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4515 | vos_ssr_protect(__func__); |
| 4516 | ret = __wlan_hdd_cfg80211_extscan_get_cached_results(wiphy, wdev, data, dataLen); |
| 4517 | vos_ssr_unprotect(__func__); |
| 4518 | |
| 4519 | return ret; |
| 4520 | } |
| 4521 | |
| 4522 | static int __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4523 | struct wireless_dev *wdev, |
Edhar, Mahesh Kumar | ed8631f | 2015-01-20 14:31:47 +0530 | [diff] [blame] | 4524 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4525 | { |
| 4526 | tpSirEXTScanSetBssidHotListReqParams pReqMsg = NULL; |
| 4527 | struct net_device *dev = wdev->netdev; |
| 4528 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4529 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4530 | struct nlattr |
| 4531 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4532 | struct nlattr |
| 4533 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4534 | struct nlattr *apTh; |
| 4535 | eHalStatus status; |
| 4536 | tANI_U8 i = 0; |
| 4537 | int rem; |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 4538 | struct hdd_ext_scan_context *context; |
| 4539 | tANI_U32 request_id; |
| 4540 | unsigned long rc; |
| 4541 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4542 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4543 | ENTER(); |
| 4544 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 4545 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 4546 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 4547 | return -EINVAL; |
| 4548 | } |
| 4549 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4550 | status = wlan_hdd_validate_context(pHddCtx); |
| 4551 | if (0 != status) |
| 4552 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4553 | return -EINVAL; |
| 4554 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4555 | /* check the EXTScan Capability */ |
| 4556 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4557 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4558 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4559 | { |
| 4560 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4561 | FL("EXTScan not enabled/supported by Firmware")); |
| 4562 | return -EINVAL; |
| 4563 | } |
| 4564 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4565 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4566 | data, dataLen, |
| 4567 | wlan_hdd_extscan_config_policy)) { |
| 4568 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4569 | return -EINVAL; |
| 4570 | } |
| 4571 | |
| 4572 | /* Parse and fetch request Id */ |
| 4573 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4574 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4575 | return -EINVAL; |
| 4576 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4577 | pReqMsg = (tpSirEXTScanSetBssidHotListReqParams) |
| 4578 | vos_mem_malloc(sizeof(*pReqMsg)); |
| 4579 | if (!pReqMsg) { |
| 4580 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 4581 | return -ENOMEM; |
| 4582 | } |
| 4583 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4584 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4585 | pReqMsg->requestId = nla_get_u32( |
| 4586 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 4587 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 4588 | |
| 4589 | /* Parse and fetch number of APs */ |
| 4590 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]) { |
| 4591 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 4592 | goto fail; |
| 4593 | } |
| 4594 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 4595 | /* Parse and fetch lost ap sample size */ |
| 4596 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE]) { |
| 4597 | hddLog(LOGE, FL("attr lost ap sample size failed")); |
| 4598 | goto fail; |
| 4599 | } |
| 4600 | |
| 4601 | pReqMsg->lostBssidSampleSize = nla_get_u32( |
| 4602 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE]); |
| 4603 | hddLog(LOG1, FL("Lost ap sample size %d"), pReqMsg->lostBssidSampleSize); |
| 4604 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4605 | pReqMsg->sessionId = pAdapter->sessionId; |
| 4606 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 4607 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 4608 | pReqMsg->numBssid = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4609 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]); |
Hanumanth Reddy Pothula | 8e18840 | 2017-01-27 16:43:45 +0530 | [diff] [blame] | 4610 | if (pReqMsg->numBssid > WLAN_EXTSCAN_MAX_HOTLIST_APS) { |
| 4611 | hddLog(LOGE, FL("Number of AP: %u exceeds max: %u"), |
| 4612 | pReqMsg->numBssid, WLAN_EXTSCAN_MAX_HOTLIST_APS); |
| 4613 | goto fail; |
| 4614 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 4615 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numBssid); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4616 | |
| 4617 | nla_for_each_nested(apTh, |
| 4618 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
Hanumanth Reddy Pothula | 8e18840 | 2017-01-27 16:43:45 +0530 | [diff] [blame] | 4619 | if (i == pReqMsg->numBssid) { |
| 4620 | hddLog(LOGW, FL("Ignoring excess AP")); |
| 4621 | break; |
| 4622 | } |
| 4623 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4624 | if(nla_parse(tb2, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4625 | nla_data(apTh), nla_len(apTh), |
| 4626 | NULL)) { |
| 4627 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 4628 | goto fail; |
| 4629 | } |
| 4630 | |
| 4631 | /* Parse and fetch MAC address */ |
| 4632 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 4633 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 4634 | goto fail; |
| 4635 | } |
| 4636 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 4637 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 4638 | sizeof(tSirMacAddr)); |
| 4639 | hddLog(VOS_TRACE_LEVEL_INFO, FL("BSSID: %pM "), pReqMsg->ap[i].bssid); |
| 4640 | |
| 4641 | /* Parse and fetch low RSSI */ |
| 4642 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 4643 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 4644 | goto fail; |
| 4645 | } |
| 4646 | pReqMsg->ap[i].low = nla_get_s32( |
| 4647 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 4648 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 4649 | |
| 4650 | /* Parse and fetch high RSSI */ |
| 4651 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 4652 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 4653 | goto fail; |
| 4654 | } |
| 4655 | pReqMsg->ap[i].high = nla_get_s32( |
| 4656 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 4657 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"), |
| 4658 | pReqMsg->ap[i].high); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4659 | i++; |
| 4660 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 4661 | |
Hanumanth Reddy Pothula | 8e18840 | 2017-01-27 16:43:45 +0530 | [diff] [blame] | 4662 | if (i < pReqMsg->numBssid) { |
| 4663 | hddLog(LOGW, FL("Number of AP %u less than expected %u"), |
| 4664 | i, pReqMsg->numBssid); |
| 4665 | pReqMsg->numBssid = i; |
| 4666 | } |
| 4667 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 4668 | context = &pHddCtx->ext_scan_context; |
| 4669 | spin_lock(&hdd_context_lock); |
| 4670 | INIT_COMPLETION(context->response_event); |
| 4671 | context->request_id = request_id = pReqMsg->requestId; |
| 4672 | spin_unlock(&hdd_context_lock); |
| 4673 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4674 | status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg); |
| 4675 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4676 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4677 | FL("sme_SetBssHotlist failed(err=%d)"), status); |
| 4678 | vos_mem_free(pReqMsg); |
| 4679 | return -EINVAL; |
| 4680 | } |
| 4681 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 4682 | /* request was sent -- wait for the response */ |
| 4683 | rc = wait_for_completion_timeout(&context->response_event, |
| 4684 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 4685 | |
| 4686 | if (!rc) { |
| 4687 | hddLog(LOGE, FL("sme_SetBssHotlist timed out")); |
| 4688 | retval = -ETIMEDOUT; |
| 4689 | } else { |
| 4690 | spin_lock(&hdd_context_lock); |
| 4691 | if (context->request_id == request_id) |
| 4692 | retval = context->response_status; |
| 4693 | else |
| 4694 | retval = -EINVAL; |
| 4695 | spin_unlock(&hdd_context_lock); |
| 4696 | } |
| 4697 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4698 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4699 | EXIT(); |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 4700 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4701 | |
| 4702 | fail: |
| 4703 | vos_mem_free(pReqMsg); |
| 4704 | return -EINVAL; |
| 4705 | } |
| 4706 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4707 | static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
| 4708 | struct wireless_dev *wdev, |
| 4709 | const void *data, int dataLen) |
| 4710 | { |
| 4711 | int ret = 0; |
| 4712 | |
| 4713 | vos_ssr_protect(__func__); |
| 4714 | ret = __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(wiphy, wdev, data, |
| 4715 | dataLen); |
| 4716 | vos_ssr_unprotect(__func__); |
| 4717 | |
| 4718 | return ret; |
| 4719 | } |
| 4720 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4721 | static int __wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4722 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4723 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4724 | { |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4725 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4726 | struct net_device *dev = wdev->netdev; |
| 4727 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4728 | uint32_t chan_list[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 4729 | uint8_t num_channels = 0; |
| 4730 | uint8_t num_chan_new = 0; |
| 4731 | uint8_t buf[256] = {0}; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4732 | 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] | 4733 | tANI_U32 requestId, maxChannels; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4734 | tWifiBand wifiBand; |
| 4735 | eHalStatus status; |
| 4736 | struct sk_buff *replySkb; |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4737 | tANI_U8 i,j,k; |
| 4738 | int ret,len = 0;; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4739 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4740 | ENTER(); |
| 4741 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4742 | status = wlan_hdd_validate_context(pHddCtx); |
| 4743 | if (0 != status) |
| 4744 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4745 | return -EINVAL; |
| 4746 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4747 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4748 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4749 | data, dataLen, |
| 4750 | wlan_hdd_extscan_config_policy)) { |
| 4751 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4752 | return -EINVAL; |
| 4753 | } |
| 4754 | |
| 4755 | /* Parse and fetch request Id */ |
| 4756 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4757 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4758 | return -EINVAL; |
| 4759 | } |
| 4760 | requestId = nla_get_u32( |
| 4761 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 4762 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); |
| 4763 | |
| 4764 | /* Parse and fetch wifi band */ |
| 4765 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) |
| 4766 | { |
| 4767 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 4768 | return -EINVAL; |
| 4769 | } |
| 4770 | wifiBand = nla_get_u32( |
| 4771 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); |
| 4772 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); |
| 4773 | |
Padma, Santhosh Kumar | 387aa9c | 2015-06-19 15:39:37 +0530 | [diff] [blame] | 4774 | /* Parse and fetch max channels */ |
| 4775 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS]) |
| 4776 | { |
| 4777 | hddLog(LOGE, FL("attr max channels failed")); |
| 4778 | return -EINVAL; |
| 4779 | } |
| 4780 | maxChannels = nla_get_u32( |
| 4781 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS]); |
| 4782 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max channels %d"), maxChannels); |
| 4783 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4784 | status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4785 | wifiBand, chan_list, |
| 4786 | &num_channels); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4787 | if (eHAL_STATUS_SUCCESS != status) { |
| 4788 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4789 | FL("sme_GetValidChannelsByBand failed (err=%d)"), status); |
| 4790 | return -EINVAL; |
| 4791 | } |
Padma, Santhosh Kumar | 387aa9c | 2015-06-19 15:39:37 +0530 | [diff] [blame] | 4792 | |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4793 | num_channels = VOS_MIN(num_channels, maxChannels); |
| 4794 | num_chan_new = num_channels; |
| 4795 | /* remove the indoor only channels if iface is SAP */ |
| 4796 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 4797 | { |
| 4798 | num_chan_new = 0; |
| 4799 | for (i = 0; i < num_channels; i++) |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 4800 | for (j = 0; j < HDD_NUM_NL80211_BANDS; j++) { |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4801 | if (wiphy->bands[j] == NULL) |
| 4802 | continue; |
| 4803 | for (k = 0; k < wiphy->bands[j]->n_channels; k++) { |
| 4804 | if ((chan_list[i] == |
| 4805 | wiphy->bands[j]->channels[k].center_freq) && |
| 4806 | (!(wiphy->bands[j]->channels[k].flags & |
| 4807 | IEEE80211_CHAN_INDOOR_ONLY))) { |
| 4808 | chan_list[num_chan_new] = chan_list[i]; |
| 4809 | num_chan_new++; |
| 4810 | } |
| 4811 | } |
| 4812 | } |
| 4813 | } |
Padma, Santhosh Kumar | 387aa9c | 2015-06-19 15:39:37 +0530 | [diff] [blame] | 4814 | |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4815 | hddLog(LOG1, FL("Number of channels: %d"), num_chan_new); |
| 4816 | for (i = 0; i < num_chan_new; i++) |
| 4817 | len += scnprintf(buf + len, sizeof(buf) - len, "%u ", chan_list[i]); |
| 4818 | hddLog(LOG1, "Channels: %s", buf); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4819 | |
| 4820 | replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4821 | sizeof(u32) * num_chan_new + |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4822 | NLMSG_HDRLEN); |
| 4823 | |
| 4824 | if (!replySkb) { |
| 4825 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4826 | FL("valid channels: buffer alloc fail")); |
| 4827 | return -EINVAL; |
| 4828 | } |
| 4829 | if (nla_put_u32(replySkb, |
| 4830 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS, |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4831 | num_chan_new) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4832 | nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS, |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame] | 4833 | sizeof(u32) * num_chan_new, chan_list)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4834 | |
| 4835 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4836 | kfree_skb(replySkb); |
| 4837 | return -EINVAL; |
| 4838 | } |
| 4839 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4840 | ret = cfg80211_vendor_cmd_reply(replySkb); |
| 4841 | |
| 4842 | EXIT(); |
| 4843 | return ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4844 | } |
| 4845 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4846 | static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
| 4847 | struct wireless_dev *wdev, |
| 4848 | const void *data, int dataLen) |
| 4849 | { |
| 4850 | int ret = 0; |
| 4851 | |
| 4852 | vos_ssr_protect(__func__); |
| 4853 | ret = __wlan_hdd_cfg80211_extscan_get_valid_channels(wiphy, wdev, data, |
| 4854 | dataLen); |
| 4855 | vos_ssr_unprotect(__func__); |
| 4856 | |
| 4857 | return ret; |
| 4858 | } |
| 4859 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4860 | static int hdd_extscan_start_fill_bucket_channel_spec( |
| 4861 | hdd_context_t *pHddCtx, |
| 4862 | tpSirEXTScanStartReqParams pReqMsg, |
| 4863 | struct nlattr **tb) |
| 4864 | { |
| 4865 | struct nlattr *bucket[ |
| 4866 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4867 | struct nlattr *channel[ |
| 4868 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4869 | struct nlattr *buckets; |
| 4870 | struct nlattr *channels; |
| 4871 | int rem1, rem2; |
| 4872 | eHalStatus status; |
| 4873 | tANI_U8 bktIndex, j, numChannels; |
Ashish Kumar Dhanotiya | cb40790 | 2017-08-14 19:57:32 +0530 | [diff] [blame] | 4874 | uint32_t expected_buckets; |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4875 | tANI_U32 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 4876 | tANI_U32 passive_max_chn_time, active_max_chn_time; |
| 4877 | |
Ashish Kumar Dhanotiya | cb40790 | 2017-08-14 19:57:32 +0530 | [diff] [blame] | 4878 | expected_buckets = pReqMsg->numBuckets; |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4879 | bktIndex = 0; |
| 4880 | |
| 4881 | nla_for_each_nested(buckets, |
| 4882 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) { |
Ashish Kumar Dhanotiya | cb40790 | 2017-08-14 19:57:32 +0530 | [diff] [blame] | 4883 | if (bktIndex >= expected_buckets) { |
| 4884 | hddLog(LOGW, FL("ignoring excess buckets")); |
| 4885 | break; |
| 4886 | } |
| 4887 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4888 | if (nla_parse(bucket, |
Ashish Kumar Dhanotiya | 9c93f56 | 2017-06-20 12:13:33 +0530 | [diff] [blame] | 4889 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4890 | nla_data(buckets), nla_len(buckets), |
| 4891 | wlan_hdd_extscan_config_policy)) { |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4892 | hddLog(LOGE, FL("nla_parse failed")); |
| 4893 | return -EINVAL; |
| 4894 | } |
| 4895 | |
| 4896 | /* Parse and fetch bucket spec */ |
| 4897 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) { |
| 4898 | hddLog(LOGE, FL("attr bucket index failed")); |
| 4899 | return -EINVAL; |
| 4900 | } |
| 4901 | pReqMsg->buckets[bktIndex].bucket = nla_get_u8( |
| 4902 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]); |
| 4903 | hddLog(LOG1, FL("Bucket spec Index %d"), |
| 4904 | pReqMsg->buckets[bktIndex].bucket); |
| 4905 | |
| 4906 | /* Parse and fetch wifi band */ |
| 4907 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) { |
| 4908 | hddLog(LOGE, FL("attr wifi band failed")); |
| 4909 | return -EINVAL; |
| 4910 | } |
| 4911 | pReqMsg->buckets[bktIndex].band = nla_get_u8( |
| 4912 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]); |
| 4913 | hddLog(LOG1, FL("Wifi band %d"), |
| 4914 | pReqMsg->buckets[bktIndex].band); |
| 4915 | |
| 4916 | /* Parse and fetch period */ |
| 4917 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) { |
| 4918 | hddLog(LOGE, FL("attr period failed")); |
| 4919 | return -EINVAL; |
| 4920 | } |
| 4921 | pReqMsg->buckets[bktIndex].period = nla_get_u32( |
| 4922 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]); |
| 4923 | hddLog(LOG1, FL("period %d"), |
| 4924 | pReqMsg->buckets[bktIndex].period); |
| 4925 | |
| 4926 | /* Parse and fetch report events */ |
| 4927 | if (!bucket[ |
| 4928 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) { |
| 4929 | hddLog(LOGE, FL("attr report events failed")); |
| 4930 | return -EINVAL; |
| 4931 | } |
| 4932 | pReqMsg->buckets[bktIndex].reportEvents = nla_get_u8( |
| 4933 | bucket[ |
| 4934 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]); |
| 4935 | hddLog(LOG1, FL("report events %d"), |
| 4936 | pReqMsg->buckets[bktIndex].reportEvents); |
| 4937 | |
| 4938 | /* Parse and fetch max period */ |
| 4939 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD]) { |
| 4940 | hddLog(LOGE, FL("attr max period failed")); |
| 4941 | return -EINVAL; |
| 4942 | } |
| 4943 | pReqMsg->buckets[bktIndex].max_period = nla_get_u32( |
| 4944 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD]); |
| 4945 | hddLog(LOG1, FL("max period %u"), |
| 4946 | pReqMsg->buckets[bktIndex].max_period); |
| 4947 | |
| 4948 | /* Parse and fetch exponent */ |
| 4949 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT]) { |
| 4950 | hddLog(LOGE, FL("attr exponent failed")); |
| 4951 | return -EINVAL; |
| 4952 | } |
| 4953 | pReqMsg->buckets[bktIndex].exponent = nla_get_u32( |
| 4954 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT]); |
| 4955 | hddLog(LOG1, FL("exponent %u"), |
| 4956 | pReqMsg->buckets[bktIndex].exponent); |
| 4957 | |
| 4958 | /* Parse and fetch step count */ |
| 4959 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT]) { |
| 4960 | hddLog(LOGE, FL("attr step count failed")); |
| 4961 | return -EINVAL; |
| 4962 | } |
| 4963 | pReqMsg->buckets[bktIndex].step_count = nla_get_u32( |
| 4964 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT]); |
| 4965 | hddLog(LOG1, FL("Step count %u"), |
| 4966 | pReqMsg->buckets[bktIndex].step_count); |
| 4967 | |
| 4968 | ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &passive_max_chn_time); |
| 4969 | ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &active_max_chn_time); |
| 4970 | |
| 4971 | /* Framework shall pass the channel list if the input WiFi band is |
| 4972 | * WIFI_BAND_UNSPECIFIED. |
| 4973 | * If the input WiFi band is specified (any value other than |
| 4974 | * WIFI_BAND_UNSPECIFIED) then driver populates the channel list |
| 4975 | */ |
| 4976 | if (pReqMsg->buckets[bktIndex].band != WIFI_BAND_UNSPECIFIED) { |
| 4977 | numChannels = 0; |
| 4978 | hddLog(LOG1, "WiFi band is specified, driver to fill channel list"); |
| 4979 | status = sme_GetValidChannelsByBand(pHddCtx->hHal, |
| 4980 | pReqMsg->buckets[bktIndex].band, |
| 4981 | chanList, &numChannels); |
| 4982 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4983 | hddLog(LOGE, |
| 4984 | FL("sme_GetValidChannelsByBand failed (err=%d)"), |
| 4985 | status); |
| 4986 | return -EINVAL; |
| 4987 | } |
| 4988 | |
| 4989 | pReqMsg->buckets[bktIndex].numChannels = |
| 4990 | VOS_MIN(numChannels, WLAN_EXTSCAN_MAX_CHANNELS); |
| 4991 | hddLog(LOG1, FL("Num channels %d"), |
| 4992 | pReqMsg->buckets[bktIndex].numChannels); |
| 4993 | |
| 4994 | for (j = 0; j < pReqMsg->buckets[bktIndex].numChannels; |
| 4995 | j++) { |
| 4996 | pReqMsg->buckets[bktIndex].channels[j].channel = |
| 4997 | chanList[j]; |
| 4998 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4999 | chnlClass = 0; |
| 5000 | if (CSR_IS_CHANNEL_DFS( |
| 5001 | vos_freq_to_chan(chanList[j]))) { |
| 5002 | pReqMsg->buckets[bktIndex].channels[j]. |
| 5003 | passive = 1; |
| 5004 | pReqMsg->buckets[bktIndex].channels[j]. |
| 5005 | dwellTimeMs = passive_max_chn_time; |
| 5006 | } else { |
| 5007 | pReqMsg->buckets[bktIndex].channels[j]. |
| 5008 | passive = 0; |
| 5009 | pReqMsg->buckets[bktIndex].channels[j]. |
| 5010 | dwellTimeMs = active_max_chn_time; |
| 5011 | } |
| 5012 | |
| 5013 | hddLog(LOG1, |
| 5014 | "Channel %u Passive %u Dwell time %u ms", |
| 5015 | pReqMsg->buckets[bktIndex].channels[j].channel, |
| 5016 | pReqMsg->buckets[bktIndex].channels[j].passive, |
| 5017 | pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs); |
| 5018 | } |
| 5019 | |
| 5020 | bktIndex++; |
| 5021 | continue; |
| 5022 | } |
| 5023 | |
| 5024 | /* Parse and fetch number of channels */ |
| 5025 | if (!bucket[ |
| 5026 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) { |
| 5027 | hddLog(LOGE, FL("attr num channels failed")); |
| 5028 | return -EINVAL; |
| 5029 | } |
| 5030 | |
| 5031 | pReqMsg->buckets[bktIndex].numChannels = |
| 5032 | nla_get_u32(bucket[ |
| 5033 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]); |
| 5034 | hddLog(LOG1, FL("num channels %d"), |
| 5035 | pReqMsg->buckets[bktIndex].numChannels); |
| 5036 | |
| 5037 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) { |
| 5038 | hddLog(LOGE, FL("attr channel spec failed")); |
| 5039 | return -EINVAL; |
| 5040 | } |
| 5041 | |
| 5042 | j = 0; |
| 5043 | nla_for_each_nested(channels, |
| 5044 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) { |
| 5045 | if (nla_parse(channel, |
| 5046 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 5047 | nla_data(channels), nla_len(channels), |
| 5048 | wlan_hdd_extscan_config_policy)) { |
| 5049 | hddLog(LOGE, FL("nla_parse failed")); |
| 5050 | return -EINVAL; |
| 5051 | } |
| 5052 | |
| 5053 | /* Parse and fetch channel */ |
| 5054 | if (!channel[ |
| 5055 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) { |
| 5056 | hddLog(LOGE, FL("attr channel failed")); |
| 5057 | return -EINVAL; |
| 5058 | } |
| 5059 | pReqMsg->buckets[bktIndex].channels[j].channel = |
| 5060 | nla_get_u32(channel[ |
| 5061 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]); |
| 5062 | hddLog(LOG1, FL("channel %u"), |
| 5063 | pReqMsg->buckets[bktIndex].channels[j].channel); |
| 5064 | |
| 5065 | /* Parse and fetch dwell time */ |
| 5066 | if (!channel[ |
| 5067 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) { |
| 5068 | hddLog(LOGE, FL("attr dwelltime failed")); |
| 5069 | return -EINVAL; |
| 5070 | } |
| 5071 | pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs = |
| 5072 | nla_get_u32(channel[ |
| 5073 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]); |
| 5074 | |
| 5075 | hddLog(LOG1, FL("Dwell time (%u ms)"), |
| 5076 | pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs); |
| 5077 | |
| 5078 | |
| 5079 | /* Parse and fetch channel spec passive */ |
| 5080 | if (!channel[ |
| 5081 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) { |
| 5082 | hddLog(LOGE, |
| 5083 | FL("attr channel spec passive failed")); |
| 5084 | return -EINVAL; |
| 5085 | } |
| 5086 | pReqMsg->buckets[bktIndex].channels[j].passive = |
| 5087 | nla_get_u8(channel[ |
| 5088 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]); |
| 5089 | hddLog(LOG1, FL("Chnl spec passive %u"), |
| 5090 | pReqMsg->buckets[bktIndex].channels[j].passive); |
| 5091 | |
| 5092 | j++; |
| 5093 | } |
| 5094 | |
| 5095 | bktIndex++; |
| 5096 | } |
| 5097 | |
| 5098 | return 0; |
| 5099 | } |
| 5100 | |
| 5101 | |
| 5102 | /* |
| 5103 | * define short names for the global vendor params |
| 5104 | * used by wlan_hdd_cfg80211_extscan_start() |
| 5105 | */ |
| 5106 | #define PARAM_MAX \ |
| 5107 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX |
| 5108 | #define PARAM_REQUEST_ID \ |
| 5109 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID |
| 5110 | #define PARAM_BASE_PERIOD \ |
| 5111 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD |
| 5112 | #define PARAM_MAX_AP_PER_SCAN \ |
| 5113 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN |
| 5114 | #define PARAM_RPT_THRHLD_PERCENT \ |
| 5115 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT |
| 5116 | #define PARAM_RPT_THRHLD_NUM_SCANS \ |
| 5117 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS |
| 5118 | #define PARAM_NUM_BUCKETS \ |
| 5119 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS |
| 5120 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5121 | static int __wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5122 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5123 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5124 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5125 | tpSirEXTScanStartReqParams pReqMsg = NULL; |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5126 | struct net_device *dev = wdev->netdev; |
| 5127 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5128 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5129 | struct nlattr *tb[PARAM_MAX + 1]; |
| 5130 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5131 | eHalStatus status; |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5132 | tANI_U32 request_id; |
| 5133 | struct hdd_ext_scan_context *context; |
| 5134 | unsigned long rc; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5135 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5136 | ENTER(); |
| 5137 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5138 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 5139 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 5140 | return -EINVAL; |
| 5141 | } |
| 5142 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5143 | status = wlan_hdd_validate_context(pHddCtx); |
| 5144 | if (0 != status) |
| 5145 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5146 | return -EINVAL; |
| 5147 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5148 | /* check the EXTScan Capability */ |
| 5149 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 5150 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 5151 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5152 | { |
| 5153 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5154 | FL("EXTScan not enabled/supported by Firmware")); |
| 5155 | return -EINVAL; |
| 5156 | } |
| 5157 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5158 | if (nla_parse(tb, PARAM_MAX, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5159 | data, dataLen, |
| 5160 | wlan_hdd_extscan_config_policy)) { |
| 5161 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5162 | return -EINVAL; |
| 5163 | } |
| 5164 | |
| 5165 | /* Parse and fetch request Id */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5166 | if (!tb[PARAM_REQUEST_ID]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5167 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 5168 | return -EINVAL; |
| 5169 | } |
| 5170 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5171 | pReqMsg = (tpSirEXTScanStartReqParams) |
| 5172 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5173 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5174 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 5175 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5176 | } |
| 5177 | |
| 5178 | pReqMsg->requestId = nla_get_u32( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5179 | tb[PARAM_REQUEST_ID]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5180 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 5181 | |
| 5182 | pReqMsg->sessionId = pAdapter->sessionId; |
| 5183 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 5184 | |
| 5185 | /* Parse and fetch base period */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5186 | if (!tb[PARAM_BASE_PERIOD]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5187 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed")); |
| 5188 | goto fail; |
| 5189 | } |
| 5190 | pReqMsg->basePeriod = nla_get_u32( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5191 | tb[PARAM_BASE_PERIOD]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5192 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"), |
| 5193 | pReqMsg->basePeriod); |
| 5194 | |
| 5195 | /* Parse and fetch max AP per scan */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5196 | if (!tb[PARAM_MAX_AP_PER_SCAN]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5197 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed")); |
| 5198 | goto fail; |
| 5199 | } |
| 5200 | pReqMsg->maxAPperScan = nla_get_u32( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5201 | tb[PARAM_MAX_AP_PER_SCAN]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5202 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"), |
| 5203 | pReqMsg->maxAPperScan); |
| 5204 | |
| 5205 | /* Parse and fetch report threshold */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5206 | if (!tb[PARAM_RPT_THRHLD_PERCENT]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5207 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed")); |
| 5208 | goto fail; |
| 5209 | } |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5210 | pReqMsg->reportThresholdPercent = nla_get_u8( |
| 5211 | tb[PARAM_RPT_THRHLD_PERCENT]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5212 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"), |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5213 | pReqMsg->reportThresholdPercent); |
| 5214 | |
| 5215 | /* Parse and fetch report threshold num scans */ |
| 5216 | if (!tb[PARAM_RPT_THRHLD_NUM_SCANS]) { |
| 5217 | hddLog(LOGE, FL("attr report_threshold num scans failed")); |
| 5218 | goto fail; |
| 5219 | } |
| 5220 | pReqMsg->reportThresholdNumScans = nla_get_u8( |
| 5221 | tb[PARAM_RPT_THRHLD_NUM_SCANS]); |
| 5222 | hddLog(LOG1, FL("Report Threshold num scans %d"), |
| 5223 | pReqMsg->reportThresholdNumScans); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5224 | |
| 5225 | /* Parse and fetch number of buckets */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5226 | if (!tb[PARAM_NUM_BUCKETS]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5227 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed")); |
| 5228 | goto fail; |
| 5229 | } |
| 5230 | pReqMsg->numBuckets = nla_get_u8( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5231 | tb[PARAM_NUM_BUCKETS]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5232 | if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) { |
| 5233 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets " |
| 5234 | "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS); |
| 5235 | pReqMsg->numBuckets = WLAN_EXTSCAN_MAX_BUCKETS; |
| 5236 | } |
| 5237 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"), |
| 5238 | pReqMsg->numBuckets); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5239 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5240 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) { |
| 5241 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed")); |
| 5242 | goto fail; |
| 5243 | } |
| 5244 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5245 | pReqMsg->homeAwayTime = pHddCtx->cfg_ini->nRestTimeConc; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5246 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5247 | if (hdd_extscan_start_fill_bucket_channel_spec(pHddCtx, pReqMsg, tb)) |
| 5248 | goto fail; |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 5249 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5250 | context = &pHddCtx->ext_scan_context; |
| 5251 | spin_lock(&hdd_context_lock); |
| 5252 | INIT_COMPLETION(context->response_event); |
| 5253 | context->request_id = request_id = pReqMsg->requestId; |
| 5254 | spin_unlock(&hdd_context_lock); |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 5255 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5256 | status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg); |
| 5257 | if (!HAL_STATUS_SUCCESS(status)) { |
| 5258 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5259 | FL("sme_EXTScanStart failed(err=%d)"), status); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5260 | goto fail; |
| 5261 | } |
| 5262 | |
Srinivas Dasari | 91727c1 | 2016-03-23 17:59:06 +0530 | [diff] [blame] | 5263 | pHddCtx->extscan_start_time_since_boot = vos_get_monotonic_boottime(); |
| 5264 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5265 | /* request was sent -- wait for the response */ |
| 5266 | rc = wait_for_completion_timeout(&context->response_event, |
| 5267 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 5268 | |
| 5269 | if (!rc) { |
| 5270 | hddLog(LOGE, FL("sme_ExtScanStart timed out")); |
| 5271 | retval = -ETIMEDOUT; |
| 5272 | } else { |
| 5273 | spin_lock(&hdd_context_lock); |
| 5274 | if (context->request_id == request_id) |
| 5275 | retval = context->response_status; |
| 5276 | else |
| 5277 | retval = -EINVAL; |
| 5278 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5279 | } |
| 5280 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5281 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5282 | EXIT(); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5283 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5284 | |
| 5285 | fail: |
| 5286 | vos_mem_free(pReqMsg); |
| 5287 | return -EINVAL; |
| 5288 | } |
| 5289 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 5290 | /* |
| 5291 | * done with short names for the global vendor params |
| 5292 | * used by wlan_hdd_cfg80211_extscan_start() |
| 5293 | */ |
| 5294 | #undef PARAM_MAX |
| 5295 | #undef PARAM_REQUEST_ID |
| 5296 | #undef PARAM_BASE_PERIOD |
| 5297 | #undef PARAMS_MAX_AP_PER_SCAN |
| 5298 | #undef PARAMS_RPT_THRHLD_PERCENT |
| 5299 | #undef PARAMS_RPT_THRHLD_NUM_SCANS |
| 5300 | #undef PARAMS_NUM_BUCKETS |
| 5301 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5302 | static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
| 5303 | struct wireless_dev *wdev, |
| 5304 | const void *data, int dataLen) |
| 5305 | { |
| 5306 | int ret = 0; |
| 5307 | |
| 5308 | vos_ssr_protect(__func__); |
| 5309 | ret = __wlan_hdd_cfg80211_extscan_start(wiphy, wdev, data, dataLen); |
| 5310 | vos_ssr_unprotect(__func__); |
| 5311 | |
| 5312 | return ret; |
| 5313 | } |
| 5314 | |
| 5315 | static int __wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5316 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5317 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5318 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5319 | tSirEXTScanStopReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5320 | struct net_device *dev = wdev->netdev; |
| 5321 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5322 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5323 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 5324 | eHalStatus status; |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 5325 | int retval; |
| 5326 | unsigned long rc; |
| 5327 | struct hdd_ext_scan_context *context; |
| 5328 | tANI_U32 request_id; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5329 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5330 | ENTER(); |
| 5331 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 5332 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 5333 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 5334 | return -EINVAL; |
| 5335 | } |
| 5336 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5337 | status = wlan_hdd_validate_context(pHddCtx); |
| 5338 | if (0 != status) |
| 5339 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5340 | return -EINVAL; |
| 5341 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5342 | /* check the EXTScan Capability */ |
| 5343 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 5344 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 5345 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5346 | { |
| 5347 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5348 | FL("EXTScan not enabled/supported by Firmware")); |
| 5349 | return -EINVAL; |
| 5350 | } |
| 5351 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5352 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 5353 | data, dataLen, |
| 5354 | wlan_hdd_extscan_config_policy)) { |
| 5355 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5356 | return -EINVAL; |
| 5357 | } |
| 5358 | |
| 5359 | /* Parse and fetch request Id */ |
| 5360 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 5361 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 5362 | return -EINVAL; |
| 5363 | } |
| 5364 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5365 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5366 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5367 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5368 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5369 | reqMsg.sessionId = pAdapter->sessionId; |
| 5370 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5371 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 5372 | context = &pHddCtx->ext_scan_context; |
| 5373 | spin_lock(&hdd_context_lock); |
| 5374 | INIT_COMPLETION(context->response_event); |
Sravanti Palakonda | 7539fb9 | 2016-02-26 17:49:21 +0530 | [diff] [blame] | 5375 | context->request_id = request_id = reqMsg.requestId; |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 5376 | spin_unlock(&hdd_context_lock); |
| 5377 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5378 | status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5379 | if (!HAL_STATUS_SUCCESS(status)) { |
| 5380 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5381 | FL("sme_EXTScanStop failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5382 | return -EINVAL; |
| 5383 | } |
| 5384 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 5385 | /* request was sent -- wait for the response */ |
| 5386 | rc = wait_for_completion_timeout(&context->response_event, |
| 5387 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 5388 | |
| 5389 | if (!rc) { |
| 5390 | hddLog(LOGE, FL("sme_ExtScanStop timed out")); |
| 5391 | retval = -ETIMEDOUT; |
| 5392 | } else { |
| 5393 | spin_lock(&hdd_context_lock); |
| 5394 | if (context->request_id == request_id) |
| 5395 | retval = context->response_status; |
| 5396 | else |
| 5397 | retval = -EINVAL; |
| 5398 | spin_unlock(&hdd_context_lock); |
| 5399 | } |
| 5400 | |
| 5401 | return retval; |
| 5402 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5403 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5404 | return 0; |
| 5405 | } |
| 5406 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5407 | static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
| 5408 | struct wireless_dev *wdev, |
| 5409 | const void *data, int dataLen) |
| 5410 | { |
| 5411 | int ret = 0; |
| 5412 | |
| 5413 | vos_ssr_protect(__func__); |
| 5414 | ret = __wlan_hdd_cfg80211_extscan_stop(wiphy, wdev, data, dataLen); |
| 5415 | vos_ssr_unprotect(__func__); |
| 5416 | |
| 5417 | return ret; |
| 5418 | } |
| 5419 | |
| 5420 | static int __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5421 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5422 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5423 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5424 | tSirEXTScanResetBssidHotlistReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5425 | struct net_device *dev = wdev->netdev; |
| 5426 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5427 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5428 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 5429 | eHalStatus status; |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 5430 | struct hdd_ext_scan_context *context; |
| 5431 | tANI_U32 request_id; |
| 5432 | unsigned long rc; |
| 5433 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5434 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5435 | ENTER(); |
| 5436 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 5437 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 5438 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 5439 | return -EINVAL; |
| 5440 | } |
| 5441 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5442 | status = wlan_hdd_validate_context(pHddCtx); |
| 5443 | if (0 != status) |
| 5444 | { |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 5445 | hddLog(LOGE, FL("HDD context is not valid")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5446 | return -EINVAL; |
| 5447 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5448 | /* check the EXTScan Capability */ |
| 5449 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 5450 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 5451 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5452 | { |
| 5453 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5454 | FL("EXTScan not enabled/supported by Firmware")); |
| 5455 | return -EINVAL; |
| 5456 | } |
| 5457 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5458 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 5459 | data, dataLen, |
| 5460 | wlan_hdd_extscan_config_policy)) { |
| 5461 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5462 | return -EINVAL; |
| 5463 | } |
| 5464 | |
| 5465 | /* Parse and fetch request Id */ |
| 5466 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 5467 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 5468 | return -EINVAL; |
| 5469 | } |
| 5470 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5471 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5472 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5473 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5474 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5475 | reqMsg.sessionId = pAdapter->sessionId; |
| 5476 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5477 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 5478 | context = &pHddCtx->ext_scan_context; |
| 5479 | spin_lock(&hdd_context_lock); |
| 5480 | INIT_COMPLETION(context->response_event); |
| 5481 | context->request_id = request_id = reqMsg.requestId; |
| 5482 | spin_unlock(&hdd_context_lock); |
| 5483 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 5484 | status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5485 | if (!HAL_STATUS_SUCCESS(status)) { |
| 5486 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5487 | FL("sme_ResetBssHotlist failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5488 | return -EINVAL; |
| 5489 | } |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 5490 | |
| 5491 | /* request was sent -- wait for the response */ |
| 5492 | rc = wait_for_completion_timeout(&context->response_event, |
| 5493 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 5494 | if (!rc) { |
| 5495 | hddLog(LOGE, FL("sme_ResetBssHotlist timed out")); |
| 5496 | retval = -ETIMEDOUT; |
| 5497 | } else { |
| 5498 | spin_lock(&hdd_context_lock); |
| 5499 | if (context->request_id == request_id) |
| 5500 | retval = context->response_status; |
| 5501 | else |
| 5502 | retval = -EINVAL; |
| 5503 | spin_unlock(&hdd_context_lock); |
| 5504 | } |
| 5505 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5506 | EXIT(); |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 5507 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5508 | } |
| 5509 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5510 | static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
| 5511 | struct wireless_dev *wdev, |
| 5512 | const void *data, int dataLen) |
| 5513 | { |
| 5514 | int ret = 0; |
| 5515 | |
| 5516 | vos_ssr_protect(__func__); |
| 5517 | ret = __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(wiphy, wdev, data, dataLen); |
| 5518 | vos_ssr_unprotect(__func__); |
| 5519 | |
| 5520 | return ret; |
| 5521 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5522 | #endif /* WLAN_FEATURE_EXTSCAN */ |
| 5523 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5524 | /*EXT TDLS*/ |
| 5525 | static const struct nla_policy |
| 5526 | wlan_hdd_tdls_config_enable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX +1] = |
| 5527 | { |
Jeff Johnson | da8c3a7 | 2017-06-23 15:59:08 +0530 | [diff] [blame] | 5528 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR] = { |
| 5529 | .type = NLA_UNSPEC, |
| 5530 | .len = HDD_MAC_ADDR_LEN}, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5531 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL] = {.type = NLA_S32 }, |
| 5532 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS] = |
| 5533 | {.type = NLA_S32 }, |
| 5534 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS] = {.type = NLA_S32 }, |
| 5535 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS] = {.type = NLA_S32 }, |
| 5536 | |
| 5537 | }; |
| 5538 | |
| 5539 | static const struct nla_policy |
| 5540 | wlan_hdd_tdls_config_disable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX +1] = |
| 5541 | { |
Jeff Johnson | da8c3a7 | 2017-06-23 15:59:08 +0530 | [diff] [blame] | 5542 | [QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR] = { |
| 5543 | .type = NLA_UNSPEC, |
| 5544 | .len = HDD_MAC_ADDR_LEN}, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5545 | |
| 5546 | }; |
| 5547 | |
| 5548 | static const struct nla_policy |
| 5549 | wlan_hdd_tdls_config_state_change_policy[ |
| 5550 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAX +1] = |
| 5551 | { |
Jeff Johnson | da8c3a7 | 2017-06-23 15:59:08 +0530 | [diff] [blame] | 5552 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR] = { |
| 5553 | .type = NLA_UNSPEC, |
| 5554 | .len = HDD_MAC_ADDR_LEN}, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5555 | [QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE] = {.type = NLA_S32 }, |
| 5556 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5557 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL] = {.type = NLA_S32 }, |
| 5558 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS] = |
| 5559 | {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5560 | |
| 5561 | }; |
| 5562 | |
| 5563 | static const struct nla_policy |
| 5564 | wlan_hdd_tdls_config_get_status_policy[ |
| 5565 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX +1] = |
| 5566 | { |
Jeff Johnson | da8c3a7 | 2017-06-23 15:59:08 +0530 | [diff] [blame] | 5567 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR] = { |
| 5568 | .type = NLA_UNSPEC, |
| 5569 | .len = HDD_MAC_ADDR_LEN}, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5570 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE] = {.type = NLA_S32 }, |
| 5571 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5572 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL] = {.type = NLA_S32 }, |
| 5573 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS] |
| 5574 | = {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5575 | |
| 5576 | }; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5577 | |
| 5578 | static const struct nla_policy |
| 5579 | wlan_hdd_mac_config[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX+1] = |
| 5580 | { |
Jeff Johnson | da8c3a7 | 2017-06-23 15:59:08 +0530 | [diff] [blame] | 5581 | [QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI] = { |
| 5582 | .type = NLA_UNSPEC, |
| 5583 | .len = VOS_MAC_ADDR_FIRST_3_BYTES}, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5584 | }; |
| 5585 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5586 | static int __wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5587 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5588 | const void *data, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5589 | int data_len) |
| 5590 | { |
| 5591 | |
| 5592 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5593 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX + 1]; |
| 5594 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5595 | ENTER(); |
| 5596 | |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5597 | if (0 != wlan_hdd_validate_context(pHddCtx)){ |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5598 | return -EINVAL; |
| 5599 | } |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 5600 | if (0 == pHddCtx->cfg_ini->enableMacSpoofing) { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 5601 | hddLog(VOS_TRACE_LEVEL_INFO, FL("MAC_SPOOFED_SCAN disabled in ini")); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5602 | return -ENOTSUPP; |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 5603 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5604 | if (TRUE != sme_IsFeatureSupportedByFW(MAC_SPOOFED_SCAN)){ |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 5605 | 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] | 5606 | return -ENOTSUPP; |
| 5607 | } |
| 5608 | |
| 5609 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX, |
| 5610 | data, data_len, wlan_hdd_mac_config)) { |
| 5611 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5612 | return -EINVAL; |
| 5613 | } |
| 5614 | |
| 5615 | /* Parse and fetch mac address */ |
| 5616 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]) { |
| 5617 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5618 | return -EINVAL; |
| 5619 | } |
| 5620 | |
| 5621 | memcpy(pHddCtx->spoofMacAddr.randomMacAddr.bytes, nla_data( |
| 5622 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 5623 | VOS_MAC_ADDR_LAST_3_BYTES); |
| 5624 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 5625 | pHddCtx->spoofMacAddr.isEnabled = TRUE; |
| 5626 | |
| 5627 | 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] | 5628 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 5629 | VOS_MAC_ADDR_FIRST_3_BYTES); |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 5630 | if ((pHddCtx->spoofMacAddr.randomMacAddr.bytes[0] == 0) && |
| 5631 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[1] == 0) && |
| 5632 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[2] == 0)) |
| 5633 | { |
| 5634 | hddLog(LOG1, FL("ZERO MAC OUI Recieved. Disabling Spoofing")); |
| 5635 | vos_mem_zero(pHddCtx->spoofMacAddr.randomMacAddr.bytes, |
| 5636 | VOS_MAC_ADDRESS_LEN); |
| 5637 | pHddCtx->spoofMacAddr.isEnabled = FALSE; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5638 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5639 | |
Padma, Santhosh Kumar | db2d75b | 2015-11-17 12:18:10 +0530 | [diff] [blame] | 5640 | schedule_delayed_work(&pHddCtx->spoof_mac_addr_work, |
| 5641 | msecs_to_jiffies(MAC_ADDR_SPOOFING_DEFER_INTERVAL)); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5642 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5643 | EXIT(); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5644 | return 0; |
| 5645 | } |
| 5646 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5647 | static int wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
| 5648 | struct wireless_dev *wdev, |
| 5649 | const void *data, |
| 5650 | int data_len) |
| 5651 | { |
| 5652 | int ret = 0; |
| 5653 | |
| 5654 | vos_ssr_protect(__func__); |
| 5655 | ret = __wlan_hdd_cfg80211_set_spoofed_mac_oui(wiphy, wdev, data, data_len); |
| 5656 | vos_ssr_unprotect(__func__); |
| 5657 | |
| 5658 | return ret; |
| 5659 | } |
| 5660 | |
| 5661 | static int __wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5662 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5663 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5664 | int data_len) |
| 5665 | { |
| 5666 | u8 peer[6] = {0}; |
| 5667 | struct net_device *dev = wdev->netdev; |
| 5668 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5669 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5670 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; |
| 5671 | eHalStatus ret; |
| 5672 | tANI_S32 state; |
| 5673 | tANI_S32 reason; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5674 | tANI_S32 global_operating_class = 0; |
| 5675 | tANI_S32 channel = 0; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5676 | struct sk_buff *skb = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5677 | int retVal; |
| 5678 | |
| 5679 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5680 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5681 | if (!pAdapter) { |
| 5682 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 5683 | return -EINVAL; |
| 5684 | } |
| 5685 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5686 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5687 | if (0 != ret) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5688 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5689 | return -EINVAL; |
| 5690 | } |
| 5691 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5692 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5693 | return -ENOTSUPP; |
| 5694 | } |
| 5695 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, |
| 5696 | data, data_len, |
| 5697 | wlan_hdd_tdls_config_get_status_policy)) { |
| 5698 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5699 | return -EINVAL; |
| 5700 | } |
| 5701 | |
| 5702 | /* Parse and fetch mac address */ |
| 5703 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]) { |
| 5704 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5705 | return -EINVAL; |
| 5706 | } |
| 5707 | |
| 5708 | memcpy(peer, nla_data( |
| 5709 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]), |
| 5710 | sizeof(peer)); |
| 5711 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 5712 | |
Konamki, Sreelakshmi | abb59ed | 2015-06-12 12:13:23 +0530 | [diff] [blame] | 5713 | wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5714 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5715 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5716 | 4 * sizeof(s32) + |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5717 | NLMSG_HDRLEN); |
| 5718 | |
| 5719 | if (!skb) { |
| 5720 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5721 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 5722 | return -EINVAL; |
| 5723 | } |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5724 | 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] | 5725 | reason, |
| 5726 | state, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5727 | global_operating_class, |
| 5728 | channel, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5729 | MAC_ADDR_ARRAY(peer)); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5730 | if (nla_put_s32(skb, |
| 5731 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE, |
| 5732 | state) || |
| 5733 | nla_put_s32(skb, |
| 5734 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON, |
| 5735 | reason) || |
| 5736 | nla_put_s32(skb, |
| 5737 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS, |
| 5738 | global_operating_class) || |
| 5739 | nla_put_s32(skb, |
| 5740 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL, |
| 5741 | channel)) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5742 | |
| 5743 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 5744 | goto nla_put_failure; |
| 5745 | } |
| 5746 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5747 | retVal = cfg80211_vendor_cmd_reply(skb); |
| 5748 | EXIT(); |
| 5749 | return retVal; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5750 | |
| 5751 | nla_put_failure: |
| 5752 | kfree_skb(skb); |
| 5753 | return -EINVAL; |
| 5754 | } |
| 5755 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5756 | static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
| 5757 | struct wireless_dev *wdev, |
| 5758 | const void *data, |
| 5759 | int data_len) |
| 5760 | { |
| 5761 | int ret = 0; |
| 5762 | |
| 5763 | vos_ssr_protect(__func__); |
| 5764 | ret = __wlan_hdd_cfg80211_exttdls_get_status(wiphy, wdev, data, data_len); |
| 5765 | vos_ssr_unprotect(__func__); |
| 5766 | |
| 5767 | return ret; |
| 5768 | } |
| 5769 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 5770 | static int wlan_hdd_cfg80211_exttdls_callback( |
| 5771 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 5772 | const tANI_U8* mac, |
| 5773 | #else |
| 5774 | tANI_U8* mac, |
| 5775 | #endif |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5776 | tANI_S32 state, |
| 5777 | tANI_S32 reason, |
| 5778 | void *ctx) |
| 5779 | { |
| 5780 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)ctx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5781 | struct sk_buff *skb = NULL; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5782 | tANI_S32 global_operating_class = 0; |
| 5783 | tANI_S32 channel = 0; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5784 | hdd_context_t *pHddCtx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5785 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5786 | ENTER(); |
| 5787 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5788 | if (!pAdapter) { |
| 5789 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 5790 | return -EINVAL; |
| 5791 | } |
| 5792 | |
| 5793 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5794 | if (wlan_hdd_validate_context(pHddCtx)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5795 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5796 | return -EINVAL; |
| 5797 | } |
| 5798 | |
| 5799 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5800 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5801 | return -ENOTSUPP; |
| 5802 | } |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 5803 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 5804 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 5805 | NULL, |
| 5806 | #endif |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5807 | EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 5808 | QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX, |
| 5809 | GFP_KERNEL); |
| 5810 | |
| 5811 | if (!skb) { |
| 5812 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5813 | FL("cfg80211_vendor_event_alloc failed")); |
| 5814 | return -EINVAL; |
| 5815 | } |
| 5816 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5817 | hddLog(VOS_TRACE_LEVEL_INFO, "Reason: (%d) Status: (%d) Class: (%d) Channel: (%d)", |
| 5818 | reason, |
| 5819 | state, |
| 5820 | global_operating_class, |
| 5821 | channel); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5822 | hddLog(VOS_TRACE_LEVEL_WARN, "tdls peer " MAC_ADDRESS_STR, |
| 5823 | MAC_ADDR_ARRAY(mac)); |
| 5824 | |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5825 | if (nla_put(skb, |
| 5826 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR, |
| 5827 | VOS_MAC_ADDR_SIZE, mac) || |
| 5828 | nla_put_s32(skb, |
| 5829 | QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE, |
| 5830 | state) || |
| 5831 | nla_put_s32(skb, |
| 5832 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON, |
| 5833 | reason) || |
| 5834 | nla_put_s32(skb, |
| 5835 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL, |
| 5836 | channel) || |
| 5837 | nla_put_s32(skb, |
| 5838 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS, |
| 5839 | global_operating_class) |
| 5840 | ) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5841 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 5842 | goto nla_put_failure; |
| 5843 | } |
| 5844 | |
| 5845 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5846 | EXIT(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5847 | return (0); |
| 5848 | |
| 5849 | nla_put_failure: |
| 5850 | kfree_skb(skb); |
| 5851 | return -EINVAL; |
| 5852 | } |
| 5853 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5854 | static int __wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5855 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5856 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5857 | int data_len) |
| 5858 | { |
| 5859 | u8 peer[6] = {0}; |
| 5860 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5861 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5862 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1]; |
| 5863 | eHalStatus status; |
| 5864 | tdls_req_params_t pReqMsg = {0}; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5865 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5866 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5867 | |
| 5868 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5869 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5870 | if (!dev) { |
| 5871 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 5872 | return -EINVAL; |
| 5873 | } |
| 5874 | |
| 5875 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5876 | if (!pAdapter) { |
| 5877 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 5878 | return -EINVAL; |
| 5879 | } |
| 5880 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5881 | status = wlan_hdd_validate_context(pHddCtx); |
| 5882 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5883 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5884 | return -EINVAL; |
| 5885 | } |
| 5886 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5887 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5888 | return -ENOTSUPP; |
| 5889 | } |
| 5890 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX, |
| 5891 | data, data_len, |
| 5892 | wlan_hdd_tdls_config_enable_policy)) { |
| 5893 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5894 | return -EINVAL; |
| 5895 | } |
| 5896 | |
| 5897 | /* Parse and fetch mac address */ |
| 5898 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]) { |
| 5899 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5900 | return -EINVAL; |
| 5901 | } |
| 5902 | |
| 5903 | memcpy(peer, nla_data( |
| 5904 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]), |
| 5905 | sizeof(peer)); |
| 5906 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 5907 | |
| 5908 | /* Parse and fetch channel */ |
| 5909 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]) { |
| 5910 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 5911 | return -EINVAL; |
| 5912 | } |
| 5913 | pReqMsg.channel = nla_get_s32( |
| 5914 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]); |
| 5915 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Channel Num (%d)"), pReqMsg.channel); |
| 5916 | |
| 5917 | /* Parse and fetch global operating class */ |
| 5918 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]) { |
| 5919 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr operating class failed")); |
| 5920 | return -EINVAL; |
| 5921 | } |
| 5922 | pReqMsg.global_operating_class = nla_get_s32( |
| 5923 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]); |
| 5924 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Operating class (%d)"), |
| 5925 | pReqMsg.global_operating_class); |
| 5926 | |
| 5927 | /* Parse and fetch latency ms */ |
| 5928 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]) { |
| 5929 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr latency failed")); |
| 5930 | return -EINVAL; |
| 5931 | } |
| 5932 | pReqMsg.max_latency_ms = nla_get_s32( |
| 5933 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]); |
| 5934 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Latency (%d)"), |
| 5935 | pReqMsg.max_latency_ms); |
| 5936 | |
| 5937 | /* Parse and fetch required bandwidth kbps */ |
| 5938 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]) { |
| 5939 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bandwidth failed")); |
| 5940 | return -EINVAL; |
| 5941 | } |
| 5942 | |
| 5943 | pReqMsg.min_bandwidth_kbps = nla_get_s32( |
| 5944 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]); |
| 5945 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bandwidth (%d)"), |
| 5946 | pReqMsg.min_bandwidth_kbps); |
| 5947 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5948 | ret = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5949 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 5950 | &pReqMsg, |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5951 | wlan_hdd_cfg80211_exttdls_callback); |
| 5952 | |
| 5953 | EXIT(); |
| 5954 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5955 | } |
| 5956 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5957 | static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
| 5958 | struct wireless_dev *wdev, |
| 5959 | const void *data, |
| 5960 | int data_len) |
| 5961 | { |
| 5962 | int ret = 0; |
| 5963 | |
| 5964 | vos_ssr_protect(__func__); |
| 5965 | ret = __wlan_hdd_cfg80211_exttdls_enable(wiphy, wdev, data, data_len); |
| 5966 | vos_ssr_unprotect(__func__); |
| 5967 | |
| 5968 | return ret; |
| 5969 | } |
| 5970 | |
| 5971 | static int __wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5972 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5973 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5974 | int data_len) |
| 5975 | { |
| 5976 | u8 peer[6] = {0}; |
| 5977 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5978 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5979 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1]; |
| 5980 | eHalStatus status; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5981 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5982 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5983 | |
| 5984 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5985 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5986 | if (!dev) { |
| 5987 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 5988 | return -EINVAL; |
| 5989 | } |
| 5990 | |
| 5991 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5992 | if (!pAdapter) { |
| 5993 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 5994 | return -EINVAL; |
| 5995 | } |
| 5996 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5997 | status = wlan_hdd_validate_context(pHddCtx); |
| 5998 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5999 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 6000 | return -EINVAL; |
| 6001 | } |
| 6002 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 6003 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 6004 | return -ENOTSUPP; |
| 6005 | } |
| 6006 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX, |
| 6007 | data, data_len, |
| 6008 | wlan_hdd_tdls_config_disable_policy)) { |
| 6009 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 6010 | return -EINVAL; |
| 6011 | } |
| 6012 | /* Parse and fetch mac address */ |
| 6013 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]) { |
| 6014 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 6015 | return -EINVAL; |
| 6016 | } |
| 6017 | |
| 6018 | memcpy(peer, nla_data( |
| 6019 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]), |
| 6020 | sizeof(peer)); |
| 6021 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 6022 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6023 | ret = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
| 6024 | |
| 6025 | EXIT(); |
| 6026 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 6027 | } |
| 6028 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6029 | static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
| 6030 | struct wireless_dev *wdev, |
| 6031 | const void *data, |
| 6032 | int data_len) |
| 6033 | { |
| 6034 | int ret = 0; |
| 6035 | |
| 6036 | vos_ssr_protect(__func__); |
| 6037 | ret = __wlan_hdd_cfg80211_exttdls_disable(wiphy, wdev, data, data_len); |
| 6038 | vos_ssr_unprotect(__func__); |
| 6039 | |
| 6040 | return ret; |
| 6041 | } |
| 6042 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 6043 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6044 | __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 6045 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 6046 | const void *data, int data_len) |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 6047 | { |
| 6048 | struct net_device *dev = wdev->netdev; |
| 6049 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6050 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6051 | struct sk_buff *skb = NULL; |
| 6052 | tANI_U32 fset = 0; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6053 | int ret = 0; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 6054 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6055 | ENTER(); |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6056 | |
| 6057 | ret = wlan_hdd_validate_context(pHddCtx); |
| 6058 | if (0 != ret) |
| 6059 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6060 | return ret; |
| 6061 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 6062 | if (wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { |
| 6063 | hddLog(LOG1, FL("Infra Station mode is supported by driver")); |
| 6064 | fset |= WIFI_FEATURE_INFRA; |
| 6065 | } |
| 6066 | |
| 6067 | if (TRUE == hdd_is_5g_supported(pHddCtx)) { |
| 6068 | hddLog(LOG1, FL("INFRA_5G is supported by firmware")); |
| 6069 | fset |= WIFI_FEATURE_INFRA_5G; |
| 6070 | } |
| 6071 | |
| 6072 | #ifdef WLAN_FEATURE_P2P |
| 6073 | if ((wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) && |
| 6074 | (wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_GO))) { |
| 6075 | hddLog(LOG1, FL("WiFi-Direct is supported by driver")); |
| 6076 | fset |= WIFI_FEATURE_P2P; |
| 6077 | } |
| 6078 | #endif |
| 6079 | |
| 6080 | /* Soft-AP is supported currently by default */ |
| 6081 | fset |= WIFI_FEATURE_SOFT_AP; |
| 6082 | |
Kanchanapally, Vidyullatha | 683aed0 | 2015-03-24 16:58:38 +0530 | [diff] [blame] | 6083 | /* HOTSPOT is a supplicant feature, enable it by default */ |
| 6084 | fset |= WIFI_FEATURE_HOTSPOT; |
| 6085 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 6086 | #ifdef WLAN_FEATURE_EXTSCAN |
| 6087 | if ((TRUE == pHddCtx->cfg_ini->fEnableEXTScan) && |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 6088 | sme_IsFeatureSupportedByFW(EXTENDED_SCAN) && |
| 6089 | sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED)) { |
| 6090 | hddLog(LOG1, FL("Enhanced EXTScan is supported by firmware")); |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 6091 | fset |= WIFI_FEATURE_EXTSCAN; |
| 6092 | } |
| 6093 | #endif |
| 6094 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 6095 | if (sme_IsFeatureSupportedByFW(NAN)) { |
| 6096 | hddLog(LOG1, FL("NAN is supported by firmware")); |
| 6097 | fset |= WIFI_FEATURE_NAN; |
| 6098 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 6099 | |
| 6100 | /* D2D RTT is not supported currently by default */ |
Sourav Mohapatra | df8b23c | 2017-11-17 17:50:31 +0530 | [diff] [blame] | 6101 | if (sme_IsFeatureSupportedByFW(RTT) && |
| 6102 | pHddCtx->cfg_ini->enable_rtt_support) { |
| 6103 | hddLog(LOG1, FL("RTT is supported by firmware and framework")); |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 6104 | fset |= WIFI_FEATURE_D2AP_RTT; |
| 6105 | } |
| 6106 | |
Padma, Santhosh Kumar | aac4c4d | 2015-12-08 16:07:47 +0530 | [diff] [blame] | 6107 | if (sme_IsFeatureSupportedByFW(RTT3)) { |
| 6108 | hddLog(LOG1, FL("RTT3 is supported by firmware")); |
| 6109 | fset |= WIFI_FEATURE_RTT3; |
| 6110 | } |
| 6111 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 6112 | #ifdef FEATURE_WLAN_BATCH_SCAN |
| 6113 | if (fset & WIFI_FEATURE_EXTSCAN) { |
| 6114 | hddLog(LOG1, FL("Batch scan is supported as extscan is supported")); |
| 6115 | fset &= ~WIFI_FEATURE_BATCH_SCAN; |
| 6116 | } else if (sme_IsFeatureSupportedByFW(BATCH_SCAN)) { |
| 6117 | hddLog(LOG1, FL("Batch scan is supported by firmware")); |
| 6118 | fset |= WIFI_FEATURE_BATCH_SCAN; |
| 6119 | } |
| 6120 | #endif |
| 6121 | |
| 6122 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 6123 | if (pHddCtx->cfg_ini->configPNOScanSupport && |
| 6124 | (eHAL_STATUS_SUCCESS == wlan_hdd_is_pno_allowed(pAdapter))) { |
| 6125 | hddLog(LOG1, FL("PNO is supported by firmware")); |
| 6126 | fset |= WIFI_FEATURE_PNO; |
| 6127 | } |
| 6128 | #endif |
| 6129 | |
| 6130 | /* STA+STA is supported currently by default */ |
| 6131 | fset |= WIFI_FEATURE_ADDITIONAL_STA; |
| 6132 | |
| 6133 | #ifdef FEATURE_WLAN_TDLS |
| 6134 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSSupport) && |
| 6135 | sme_IsFeatureSupportedByFW(TDLS)) { |
| 6136 | hddLog(LOG1, FL("TDLS is supported by firmware")); |
| 6137 | fset |= WIFI_FEATURE_TDLS; |
| 6138 | } |
| 6139 | |
| 6140 | /* TDLS_OFFCHANNEL is not supported currently by default */ |
| 6141 | #endif |
| 6142 | |
| 6143 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 6144 | /* AP+STA concurrency is supported currently by default */ |
| 6145 | fset |= WIFI_FEATURE_AP_STA; |
| 6146 | #endif |
| 6147 | |
Mukul Sharma | 5add053 | 2015-08-17 15:57:47 +0530 | [diff] [blame] | 6148 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
Ajit Vaishya | 8353cfb | 2017-11-10 16:22:36 +0530 | [diff] [blame] | 6149 | if ((TRUE == pHddCtx->cfg_ini->fEnableLLStats) && |
| 6150 | (TRUE == sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) { |
Mukul Sharma | 5add053 | 2015-08-17 15:57:47 +0530 | [diff] [blame] | 6151 | fset |= WIFI_FEATURE_LINK_LAYER_STATS; |
| 6152 | hddLog(LOG1, FL("Link layer stats is supported by driver")); |
Ajit Vaishya | 8353cfb | 2017-11-10 16:22:36 +0530 | [diff] [blame] | 6153 | } |
Mukul Sharma | 5add053 | 2015-08-17 15:57:47 +0530 | [diff] [blame] | 6154 | #endif |
| 6155 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 6156 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) + |
| 6157 | NLMSG_HDRLEN); |
| 6158 | |
| 6159 | if (!skb) { |
| 6160 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 6161 | return -EINVAL; |
| 6162 | } |
| 6163 | hddLog(LOG1, FL("Supported Features : 0x%x"), fset); |
| 6164 | |
| 6165 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_FEATURE_SET, fset)) { |
| 6166 | hddLog(LOGE, FL("nla put fail")); |
| 6167 | goto nla_put_failure; |
| 6168 | } |
| 6169 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6170 | ret = cfg80211_vendor_cmd_reply(skb); |
| 6171 | EXIT(); |
| 6172 | return ret; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 6173 | |
| 6174 | nla_put_failure: |
| 6175 | kfree_skb(skb); |
| 6176 | return -EINVAL; |
| 6177 | } |
| 6178 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 6179 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6180 | wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
| 6181 | struct wireless_dev *wdev, |
| 6182 | const void *data, int data_len) |
| 6183 | { |
| 6184 | int ret = 0; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6185 | vos_ssr_protect(__func__); |
| 6186 | ret = __wlan_hdd_cfg80211_get_supported_features(wiphy, wdev, data, data_len); |
| 6187 | vos_ssr_unprotect(__func__); |
| 6188 | |
| 6189 | return ret; |
| 6190 | } |
| 6191 | |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 6192 | |
| 6193 | static const struct |
| 6194 | nla_policy |
| 6195 | qca_wlan_vendor_wifi_logger_get_ring_data_policy |
| 6196 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX + 1] = { |
| 6197 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID] |
| 6198 | = {.type = NLA_U32 }, |
| 6199 | }; |
| 6200 | |
| 6201 | static int |
| 6202 | __wlan_hdd_cfg80211_wifi_logger_get_ring_data(struct wiphy *wiphy, |
| 6203 | struct wireless_dev *wdev, |
| 6204 | const void *data, |
| 6205 | int data_len) |
| 6206 | { |
| 6207 | int ret; |
| 6208 | VOS_STATUS status; |
| 6209 | uint32_t ring_id; |
| 6210 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6211 | struct nlattr *tb |
| 6212 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX + 1]; |
| 6213 | |
| 6214 | ENTER(); |
| 6215 | |
| 6216 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6217 | if (0 != ret) { |
| 6218 | return ret; |
| 6219 | } |
| 6220 | |
| 6221 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX, |
| 6222 | data, data_len, |
| 6223 | qca_wlan_vendor_wifi_logger_get_ring_data_policy)) { |
| 6224 | hddLog(LOGE, FL("Invalid attribute")); |
| 6225 | return -EINVAL; |
| 6226 | } |
| 6227 | |
| 6228 | /* Parse and fetch ring id */ |
| 6229 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID]) { |
| 6230 | hddLog(LOGE, FL("attr ATTR failed")); |
| 6231 | return -EINVAL; |
| 6232 | } |
| 6233 | |
| 6234 | ring_id = nla_get_u32( |
| 6235 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID]); |
| 6236 | |
| 6237 | hddLog(LOG1, FL("Bug report triggered by framework")); |
| 6238 | |
| 6239 | status = vos_fatal_event_logs_req(WLAN_LOG_TYPE_NON_FATAL, |
| 6240 | WLAN_LOG_INDICATOR_FRAMEWORK, |
| 6241 | WLAN_LOG_REASON_CODE_FRAMEWORK, |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 6242 | TRUE, TRUE |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 6243 | ); |
| 6244 | if (VOS_STATUS_SUCCESS != status) { |
| 6245 | hddLog(LOGE, FL("Failed to trigger bug report")); |
| 6246 | |
| 6247 | return -EINVAL; |
| 6248 | } |
| 6249 | |
| 6250 | return 0; |
| 6251 | |
| 6252 | |
| 6253 | } |
| 6254 | |
| 6255 | |
| 6256 | static int |
| 6257 | wlan_hdd_cfg80211_wifi_logger_get_ring_data(struct wiphy *wiphy, |
| 6258 | struct wireless_dev *wdev, |
| 6259 | const void *data, |
| 6260 | int data_len) |
| 6261 | { |
| 6262 | int ret = 0; |
| 6263 | |
| 6264 | vos_ssr_protect(__func__); |
| 6265 | ret = __wlan_hdd_cfg80211_wifi_logger_get_ring_data(wiphy, |
| 6266 | wdev, data, data_len); |
| 6267 | vos_ssr_unprotect(__func__); |
| 6268 | |
| 6269 | return ret; |
| 6270 | |
| 6271 | } |
| 6272 | |
Rajeev Kumar Sirasanagandla | 4c00e0d | 2017-06-13 12:04:09 +0530 | [diff] [blame] | 6273 | #define MAX_CONCURRENT_MATRIX \ |
| 6274 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX |
| 6275 | #define MATRIX_CONFIG_PARAM_SET_SIZE_MAX \ |
| 6276 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX |
| 6277 | static const struct nla_policy |
| 6278 | wlan_hdd_get_concurrency_matrix_policy[MAX_CONCURRENT_MATRIX + 1] = { |
| 6279 | [MATRIX_CONFIG_PARAM_SET_SIZE_MAX] = {.type = NLA_U32}, |
| 6280 | }; |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 6281 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6282 | static int |
| 6283 | __wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 6284 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 6285 | const void *data, int data_len) |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 6286 | { |
| 6287 | uint32_t feature_set_matrix[WLAN_HDD_MAX_FEATURE_SET] = {0}; |
| 6288 | uint8_t i, feature_sets, max_feature_sets; |
Rajeev Kumar Sirasanagandla | 4c00e0d | 2017-06-13 12:04:09 +0530 | [diff] [blame] | 6289 | struct nlattr *tb[MAX_CONCURRENT_MATRIX + 1]; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 6290 | struct sk_buff *reply_skb; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6291 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6292 | int ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 6293 | |
| 6294 | ENTER(); |
| 6295 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6296 | ret = wlan_hdd_validate_context(pHddCtx); |
| 6297 | if (0 != ret) |
| 6298 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6299 | return ret; |
| 6300 | } |
| 6301 | |
Rajeev Kumar Sirasanagandla | 4c00e0d | 2017-06-13 12:04:09 +0530 | [diff] [blame] | 6302 | if (nla_parse(tb, MAX_CONCURRENT_MATRIX, data, data_len, |
| 6303 | wlan_hdd_get_concurrency_matrix_policy)) { |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 6304 | hddLog(LOGE, FL("Invalid ATTR")); |
| 6305 | return -EINVAL; |
| 6306 | } |
| 6307 | |
| 6308 | /* Parse and fetch max feature set */ |
Rajeev Kumar Sirasanagandla | 4c00e0d | 2017-06-13 12:04:09 +0530 | [diff] [blame] | 6309 | if (!tb[MATRIX_CONFIG_PARAM_SET_SIZE_MAX]) { |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 6310 | hddLog(LOGE, FL("Attr max feature set size failed")); |
| 6311 | return -EINVAL; |
| 6312 | } |
Rajeev Kumar Sirasanagandla | 4c00e0d | 2017-06-13 12:04:09 +0530 | [diff] [blame] | 6313 | max_feature_sets = nla_get_u32(tb[MATRIX_CONFIG_PARAM_SET_SIZE_MAX]); |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 6314 | hddLog(LOG1, FL("Max feature set size (%d)"), max_feature_sets); |
| 6315 | |
| 6316 | /* Fill feature combination matrix */ |
| 6317 | feature_sets = 0; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 6318 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 6319 | WIFI_FEATURE_P2P; |
| 6320 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 6321 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 6322 | WIFI_FEATURE_SOFT_AP; |
| 6323 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 6324 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_P2P | |
| 6325 | WIFI_FEATURE_SOFT_AP; |
| 6326 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 6327 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 6328 | WIFI_FEATURE_SOFT_AP | |
| 6329 | WIFI_FEATURE_P2P; |
| 6330 | |
| 6331 | /* Add more feature combinations here */ |
| 6332 | |
| 6333 | feature_sets = VOS_MIN(feature_sets, max_feature_sets); |
| 6334 | hddLog(LOG1, FL("Number of feature sets (%d)"), feature_sets); |
| 6335 | hddLog(LOG1, "Feature set matrix"); |
| 6336 | for (i = 0; i < feature_sets; i++) |
| 6337 | hddLog(LOG1, "[%d] 0x%02X", i, feature_set_matrix[i]); |
| 6338 | |
| 6339 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 6340 | sizeof(u32) * feature_sets + |
| 6341 | NLMSG_HDRLEN); |
| 6342 | |
| 6343 | if (reply_skb) { |
| 6344 | if (nla_put_u32(reply_skb, |
| 6345 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET_SIZE, |
| 6346 | feature_sets) || |
| 6347 | nla_put(reply_skb, |
| 6348 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET, |
| 6349 | sizeof(u32) * feature_sets, feature_set_matrix)) { |
| 6350 | hddLog(LOGE, FL("nla put fail")); |
| 6351 | kfree_skb(reply_skb); |
| 6352 | return -EINVAL; |
| 6353 | } |
| 6354 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6355 | ret = cfg80211_vendor_cmd_reply(reply_skb); |
| 6356 | EXIT(); |
| 6357 | return ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 6358 | } |
| 6359 | hddLog(LOGE, FL("Feature set matrix: buffer alloc fail")); |
| 6360 | return -ENOMEM; |
| 6361 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 6362 | } |
| 6363 | |
Rajeev Kumar Sirasanagandla | 4c00e0d | 2017-06-13 12:04:09 +0530 | [diff] [blame] | 6364 | #undef MAX_CONCURRENT_MATRIX |
| 6365 | #undef MATRIX_CONFIG_PARAM_SET_SIZE_MAX |
| 6366 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6367 | static int |
| 6368 | wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
| 6369 | struct wireless_dev *wdev, |
| 6370 | const void *data, int data_len) |
| 6371 | { |
| 6372 | int ret = 0; |
| 6373 | |
| 6374 | vos_ssr_protect(__func__); |
| 6375 | ret = __wlan_hdd_cfg80211_get_concurrency_matrix(wiphy, wdev, data, |
| 6376 | data_len); |
| 6377 | vos_ssr_unprotect(__func__); |
| 6378 | |
| 6379 | return ret; |
| 6380 | } |
| 6381 | |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 6382 | |
| 6383 | static int |
| 6384 | __wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy, |
| 6385 | struct wireless_dev *wdev, |
| 6386 | const void *data, int data_len) |
| 6387 | { |
| 6388 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6389 | int ret; |
| 6390 | ENTER(); |
| 6391 | |
| 6392 | ret = wlan_hdd_validate_context(pHddCtx); |
| 6393 | if (0 != ret) |
| 6394 | { |
| 6395 | return ret; |
| 6396 | } |
| 6397 | |
| 6398 | if( !pHddCtx->cfg_ini->enableFwrMemDump || |
| 6399 | (FALSE == sme_IsFeatureSupportedByFW(MEMORY_DUMP_SUPPORTED))) |
| 6400 | { |
| 6401 | hddLog(VOS_TRACE_LEVEL_INFO, FL("FW dump Logging not supported")); |
Ajit Vaishya | c5ba848 | 2017-11-16 14:10:37 +0530 | [diff] [blame] | 6402 | return -EOPNOTSUPP; |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 6403 | } |
| 6404 | /*call common API for FW mem dump req*/ |
| 6405 | ret = wlan_hdd_fw_mem_dump_req(pHddCtx); |
| 6406 | |
Abhishek Singh | c783fa7 | 2015-12-09 18:07:34 +0530 | [diff] [blame] | 6407 | if (!ret) |
c_manjee | 04b4c5c | 2015-10-13 18:35:01 +0530 | [diff] [blame] | 6408 | { |
| 6409 | /*indicate to userspace the status of fw mem dump */ |
| 6410 | wlan_indicate_mem_dump_complete(true); |
| 6411 | } |
| 6412 | else |
| 6413 | { |
| 6414 | /*else send failure to userspace */ |
| 6415 | wlan_indicate_mem_dump_complete(false); |
| 6416 | } |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 6417 | EXIT(); |
| 6418 | return ret; |
| 6419 | } |
| 6420 | |
| 6421 | /** |
| 6422 | * wlan_hdd_cfg80211_get_fw_mem_dump() - Get FW memory dump |
| 6423 | * @wiphy: pointer to wireless wiphy structure. |
| 6424 | * @wdev: pointer to wireless_dev structure. |
| 6425 | * @data: Pointer to the NL data. |
| 6426 | * @data_len:Length of @data |
| 6427 | * |
| 6428 | * This is called when wlan driver needs to get the firmware memory dump |
| 6429 | * via vendor specific command. |
| 6430 | * |
| 6431 | * Return: 0 on success, error number otherwise. |
| 6432 | */ |
| 6433 | |
| 6434 | static int |
| 6435 | wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy, |
| 6436 | struct wireless_dev *wdev, |
| 6437 | const void *data, int data_len) |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 6438 | { |
| 6439 | int ret = 0; |
| 6440 | vos_ssr_protect(__func__); |
| 6441 | ret = __wlan_hdd_cfg80211_get_fw_mem_dump(wiphy, wdev, data, |
| 6442 | data_len); |
| 6443 | vos_ssr_unprotect(__func__); |
| 6444 | return ret; |
| 6445 | } |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 6446 | |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 6447 | static const struct |
| 6448 | nla_policy |
| 6449 | qca_wlan_vendor_wifi_logger_start_policy |
| 6450 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX + 1] = { |
| 6451 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID] |
| 6452 | = {.type = NLA_U32 }, |
| 6453 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL] |
| 6454 | = {.type = NLA_U32 }, |
| 6455 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS] |
| 6456 | = {.type = NLA_U32 }, |
| 6457 | }; |
| 6458 | |
| 6459 | /** |
| 6460 | * __wlan_hdd_cfg80211_wifi_logger_start() - This function is used to enable |
| 6461 | * or disable the collection of packet statistics from the firmware |
| 6462 | * @wiphy: WIPHY structure pointer |
| 6463 | * @wdev: Wireless device structure pointer |
| 6464 | * @data: Pointer to the data received |
| 6465 | * @data_len: Length of the data received |
| 6466 | * |
| 6467 | * This function is used to enable or disable the collection of packet |
| 6468 | * statistics from the firmware |
| 6469 | * |
| 6470 | * Return: 0 on success and errno on failure |
| 6471 | */ |
| 6472 | static int __wlan_hdd_cfg80211_wifi_logger_start(struct wiphy *wiphy, |
| 6473 | struct wireless_dev *wdev, |
| 6474 | const void *data, |
| 6475 | int data_len) |
| 6476 | { |
| 6477 | eHalStatus status; |
| 6478 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6479 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX + 1]; |
| 6480 | tAniWifiStartLog start_log; |
| 6481 | |
| 6482 | status = wlan_hdd_validate_context(hdd_ctx); |
| 6483 | if (0 != status) { |
| 6484 | return -EINVAL; |
| 6485 | } |
| 6486 | |
| 6487 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX, |
| 6488 | data, data_len, |
| 6489 | qca_wlan_vendor_wifi_logger_start_policy)) { |
| 6490 | hddLog(LOGE, FL("Invalid attribute")); |
| 6491 | return -EINVAL; |
| 6492 | } |
| 6493 | |
| 6494 | /* Parse and fetch ring id */ |
| 6495 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID]) { |
| 6496 | hddLog(LOGE, FL("attr ATTR failed")); |
| 6497 | return -EINVAL; |
| 6498 | } |
| 6499 | start_log.ringId = nla_get_u32( |
| 6500 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID]); |
| 6501 | hddLog(LOG1, FL("Ring ID=%d"), start_log.ringId); |
| 6502 | |
| 6503 | /* Parse and fetch verbose level */ |
| 6504 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL]) { |
| 6505 | hddLog(LOGE, FL("attr verbose_level failed")); |
| 6506 | return -EINVAL; |
| 6507 | } |
| 6508 | start_log.verboseLevel = nla_get_u32( |
| 6509 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL]); |
| 6510 | hddLog(LOG1, FL("verbose_level=%d"), start_log.verboseLevel); |
| 6511 | |
| 6512 | /* Parse and fetch flag */ |
| 6513 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS]) { |
| 6514 | hddLog(LOGE, FL("attr flag failed")); |
| 6515 | return -EINVAL; |
| 6516 | } |
| 6517 | start_log.flag = nla_get_u32( |
| 6518 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS]); |
| 6519 | hddLog(LOG1, FL("flag=%d"), start_log.flag); |
| 6520 | |
| 6521 | if ((RING_ID_PER_PACKET_STATS == start_log.ringId) && |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 6522 | (!hdd_ctx->cfg_ini->wlanPerPktStatsLogEnable || |
| 6523 | !vos_isPktStatsEnabled())) |
| 6524 | |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 6525 | { |
| 6526 | hddLog(LOGE, FL("per pkt stats not enabled")); |
| 6527 | return -EINVAL; |
| 6528 | } |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 6529 | |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 6530 | vos_set_ring_log_level(start_log.ringId, start_log.verboseLevel); |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 6531 | return 0; |
| 6532 | } |
| 6533 | |
| 6534 | /** |
| 6535 | * wlan_hdd_cfg80211_wifi_logger_start() - Wrapper function used to enable |
| 6536 | * or disable the collection of packet statistics from the firmware |
| 6537 | * @wiphy: WIPHY structure pointer |
| 6538 | * @wdev: Wireless device structure pointer |
| 6539 | * @data: Pointer to the data received |
| 6540 | * @data_len: Length of the data received |
| 6541 | * |
| 6542 | * This function is used to enable or disable the collection of packet |
| 6543 | * statistics from the firmware |
| 6544 | * |
| 6545 | * Return: 0 on success and errno on failure |
| 6546 | */ |
| 6547 | static int wlan_hdd_cfg80211_wifi_logger_start(struct wiphy *wiphy, |
| 6548 | struct wireless_dev *wdev, |
| 6549 | const void *data, |
| 6550 | int data_len) |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 6551 | { |
| 6552 | int ret = 0; |
| 6553 | |
| 6554 | vos_ssr_protect(__func__); |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 6555 | |
| 6556 | ret = __wlan_hdd_cfg80211_wifi_logger_start(wiphy, |
| 6557 | wdev, data, data_len); |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 6558 | vos_ssr_unprotect(__func__); |
| 6559 | |
| 6560 | return ret; |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 6561 | } |
| 6562 | |
| 6563 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6564 | static const struct nla_policy |
| 6565 | wlan_hdd_set_no_dfs_flag_config_policy[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX |
| 6566 | +1] = |
| 6567 | { |
| 6568 | [QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG] = {.type = NLA_U32 }, |
| 6569 | }; |
| 6570 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6571 | static int __wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6572 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 6573 | const void *data, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6574 | int data_len) |
| 6575 | { |
| 6576 | struct net_device *dev = wdev->netdev; |
| 6577 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6578 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6579 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6580 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX + 1]; |
| 6581 | eHalStatus status; |
| 6582 | u32 dfsFlag = 0; |
| 6583 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6584 | ENTER(); |
| 6585 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6586 | status = wlan_hdd_validate_context(pHddCtx); |
| 6587 | if (0 != status) { |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6588 | return -EINVAL; |
| 6589 | } |
| 6590 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX, |
| 6591 | data, data_len, |
| 6592 | wlan_hdd_set_no_dfs_flag_config_policy)) { |
| 6593 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 6594 | return -EINVAL; |
| 6595 | } |
| 6596 | |
| 6597 | /* Parse and fetch required bandwidth kbps */ |
| 6598 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]) { |
| 6599 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dfs flag failed")); |
| 6600 | return -EINVAL; |
| 6601 | } |
| 6602 | |
| 6603 | dfsFlag = nla_get_u32( |
| 6604 | tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]); |
| 6605 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" DFS flag (%d)"), |
| 6606 | dfsFlag); |
| 6607 | |
| 6608 | pHddCtx->disable_dfs_flag = dfsFlag; |
| 6609 | |
| 6610 | sme_disable_dfs_channel(hHal, dfsFlag); |
| 6611 | sme_FilterScanResults(hHal, pAdapter->sessionId); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6612 | |
| 6613 | EXIT(); |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6614 | return 0; |
| 6615 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 6616 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6617 | static int wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
| 6618 | struct wireless_dev *wdev, |
| 6619 | const void *data, |
| 6620 | int data_len) |
| 6621 | { |
| 6622 | int ret = 0; |
| 6623 | |
| 6624 | vos_ssr_protect(__func__); |
| 6625 | ret = __wlan_hdd_cfg80211_disable_dfs_channels(wiphy, wdev, data, data_len); |
| 6626 | vos_ssr_unprotect(__func__); |
| 6627 | |
| 6628 | return ret; |
| 6629 | |
| 6630 | } |
| 6631 | |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6632 | const struct |
| 6633 | nla_policy qca_wlan_vendor_attr[QCA_WLAN_VENDOR_ATTR_MAX+1] = |
| 6634 | { |
| 6635 | [QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY] = { .type = NLA_U32 }, |
Jeff Johnson | da8c3a7 | 2017-06-23 15:59:08 +0530 | [diff] [blame] | 6636 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { |
| 6637 | .type = NLA_UNSPEC, |
| 6638 | .len = HDD_MAC_ADDR_LEN}, |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6639 | }; |
| 6640 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6641 | static int __wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 6642 | struct wireless_dev *wdev, const void *data, int data_len) |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6643 | { |
| 6644 | |
| 6645 | u8 bssid[6] = {0}; |
| 6646 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6647 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 6648 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6649 | v_U32_t isFwrRoamEnabled = FALSE; |
| 6650 | int ret; |
| 6651 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6652 | ENTER(); |
| 6653 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6654 | ret = wlan_hdd_validate_context(pHddCtx); |
| 6655 | if (0 != ret) { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6656 | return ret; |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6657 | } |
| 6658 | |
| 6659 | ret = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, |
| 6660 | data, data_len, |
| 6661 | qca_wlan_vendor_attr); |
| 6662 | if (ret){ |
| 6663 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 6664 | return -EINVAL; |
| 6665 | } |
| 6666 | |
| 6667 | /* Parse and fetch Enable flag */ |
| 6668 | if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]) { |
| 6669 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr enable failed")); |
| 6670 | return -EINVAL; |
| 6671 | } |
| 6672 | |
| 6673 | isFwrRoamEnabled = nla_get_u32( |
| 6674 | tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]); |
| 6675 | |
| 6676 | hddLog(VOS_TRACE_LEVEL_INFO, FL("isFwrRoamEnabled (%d)"), isFwrRoamEnabled); |
| 6677 | |
| 6678 | /* Parse and fetch bssid */ |
| 6679 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 6680 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bss id failed")); |
| 6681 | return -EINVAL; |
| 6682 | } |
| 6683 | |
| 6684 | memcpy(bssid, nla_data( |
| 6685 | tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 6686 | sizeof(bssid)); |
| 6687 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(bssid)); |
| 6688 | |
| 6689 | //Update roaming |
| 6690 | status = sme_ConfigFwrRoaming((tHalHandle)(pHddCtx->hHal), isFwrRoamEnabled); |
Abhishek Singh | c6ab38f | 2016-06-28 17:48:16 +0530 | [diff] [blame] | 6691 | if (!HAL_STATUS_SUCCESS(status)) { |
| 6692 | hddLog(LOGE, |
| 6693 | FL("sme_ConfigFwrRoaming failed (err=%d)"), status); |
| 6694 | return -EINVAL; |
| 6695 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6696 | EXIT(); |
Abhishek Singh | c6ab38f | 2016-06-28 17:48:16 +0530 | [diff] [blame] | 6697 | return 0; |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6698 | } |
| 6699 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6700 | static int wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
| 6701 | struct wireless_dev *wdev, const void *data, int data_len) |
| 6702 | { |
| 6703 | int ret = 0; |
| 6704 | |
| 6705 | vos_ssr_protect(__func__); |
| 6706 | ret = __wlan_hdd_cfg80211_firmware_roaming(wiphy, wdev, data, data_len); |
| 6707 | vos_ssr_unprotect(__func__); |
| 6708 | |
| 6709 | return ret; |
| 6710 | } |
| 6711 | |
Sushant Kaushik | 847890c | 2015-09-28 16:05:17 +0530 | [diff] [blame] | 6712 | static const struct |
| 6713 | nla_policy |
| 6714 | qca_wlan_vendor_get_wifi_info_policy[ |
| 6715 | QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX +1] = { |
| 6716 | [QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION] = {.type = NLA_U8 }, |
| 6717 | [QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION] = {.type = NLA_U8 }, |
| 6718 | }; |
| 6719 | |
| 6720 | |
| 6721 | /** |
| 6722 | * __wlan_hdd_cfg80211_get_wifi_info() - Get the wifi driver related info |
| 6723 | * @wiphy: pointer to wireless wiphy structure. |
| 6724 | * @wdev: pointer to wireless_dev structure. |
| 6725 | * @data: Pointer to the data to be passed via vendor interface |
| 6726 | * @data_len:Length of the data to be passed |
| 6727 | * |
| 6728 | * This is called when wlan driver needs to send wifi driver related info |
| 6729 | * (driver/fw version) to the user space application upon request. |
| 6730 | * |
| 6731 | * Return: Return the Success or Failure code. |
| 6732 | */ |
| 6733 | static int __wlan_hdd_cfg80211_get_wifi_info(struct wiphy *wiphy, |
| 6734 | struct wireless_dev *wdev, |
| 6735 | const void *data, int data_len) |
| 6736 | { |
| 6737 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6738 | struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX + 1]; |
| 6739 | tSirVersionString version; |
| 6740 | uint32 version_len; |
| 6741 | uint8 attr; |
| 6742 | int status; |
| 6743 | struct sk_buff *reply_skb = NULL; |
| 6744 | |
| 6745 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 6746 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 6747 | return -EINVAL; |
| 6748 | } |
| 6749 | |
| 6750 | status = wlan_hdd_validate_context(hdd_ctx); |
| 6751 | if (0 != status) { |
| 6752 | hddLog(LOGE, FL("HDD context is not valid")); |
| 6753 | return -EINVAL; |
| 6754 | } |
| 6755 | |
| 6756 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX, data, |
| 6757 | data_len, qca_wlan_vendor_get_wifi_info_policy)) { |
| 6758 | hddLog(LOGE, FL("WIFI_INFO_GET NL CMD parsing failed")); |
| 6759 | return -EINVAL; |
| 6760 | } |
| 6761 | |
| 6762 | if (tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION]) { |
| 6763 | hddLog(LOG1, FL("Rcvd req for Driver version Driver version is %s"), |
| 6764 | QWLAN_VERSIONSTR); |
| 6765 | strlcpy(version, QWLAN_VERSIONSTR, sizeof(version)); |
| 6766 | attr = QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION; |
| 6767 | } else if (tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION]) { |
| 6768 | hddLog(LOG1, FL("Rcvd req for FW version FW version is %s"), |
| 6769 | hdd_ctx->fw_Version); |
| 6770 | strlcpy(version, hdd_ctx->fw_Version, sizeof(version)); |
| 6771 | attr = QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION; |
| 6772 | } else { |
| 6773 | hddLog(LOGE, FL("Invalid attribute in get wifi info request")); |
| 6774 | return -EINVAL; |
| 6775 | } |
| 6776 | |
| 6777 | version_len = strlen(version); |
| 6778 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 6779 | version_len + NLA_HDRLEN + NLMSG_HDRLEN); |
| 6780 | if (!reply_skb) { |
| 6781 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 6782 | return -ENOMEM; |
| 6783 | } |
| 6784 | |
| 6785 | if (nla_put(reply_skb, attr, version_len, version)) { |
| 6786 | hddLog(LOGE, FL("nla put fail")); |
| 6787 | kfree_skb(reply_skb); |
| 6788 | return -EINVAL; |
| 6789 | } |
| 6790 | |
| 6791 | return cfg80211_vendor_cmd_reply(reply_skb); |
| 6792 | } |
| 6793 | |
| 6794 | /** |
| 6795 | * __wlan_hdd_cfg80211_get_wifi_info() - Get the wifi driver related info |
| 6796 | * @wiphy: pointer to wireless wiphy structure. |
| 6797 | * @wdev: pointer to wireless_dev structure. |
| 6798 | * @data: Pointer to the data to be passed via vendor interface |
| 6799 | * @data_len:Length of the data to be passed |
| 6800 | * @data_len: Length of the data received |
| 6801 | * |
| 6802 | * This function is used to enable or disable the collection of packet |
| 6803 | * statistics from the firmware |
| 6804 | * |
| 6805 | * Return: 0 on success and errno on failure |
| 6806 | */ |
| 6807 | |
| 6808 | static int |
| 6809 | wlan_hdd_cfg80211_get_wifi_info(struct wiphy *wiphy, |
| 6810 | struct wireless_dev *wdev, |
| 6811 | const void *data, int data_len) |
| 6812 | |
| 6813 | |
| 6814 | { |
| 6815 | int ret = 0; |
| 6816 | |
| 6817 | vos_ssr_protect(__func__); |
| 6818 | ret = __wlan_hdd_cfg80211_get_wifi_info(wiphy, |
| 6819 | wdev, data, data_len); |
| 6820 | vos_ssr_unprotect(__func__); |
| 6821 | |
| 6822 | return ret; |
| 6823 | } |
| 6824 | |
| 6825 | |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6826 | /* |
| 6827 | * define short names for the global vendor params |
| 6828 | * used by __wlan_hdd_cfg80211_monitor_rssi() |
| 6829 | */ |
| 6830 | #define PARAM_MAX QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX |
| 6831 | #define PARAM_REQUEST_ID QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID |
| 6832 | #define PARAM_CONTROL QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CONTROL |
| 6833 | #define PARAM_MIN_RSSI QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MIN_RSSI |
| 6834 | #define PARAM_MAX_RSSI QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX_RSSI |
| 6835 | |
| 6836 | /**--------------------------------------------------------------------------- |
| 6837 | |
| 6838 | \brief hdd_rssi_monitor_start_done - callback to be executed when rssi |
| 6839 | monitor start is completed successfully. |
| 6840 | |
| 6841 | \return - None |
| 6842 | |
| 6843 | --------------------------------------------------------------------------*/ |
| 6844 | void hdd_rssi_monitor_start_done(void *fwRssiMonitorCbContext, VOS_STATUS status) |
| 6845 | { |
| 6846 | hdd_context_t* pHddCtx = (hdd_context_t*)fwRssiMonitorCbContext; |
| 6847 | |
| 6848 | if (NULL == pHddCtx) |
| 6849 | { |
| 6850 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6851 | "%s: HDD context is NULL",__func__); |
| 6852 | return; |
| 6853 | } |
| 6854 | |
| 6855 | if (VOS_STATUS_SUCCESS == status) |
| 6856 | { |
| 6857 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rssi Monitor start successful")); |
| 6858 | } |
| 6859 | else |
| 6860 | { |
| 6861 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Rssi Monitor start not successful")); |
| 6862 | } |
| 6863 | |
| 6864 | return; |
| 6865 | } |
| 6866 | |
| 6867 | /**--------------------------------------------------------------------------- |
| 6868 | |
| 6869 | \brief hdd_rssi_monitor_stop_done - callback to be executed when rssi monitor |
| 6870 | stop is completed successfully. |
| 6871 | |
| 6872 | \return - None |
| 6873 | |
| 6874 | --------------------------------------------------------------------------*/ |
| 6875 | void hdd_rssi_monitor_stop_done(void *fwRssiMonitorCbContext, VOS_STATUS status) |
| 6876 | { |
| 6877 | hdd_context_t* pHddCtx = (hdd_context_t*)fwRssiMonitorCbContext; |
| 6878 | |
| 6879 | if (NULL == pHddCtx) |
| 6880 | { |
| 6881 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6882 | "%s: HDD context is NULL",__func__); |
| 6883 | return; |
| 6884 | } |
| 6885 | |
| 6886 | if (VOS_STATUS_SUCCESS == status) |
| 6887 | { |
| 6888 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rssi Monitor stop successful")); |
| 6889 | } |
| 6890 | else |
| 6891 | { |
| 6892 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Rssi Monitor stop not successful")); |
| 6893 | } |
| 6894 | |
| 6895 | return; |
| 6896 | } |
| 6897 | |
| 6898 | /** |
| 6899 | * __wlan_hdd_cfg80211_monitor_rssi() - monitor rssi |
| 6900 | * @wiphy: Pointer to wireless phy |
| 6901 | * @wdev: Pointer to wireless device |
| 6902 | * @data: Pointer to data |
| 6903 | * @data_len: Data length |
| 6904 | * |
| 6905 | * Return: 0 on success, negative errno on failure |
| 6906 | */ |
| 6907 | |
| 6908 | static int |
| 6909 | __wlan_hdd_cfg80211_monitor_rssi(struct wiphy *wiphy, |
| 6910 | struct wireless_dev *wdev, |
| 6911 | const void *data, |
| 6912 | int data_len) |
| 6913 | { |
| 6914 | struct net_device *dev = wdev->netdev; |
| 6915 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6916 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6917 | hdd_station_ctx_t *pHddStaCtx; |
| 6918 | struct nlattr *tb[PARAM_MAX + 1]; |
| 6919 | tpSirRssiMonitorReq pReq; |
| 6920 | eHalStatus status; |
| 6921 | int ret; |
| 6922 | uint32_t control; |
| 6923 | static const struct nla_policy policy[PARAM_MAX + 1] = { |
| 6924 | [PARAM_REQUEST_ID] = { .type = NLA_U32 }, |
| 6925 | [PARAM_CONTROL] = { .type = NLA_U32 }, |
| 6926 | [PARAM_MIN_RSSI] = { .type = NLA_S8 }, |
| 6927 | [PARAM_MAX_RSSI] = { .type = NLA_S8 }, |
| 6928 | }; |
| 6929 | |
| 6930 | ENTER(); |
| 6931 | |
| 6932 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6933 | if (0 != ret) { |
| 6934 | return -EINVAL; |
| 6935 | } |
| 6936 | |
| 6937 | if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) { |
| 6938 | hddLog(LOGE, FL("Not in Connected state!")); |
| 6939 | return -ENOTSUPP; |
| 6940 | } |
| 6941 | |
| 6942 | if (nla_parse(tb, PARAM_MAX, data, data_len, policy)) { |
| 6943 | hddLog(LOGE, FL("Invalid ATTR")); |
| 6944 | return -EINVAL; |
| 6945 | } |
| 6946 | |
| 6947 | if (!tb[PARAM_REQUEST_ID]) { |
| 6948 | hddLog(LOGE, FL("attr request id failed")); |
| 6949 | return -EINVAL; |
| 6950 | } |
| 6951 | |
| 6952 | if (!tb[PARAM_CONTROL]) { |
| 6953 | hddLog(LOGE, FL("attr control failed")); |
| 6954 | return -EINVAL; |
| 6955 | } |
| 6956 | |
| 6957 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6958 | |
| 6959 | pReq = vos_mem_malloc(sizeof(tSirRssiMonitorReq)); |
| 6960 | if(NULL == pReq) |
| 6961 | { |
| 6962 | hddLog(LOGE, |
| 6963 | FL("vos_mem_alloc failed ")); |
| 6964 | return eHAL_STATUS_FAILED_ALLOC; |
| 6965 | } |
| 6966 | vos_mem_set(pReq, sizeof(tSirRssiMonitorReq), 0); |
| 6967 | |
| 6968 | pReq->requestId = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 6969 | pReq->sessionId = pAdapter->sessionId; |
| 6970 | pReq->rssiMonitorCbContext = hdd_ctx; |
| 6971 | control = nla_get_u32(tb[PARAM_CONTROL]); |
| 6972 | vos_mem_copy( &pReq->currentBssId, pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 6973 | |
| 6974 | hddLog(LOG1, FL("Request Id: %u Session_id: %d Control: %d"), |
| 6975 | pReq->requestId, pReq->sessionId, control); |
| 6976 | |
| 6977 | if (control == QCA_WLAN_RSSI_MONITORING_START) { |
| 6978 | if (!tb[PARAM_MIN_RSSI]) { |
| 6979 | hddLog(LOGE, FL("attr min rssi failed")); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6980 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6981 | } |
| 6982 | |
| 6983 | if (!tb[PARAM_MAX_RSSI]) { |
| 6984 | hddLog(LOGE, FL("attr max rssi failed")); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6985 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6986 | } |
| 6987 | |
| 6988 | pReq->minRssi = nla_get_s8(tb[PARAM_MIN_RSSI]); |
| 6989 | pReq->maxRssi = nla_get_s8(tb[PARAM_MAX_RSSI]); |
| 6990 | pReq->rssiMonitorCallback = hdd_rssi_monitor_start_done; |
| 6991 | |
| 6992 | if (!(pReq->minRssi < pReq->maxRssi)) { |
| 6993 | hddLog(LOGW, FL("min_rssi: %d must be less than max_rssi: %d"), |
| 6994 | pReq->minRssi, pReq->maxRssi); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6995 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6996 | } |
| 6997 | hddLog(LOG1, FL("Min_rssi: %d Max_rssi: %d"), |
| 6998 | pReq->minRssi, pReq->maxRssi); |
| 6999 | status = sme_StartRssiMonitoring(hdd_ctx->hHal, pReq); |
| 7000 | |
| 7001 | } |
| 7002 | else if (control == QCA_WLAN_RSSI_MONITORING_STOP) { |
| 7003 | pReq->rssiMonitorCallback = hdd_rssi_monitor_stop_done; |
| 7004 | status = sme_StopRssiMonitoring(hdd_ctx->hHal, pReq); |
| 7005 | } |
| 7006 | else { |
| 7007 | hddLog(LOGE, FL("Invalid control cmd: %d"), control); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 7008 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 7009 | } |
| 7010 | |
| 7011 | if (!HAL_STATUS_SUCCESS(status)) { |
| 7012 | hddLog(LOGE, |
| 7013 | FL("sme_set_rssi_monitoring failed(err=%d)"), status); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 7014 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 7015 | } |
| 7016 | |
| 7017 | return 0; |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 7018 | fail: |
| 7019 | vos_mem_free(pReq); |
| 7020 | return -EINVAL; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 7021 | } |
| 7022 | |
| 7023 | /* |
| 7024 | * done with short names for the global vendor params |
| 7025 | * used by __wlan_hdd_cfg80211_monitor_rssi() |
| 7026 | */ |
| 7027 | #undef PARAM_MAX |
| 7028 | #undef PARAM_CONTROL |
| 7029 | #undef PARAM_REQUEST_ID |
| 7030 | #undef PARAM_MAX_RSSI |
| 7031 | #undef PARAM_MIN_RSSI |
| 7032 | |
| 7033 | /** |
| 7034 | * wlan_hdd_cfg80211_monitor_rssi() - SSR wrapper to rssi monitoring |
| 7035 | * @wiphy: wiphy structure pointer |
| 7036 | * @wdev: Wireless device structure pointer |
| 7037 | * @data: Pointer to the data received |
| 7038 | * @data_len: Length of @data |
| 7039 | * |
| 7040 | * Return: 0 on success; errno on failure |
| 7041 | */ |
| 7042 | static int |
| 7043 | wlan_hdd_cfg80211_monitor_rssi(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 7044 | const void *data, int data_len) |
| 7045 | { |
| 7046 | int ret; |
| 7047 | |
| 7048 | vos_ssr_protect(__func__); |
| 7049 | ret = __wlan_hdd_cfg80211_monitor_rssi(wiphy, wdev, data, data_len); |
| 7050 | vos_ssr_unprotect(__func__); |
| 7051 | |
| 7052 | return ret; |
| 7053 | } |
| 7054 | |
| 7055 | /** |
| 7056 | * hdd_rssi_threshold_breached_cb() - rssi breached NL event |
| 7057 | * @hddctx: HDD context |
| 7058 | * @data: rssi breached event data |
| 7059 | * |
| 7060 | * This function reads the rssi breached event %data and fill in the skb with |
| 7061 | * NL attributes and send up the NL event. |
| 7062 | * This callback execute in atomic context and must not invoke any |
| 7063 | * blocking calls. |
| 7064 | * |
| 7065 | * Return: none |
| 7066 | */ |
| 7067 | void hdd_rssi_threshold_breached_cb(void *hddctx, |
| 7068 | struct rssi_breach_event *data) |
| 7069 | { |
| 7070 | hdd_context_t *pHddCtx = (hdd_context_t *)hddctx; |
| 7071 | int status; |
| 7072 | struct sk_buff *skb; |
| 7073 | |
| 7074 | ENTER(); |
| 7075 | status = wlan_hdd_validate_context(pHddCtx); |
| 7076 | |
| 7077 | if (0 != status) { |
| 7078 | return; |
| 7079 | } |
| 7080 | |
| 7081 | if (!data) { |
| 7082 | hddLog(LOGE, FL("data is null")); |
| 7083 | return; |
| 7084 | } |
| 7085 | |
| 7086 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 7087 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 7088 | NULL, |
| 7089 | #endif |
| 7090 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 7091 | QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI_INDEX, |
| 7092 | GFP_KERNEL); |
| 7093 | |
| 7094 | if (!skb) { |
| 7095 | hddLog(LOGE, FL("cfg80211_vendor_event_alloc failed")); |
| 7096 | return; |
| 7097 | } |
| 7098 | |
| 7099 | hddLog(LOG1, "Req Id: %u Current rssi: %d", |
| 7100 | data->request_id, data->curr_rssi); |
| 7101 | hddLog(LOG1, "Current BSSID: "MAC_ADDRESS_STR, |
| 7102 | MAC_ADDR_ARRAY(data->curr_bssid.bytes)); |
| 7103 | |
| 7104 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID, |
| 7105 | data->request_id) || |
| 7106 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CUR_BSSID, |
| 7107 | sizeof(data->curr_bssid), data->curr_bssid.bytes) || |
| 7108 | nla_put_s8(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CUR_RSSI, |
| 7109 | data->curr_rssi)) { |
| 7110 | hddLog(LOGE, FL("nla put fail")); |
| 7111 | goto fail; |
| 7112 | } |
| 7113 | |
| 7114 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 7115 | return; |
| 7116 | |
| 7117 | fail: |
| 7118 | kfree_skb(skb); |
| 7119 | return; |
| 7120 | } |
| 7121 | |
| 7122 | |
| 7123 | |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 7124 | /** |
| 7125 | * __wlan_hdd_cfg80211_setband() - set band |
| 7126 | * @wiphy: Pointer to wireless phy |
| 7127 | * @wdev: Pointer to wireless device |
| 7128 | * @data: Pointer to data |
| 7129 | * @data_len: Data length |
| 7130 | * |
| 7131 | * Return: 0 on success, negative errno on failure |
| 7132 | */ |
| 7133 | static int |
| 7134 | __wlan_hdd_cfg80211_setband(struct wiphy *wiphy, |
| 7135 | struct wireless_dev *wdev, |
| 7136 | const void *data, |
| 7137 | int data_len) |
| 7138 | { |
| 7139 | struct net_device *dev = wdev->netdev; |
| 7140 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 7141 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 7142 | int ret; |
| 7143 | static const struct nla_policy policy[QCA_WLAN_VENDOR_ATTR_MAX + 1] |
| 7144 | = {[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE] = { .type = NLA_U32 }}; |
| 7145 | |
| 7146 | ENTER(); |
| 7147 | |
| 7148 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7149 | if (0 != ret) { |
| 7150 | hddLog(LOGE, FL("HDD context is not valid")); |
| 7151 | return ret; |
| 7152 | } |
| 7153 | |
| 7154 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len, |
| 7155 | policy)) { |
| 7156 | hddLog(LOGE, FL("Invalid ATTR")); |
| 7157 | return -EINVAL; |
| 7158 | } |
| 7159 | |
| 7160 | if (!tb[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE]) { |
| 7161 | hddLog(LOGE, FL("attr QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE failed")); |
| 7162 | return -EINVAL; |
| 7163 | } |
| 7164 | |
Hanumantha Reddy Pothula | 1347e43 | 2015-08-05 09:53:44 +0530 | [diff] [blame] | 7165 | hdd_ctx->isSetBandByNL = TRUE; |
| 7166 | ret = hdd_setBand(dev, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 7167 | nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE])); |
Hanumantha Reddy Pothula | 1347e43 | 2015-08-05 09:53:44 +0530 | [diff] [blame] | 7168 | hdd_ctx->isSetBandByNL = FALSE; |
| 7169 | |
| 7170 | EXIT(); |
| 7171 | return ret; |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 7172 | } |
| 7173 | |
| 7174 | /** |
| 7175 | * wlan_hdd_cfg80211_setband() - Wrapper to offload packets |
| 7176 | * @wiphy: wiphy structure pointer |
| 7177 | * @wdev: Wireless device structure pointer |
| 7178 | * @data: Pointer to the data received |
| 7179 | * @data_len: Length of @data |
| 7180 | * |
| 7181 | * Return: 0 on success; errno on failure |
| 7182 | */ |
| 7183 | static int wlan_hdd_cfg80211_setband(struct wiphy *wiphy, |
| 7184 | struct wireless_dev *wdev, |
| 7185 | const void *data, |
| 7186 | int data_len) |
| 7187 | { |
| 7188 | int ret = 0; |
| 7189 | |
| 7190 | vos_ssr_protect(__func__); |
| 7191 | ret = __wlan_hdd_cfg80211_setband(wiphy, |
| 7192 | wdev, data, data_len); |
| 7193 | vos_ssr_unprotect(__func__); |
| 7194 | |
| 7195 | return ret; |
| 7196 | } |
| 7197 | |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 7198 | #ifdef WLAN_FEATURE_OFFLOAD_PACKETS |
| 7199 | /** |
| 7200 | * hdd_map_req_id_to_pattern_id() - map request id to pattern id |
| 7201 | * @hdd_ctx: HDD context |
| 7202 | * @request_id: [input] request id |
| 7203 | * @pattern_id: [output] pattern id |
| 7204 | * |
| 7205 | * This function loops through request id to pattern id array |
| 7206 | * if the slot is available, store the request id and return pattern id |
| 7207 | * if entry exists, return the pattern id |
| 7208 | * |
| 7209 | * Return: 0 on success and errno on failure |
| 7210 | */ |
| 7211 | static int hdd_map_req_id_to_pattern_id(hdd_context_t *hdd_ctx, |
| 7212 | uint32_t request_id, |
| 7213 | uint8_t *pattern_id) |
| 7214 | { |
| 7215 | uint32_t i; |
| 7216 | |
| 7217 | mutex_lock(&hdd_ctx->op_ctx.op_lock); |
| 7218 | for (i = 0; i < MAXNUM_PERIODIC_TX_PTRNS; i++) |
| 7219 | { |
| 7220 | if (hdd_ctx->op_ctx.op_table[i].request_id == 0) |
| 7221 | { |
| 7222 | hdd_ctx->op_ctx.op_table[i].request_id = request_id; |
| 7223 | *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id; |
| 7224 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 7225 | return 0; |
| 7226 | } else if (hdd_ctx->op_ctx.op_table[i].request_id == |
| 7227 | request_id) { |
| 7228 | *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id; |
| 7229 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 7230 | return 0; |
| 7231 | } |
| 7232 | } |
| 7233 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 7234 | return -EINVAL; |
| 7235 | } |
| 7236 | |
| 7237 | /** |
| 7238 | * hdd_unmap_req_id_to_pattern_id() - unmap request id to pattern id |
| 7239 | * @hdd_ctx: HDD context |
| 7240 | * @request_id: [input] request id |
| 7241 | * @pattern_id: [output] pattern id |
| 7242 | * |
| 7243 | * This function loops through request id to pattern id array |
| 7244 | * reset request id to 0 (slot available again) and |
| 7245 | * return pattern id |
| 7246 | * |
| 7247 | * Return: 0 on success and errno on failure |
| 7248 | */ |
| 7249 | static int hdd_unmap_req_id_to_pattern_id(hdd_context_t *hdd_ctx, |
| 7250 | uint32_t request_id, |
| 7251 | uint8_t *pattern_id) |
| 7252 | { |
| 7253 | uint32_t i; |
| 7254 | |
| 7255 | mutex_lock(&hdd_ctx->op_ctx.op_lock); |
| 7256 | for (i = 0; i < MAXNUM_PERIODIC_TX_PTRNS; i++) |
| 7257 | { |
| 7258 | if (hdd_ctx->op_ctx.op_table[i].request_id == request_id) |
| 7259 | { |
| 7260 | hdd_ctx->op_ctx.op_table[i].request_id = 0; |
| 7261 | *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id; |
| 7262 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 7263 | return 0; |
| 7264 | } |
| 7265 | } |
| 7266 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 7267 | return -EINVAL; |
| 7268 | } |
| 7269 | |
| 7270 | |
| 7271 | /* |
| 7272 | * define short names for the global vendor params |
| 7273 | * used by __wlan_hdd_cfg80211_offloaded_packets() |
| 7274 | */ |
| 7275 | #define PARAM_MAX QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_MAX |
| 7276 | #define PARAM_REQUEST_ID \ |
| 7277 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_REQUEST_ID |
| 7278 | #define PARAM_CONTROL \ |
| 7279 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SENDING_CONTROL |
| 7280 | #define PARAM_IP_PACKET \ |
| 7281 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_IP_PACKET_DATA |
| 7282 | #define PARAM_SRC_MAC_ADDR \ |
| 7283 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SRC_MAC_ADDR |
| 7284 | #define PARAM_DST_MAC_ADDR \ |
| 7285 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_DST_MAC_ADDR |
| 7286 | #define PARAM_PERIOD QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_PERIOD |
| 7287 | |
| 7288 | /** |
| 7289 | * wlan_hdd_add_tx_ptrn() - add tx pattern |
| 7290 | * @adapter: adapter pointer |
| 7291 | * @hdd_ctx: hdd context |
| 7292 | * @tb: nl attributes |
| 7293 | * |
| 7294 | * This function reads the NL attributes and forms a AddTxPtrn message |
| 7295 | * posts it to SME. |
| 7296 | * |
| 7297 | */ |
| 7298 | static int |
| 7299 | wlan_hdd_add_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx, |
| 7300 | struct nlattr **tb) |
| 7301 | { |
| 7302 | struct sSirAddPeriodicTxPtrn *add_req; |
| 7303 | eHalStatus status; |
| 7304 | uint32_t request_id, ret, len; |
| 7305 | uint8_t pattern_id = 0; |
| 7306 | v_MACADDR_t dst_addr; |
| 7307 | uint16_t eth_type = htons(ETH_P_IP); |
| 7308 | |
| 7309 | if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) |
| 7310 | { |
| 7311 | hddLog(LOGE, FL("Not in Connected state!")); |
| 7312 | return -ENOTSUPP; |
| 7313 | } |
| 7314 | |
| 7315 | add_req = vos_mem_malloc(sizeof(*add_req)); |
| 7316 | if (!add_req) |
| 7317 | { |
| 7318 | hddLog(LOGE, FL("memory allocation failed")); |
| 7319 | return -ENOMEM; |
| 7320 | } |
| 7321 | |
| 7322 | /* Parse and fetch request Id */ |
| 7323 | if (!tb[PARAM_REQUEST_ID]) |
| 7324 | { |
| 7325 | hddLog(LOGE, FL("attr request id failed")); |
| 7326 | goto fail; |
| 7327 | } |
| 7328 | |
| 7329 | request_id = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 7330 | hddLog(LOG1, FL("Request Id: %u"), request_id); |
| 7331 | if (request_id == 0) |
| 7332 | { |
| 7333 | hddLog(LOGE, FL("request_id cannot be zero")); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 7334 | goto fail; |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 7335 | } |
| 7336 | |
| 7337 | if (!tb[PARAM_PERIOD]) |
| 7338 | { |
| 7339 | hddLog(LOGE, FL("attr period failed")); |
| 7340 | goto fail; |
| 7341 | } |
| 7342 | add_req->usPtrnIntervalMs = nla_get_u32(tb[PARAM_PERIOD]); |
| 7343 | hddLog(LOG1, FL("Period: %u ms"), add_req->usPtrnIntervalMs); |
| 7344 | if (add_req->usPtrnIntervalMs == 0) |
| 7345 | { |
| 7346 | hddLog(LOGE, FL("Invalid interval zero, return failure")); |
| 7347 | goto fail; |
| 7348 | } |
| 7349 | |
| 7350 | if (!tb[PARAM_SRC_MAC_ADDR]) |
| 7351 | { |
| 7352 | hddLog(LOGE, FL("attr source mac address failed")); |
| 7353 | goto fail; |
| 7354 | } |
| 7355 | nla_memcpy(add_req->macAddress, tb[PARAM_SRC_MAC_ADDR], |
| 7356 | VOS_MAC_ADDR_SIZE); |
| 7357 | hddLog(LOG1, "input src mac address: "MAC_ADDRESS_STR, |
| 7358 | MAC_ADDR_ARRAY(add_req->macAddress)); |
| 7359 | |
| 7360 | if (memcmp(add_req->macAddress, adapter->macAddressCurrent.bytes, |
| 7361 | VOS_MAC_ADDR_SIZE)) |
| 7362 | { |
| 7363 | hddLog(LOGE, |
| 7364 | FL("input src mac address and connected ap bssid are different")); |
| 7365 | goto fail; |
| 7366 | } |
| 7367 | |
| 7368 | if (!tb[PARAM_DST_MAC_ADDR]) |
| 7369 | { |
| 7370 | hddLog(LOGE, FL("attr dst mac address failed")); |
| 7371 | goto fail; |
| 7372 | } |
| 7373 | nla_memcpy(dst_addr.bytes, tb[PARAM_DST_MAC_ADDR], VOS_MAC_ADDR_SIZE); |
| 7374 | hddLog(LOG1, "input dst mac address: "MAC_ADDRESS_STR, |
| 7375 | MAC_ADDR_ARRAY(dst_addr.bytes)); |
| 7376 | |
| 7377 | if (!tb[PARAM_IP_PACKET]) |
| 7378 | { |
| 7379 | hddLog(LOGE, FL("attr ip packet failed")); |
| 7380 | goto fail; |
| 7381 | } |
| 7382 | add_req->ucPtrnSize = nla_len(tb[PARAM_IP_PACKET]); |
| 7383 | hddLog(LOG1, FL("IP packet len: %u"), add_req->ucPtrnSize); |
| 7384 | |
| 7385 | if (add_req->ucPtrnSize < 0 || |
| 7386 | add_req->ucPtrnSize > (PERIODIC_TX_PTRN_MAX_SIZE - |
| 7387 | HDD_ETH_HEADER_LEN)) |
| 7388 | { |
| 7389 | hddLog(LOGE, FL("Invalid IP packet len: %d"), |
| 7390 | add_req->ucPtrnSize); |
| 7391 | goto fail; |
| 7392 | } |
| 7393 | |
| 7394 | len = 0; |
| 7395 | vos_mem_copy(&add_req->ucPattern[0], dst_addr.bytes, VOS_MAC_ADDR_SIZE); |
| 7396 | len += VOS_MAC_ADDR_SIZE; |
| 7397 | vos_mem_copy(&add_req->ucPattern[len], add_req->macAddress, |
| 7398 | VOS_MAC_ADDR_SIZE); |
| 7399 | len += VOS_MAC_ADDR_SIZE; |
| 7400 | vos_mem_copy(&add_req->ucPattern[len], ð_type, 2); |
| 7401 | len += 2; |
| 7402 | |
| 7403 | /* |
| 7404 | * This is the IP packet, add 14 bytes Ethernet (802.3) header |
| 7405 | * ------------------------------------------------------------ |
| 7406 | * | 14 bytes Ethernet (802.3) header | IP header and payload | |
| 7407 | * ------------------------------------------------------------ |
| 7408 | */ |
| 7409 | vos_mem_copy(&add_req->ucPattern[len], |
| 7410 | nla_data(tb[PARAM_IP_PACKET]), |
| 7411 | add_req->ucPtrnSize); |
| 7412 | add_req->ucPtrnSize += len; |
| 7413 | |
| 7414 | VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7415 | add_req->ucPattern, add_req->ucPtrnSize); |
| 7416 | |
| 7417 | ret = hdd_map_req_id_to_pattern_id(hdd_ctx, request_id, &pattern_id); |
| 7418 | if (ret) |
| 7419 | { |
| 7420 | hddLog(LOGW, FL("req id to pattern id failed (ret=%d)"), ret); |
| 7421 | goto fail; |
| 7422 | } |
| 7423 | add_req->ucPtrnId = pattern_id; |
| 7424 | hddLog(LOG1, FL("pattern id: %d"), add_req->ucPtrnId); |
| 7425 | |
| 7426 | status = sme_AddPeriodicTxPtrn(hdd_ctx->hHal, add_req); |
| 7427 | if (!HAL_STATUS_SUCCESS(status)) |
| 7428 | { |
| 7429 | hddLog(LOGE, |
| 7430 | FL("sme_AddPeriodicTxPtrn failed (err=%d)"), status); |
| 7431 | goto fail; |
| 7432 | } |
| 7433 | |
| 7434 | EXIT(); |
| 7435 | vos_mem_free(add_req); |
| 7436 | return 0; |
| 7437 | |
| 7438 | fail: |
| 7439 | vos_mem_free(add_req); |
| 7440 | return -EINVAL; |
| 7441 | } |
| 7442 | |
| 7443 | /** |
| 7444 | * wlan_hdd_del_tx_ptrn() - delete tx pattern |
| 7445 | * @adapter: adapter pointer |
| 7446 | * @hdd_ctx: hdd context |
| 7447 | * @tb: nl attributes |
| 7448 | * |
| 7449 | * This function reads the NL attributes and forms a DelTxPtrn message |
| 7450 | * posts it to SME. |
| 7451 | * |
| 7452 | */ |
| 7453 | static int |
| 7454 | wlan_hdd_del_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx, |
| 7455 | struct nlattr **tb) |
| 7456 | { |
| 7457 | struct sSirDelPeriodicTxPtrn *del_req; |
| 7458 | eHalStatus status; |
| 7459 | uint32_t request_id, ret; |
| 7460 | uint8_t pattern_id = 0; |
| 7461 | |
| 7462 | /* Parse and fetch request Id */ |
| 7463 | if (!tb[PARAM_REQUEST_ID]) |
| 7464 | { |
| 7465 | hddLog(LOGE, FL("attr request id failed")); |
| 7466 | return -EINVAL; |
| 7467 | } |
| 7468 | request_id = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 7469 | if (request_id == 0) |
| 7470 | { |
| 7471 | hddLog(LOGE, FL("request_id cannot be zero")); |
| 7472 | return -EINVAL; |
| 7473 | } |
| 7474 | |
| 7475 | ret = hdd_unmap_req_id_to_pattern_id(hdd_ctx, request_id, &pattern_id); |
| 7476 | if (ret) |
| 7477 | { |
| 7478 | hddLog(LOGW, FL("req id to pattern id failed (ret=%d)"), ret); |
| 7479 | return -EINVAL; |
| 7480 | } |
| 7481 | |
| 7482 | del_req = vos_mem_malloc(sizeof(*del_req)); |
| 7483 | if (!del_req) |
| 7484 | { |
| 7485 | hddLog(LOGE, FL("memory allocation failed")); |
| 7486 | return -ENOMEM; |
| 7487 | } |
| 7488 | |
| 7489 | vos_mem_set(del_req, sizeof(*del_req), 0); |
| 7490 | vos_mem_copy(del_req->macAddress, adapter->macAddressCurrent.bytes, |
| 7491 | VOS_MAC_ADDR_SIZE); |
| 7492 | hddLog(LOG1, MAC_ADDRESS_STR, MAC_ADDR_ARRAY(del_req->macAddress)); |
| 7493 | del_req->ucPatternIdBitmap |= (0x1 << pattern_id); |
| 7494 | hddLog(LOG1, FL("Request Id: %u Pattern id: %d, bitmap %04x"), |
| 7495 | request_id, pattern_id, del_req->ucPatternIdBitmap); |
| 7496 | |
| 7497 | status = sme_DelPeriodicTxPtrn(hdd_ctx->hHal, del_req); |
| 7498 | if (!HAL_STATUS_SUCCESS(status)) |
| 7499 | { |
| 7500 | hddLog(LOGE, |
| 7501 | FL("sme_DelPeriodicTxPtrn failed (err=%d)"), status); |
| 7502 | goto fail; |
| 7503 | } |
| 7504 | |
| 7505 | EXIT(); |
| 7506 | vos_mem_free(del_req); |
| 7507 | return 0; |
| 7508 | |
| 7509 | fail: |
| 7510 | vos_mem_free(del_req); |
| 7511 | return -EINVAL; |
| 7512 | } |
| 7513 | |
| 7514 | |
| 7515 | /** |
| 7516 | * __wlan_hdd_cfg80211_offloaded_packets() - send offloaded packets |
| 7517 | * @wiphy: Pointer to wireless phy |
| 7518 | * @wdev: Pointer to wireless device |
| 7519 | * @data: Pointer to data |
| 7520 | * @data_len: Data length |
| 7521 | * |
| 7522 | * Return: 0 on success, negative errno on failure |
| 7523 | */ |
| 7524 | static int |
| 7525 | __wlan_hdd_cfg80211_offloaded_packets(struct wiphy *wiphy, |
| 7526 | struct wireless_dev *wdev, |
| 7527 | const void *data, |
| 7528 | int data_len) |
| 7529 | { |
| 7530 | struct net_device *dev = wdev->netdev; |
| 7531 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7532 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 7533 | struct nlattr *tb[PARAM_MAX + 1]; |
| 7534 | uint8_t control; |
| 7535 | int ret; |
| 7536 | static const struct nla_policy policy[PARAM_MAX + 1] = |
| 7537 | { |
| 7538 | [PARAM_REQUEST_ID] = { .type = NLA_U32 }, |
| 7539 | [PARAM_CONTROL] = { .type = NLA_U32 }, |
| 7540 | [PARAM_SRC_MAC_ADDR] = { .type = NLA_BINARY, |
| 7541 | .len = VOS_MAC_ADDR_SIZE }, |
| 7542 | [PARAM_DST_MAC_ADDR] = { .type = NLA_BINARY, |
| 7543 | .len = VOS_MAC_ADDR_SIZE }, |
| 7544 | [PARAM_PERIOD] = { .type = NLA_U32 }, |
| 7545 | }; |
| 7546 | |
| 7547 | ENTER(); |
| 7548 | |
| 7549 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7550 | if (0 != ret) |
| 7551 | { |
| 7552 | hddLog(LOGE, FL("HDD context is not valid")); |
| 7553 | return ret; |
| 7554 | } |
| 7555 | |
| 7556 | if (!sme_IsFeatureSupportedByFW(WLAN_PERIODIC_TX_PTRN)) |
| 7557 | { |
| 7558 | hddLog(LOGE, |
| 7559 | FL("Periodic Tx Pattern Offload feature is not supported in FW!")); |
| 7560 | return -ENOTSUPP; |
| 7561 | } |
| 7562 | |
| 7563 | if (nla_parse(tb, PARAM_MAX, data, data_len, policy)) |
| 7564 | { |
| 7565 | hddLog(LOGE, FL("Invalid ATTR")); |
| 7566 | return -EINVAL; |
| 7567 | } |
| 7568 | |
| 7569 | if (!tb[PARAM_CONTROL]) |
| 7570 | { |
| 7571 | hddLog(LOGE, FL("attr control failed")); |
| 7572 | return -EINVAL; |
| 7573 | } |
| 7574 | control = nla_get_u32(tb[PARAM_CONTROL]); |
| 7575 | hddLog(LOG1, FL("Control: %d"), control); |
| 7576 | |
| 7577 | if (control == WLAN_START_OFFLOADED_PACKETS) |
| 7578 | return wlan_hdd_add_tx_ptrn(adapter, hdd_ctx, tb); |
| 7579 | else if (control == WLAN_STOP_OFFLOADED_PACKETS) |
| 7580 | return wlan_hdd_del_tx_ptrn(adapter, hdd_ctx, tb); |
| 7581 | else |
| 7582 | { |
| 7583 | hddLog(LOGE, FL("Invalid control: %d"), control); |
| 7584 | return -EINVAL; |
| 7585 | } |
| 7586 | } |
| 7587 | |
| 7588 | /* |
| 7589 | * done with short names for the global vendor params |
| 7590 | * used by __wlan_hdd_cfg80211_offloaded_packets() |
| 7591 | */ |
| 7592 | #undef PARAM_MAX |
| 7593 | #undef PARAM_REQUEST_ID |
| 7594 | #undef PARAM_CONTROL |
| 7595 | #undef PARAM_IP_PACKET |
| 7596 | #undef PARAM_SRC_MAC_ADDR |
| 7597 | #undef PARAM_DST_MAC_ADDR |
| 7598 | #undef PARAM_PERIOD |
| 7599 | |
| 7600 | /** |
| 7601 | * wlan_hdd_cfg80211_offloaded_packets() - Wrapper to offload packets |
| 7602 | * @wiphy: wiphy structure pointer |
| 7603 | * @wdev: Wireless device structure pointer |
| 7604 | * @data: Pointer to the data received |
| 7605 | * @data_len: Length of @data |
| 7606 | * |
| 7607 | * Return: 0 on success; errno on failure |
| 7608 | */ |
| 7609 | static int wlan_hdd_cfg80211_offloaded_packets(struct wiphy *wiphy, |
| 7610 | struct wireless_dev *wdev, |
| 7611 | const void *data, |
| 7612 | int data_len) |
| 7613 | { |
| 7614 | int ret = 0; |
| 7615 | |
| 7616 | vos_ssr_protect(__func__); |
| 7617 | ret = __wlan_hdd_cfg80211_offloaded_packets(wiphy, |
| 7618 | wdev, data, data_len); |
| 7619 | vos_ssr_unprotect(__func__); |
| 7620 | |
| 7621 | return ret; |
| 7622 | } |
| 7623 | #endif |
| 7624 | |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7625 | static const struct |
| 7626 | nla_policy |
| 7627 | qca_wlan_vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_MAX+1] = { |
Jeff Johnson | da8c3a7 | 2017-06-23 15:59:08 +0530 | [diff] [blame] | 7628 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { |
| 7629 | .type = NLA_BINARY, |
| 7630 | .len = HDD_MAC_ADDR_LEN}, |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7631 | }; |
| 7632 | |
| 7633 | /** |
| 7634 | * wlan_hdd_cfg80211_get_link_properties() - This function is used to |
| 7635 | * get link properties like nss, rate flags and operating frequency for |
| 7636 | * the connection with the given peer. |
| 7637 | * @wiphy: WIPHY structure pointer |
| 7638 | * @wdev: Wireless device structure pointer |
| 7639 | * @data: Pointer to the data received |
| 7640 | * @data_len: Length of the data received |
| 7641 | * |
| 7642 | * This function return the above link properties on success. |
| 7643 | * |
| 7644 | * Return: 0 on success and errno on failure |
| 7645 | */ |
| 7646 | static int wlan_hdd_cfg80211_get_link_properties(struct wiphy *wiphy, |
| 7647 | struct wireless_dev *wdev, |
| 7648 | const void *data, |
| 7649 | int data_len) |
| 7650 | { |
| 7651 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 7652 | struct net_device *dev = wdev->netdev; |
| 7653 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7654 | hdd_station_ctx_t *hdd_sta_ctx; |
| 7655 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX+1]; |
| 7656 | uint8_t peer_mac[VOS_MAC_ADDR_SIZE]; |
| 7657 | uint32_t sta_id; |
| 7658 | struct sk_buff *reply_skb; |
| 7659 | uint32_t rate_flags = 0; |
| 7660 | uint8_t nss; |
| 7661 | uint8_t final_rate_flags = 0; |
| 7662 | uint32_t freq; |
| 7663 | v_CONTEXT_t pVosContext = NULL; |
| 7664 | ptSapContext pSapCtx = NULL; |
| 7665 | |
| 7666 | if (0 != wlan_hdd_validate_context(hdd_ctx)) { |
| 7667 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid")); |
| 7668 | return -EINVAL; |
| 7669 | } |
| 7670 | |
| 7671 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len, |
| 7672 | qca_wlan_vendor_attr_policy)) { |
| 7673 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid attribute")); |
| 7674 | return -EINVAL; |
| 7675 | } |
| 7676 | |
| 7677 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 7678 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7679 | FL("Attribute peerMac not provided for mode=%d"), |
| 7680 | adapter->device_mode); |
| 7681 | return -EINVAL; |
| 7682 | } |
| 7683 | |
Ashish Kumar Dhanotiya | ddaf048 | 2017-06-23 15:22:42 +0530 | [diff] [blame] | 7684 | if (nla_len(tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) < sizeof(peer_mac)) { |
| 7685 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7686 | FL("Attribute peerMac is invalid=%d"), |
| 7687 | adapter->device_mode); |
| 7688 | return -EINVAL; |
| 7689 | } |
| 7690 | |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7691 | memcpy(peer_mac, nla_data(tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 7692 | sizeof(peer_mac)); |
| 7693 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7694 | FL("peerMac="MAC_ADDRESS_STR" for device_mode:%d"), |
| 7695 | MAC_ADDR_ARRAY(peer_mac), adapter->device_mode); |
| 7696 | |
| 7697 | if (adapter->device_mode == WLAN_HDD_INFRA_STATION || |
| 7698 | adapter->device_mode == WLAN_HDD_P2P_CLIENT) { |
| 7699 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 7700 | if ((hdd_sta_ctx->conn_info.connState != |
| 7701 | eConnectionState_Associated) || |
| 7702 | !vos_mem_compare(hdd_sta_ctx->conn_info.bssId, peer_mac, |
| 7703 | VOS_MAC_ADDRESS_LEN)) { |
| 7704 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7705 | FL("Not Associated to mac "MAC_ADDRESS_STR), |
| 7706 | MAC_ADDR_ARRAY(peer_mac)); |
| 7707 | return -EINVAL; |
| 7708 | } |
| 7709 | |
| 7710 | nss = 1; //pronto supports only one spatial stream |
| 7711 | freq = vos_chan_to_freq( |
| 7712 | hdd_sta_ctx->conn_info.operationChannel); |
| 7713 | rate_flags = hdd_sta_ctx->conn_info.rate_flags; |
| 7714 | |
| 7715 | } else if (adapter->device_mode == WLAN_HDD_P2P_GO || |
| 7716 | adapter->device_mode == WLAN_HDD_SOFTAP) { |
| 7717 | |
| 7718 | pVosContext = ( WLAN_HDD_GET_CTX(adapter))->pvosContext; |
| 7719 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 7720 | if(pSapCtx == NULL){ |
| 7721 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7722 | FL("psapCtx is NULL")); |
| 7723 | return -ENOENT; |
| 7724 | } |
| 7725 | |
| 7726 | |
| 7727 | for (sta_id = 0; sta_id < WLAN_MAX_STA_COUNT; sta_id++) { |
| 7728 | if (pSapCtx->aStaInfo[sta_id].isUsed && |
| 7729 | !vos_is_macaddr_broadcast( |
| 7730 | &pSapCtx->aStaInfo[sta_id].macAddrSTA) && |
| 7731 | vos_mem_compare( |
| 7732 | &pSapCtx->aStaInfo[sta_id].macAddrSTA, |
| 7733 | peer_mac, VOS_MAC_ADDRESS_LEN)) |
| 7734 | break; |
| 7735 | } |
| 7736 | |
| 7737 | if (WLAN_MAX_STA_COUNT == sta_id) { |
| 7738 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7739 | FL("No active peer with mac="MAC_ADDRESS_STR), |
| 7740 | MAC_ADDR_ARRAY(peer_mac)); |
| 7741 | return -EINVAL; |
| 7742 | } |
| 7743 | |
| 7744 | nss = 1; //pronto supports only one spatial stream |
| 7745 | freq = vos_chan_to_freq( |
| 7746 | (WLAN_HDD_GET_AP_CTX_PTR(adapter))->operatingChannel); |
| 7747 | rate_flags = pSapCtx->aStaInfo[sta_id].rate_flags; |
| 7748 | } else { |
| 7749 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7750 | FL("Not Associated! with mac"MAC_ADDRESS_STR), |
| 7751 | MAC_ADDR_ARRAY(peer_mac)); |
| 7752 | return -EINVAL; |
| 7753 | } |
| 7754 | |
| 7755 | if (!(rate_flags & eHAL_TX_RATE_LEGACY)) { |
| 7756 | if (rate_flags & eHAL_TX_RATE_VHT80) { |
| 7757 | final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 7758 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)) && \ |
| 7759 | !defined(WITH_BACKPORTS) |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7760 | final_rate_flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 7761 | #endif |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7762 | } else if (rate_flags & eHAL_TX_RATE_VHT40) { |
| 7763 | final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 7764 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)) && \ |
| 7765 | !defined(WITH_BACKPORTS) |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7766 | final_rate_flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 7767 | #endif |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7768 | } else if (rate_flags & eHAL_TX_RATE_VHT20) { |
| 7769 | final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7770 | } else if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) { |
| 7771 | final_rate_flags |= RATE_INFO_FLAGS_MCS; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 7772 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)) && \ |
| 7773 | !defined(WITH_BACKPORTS) |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7774 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 7775 | final_rate_flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 7776 | #endif |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7777 | } |
| 7778 | |
| 7779 | if (rate_flags & eHAL_TX_RATE_SGI) { |
| 7780 | if (!(final_rate_flags & RATE_INFO_FLAGS_VHT_MCS)) |
| 7781 | final_rate_flags |= RATE_INFO_FLAGS_MCS; |
| 7782 | final_rate_flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 7783 | } |
| 7784 | } |
| 7785 | |
| 7786 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 7787 | sizeof(u8) + sizeof(u8) + sizeof(u32) + NLMSG_HDRLEN); |
| 7788 | |
| 7789 | if (NULL == reply_skb) { |
| 7790 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7791 | FL("getLinkProperties: skb alloc failed")); |
| 7792 | return -EINVAL; |
| 7793 | } |
| 7794 | |
| 7795 | if (nla_put_u8(reply_skb, |
| 7796 | QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_NSS, |
| 7797 | nss) || |
| 7798 | nla_put_u8(reply_skb, |
| 7799 | QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_RATE_FLAGS, |
| 7800 | final_rate_flags) || |
| 7801 | nla_put_u32(reply_skb, |
| 7802 | QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_FREQ, |
| 7803 | freq)) { |
| 7804 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_put failed")); |
| 7805 | kfree_skb(reply_skb); |
| 7806 | return -EINVAL; |
| 7807 | } |
| 7808 | |
| 7809 | return cfg80211_vendor_cmd_reply(reply_skb); |
| 7810 | } |
| 7811 | |
Ravi Kumar bokka | 7d03276 | 2016-12-12 23:33:01 +0530 | [diff] [blame] | 7812 | #define BEACON_MISS_THRESH_2_4 \ |
| 7813 | QCA_WLAN_VENDOR_ATTR_CONFIG_BEACON_MISS_THRESHOLD_24 |
| 7814 | #define BEACON_MISS_THRESH_5_0 \ |
| 7815 | QCA_WLAN_VENDOR_ATTR_CONFIG_BEACON_MISS_THRESHOLD_5 |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7816 | #define PARAM_WIFICONFIG_MAX QCA_WLAN_VENDOR_ATTR_CONFIG_MAX |
| 7817 | #define PARAM_MODULATED_DTIM QCA_WLAN_VENDOR_ATTR_CONFIG_MODULATED_DTIM |
| 7818 | #define PARAM_STATS_AVG_FACTOR QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR |
| 7819 | #define PARAM_GUARD_TIME QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME |
Mahesh A Saptasagar | 41f9ddd | 2016-02-09 14:01:03 +0530 | [diff] [blame] | 7820 | #define PARAM_BCNMISS_PENALTY_PARAM_COUNT \ |
| 7821 | QCA_WLAN_VENDOR_ATTR_CONFIG_PENALIZE_AFTER_NCONS_BEACON_MISS |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 7822 | #define PARAM_FORCE_RSN_IE \ |
| 7823 | QCA_WLAN_VENDOR_ATTR_CONFIG_RSN_IE |
Ashish Kumar Dhanotiya | f59c776 | 2018-04-10 17:54:25 +0530 | [diff] [blame] | 7824 | /* |
| 7825 | * hdd_set_qpower() - Process the qpower command and invoke the SME api |
| 7826 | * @hdd_ctx: hdd context |
| 7827 | * @enable: Value received in the command, 1 for disable and 2 for enable |
| 7828 | * |
| 7829 | * Return: void |
| 7830 | */ |
| 7831 | static void hdd_set_qpower(hdd_context_t *hdd_ctx, uint8_t enable) |
| 7832 | { |
| 7833 | if (!hdd_ctx) { |
| 7834 | hddLog(LOGE, "hdd_ctx NULL"); |
| 7835 | return; |
| 7836 | } |
| 7837 | |
| 7838 | sme_set_qpower(hdd_ctx->hHal, enable); |
| 7839 | } |
| 7840 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7841 | /** |
| 7842 | * __wlan_hdd_cfg80211_wifi_configuration_set() - Wifi configuration |
| 7843 | * vendor command |
| 7844 | * |
| 7845 | * @wiphy: wiphy device pointer |
| 7846 | * @wdev: wireless device pointer |
| 7847 | * @data: Vendor command data buffer |
| 7848 | * @data_len: Buffer length |
| 7849 | * |
| 7850 | * Handles QCA_WLAN_VENDOR_ATTR_CONFIG_MAX. |
| 7851 | * |
| 7852 | * Return: EOK or other error codes. |
| 7853 | */ |
| 7854 | |
| 7855 | static int __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, |
| 7856 | struct wireless_dev *wdev, |
| 7857 | const void *data, |
| 7858 | int data_len) |
| 7859 | { |
| 7860 | struct net_device *dev = wdev->netdev; |
| 7861 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7862 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 7863 | hdd_station_ctx_t *pHddStaCtx; |
| 7864 | struct nlattr *tb[PARAM_WIFICONFIG_MAX + 1]; |
| 7865 | tpSetWifiConfigParams pReq; |
Mahesh A Saptasagar | 41f9ddd | 2016-02-09 14:01:03 +0530 | [diff] [blame] | 7866 | tModifyRoamParamsReqParams modifyRoamParamsReq; |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7867 | eHalStatus status; |
| 7868 | int ret_val; |
Ravi Kumar bokka | 7d03276 | 2016-12-12 23:33:01 +0530 | [diff] [blame] | 7869 | uint8_t hb_thresh_val; |
Ashish Kumar Dhanotiya | f59c776 | 2018-04-10 17:54:25 +0530 | [diff] [blame] | 7870 | uint8_t qpower; |
Ravi Kumar bokka | 7d03276 | 2016-12-12 23:33:01 +0530 | [diff] [blame] | 7871 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7872 | static const struct nla_policy policy[PARAM_WIFICONFIG_MAX + 1] = { |
| 7873 | [PARAM_STATS_AVG_FACTOR] = { .type = NLA_U16 }, |
| 7874 | [PARAM_MODULATED_DTIM] = { .type = NLA_U32 }, |
Mahesh A Saptasagar | 41f9ddd | 2016-02-09 14:01:03 +0530 | [diff] [blame] | 7875 | [PARAM_GUARD_TIME] = { .type = NLA_U32}, |
| 7876 | [PARAM_BCNMISS_PENALTY_PARAM_COUNT] = |
| 7877 | { .type = NLA_U32}, |
Ravi Kumar bokka | 7d03276 | 2016-12-12 23:33:01 +0530 | [diff] [blame] | 7878 | [BEACON_MISS_THRESH_2_4] = { .type = NLA_U8 }, |
| 7879 | [BEACON_MISS_THRESH_5_0] = { .type = NLA_U8 }, |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 7880 | [PARAM_FORCE_RSN_IE] = {.type = NLA_U8 }, |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7881 | }; |
| 7882 | |
| 7883 | ENTER(); |
| 7884 | |
| 7885 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 7886 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 7887 | return -EINVAL; |
| 7888 | } |
| 7889 | |
| 7890 | ret_val = wlan_hdd_validate_context(pHddCtx); |
| 7891 | if (ret_val) { |
| 7892 | return ret_val; |
| 7893 | } |
| 7894 | |
| 7895 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7896 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7897 | if (nla_parse(tb, PARAM_WIFICONFIG_MAX, data, data_len, policy)) { |
| 7898 | hddLog(LOGE, FL("Invalid ATTR")); |
| 7899 | return -EINVAL; |
| 7900 | } |
| 7901 | |
| 7902 | /* check the Wifi Capability */ |
| 7903 | if ( (TRUE != pHddCtx->cfg_ini->fEnableWifiConfig) && |
| 7904 | (TRUE != sme_IsFeatureSupportedByFW(WIFI_CONFIG))) |
| 7905 | { |
| 7906 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7907 | FL("WIFICONFIG not supported by Firmware")); |
| 7908 | return -EINVAL; |
| 7909 | } |
| 7910 | |
Mahesh A Saptasagar | 41f9ddd | 2016-02-09 14:01:03 +0530 | [diff] [blame] | 7911 | if (tb[PARAM_BCNMISS_PENALTY_PARAM_COUNT]) { |
| 7912 | modifyRoamParamsReq.param = WIFI_CONFIG_SET_BCNMISS_PENALTY_COUNT; |
| 7913 | modifyRoamParamsReq.value = |
| 7914 | nla_get_u32(tb[PARAM_BCNMISS_PENALTY_PARAM_COUNT]); |
| 7915 | |
| 7916 | if (eHAL_STATUS_SUCCESS != |
| 7917 | sme_setBcnMissPenaltyCount(pHddCtx->hHal,&modifyRoamParamsReq)) |
| 7918 | { |
| 7919 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed", __func__); |
| 7920 | ret_val = -EINVAL; |
| 7921 | } |
| 7922 | return ret_val; |
| 7923 | } |
| 7924 | |
| 7925 | /* Moved this down in order to provide provision to set beacon |
| 7926 | * miss penalty count irrespective of connection state. |
| 7927 | */ |
| 7928 | if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) { |
| 7929 | hddLog(LOGE, FL("Not in Connected state!")); |
| 7930 | return -ENOTSUPP; |
| 7931 | } |
| 7932 | |
| 7933 | pReq = vos_mem_malloc(sizeof(tSetWifiConfigParams)); |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7934 | |
| 7935 | if (!pReq) { |
| 7936 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 7937 | "%s: Not able to allocate memory for tSetWifiConfigParams", |
| 7938 | __func__); |
| 7939 | return eHAL_STATUS_E_MALLOC_FAILED; |
| 7940 | } |
| 7941 | |
| 7942 | vos_mem_set(pReq, sizeof(tSetWifiConfigParams), 0); |
| 7943 | |
| 7944 | pReq->sessionId = pAdapter->sessionId; |
| 7945 | vos_mem_copy( &pReq->bssId, pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 7946 | |
| 7947 | if (tb[PARAM_MODULATED_DTIM]) { |
| 7948 | pReq->paramValue = nla_get_u32( |
| 7949 | tb[PARAM_MODULATED_DTIM]); |
| 7950 | hddLog(LOG1, FL("Modulated DTIM: pReq->paramValue:%d "), |
| 7951 | pReq->paramValue); |
Arun Khandavalli | 876886f | 2015-11-23 11:42:27 +0530 | [diff] [blame] | 7952 | pHddCtx->cfg_ini->enableDynamicDTIM = pReq->paramValue; |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7953 | hdd_set_pwrparams(pHddCtx); |
| 7954 | if (BMPS == pmcGetPmcState(pHddCtx->hHal)) { |
| 7955 | hddLog( LOG1, FL("WifiConfig: Requesting FullPower!")); |
| 7956 | |
| 7957 | sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7958 | iw_full_power_cbfn, pAdapter, |
| 7959 | eSME_FULL_PWR_NEEDED_BY_HDD); |
| 7960 | } |
| 7961 | else |
| 7962 | { |
| 7963 | hddLog( LOG1, FL("WifiConfig Not in BMPS state")); |
| 7964 | } |
| 7965 | } |
| 7966 | |
| 7967 | if (tb[PARAM_STATS_AVG_FACTOR]) { |
| 7968 | pReq->paramType = WIFI_CONFIG_SET_AVG_STATS_FACTOR; |
| 7969 | pReq->paramValue = nla_get_u16( |
| 7970 | tb[PARAM_STATS_AVG_FACTOR]); |
| 7971 | hddLog(LOG1, FL("AVG_STATS_FACTOR pReq->paramType:%d,pReq->paramValue:%d "), |
| 7972 | pReq->paramType, pReq->paramValue); |
| 7973 | status = sme_set_wificonfig_params(pHddCtx->hHal, pReq); |
| 7974 | |
| 7975 | if (eHAL_STATUS_SUCCESS != status) |
| 7976 | { |
| 7977 | vos_mem_free(pReq); |
| 7978 | pReq = NULL; |
| 7979 | ret_val = -EPERM; |
| 7980 | return ret_val; |
| 7981 | } |
| 7982 | } |
| 7983 | |
| 7984 | |
| 7985 | if (tb[PARAM_GUARD_TIME]) { |
| 7986 | pReq->paramType = WIFI_CONFIG_SET_GUARD_TIME; |
| 7987 | pReq->paramValue = nla_get_u32( |
| 7988 | tb[PARAM_GUARD_TIME]); |
| 7989 | hddLog(LOG1, FL("GUARD_TIME pReq->paramType:%d,pReq->paramValue:%d "), |
| 7990 | pReq->paramType, pReq->paramValue); |
| 7991 | status = sme_set_wificonfig_params(pHddCtx->hHal, pReq); |
| 7992 | |
| 7993 | if (eHAL_STATUS_SUCCESS != status) |
| 7994 | { |
| 7995 | vos_mem_free(pReq); |
| 7996 | pReq = NULL; |
| 7997 | ret_val = -EPERM; |
| 7998 | return ret_val; |
| 7999 | } |
| 8000 | |
| 8001 | } |
| 8002 | |
Ravi Kumar bokka | 7d03276 | 2016-12-12 23:33:01 +0530 | [diff] [blame] | 8003 | if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_BEACON_MISS_THRESHOLD_24]) { |
| 8004 | hb_thresh_val = nla_get_u8( |
| 8005 | tb[QCA_WLAN_VENDOR_ATTR_CONFIG_BEACON_MISS_THRESHOLD_24]); |
| 8006 | |
| 8007 | hddLog(LOG1, "WLAN set heartbeat threshold for 2.4Ghz %d", |
| 8008 | hb_thresh_val); |
| 8009 | ccmCfgSetInt((WLAN_HDD_GET_CTX(pAdapter))->hHal, |
| 8010 | WNI_CFG_HEART_BEAT_THRESHOLD, hb_thresh_val, |
| 8011 | NULL, eANI_BOOLEAN_FALSE); |
| 8012 | |
| 8013 | status = sme_update_hb_threshold( |
| 8014 | (WLAN_HDD_GET_CTX(pAdapter))->hHal, |
| 8015 | WNI_CFG_HEART_BEAT_THRESHOLD, |
| 8016 | hb_thresh_val, eCSR_BAND_24); |
| 8017 | if (eHAL_STATUS_SUCCESS != status) { |
| 8018 | hddLog(LOGE, "WLAN set heartbeat threshold FAILED %d", status); |
| 8019 | vos_mem_free(pReq); |
| 8020 | pReq = NULL; |
| 8021 | return -EPERM; |
| 8022 | } |
| 8023 | } |
| 8024 | |
| 8025 | if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_BEACON_MISS_THRESHOLD_5]) { |
| 8026 | hb_thresh_val = nla_get_u8( |
| 8027 | tb[QCA_WLAN_VENDOR_ATTR_CONFIG_BEACON_MISS_THRESHOLD_5]); |
| 8028 | |
| 8029 | hddLog(LOG1, "WLAN set heartbeat threshold for 5Ghz %d", |
| 8030 | hb_thresh_val); |
| 8031 | ccmCfgSetInt((WLAN_HDD_GET_CTX(pAdapter))->hHal, |
| 8032 | WNI_CFG_HEART_BEAT_THRESHOLD, hb_thresh_val, |
| 8033 | NULL, eANI_BOOLEAN_FALSE); |
| 8034 | |
| 8035 | status = sme_update_hb_threshold( |
| 8036 | (WLAN_HDD_GET_CTX(pAdapter))->hHal, |
| 8037 | WNI_CFG_HEART_BEAT_THRESHOLD, |
| 8038 | hb_thresh_val, eCSR_BAND_5G); |
| 8039 | if (eHAL_STATUS_SUCCESS != status) { |
| 8040 | hddLog(LOGE, "WLAN set heartbeat threshold FAILED %d", status); |
| 8041 | vos_mem_free(pReq); |
| 8042 | pReq = NULL; |
| 8043 | return -EPERM; |
| 8044 | } |
| 8045 | } |
| 8046 | |
Ashish Kumar Dhanotiya | f59c776 | 2018-04-10 17:54:25 +0530 | [diff] [blame] | 8047 | if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER]) { |
| 8048 | qpower = nla_get_u8( |
| 8049 | tb[QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER]); |
| 8050 | |
| 8051 | if(qpower > 1) { |
| 8052 | hddLog(LOGE, "Invalid QPOWER value %d", qpower); |
| 8053 | vos_mem_free(pReq); |
| 8054 | pReq = NULL; |
| 8055 | return -EINVAL; |
| 8056 | } |
| 8057 | /* FW is expacting qpower as 1 for Disable and 2 for enable */ |
| 8058 | qpower++; |
| 8059 | hdd_set_qpower(pHddCtx, qpower); |
| 8060 | } |
| 8061 | |
Pragaspathi Thilagaraj | 03e2ab1 | 2018-06-22 12:19:48 +0530 | [diff] [blame] | 8062 | if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_RSN_IE] && |
| 8063 | pHddCtx->cfg_ini->force_rsne_override) { |
| 8064 | uint8_t force_rsne_override; |
| 8065 | |
| 8066 | force_rsne_override = |
| 8067 | nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_CONFIG_RSN_IE]); |
| 8068 | if (force_rsne_override > 1) { |
| 8069 | hddLog(LOGE, "Invalid test_mode %d", force_rsne_override); |
| 8070 | ret_val = -EINVAL; |
| 8071 | } |
| 8072 | pHddCtx->force_rsne_override = force_rsne_override; |
| 8073 | hddLog(LOG1, "force_rsne_override - %d", |
| 8074 | pHddCtx->force_rsne_override); |
| 8075 | } |
| 8076 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 8077 | EXIT(); |
| 8078 | return ret_val; |
| 8079 | } |
| 8080 | |
| 8081 | /** |
| 8082 | * wlan_hdd_cfg80211_wifi_configuration_set() - Wifi configuration |
| 8083 | * vendor command |
| 8084 | * |
| 8085 | * @wiphy: wiphy device pointer |
| 8086 | * @wdev: wireless device pointer |
| 8087 | * @data: Vendor command data buffer |
| 8088 | * @data_len: Buffer length |
| 8089 | * |
| 8090 | * Handles QCA_WLAN_VENDOR_ATTR_CONFIG_MAX. |
| 8091 | * |
| 8092 | * Return: EOK or other error codes. |
| 8093 | */ |
| 8094 | static int wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, |
| 8095 | struct wireless_dev *wdev, |
| 8096 | const void *data, |
| 8097 | int data_len) |
| 8098 | { |
| 8099 | int ret; |
| 8100 | |
| 8101 | vos_ssr_protect(__func__); |
| 8102 | ret = __wlan_hdd_cfg80211_wifi_configuration_set(wiphy, wdev, |
| 8103 | data, data_len); |
| 8104 | vos_ssr_unprotect(__func__); |
| 8105 | |
| 8106 | return ret; |
| 8107 | } |
Anurag Chouhan | 6ee8154 | 2017-02-09 18:09:27 +0530 | [diff] [blame] | 8108 | |
| 8109 | /* |
| 8110 | * define short names for the global vendor params |
| 8111 | * used by wlan_hdd_cfg80211_setarp_stats_cmd() |
| 8112 | */ |
| 8113 | #define STATS_SET_INVALID \ |
| 8114 | QCA_ATTR_NUD_STATS_SET_INVALID |
| 8115 | #define STATS_SET_START \ |
| 8116 | QCA_ATTR_NUD_STATS_SET_START |
| 8117 | #define STATS_GW_IPV4 \ |
| 8118 | QCA_ATTR_NUD_STATS_GW_IPV4 |
| 8119 | #define STATS_SET_MAX \ |
| 8120 | QCA_ATTR_NUD_STATS_SET_MAX |
| 8121 | |
| 8122 | const struct nla_policy |
| 8123 | qca_wlan_vendor_set_nud_stats[STATS_SET_MAX +1] = |
| 8124 | { |
| 8125 | [STATS_SET_START] = {.type = NLA_FLAG }, |
| 8126 | [STATS_GW_IPV4] = {.type = NLA_U32 }, |
| 8127 | }; |
| 8128 | |
| 8129 | /** |
| 8130 | * hdd_set_nud_stats_cb() - hdd callback api to get status |
| 8131 | * @data: pointer to adapter |
| 8132 | * @rsp: status |
| 8133 | * |
| 8134 | * Return: None |
| 8135 | */ |
| 8136 | static void hdd_set_nud_stats_cb(void *data, VOS_STATUS rsp) |
| 8137 | { |
| 8138 | |
| 8139 | hdd_adapter_t *adapter = (hdd_adapter_t *)data; |
| 8140 | |
| 8141 | if (NULL == adapter) |
| 8142 | return; |
| 8143 | |
| 8144 | if (VOS_STATUS_SUCCESS == rsp) { |
| 8145 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8146 | "%s success received STATS_SET_START", __func__); |
| 8147 | } else { |
| 8148 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8149 | "%s STATS_SET_START Failed!!", __func__); |
| 8150 | } |
| 8151 | return; |
| 8152 | } |
| 8153 | |
| 8154 | /** |
| 8155 | * __wlan_hdd_cfg80211_set_nud_stats() - set arp stats command to firmware |
| 8156 | * @wiphy: pointer to wireless wiphy structure. |
| 8157 | * @wdev: pointer to wireless_dev structure. |
| 8158 | * @data: pointer to apfind configuration data. |
| 8159 | * @data_len: the length in byte of apfind data. |
| 8160 | * |
| 8161 | * This is called when wlan driver needs to send arp stats to |
| 8162 | * firmware. |
| 8163 | * |
| 8164 | * Return: An error code or 0 on success. |
| 8165 | */ |
| 8166 | static int __wlan_hdd_cfg80211_set_nud_stats(struct wiphy *wiphy, |
| 8167 | struct wireless_dev *wdev, |
| 8168 | const void *data, int data_len) |
| 8169 | { |
| 8170 | struct nlattr *tb[STATS_SET_MAX + 1]; |
| 8171 | struct net_device *dev = wdev->netdev; |
| 8172 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8173 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
Sravan Kumar Kairam | d9e8cbb | 2017-01-17 12:17:28 +0530 | [diff] [blame] | 8174 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(adapter))->pvosContext; |
Anurag Chouhan | 6ee8154 | 2017-02-09 18:09:27 +0530 | [diff] [blame] | 8175 | setArpStatsParams arp_stats_params; |
| 8176 | int err = 0; |
| 8177 | |
| 8178 | ENTER(); |
| 8179 | |
| 8180 | err = wlan_hdd_validate_context(hdd_ctx); |
| 8181 | if (0 != err) |
| 8182 | return err; |
| 8183 | |
| 8184 | if (!sme_IsFeatureSupportedByFW(NUD_DEBUG)) { |
| 8185 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8186 | "%s NUD_DEBUG feature not supported by firmware!!", __func__); |
| 8187 | return -EINVAL; |
| 8188 | } |
| 8189 | |
| 8190 | err = nla_parse(tb, STATS_SET_MAX, data, data_len, |
| 8191 | qca_wlan_vendor_set_nud_stats); |
| 8192 | if (err) |
| 8193 | { |
| 8194 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8195 | "%s STATS_SET_START ATTR", __func__); |
| 8196 | return err; |
| 8197 | } |
| 8198 | |
| 8199 | if (tb[STATS_SET_START]) |
| 8200 | { |
| 8201 | if (!tb[STATS_GW_IPV4]) { |
| 8202 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8203 | "%s STATS_SET_START CMD", __func__); |
| 8204 | return -EINVAL; |
| 8205 | } |
| 8206 | arp_stats_params.flag = true; |
| 8207 | arp_stats_params.ip_addr = nla_get_u32(tb[STATS_GW_IPV4]); |
| 8208 | } else { |
| 8209 | arp_stats_params.flag = false; |
| 8210 | } |
Anurag Chouhan | 630c556 | 2017-03-23 14:51:47 +0530 | [diff] [blame] | 8211 | if (arp_stats_params.flag) |
Anurag Chouhan | 6ee8154 | 2017-02-09 18:09:27 +0530 | [diff] [blame] | 8212 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8213 | "%s STATS_SET_START Cleared!!", __func__); |
Anurag Chouhan | 630c556 | 2017-03-23 14:51:47 +0530 | [diff] [blame] | 8214 | vos_mem_zero(&adapter->hdd_stats.hddArpStats, |
| 8215 | sizeof(adapter->hdd_stats.hddArpStats)); |
Anurag Chouhan | 6ee8154 | 2017-02-09 18:09:27 +0530 | [diff] [blame] | 8216 | |
| 8217 | arp_stats_params.pkt_type = 1; // ARP packet type |
| 8218 | |
Sravan Kumar Kairam | d9e8cbb | 2017-01-17 12:17:28 +0530 | [diff] [blame] | 8219 | if (arp_stats_params.flag) { |
| 8220 | hdd_ctx->track_arp_ip = arp_stats_params.ip_addr; |
| 8221 | WLANTL_SetARPFWDatapath(pVosContext, true); |
| 8222 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8223 | "%s Set FW in data path for ARP with tgt IP :%d", |
| 8224 | __func__, hdd_ctx->track_arp_ip); |
| 8225 | } |
| 8226 | else { |
| 8227 | WLANTL_SetARPFWDatapath(pVosContext, false); |
| 8228 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8229 | "%s Remove FW from data path", __func__); |
| 8230 | } |
| 8231 | |
Anurag Chouhan | 6ee8154 | 2017-02-09 18:09:27 +0530 | [diff] [blame] | 8232 | arp_stats_params.rsp_cb_fn = hdd_set_nud_stats_cb; |
| 8233 | arp_stats_params.data_ctx = adapter; |
| 8234 | |
| 8235 | if (eHAL_STATUS_SUCCESS != |
| 8236 | sme_set_nud_debug_stats(hdd_ctx->hHal, &arp_stats_params)) { |
| 8237 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8238 | "%s STATS_SET_START CMD Failed!!", __func__); |
| 8239 | return -EINVAL; |
| 8240 | } |
| 8241 | |
| 8242 | EXIT(); |
| 8243 | |
| 8244 | return err; |
| 8245 | } |
| 8246 | |
| 8247 | /** |
| 8248 | * wlan_hdd_cfg80211_set_nud_stats() - set arp stats command to firmware |
| 8249 | * @wiphy: pointer to wireless wiphy structure. |
| 8250 | * @wdev: pointer to wireless_dev structure. |
| 8251 | * @data: pointer to apfind configuration data. |
| 8252 | * @data_len: the length in byte of apfind data. |
| 8253 | * |
| 8254 | * This is called when wlan driver needs to send arp stats to |
| 8255 | * firmware. |
| 8256 | * |
| 8257 | * Return: An error code or 0 on success. |
| 8258 | */ |
| 8259 | static int wlan_hdd_cfg80211_set_nud_stats(struct wiphy *wiphy, |
| 8260 | struct wireless_dev *wdev, |
| 8261 | const void *data, int data_len) |
| 8262 | { |
| 8263 | int ret; |
| 8264 | |
| 8265 | vos_ssr_protect(__func__); |
| 8266 | ret = __wlan_hdd_cfg80211_set_nud_stats(wiphy, wdev, data, data_len); |
| 8267 | vos_ssr_unprotect(__func__); |
| 8268 | |
| 8269 | return ret; |
| 8270 | } |
| 8271 | #undef STATS_SET_INVALID |
| 8272 | #undef STATS_SET_START |
| 8273 | #undef STATS_GW_IPV4 |
| 8274 | #undef STATS_SET_MAX |
| 8275 | |
| 8276 | /* |
| 8277 | * define short names for the global vendor params |
| 8278 | * used by wlan_hdd_cfg80211_setarp_stats_cmd() |
| 8279 | */ |
| 8280 | #define STATS_GET_INVALID \ |
| 8281 | QCA_ATTR_NUD_STATS_SET_INVALID |
| 8282 | #define COUNT_FROM_NETDEV \ |
| 8283 | QCA_ATTR_NUD_STATS_ARP_REQ_COUNT_FROM_NETDEV |
| 8284 | #define COUNT_TO_LOWER_MAC \ |
| 8285 | QCA_ATTR_NUD_STATS_ARP_REQ_COUNT_TO_LOWER_MAC |
| 8286 | #define RX_COUNT_BY_LOWER_MAC \ |
| 8287 | QCA_ATTR_NUD_STATS_ARP_REQ_RX_COUNT_BY_LOWER_MAC |
| 8288 | #define COUNT_TX_SUCCESS \ |
| 8289 | QCA_ATTR_NUD_STATS_ARP_REQ_COUNT_TX_SUCCESS |
| 8290 | #define RSP_RX_COUNT_BY_LOWER_MAC \ |
| 8291 | QCA_ATTR_NUD_STATS_ARP_RSP_RX_COUNT_BY_LOWER_MAC |
| 8292 | #define RSP_RX_COUNT_BY_UPPER_MAC \ |
| 8293 | QCA_ATTR_NUD_STATS_ARP_RSP_RX_COUNT_BY_UPPER_MAC |
| 8294 | #define RSP_COUNT_TO_NETDEV \ |
| 8295 | QCA_ATTR_NUD_STATS_ARP_RSP_COUNT_TO_NETDEV |
| 8296 | #define RSP_COUNT_OUT_OF_ORDER_DROP \ |
| 8297 | QCA_ATTR_NUD_STATS_ARP_RSP_COUNT_OUT_OF_ORDER_DROP |
| 8298 | #define AP_LINK_ACTIVE \ |
| 8299 | QCA_ATTR_NUD_STATS_AP_LINK_ACTIVE |
| 8300 | #define AP_LINK_DAD \ |
| 8301 | QCA_ATTR_NUD_STATS_AP_LINK_DAD |
| 8302 | #define STATS_GET_MAX \ |
| 8303 | QCA_ATTR_NUD_STATS_GET_MAX |
| 8304 | |
| 8305 | const struct nla_policy |
| 8306 | qca_wlan_vendor_get_nud_stats[STATS_GET_MAX +1] = |
| 8307 | { |
| 8308 | [COUNT_FROM_NETDEV] = {.type = NLA_U16 }, |
| 8309 | [COUNT_TO_LOWER_MAC] = {.type = NLA_U16 }, |
| 8310 | [RX_COUNT_BY_LOWER_MAC] = {.type = NLA_U16 }, |
| 8311 | [COUNT_TX_SUCCESS] = {.type = NLA_U16 }, |
| 8312 | [RSP_RX_COUNT_BY_LOWER_MAC] = {.type = NLA_U16 }, |
| 8313 | [RSP_RX_COUNT_BY_UPPER_MAC] = {.type = NLA_U16 }, |
| 8314 | [RSP_COUNT_TO_NETDEV] = {.type = NLA_U16 }, |
| 8315 | [RSP_COUNT_OUT_OF_ORDER_DROP] = {.type = NLA_U16 }, |
| 8316 | [AP_LINK_ACTIVE] = {.type = NLA_FLAG }, |
| 8317 | [AP_LINK_DAD] = {.type = NLA_FLAG }, |
| 8318 | }; |
| 8319 | |
| 8320 | static void hdd_get_nud_stats_cb(void *data, rsp_stats *rsp) |
| 8321 | { |
| 8322 | |
| 8323 | hdd_adapter_t *adapter = (hdd_adapter_t *)data; |
Hanumanth Reddy Pothula | 8f528c7 | 2018-02-26 16:49:25 +0530 | [diff] [blame] | 8324 | hdd_context_t *hdd_ctx; |
Anurag Chouhan | 6ee8154 | 2017-02-09 18:09:27 +0530 | [diff] [blame] | 8325 | struct hdd_nud_stats_context *context; |
| 8326 | int status; |
| 8327 | |
| 8328 | ENTER(); |
| 8329 | |
| 8330 | if (NULL == adapter) |
| 8331 | return; |
| 8332 | |
Hanumanth Reddy Pothula | 8f528c7 | 2018-02-26 16:49:25 +0530 | [diff] [blame] | 8333 | if (!rsp) { |
| 8334 | hddLog(LOGE, FL("data is null")); |
Anurag Chouhan | 6ee8154 | 2017-02-09 18:09:27 +0530 | [diff] [blame] | 8335 | return; |
| 8336 | } |
| 8337 | |
Hanumanth Reddy Pothula | 8f528c7 | 2018-02-26 16:49:25 +0530 | [diff] [blame] | 8338 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 8339 | status = wlan_hdd_validate_context(hdd_ctx); |
| 8340 | if (0 != status) { |
Anurag Chouhan | 6ee8154 | 2017-02-09 18:09:27 +0530 | [diff] [blame] | 8341 | return; |
| 8342 | } |
| 8343 | |
| 8344 | adapter->hdd_stats.hddArpStats.tx_fw_cnt = rsp->tx_fw_cnt; |
| 8345 | adapter->hdd_stats.hddArpStats.rx_fw_cnt = rsp->rx_fw_cnt; |
| 8346 | adapter->hdd_stats.hddArpStats.tx_ack_cnt = rsp->tx_ack_cnt; |
| 8347 | adapter->dad |= rsp->dad; |
| 8348 | |
| 8349 | spin_lock(&hdd_context_lock); |
| 8350 | context = &hdd_ctx->nud_stats_context; |
| 8351 | complete(&context->response_event); |
| 8352 | spin_unlock(&hdd_context_lock); |
| 8353 | |
| 8354 | return; |
| 8355 | } |
| 8356 | static int __wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy, |
| 8357 | struct wireless_dev *wdev, |
| 8358 | const void *data, int data_len) |
| 8359 | { |
| 8360 | int err = 0; |
| 8361 | unsigned long rc; |
| 8362 | struct hdd_nud_stats_context *context; |
| 8363 | struct net_device *dev = wdev->netdev; |
| 8364 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8365 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 8366 | getArpStatsParams arp_stats_params; |
| 8367 | struct sk_buff *skb; |
| 8368 | |
| 8369 | ENTER(); |
| 8370 | |
| 8371 | err = wlan_hdd_validate_context(hdd_ctx); |
| 8372 | if (0 != err) |
| 8373 | return err; |
| 8374 | |
| 8375 | arp_stats_params.pkt_type = WLAN_NUD_STATS_ARP_PKT_TYPE; |
| 8376 | arp_stats_params.get_rsp_cb_fn = hdd_get_nud_stats_cb; |
| 8377 | arp_stats_params.data_ctx = adapter; |
| 8378 | |
| 8379 | spin_lock(&hdd_context_lock); |
| 8380 | context = &hdd_ctx->nud_stats_context; |
| 8381 | INIT_COMPLETION(context->response_event); |
| 8382 | spin_unlock(&hdd_context_lock); |
| 8383 | |
| 8384 | if (!sme_IsFeatureSupportedByFW(NUD_DEBUG)) { |
| 8385 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8386 | "%s NUD_DEBUG feature not supported by firmware!!", __func__); |
| 8387 | return -EINVAL; |
| 8388 | } |
| 8389 | |
| 8390 | if (eHAL_STATUS_SUCCESS != |
| 8391 | sme_get_nud_debug_stats(hdd_ctx->hHal, &arp_stats_params)) { |
| 8392 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8393 | "%s STATS_SET_START CMD Failed!!", __func__); |
| 8394 | return -EINVAL; |
| 8395 | } |
| 8396 | |
| 8397 | rc = wait_for_completion_timeout(&context->response_event, |
| 8398 | msecs_to_jiffies(WLAN_WAIT_TIME_NUD_STATS)); |
| 8399 | if (!rc) |
| 8400 | { |
| 8401 | hddLog(LOGE, |
| 8402 | FL("Target response timed out request ")); |
| 8403 | return -ETIMEDOUT; |
| 8404 | } |
| 8405 | |
| 8406 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 8407 | WLAN_NUD_STATS_LEN); |
| 8408 | if (!skb) |
| 8409 | { |
| 8410 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8411 | "%s: cfg80211_vendor_cmd_alloc_reply_skb failed", |
| 8412 | __func__); |
| 8413 | return -ENOMEM; |
| 8414 | } |
| 8415 | |
| 8416 | if (nla_put_u16(skb, COUNT_FROM_NETDEV, |
| 8417 | adapter->hdd_stats.hddArpStats.txCount) || |
| 8418 | nla_put_u16(skb, COUNT_TO_LOWER_MAC, |
| 8419 | adapter->hdd_stats.hddArpStats.tx_host_fw_sent) || |
| 8420 | nla_put_u16(skb, RX_COUNT_BY_LOWER_MAC, |
| 8421 | adapter->hdd_stats.hddArpStats.tx_fw_cnt) || |
| 8422 | nla_put_u16(skb, COUNT_TX_SUCCESS, |
| 8423 | adapter->hdd_stats.hddArpStats.tx_ack_cnt) || |
| 8424 | nla_put_u16(skb, RSP_RX_COUNT_BY_LOWER_MAC, |
| 8425 | adapter->hdd_stats.hddArpStats.rx_fw_cnt) || |
| 8426 | nla_put_u16(skb, RSP_RX_COUNT_BY_UPPER_MAC, |
| 8427 | adapter->hdd_stats.hddArpStats.rxCount) || |
| 8428 | nla_put_u16(skb, RSP_COUNT_TO_NETDEV, |
| 8429 | adapter->hdd_stats.hddArpStats.rxDelivered) || |
| 8430 | nla_put_u16(skb, RSP_COUNT_OUT_OF_ORDER_DROP, |
| 8431 | adapter->hdd_stats.hddArpStats.rx_host_drop_reorder)) { |
| 8432 | hddLog(LOGE, FL("nla put fail")); |
| 8433 | kfree_skb(skb); |
| 8434 | return -EINVAL; |
| 8435 | } |
| 8436 | if (adapter->con_status) |
| 8437 | nla_put_flag(skb, AP_LINK_ACTIVE); |
| 8438 | if (adapter->dad) |
| 8439 | nla_put_flag(skb, AP_LINK_DAD); |
| 8440 | |
| 8441 | cfg80211_vendor_cmd_reply(skb); |
| 8442 | return err; |
| 8443 | } |
| 8444 | |
| 8445 | static int wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy, |
| 8446 | struct wireless_dev *wdev, |
| 8447 | const void *data, int data_len) |
| 8448 | { |
| 8449 | int ret; |
| 8450 | |
| 8451 | vos_ssr_protect(__func__); |
| 8452 | ret = __wlan_hdd_cfg80211_get_nud_stats(wiphy, wdev, data, data_len); |
| 8453 | vos_ssr_unprotect(__func__); |
| 8454 | |
| 8455 | return ret; |
| 8456 | } |
| 8457 | |
| 8458 | #undef QCA_ATTR_NUD_STATS_SET_INVALID |
| 8459 | #undef QCA_ATTR_NUD_STATS_ARP_REQ_COUNT_FROM_NETDEV |
| 8460 | #undef QCA_ATTR_NUD_STATS_ARP_REQ_COUNT_TO_LOWER_MAC |
| 8461 | #undef QCA_ATTR_NUD_STATS_ARP_REQ_RX_COUNT_BY_LOWER_MAC |
| 8462 | #undef QCA_ATTR_NUD_STATS_ARP_REQ_COUNT_TX_SUCCESS |
| 8463 | #undef QCA_ATTR_NUD_STATS_ARP_RSP_RX_COUNT_BY_LOWER_MAC |
| 8464 | #undef QCA_ATTR_NUD_STATS_ARP_RSP_RX_COUNT_BY_UPPER_MAC |
| 8465 | #undef QCA_ATTR_NUD_STATS_ARP_RSP_COUNT_TO_NETDEV |
| 8466 | #undef QCA_ATTR_NUD_STATS_ARP_RSP_COUNT_OUT_OF_ORDER_DROP |
| 8467 | #undef QCA_ATTR_NUD_STATS_AP_LINK_ACTIVE |
| 8468 | #undef QCA_ATTR_NUD_STATS_GET_MAX |
| 8469 | |
| 8470 | |
| 8471 | |
Kapil Gupta | ee33bf1 | 2016-12-20 18:27:37 +0530 | [diff] [blame] | 8472 | #ifdef WLAN_FEATURE_APFIND |
| 8473 | /** |
| 8474 | * __wlan_hdd_cfg80211_apfind_cmd() - set configuration to firmware |
| 8475 | * @wiphy: pointer to wireless wiphy structure. |
| 8476 | * @wdev: pointer to wireless_dev structure. |
| 8477 | * @data: pointer to apfind configuration data. |
| 8478 | * @data_len: the length in byte of apfind data. |
| 8479 | * |
| 8480 | * This is called when wlan driver needs to send APFIND configurations to |
| 8481 | * firmware. |
| 8482 | * |
| 8483 | * Return: An error code or 0 on success. |
| 8484 | */ |
| 8485 | static int __wlan_hdd_cfg80211_apfind_cmd(struct wiphy *wiphy, |
| 8486 | struct wireless_dev *wdev, |
| 8487 | const void *data, int data_len) |
| 8488 | { |
| 8489 | struct sme_ap_find_request_req apfind_req; |
| 8490 | VOS_STATUS status; |
| 8491 | int ret_val; |
| 8492 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 8493 | |
| 8494 | ENTER(); |
| 8495 | |
| 8496 | ret_val = wlan_hdd_validate_context(hdd_ctx); |
| 8497 | if (ret_val) |
| 8498 | return ret_val; |
| 8499 | |
| 8500 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 8501 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 8502 | return -EPERM; |
| 8503 | } |
| 8504 | |
| 8505 | apfind_req.request_data_len = data_len; |
| 8506 | apfind_req.request_data = data; |
| 8507 | |
| 8508 | status = sme_apfind_set_cmd(&apfind_req); |
| 8509 | if (VOS_STATUS_SUCCESS != status) { |
| 8510 | ret_val = -EIO; |
| 8511 | } |
| 8512 | return ret_val; |
| 8513 | } |
| 8514 | |
| 8515 | /** |
| 8516 | * wlan_hdd_cfg80211_apfind_cmd() - set configuration to firmware |
| 8517 | * @wiphy: pointer to wireless wiphy structure. |
| 8518 | * @wdev: pointer to wireless_dev structure. |
| 8519 | * @data: pointer to apfind configuration data. |
| 8520 | * @data_len: the length in byte of apfind data. |
| 8521 | * |
| 8522 | * This is called when wlan driver needs to send APFIND configurations to |
| 8523 | * firmware. |
| 8524 | * |
| 8525 | * Return: An error code or 0 on success. |
| 8526 | */ |
| 8527 | static int wlan_hdd_cfg80211_apfind_cmd(struct wiphy *wiphy, |
| 8528 | struct wireless_dev *wdev, |
| 8529 | const void *data, int data_len) |
| 8530 | { |
| 8531 | int ret; |
| 8532 | |
| 8533 | vos_ssr_protect(__func__); |
| 8534 | ret = __wlan_hdd_cfg80211_apfind_cmd(wiphy, wdev, data, data_len); |
| 8535 | vos_ssr_unprotect(__func__); |
| 8536 | |
| 8537 | return ret; |
| 8538 | } |
| 8539 | #endif /* WLAN_FEATURE_APFIND */ |
Hanumanth Reddy Pothula | 49c3f90 | 2018-02-16 16:01:13 +0530 | [diff] [blame] | 8540 | |
| 8541 | /** |
| 8542 | * __wlan_hdd_cfg80211_get_logger_supp_feature() - Get the wifi logger features |
| 8543 | * @wiphy: pointer to wireless wiphy structure. |
| 8544 | * @wdev: pointer to wireless_dev structure. |
| 8545 | * @data: Pointer to the data to be passed via vendor interface |
| 8546 | * @data_len:Length of the data to be passed |
| 8547 | * |
| 8548 | * This is called by userspace to know the supported logger features |
| 8549 | * |
| 8550 | * Return: Return the Success or Failure code. |
| 8551 | */ |
| 8552 | static int |
| 8553 | __wlan_hdd_cfg80211_get_logger_supp_feature(struct wiphy *wiphy, |
| 8554 | struct wireless_dev *wdev, |
| 8555 | const void *data, int data_len) |
| 8556 | { |
| 8557 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 8558 | int status; |
| 8559 | uint32_t features; |
| 8560 | struct sk_buff *reply_skb = NULL; |
| 8561 | |
| 8562 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 8563 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 8564 | return -EINVAL; |
| 8565 | } |
| 8566 | |
| 8567 | status = wlan_hdd_validate_context(hdd_ctx); |
| 8568 | if (0 != status) |
| 8569 | return -EINVAL; |
| 8570 | |
| 8571 | features = 0; |
| 8572 | |
| 8573 | if (hdd_is_memdump_supported()) |
| 8574 | features |= WIFI_LOGGER_MEMORY_DUMP_SUPPORTED; |
| 8575 | |
| 8576 | if (hdd_ctx->cfg_ini->wlanLoggingEnable && |
| 8577 | hdd_ctx->cfg_ini->enableFatalEvent && |
| 8578 | hdd_ctx->is_fatal_event_log_sup) { |
| 8579 | features |= WIFI_LOGGER_PER_PACKET_TX_RX_STATUS_SUPPORTED; |
| 8580 | features |= WIFI_LOGGER_CONNECT_EVENT_SUPPORTED; |
| 8581 | } |
| 8582 | |
| 8583 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 8584 | sizeof(uint32_t) + NLA_HDRLEN + NLMSG_HDRLEN); |
| 8585 | if (!reply_skb) { |
| 8586 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 8587 | return -ENOMEM; |
| 8588 | } |
| 8589 | |
| 8590 | hddLog(LOG1, FL("Supported logger features: 0x%0x"), features); |
| 8591 | if (nla_put_u32(reply_skb, QCA_WLAN_VENDOR_ATTR_LOGGER_SUPPORTED, |
| 8592 | features)) { |
| 8593 | hddLog(LOGE, FL("nla put fail")); |
| 8594 | kfree_skb(reply_skb); |
| 8595 | return -EINVAL; |
| 8596 | } |
| 8597 | |
| 8598 | return cfg80211_vendor_cmd_reply(reply_skb); |
| 8599 | } |
| 8600 | |
| 8601 | /** |
| 8602 | * wlan_hdd_cfg80211_get_logger_supp_feature() - Get the wifi logger features |
| 8603 | * @wiphy: pointer to wireless wiphy structure. |
| 8604 | * @wdev: pointer to wireless_dev structure. |
| 8605 | * @data: Pointer to the data to be passed via vendor interface |
| 8606 | * @data_len:Length of the data to be passed |
| 8607 | * |
| 8608 | * This is called by userspace to know the supported logger features |
| 8609 | * |
| 8610 | * Return: Return the Success or Failure code. |
| 8611 | */ |
| 8612 | static int |
| 8613 | wlan_hdd_cfg80211_get_logger_supp_feature(struct wiphy *wiphy, |
| 8614 | struct wireless_dev *wdev, |
| 8615 | const void *data, int data_len) |
| 8616 | { |
| 8617 | int ret; |
| 8618 | |
| 8619 | vos_ssr_protect(__func__); |
| 8620 | ret = __wlan_hdd_cfg80211_get_logger_supp_feature(wiphy, wdev, |
| 8621 | data, data_len); |
| 8622 | vos_ssr_unprotect(__func__); |
| 8623 | |
| 8624 | return ret; |
| 8625 | } |
| 8626 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8627 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 8628 | { |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 8629 | { |
| 8630 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8631 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAMING, |
| 8632 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8633 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8634 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8635 | .doit = wlan_hdd_cfg80211_firmware_roaming |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 8636 | }, |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 8637 | |
| 8638 | { |
| 8639 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8640 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN, |
| 8641 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8642 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8643 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8644 | .doit = wlan_hdd_cfg80211_nan_request |
| 8645 | }, |
| 8646 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8647 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 8648 | { |
| 8649 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8650 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 8651 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8652 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8653 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8654 | .doit = wlan_hdd_cfg80211_ll_stats_clear |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8655 | }, |
| 8656 | |
| 8657 | { |
| 8658 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8659 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 8660 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8661 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8662 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8663 | .doit = wlan_hdd_cfg80211_ll_stats_set |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8664 | }, |
| 8665 | |
| 8666 | { |
| 8667 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8668 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 8669 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8670 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8671 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8672 | .doit = wlan_hdd_cfg80211_ll_stats_get |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8673 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8674 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8675 | #ifdef WLAN_FEATURE_EXTSCAN |
| 8676 | { |
| 8677 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8678 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START, |
| 8679 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8680 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8681 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8682 | .doit = wlan_hdd_cfg80211_extscan_start |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8683 | }, |
| 8684 | { |
| 8685 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8686 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP, |
| 8687 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8688 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8689 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8690 | .doit = wlan_hdd_cfg80211_extscan_stop |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8691 | }, |
| 8692 | { |
| 8693 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8694 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS, |
| 8695 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8696 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8697 | .doit = wlan_hdd_cfg80211_extscan_get_valid_channels |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8698 | }, |
| 8699 | { |
| 8700 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8701 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES, |
| 8702 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8703 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8704 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8705 | .doit = wlan_hdd_cfg80211_extscan_get_capabilities |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8706 | }, |
| 8707 | { |
| 8708 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8709 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS, |
| 8710 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8711 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8712 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8713 | .doit = wlan_hdd_cfg80211_extscan_get_cached_results |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8714 | }, |
| 8715 | { |
| 8716 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8717 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST, |
| 8718 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8719 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8720 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8721 | .doit = wlan_hdd_cfg80211_extscan_set_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8722 | }, |
| 8723 | { |
| 8724 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8725 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST, |
| 8726 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8727 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8728 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8729 | .doit = wlan_hdd_cfg80211_extscan_reset_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8730 | }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8731 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8732 | /*EXT TDLS*/ |
| 8733 | { |
| 8734 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8735 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE, |
| 8736 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8737 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8738 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8739 | .doit = wlan_hdd_cfg80211_exttdls_enable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8740 | }, |
| 8741 | { |
| 8742 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8743 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE, |
| 8744 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8745 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8746 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8747 | .doit = wlan_hdd_cfg80211_exttdls_disable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8748 | }, |
| 8749 | { |
| 8750 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8751 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS, |
| 8752 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8753 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8754 | .doit = wlan_hdd_cfg80211_exttdls_get_status |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8755 | }, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 8756 | { |
| 8757 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8758 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES, |
| 8759 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8760 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8761 | .doit = wlan_hdd_cfg80211_get_supported_features |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 8762 | }, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 8763 | { |
| 8764 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8765 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG, |
| 8766 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8767 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8768 | .doit = wlan_hdd_cfg80211_disable_dfs_channels |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 8769 | }, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 8770 | { |
| 8771 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8772 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MAC_OUI, |
| 8773 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8774 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8775 | .doit = wlan_hdd_cfg80211_set_spoofed_mac_oui |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 8776 | }, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 8777 | { |
| 8778 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8779 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX, |
| 8780 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8781 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 8782 | .doit = wlan_hdd_cfg80211_get_concurrency_matrix |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 8783 | }, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 8784 | { |
| 8785 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 8786 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP, |
| 8787 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8788 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8789 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8790 | .doit = wlan_hdd_cfg80211_get_fw_mem_dump |
| 8791 | }, |
| 8792 | { |
| 8793 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 8794 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SETBAND, |
| 8795 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8796 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8797 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8798 | .doit = wlan_hdd_cfg80211_setband |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 8799 | }, |
| 8800 | { |
| 8801 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8802 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_START, |
| 8803 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8804 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
| 8805 | .doit = wlan_hdd_cfg80211_wifi_logger_start |
| 8806 | }, |
Sushant Kaushik | 847890c | 2015-09-28 16:05:17 +0530 | [diff] [blame] | 8807 | { |
| 8808 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8809 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO, |
| 8810 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8811 | WIPHY_VENDOR_CMD_NEED_NETDEV| |
| 8812 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8813 | .doit = wlan_hdd_cfg80211_get_wifi_info |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 8814 | }, |
| 8815 | { |
| 8816 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8817 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_RING_DATA, |
| 8818 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8819 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8820 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8821 | .doit = wlan_hdd_cfg80211_wifi_logger_get_ring_data |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 8822 | }, |
| 8823 | { |
| 8824 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8825 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI, |
| 8826 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8827 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8828 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8829 | .doit = wlan_hdd_cfg80211_monitor_rssi |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 8830 | }, |
| 8831 | #ifdef WLAN_FEATURE_OFFLOAD_PACKETS |
| 8832 | { |
| 8833 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8834 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_OFFLOADED_PACKETS, |
| 8835 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8836 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8837 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8838 | .doit = wlan_hdd_cfg80211_offloaded_packets |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 8839 | }, |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 8840 | #endif |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 8841 | { |
| 8842 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8843 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES, |
| 8844 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8845 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8846 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8847 | .doit = wlan_hdd_cfg80211_get_link_properties |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 8848 | }, |
| 8849 | { |
| 8850 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8851 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION, |
| 8852 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8853 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8854 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8855 | .doit = wlan_hdd_cfg80211_wifi_configuration_set |
Kapil Gupta | ee33bf1 | 2016-12-20 18:27:37 +0530 | [diff] [blame] | 8856 | }, |
| 8857 | #ifdef WLAN_FEATURE_APFIND |
| 8858 | { |
| 8859 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8860 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_APFIND, |
| 8861 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8862 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
| 8863 | .doit = wlan_hdd_cfg80211_apfind_cmd |
| 8864 | }, |
| 8865 | #endif /* WLAN_FEATURE_APFIND */ |
Anurag Chouhan | 6ee8154 | 2017-02-09 18:09:27 +0530 | [diff] [blame] | 8866 | { |
| 8867 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8868 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NUD_STATS_SET, |
| 8869 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8870 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8871 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8872 | .doit = wlan_hdd_cfg80211_set_nud_stats |
| 8873 | }, |
| 8874 | { |
| 8875 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8876 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NUD_STATS_GET, |
| 8877 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8878 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8879 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8880 | .doit = wlan_hdd_cfg80211_get_nud_stats |
| 8881 | }, |
Anurag Chouhan | fcd2017 | 2017-07-19 17:25:19 +0530 | [diff] [blame] | 8882 | { |
| 8883 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8884 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_STATION, |
| 8885 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 8886 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 8887 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 8888 | .doit = hdd_cfg80211_get_station_cmd |
| 8889 | }, |
Hanumanth Reddy Pothula | 49c3f90 | 2018-02-16 16:01:13 +0530 | [diff] [blame] | 8890 | { |
| 8891 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 8892 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_LOGGER_FEATURE_SET, |
| 8893 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
Hanumanth Reddy Pothula | 07c9558 | 2018-05-23 12:41:22 +0530 | [diff] [blame] | 8894 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Hanumanth Reddy Pothula | 49c3f90 | 2018-02-16 16:01:13 +0530 | [diff] [blame] | 8895 | .doit = wlan_hdd_cfg80211_get_logger_supp_feature |
| 8896 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8897 | }; |
| 8898 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 8899 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8900 | static const |
| 8901 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 8902 | { |
| 8903 | #ifdef FEATURE_WLAN_CH_AVOID |
| 8904 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8905 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8906 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 8907 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8908 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 8909 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 8910 | { |
| 8911 | /* Index = 1*/ |
| 8912 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8913 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 8914 | }, |
| 8915 | { |
| 8916 | /* Index = 2*/ |
| 8917 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8918 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 8919 | }, |
| 8920 | { |
| 8921 | /* Index = 3*/ |
| 8922 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8923 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 8924 | }, |
| 8925 | { |
| 8926 | /* Index = 4*/ |
| 8927 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8928 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 8929 | }, |
| 8930 | { |
| 8931 | /* Index = 5*/ |
| 8932 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8933 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 8934 | }, |
| 8935 | { |
| 8936 | /* Index = 6*/ |
| 8937 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8938 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 8939 | }, |
| 8940 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8941 | #ifdef WLAN_FEATURE_EXTSCAN |
| 8942 | { |
| 8943 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8944 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START |
| 8945 | }, |
| 8946 | { |
| 8947 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8948 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP |
| 8949 | }, |
| 8950 | { |
| 8951 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8952 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES |
| 8953 | }, |
| 8954 | { |
| 8955 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8956 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS |
| 8957 | }, |
| 8958 | { |
| 8959 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8960 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE |
| 8961 | }, |
| 8962 | { |
| 8963 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8964 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT |
| 8965 | }, |
| 8966 | { |
| 8967 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8968 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT |
| 8969 | }, |
| 8970 | { |
| 8971 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8972 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND |
| 8973 | }, |
| 8974 | { |
| 8975 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8976 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST |
| 8977 | }, |
| 8978 | { |
| 8979 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8980 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST |
| 8981 | }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 8982 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 8983 | /*EXT TDLS*/ |
| 8984 | { |
| 8985 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8986 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE |
| 8987 | }, |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 8988 | [QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP_INDEX] = { |
| 8989 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8990 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP |
| 8991 | }, |
| 8992 | |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 8993 | |
Srinivas Dasari | bd1cf64 | 2017-01-23 14:54:41 +0530 | [diff] [blame] | 8994 | [QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX] = { |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 8995 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 8996 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN |
| 8997 | }, |
| 8998 | |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 8999 | { |
| 9000 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 9001 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO, |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 9002 | }, |
| 9003 | [QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI_INDEX] = { |
| 9004 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 9005 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI |
| 9006 | }, |
Padma, Santhosh Kumar | 7bbc7d9 | 2015-12-08 20:23:19 +0530 | [diff] [blame] | 9007 | [QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST_INDEX] = { |
| 9008 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 9009 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST |
| 9010 | }, |
Anurag Chouhan | 6ee8154 | 2017-02-09 18:09:27 +0530 | [diff] [blame] | 9011 | [QCA_NL80211_VENDOR_SUBCMD_NUD_STATS_GET_INDEX] = { |
| 9012 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 9013 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_NUD_STATS_GET, |
| 9014 | }, |
Anurag Chouhan | f0d0ba1 | 2018-02-09 15:13:43 +0530 | [diff] [blame] | 9015 | [QCA_NL80211_VENDOR_SUBCMD_HANG_REASON_INDEX] = { |
| 9016 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 9017 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_HANG, |
| 9018 | }, |
Hanumanth Reddy Pothula | 852449b | 2018-03-08 13:21:10 +0530 | [diff] [blame] | 9019 | [QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES_INDEX] = { |
| 9020 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 9021 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES, |
| 9022 | }, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 9023 | }; |
| 9024 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9025 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 9026 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9027 | * This function is called by hdd_wlan_startup() |
| 9028 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 9029 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9030 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 9031 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9032 | { |
| 9033 | struct wiphy *wiphy; |
| 9034 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9035 | /* |
| 9036 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9037 | */ |
| 9038 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 9039 | |
| 9040 | if (!wiphy) |
| 9041 | { |
| 9042 | /* Print error and jump into err label and free the memory */ |
| 9043 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 9044 | return NULL; |
| 9045 | } |
| 9046 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 9047 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9048 | return wiphy; |
| 9049 | } |
| 9050 | |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 9051 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(4,4,0)) || \ |
| 9052 | defined (CFG80211_MULTI_SCAN_PLAN_BACKPORT) |
| 9053 | /** |
| 9054 | * hdd_config_sched_scan_plans_to_wiphy() - configure sched scan plans to wiphy |
| 9055 | * @wiphy: pointer to wiphy |
| 9056 | * @config: pointer to config |
| 9057 | * |
| 9058 | * Return: None |
| 9059 | */ |
| 9060 | static void hdd_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy, |
| 9061 | hdd_config_t *config) |
| 9062 | { |
| 9063 | wiphy->max_sched_scan_plans = MAX_SCHED_SCAN_PLANS; |
| 9064 | if (config->max_sched_scan_plan_interval) |
| 9065 | wiphy->max_sched_scan_plan_interval = |
| 9066 | config->max_sched_scan_plan_interval; |
| 9067 | if (config->max_sched_scan_plan_iterations) |
| 9068 | wiphy->max_sched_scan_plan_iterations = |
| 9069 | config->max_sched_scan_plan_iterations; |
| 9070 | } |
| 9071 | #else |
| 9072 | static void hdd_config_sched_scan_plans_to_wiphy(struct wiphy *wiphy, |
| 9073 | hdd_config_t *config) |
| 9074 | { |
| 9075 | } |
| 9076 | #endif |
| 9077 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9078 | /* |
| 9079 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9080 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9081 | * private ioctl to change the band value |
| 9082 | */ |
| 9083 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 9084 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 9085 | int i, j; |
| 9086 | eNVChannelEnabledType channelEnabledState; |
| 9087 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9088 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9089 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9090 | for (i = 0; i < HDD_NUM_NL80211_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9091 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 9092 | |
| 9093 | if (NULL == wiphy->bands[i]) |
| 9094 | { |
| 9095 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 9096 | __func__, i); |
| 9097 | continue; |
| 9098 | } |
| 9099 | |
| 9100 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 9101 | { |
| 9102 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 9103 | |
| 9104 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 9105 | band->channels[j].hw_value); |
| 9106 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9107 | if (HDD_NL80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 9108 | { |
Abhishek Singh | 678227a | 2014-11-04 10:52:38 +0530 | [diff] [blame] | 9109 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 9110 | continue; |
| 9111 | } |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9112 | else if (HDD_NL80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 9113 | { |
| 9114 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 9115 | continue; |
| 9116 | } |
| 9117 | |
| 9118 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 9119 | NV_CHANNEL_INVALID == channelEnabledState) |
| 9120 | { |
| 9121 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 9122 | } |
| 9123 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 9124 | { |
| 9125 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 9126 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 9127 | } |
| 9128 | else |
| 9129 | { |
| 9130 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 9131 | |IEEE80211_CHAN_RADAR); |
| 9132 | } |
| 9133 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9134 | } |
| 9135 | return 0; |
| 9136 | } |
Abhishek Singh | 2f3c475 | 2018-04-11 14:58:53 +0530 | [diff] [blame] | 9137 | |
| 9138 | /** |
| 9139 | * hdd_add_channel_switch_support()- Adds Channel Switch flag if supported |
| 9140 | * @wiphy: Pointer to the wiphy. |
| 9141 | * |
| 9142 | * This Function adds Channel Switch support flag, if channel switch is |
| 9143 | * supported by kernel. |
| 9144 | * Return: void. |
| 9145 | */ |
| 9146 | #ifdef CHANNEL_SWITCH_SUPPORTED |
| 9147 | static inline |
| 9148 | void hdd_add_channel_switch_support(struct wiphy *wiphy) |
| 9149 | { |
| 9150 | wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; |
| 9151 | wiphy->max_num_csa_counters = WLAN_HDD_MAX_NUM_CSA_COUNTERS; |
| 9152 | } |
| 9153 | #else |
| 9154 | static inline |
| 9155 | void hdd_add_channel_switch_support(struct wiphy *wiphy) |
| 9156 | { |
| 9157 | } |
| 9158 | #endif |
| 9159 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9160 | /* |
| 9161 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9162 | * This function is called by hdd_wlan_startup() |
| 9163 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9164 | * This function is used to initialize and register wiphy structure. |
| 9165 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 9166 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9167 | struct wiphy *wiphy, |
| 9168 | hdd_config_t *pCfg |
| 9169 | ) |
| 9170 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 9171 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 9172 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 9173 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9174 | ENTER(); |
| 9175 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9176 | /* Now bind the underlying wlan device with wiphy */ |
| 9177 | set_wiphy_dev(wiphy, dev); |
| 9178 | |
| 9179 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 9180 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 9181 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 9182 | /* the flag for the other case would be initialzed in |
| 9183 | vos_init_wiphy_from_nv_bin */ |
Manjeet Singh | 9e19de6 | 2016-08-18 18:26:41 +0530 | [diff] [blame] | 9184 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 9185 | wiphy->regulatory_flags |= REGULATORY_STRICT_REG; |
| 9186 | #else |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 9187 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 9188 | #endif |
Manjeet Singh | 9e19de6 | 2016-08-18 18:26:41 +0530 | [diff] [blame] | 9189 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 9190 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 9191 | /* This will disable updating of NL channels from passive to |
| 9192 | * active if a beacon is received on passive channel. */ |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 9193 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 9194 | wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS; |
| 9195 | #else |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 9196 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 9197 | #endif |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 9198 | |
Nachiket Kukade | 5b2e733 | 2018-04-06 14:40:22 +0530 | [diff] [blame] | 9199 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) || defined(WITH_BACKPORTS) |
| 9200 | wiphy->wowlan = &wowlan_support_cfg80211_init; |
| 9201 | #else |
Nachiket Kukade | 1e1b90e | 2018-05-10 15:26:13 +0530 | [diff] [blame] | 9202 | wiphy->wowlan.flags = WIPHY_WOWLAN_ANY | |
| 9203 | WIPHY_WOWLAN_MAGIC_PKT; |
Nachiket Kukade | 5b2e733 | 2018-04-06 14:40:22 +0530 | [diff] [blame] | 9204 | wiphy->wowlan.n_patterns = WOWL_MAX_PTRNS_ALLOWED; |
| 9205 | wiphy->wowlan.pattern_min_len = 1; |
| 9206 | wiphy->wowlan.pattern_max_len = WOWL_PTRN_MAX_SIZE; |
| 9207 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 9208 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9209 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 9210 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 9211 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 9212 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9213 | | WIPHY_FLAG_OFFCHAN_TX; |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 9214 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
Rajeev Kumar Sirasanagandla | 0d6dd75 | 2016-08-17 15:01:39 +0530 | [diff] [blame] | 9215 | wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE; |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 9216 | #else |
| 9217 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
| 9218 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9219 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 9220 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9221 | #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] | 9222 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 9223 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 9224 | || pCfg->isFastRoamIniFeatureEnabled |
| 9225 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9226 | #ifdef FEATURE_WLAN_ESE |
| 9227 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 9228 | #endif |
| 9229 | ) |
| 9230 | { |
| 9231 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 9232 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 9233 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 9234 | #ifdef FEATURE_WLAN_TDLS |
| 9235 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 9236 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 9237 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 9238 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 9239 | if (pCfg->configPNOScanSupport) |
| 9240 | { |
| 9241 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 9242 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 9243 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 9244 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 9245 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 9246 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 9247 | |
Abhishek Singh | 10d8597 | 2015-04-17 10:27:23 +0530 | [diff] [blame] | 9248 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 9249 | wiphy->features |= NL80211_FEATURE_HT_IBSS; |
| 9250 | #endif |
| 9251 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 9252 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 9253 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 9254 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 9255 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 9256 | driver need to determine what to do with both |
| 9257 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 9258 | |
| 9259 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 9260 | #else |
| 9261 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 9262 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9263 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9264 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 9265 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 9266 | wiphy->max_scan_ie_len = SIR_MAC_MAX_ADD_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9267 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 9268 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 9269 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9270 | /* Supports STATION & AD-HOC modes right now */ |
Bhargav Shah | 0d2e3e5 | 2015-07-24 16:51:01 +0530 | [diff] [blame] | 9271 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
| 9272 | | BIT(NL80211_IFTYPE_ADHOC) |
| 9273 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 9274 | | BIT(NL80211_IFTYPE_P2P_GO) |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 9275 | | BIT(NL80211_IFTYPE_AP) |
| 9276 | | BIT(NL80211_IFTYPE_MONITOR); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9277 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 9278 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 9279 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 9280 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 9281 | if( pCfg->enableMCC ) |
| 9282 | { |
| 9283 | /* Currently, supports up to two channels */ |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 9284 | wlan_hdd_iface_combination[0].num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 9285 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 9286 | if( !pCfg->allowMCCGODiffBI ) |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 9287 | wlan_hdd_iface_combination[0].beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 9288 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 9289 | } |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 9290 | wiphy->iface_combinations = wlan_hdd_iface_combination; |
| 9291 | wiphy->n_iface_combinations = ARRAY_SIZE(wlan_hdd_iface_combination); |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 9292 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 9293 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 9294 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9295 | /* Before registering we need to update the ht capabilitied based |
| 9296 | * on ini values*/ |
| 9297 | if( !pCfg->ShortGI20MhzEnable ) |
| 9298 | { |
| 9299 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 9300 | 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] | 9301 | } |
| 9302 | |
| 9303 | if( !pCfg->ShortGI40MhzEnable ) |
| 9304 | { |
| 9305 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 9306 | } |
| 9307 | |
| 9308 | if( !pCfg->nChannelBondingMode5GHz ) |
| 9309 | { |
| 9310 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 9311 | } |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 9312 | /* |
| 9313 | * In case of static linked driver at the time of driver unload, |
| 9314 | * module exit doesn't happens. Module cleanup helps in cleaning |
| 9315 | * of static memory. |
| 9316 | * If driver load happens statically, at the time of driver unload, |
| 9317 | * wiphy flags don't get reset because of static memory. |
| 9318 | * It's better not to store channel in static memory. |
| 9319 | */ |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9320 | wiphy->bands[HDD_NL80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
| 9321 | wiphy->bands[HDD_NL80211_BAND_2GHZ]->channels = |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 9322 | (struct ieee80211_channel *)vos_mem_malloc(sizeof(hdd_channels_2_4_GHZ)); |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9323 | if (wiphy->bands[HDD_NL80211_BAND_2GHZ]->channels == NULL) |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 9324 | { |
| 9325 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9326 | FL("Not enough memory to allocate channels")); |
| 9327 | return -ENOMEM; |
| 9328 | } |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9329 | vos_mem_copy(wiphy->bands[HDD_NL80211_BAND_2GHZ]->channels, |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 9330 | &hdd_channels_2_4_GHZ[0], |
| 9331 | sizeof(hdd_channels_2_4_GHZ)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9332 | |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 9333 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 9334 | { |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9335 | wiphy->bands[HDD_NL80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 9336 | wiphy->bands[HDD_NL80211_BAND_5GHZ]->channels = |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 9337 | (struct ieee80211_channel *)vos_mem_malloc(sizeof(hdd_channels_5_GHZ)); |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9338 | if (wiphy->bands[HDD_NL80211_BAND_5GHZ]->channels == NULL) |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 9339 | { |
| 9340 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9341 | FL("Not enough memory to allocate channels")); |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9342 | vos_mem_free(wiphy->bands[HDD_NL80211_BAND_2GHZ]->channels); |
| 9343 | wiphy->bands[HDD_NL80211_BAND_2GHZ]->channels = NULL; |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 9344 | return -ENOMEM; |
| 9345 | } |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9346 | vos_mem_copy(wiphy->bands[HDD_NL80211_BAND_5GHZ]->channels, |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 9347 | &hdd_channels_5_GHZ[0], |
| 9348 | sizeof(hdd_channels_5_GHZ)); |
| 9349 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 9350 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9351 | for (i = 0; i < HDD_NUM_NL80211_BANDS; i++) |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 9352 | { |
| 9353 | |
| 9354 | if (NULL == wiphy->bands[i]) |
| 9355 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 9356 | 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] | 9357 | __func__, i); |
| 9358 | continue; |
| 9359 | } |
| 9360 | |
| 9361 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 9362 | { |
| 9363 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 9364 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9365 | if (HDD_NL80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 9366 | { |
| 9367 | // Enable social channels for P2P |
| 9368 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 9369 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 9370 | else |
| 9371 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 9372 | continue; |
| 9373 | } |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9374 | else if (HDD_NL80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 9375 | { |
| 9376 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 9377 | continue; |
| 9378 | } |
| 9379 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9380 | } |
| 9381 | /*Initialise the supported cipher suite details*/ |
| 9382 | wiphy->cipher_suites = hdd_cipher_suites; |
| 9383 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 9384 | |
| 9385 | /*signal strength in mBm (100*dBm) */ |
| 9386 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 9387 | |
| 9388 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 9389 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9390 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9391 | |
Abhishek Singh | 2f3c475 | 2018-04-11 14:58:53 +0530 | [diff] [blame] | 9392 | hdd_add_channel_switch_support(wiphy); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 9393 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 9394 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 9395 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 9396 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 9397 | |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 9398 | hdd_config_sched_scan_plans_to_wiphy(wiphy, pCfg); |
| 9399 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 9400 | EXIT(); |
| 9401 | return 0; |
| 9402 | } |
| 9403 | |
| 9404 | /* In this function we are registering wiphy. */ |
| 9405 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 9406 | { |
| 9407 | ENTER(); |
| 9408 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9409 | if (0 > wiphy_register(wiphy)) |
| 9410 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 9411 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9412 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 9413 | return -EIO; |
| 9414 | } |
| 9415 | |
| 9416 | EXIT(); |
| 9417 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9418 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9419 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 9420 | /* In this function we are updating channel list when, |
| 9421 | regulatory domain is FCC and country code is US. |
| 9422 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 9423 | As per FCC smart phone is not a indoor device. |
| 9424 | GO should not opeate on indoor channels */ |
| 9425 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 9426 | { |
| 9427 | int j; |
| 9428 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 9429 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 9430 | //Default counrtycode from NV at the time of wiphy initialization. |
| 9431 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 9432 | &defaultCountryCode[0])) |
| 9433 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 9434 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 9435 | } |
| 9436 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 9437 | { |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9438 | if (NULL == wiphy->bands[HDD_NL80211_BAND_5GHZ]) |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 9439 | { |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9440 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[HDD_NL80211_BAND_5GHZ] is NULL",__func__ ); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 9441 | return; |
| 9442 | } |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9443 | for (j = 0; j < wiphy->bands[HDD_NL80211_BAND_5GHZ]->n_channels; j++) |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 9444 | { |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 9445 | struct ieee80211_supported_band *band = wiphy->bands[HDD_NL80211_BAND_5GHZ]; |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 9446 | // Mark UNII -1 band channel as passive |
| 9447 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 9448 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 9449 | } |
| 9450 | } |
| 9451 | } |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 9452 | /* This function registers for all frame which supplicant is interested in */ |
| 9453 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9454 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9455 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9456 | /* Register for all P2P action, public action etc frames */ |
| 9457 | 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] | 9458 | ENTER(); |
Abhishek Singh | 16e0576 | 2015-11-30 14:29:27 +0530 | [diff] [blame] | 9459 | /* Register frame indication call back */ |
| 9460 | sme_register_mgmt_frame_ind_callback(hHal, hdd_indicate_mgmt_frame); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9461 | /* Right now we are registering these frame when driver is getting |
| 9462 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 9463 | frame register ops, we will move this code as a part of that */ |
| 9464 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9465 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9466 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 9467 | |
| 9468 | /* GAS Initial Response */ |
| 9469 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 9470 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9471 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9472 | /* GAS Comeback Request */ |
| 9473 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 9474 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 9475 | |
| 9476 | /* GAS Comeback Response */ |
| 9477 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 9478 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 9479 | |
| 9480 | /* P2P Public Action */ |
| 9481 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9482 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9483 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 9484 | |
| 9485 | /* P2P Action */ |
| 9486 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 9487 | (v_U8_t*)P2P_ACTION_FRAME, |
| 9488 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 9489 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 9490 | /* WNM BSS Transition Request frame */ |
| 9491 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 9492 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 9493 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 9494 | |
| 9495 | /* WNM-Notification */ |
| 9496 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 9497 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 9498 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9499 | } |
| 9500 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 9501 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9502 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9503 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9504 | /* Register for all P2P action, public action etc frames */ |
| 9505 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 9506 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9507 | ENTER(); |
| 9508 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9509 | /* Right now we are registering these frame when driver is getting |
| 9510 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 9511 | frame register ops, we will move this code as a part of that */ |
| 9512 | /* GAS Initial Request */ |
| 9513 | |
| 9514 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 9515 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 9516 | |
| 9517 | /* GAS Initial Response */ |
| 9518 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 9519 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9520 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9521 | /* GAS Comeback Request */ |
| 9522 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 9523 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 9524 | |
| 9525 | /* GAS Comeback Response */ |
| 9526 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 9527 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 9528 | |
| 9529 | /* P2P Public Action */ |
| 9530 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9531 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9532 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 9533 | |
| 9534 | /* P2P Action */ |
| 9535 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 9536 | (v_U8_t*)P2P_ACTION_FRAME, |
| 9537 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 9538 | /* WNM-Notification */ |
| 9539 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 9540 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 9541 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9542 | } |
| 9543 | |
| 9544 | #ifdef FEATURE_WLAN_WAPI |
| 9545 | 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] | 9546 | const u8 *mac_addr, const u8 *key , int key_Len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9547 | { |
| 9548 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9549 | tCsrRoamSetKey setKey; |
| 9550 | v_BOOL_t isConnected = TRUE; |
| 9551 | int status = 0; |
| 9552 | v_U32_t roamId= 0xFF; |
| 9553 | tANI_U8 *pKeyPtr = NULL; |
| 9554 | int n = 0; |
| 9555 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9556 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 9557 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9558 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9559 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 9560 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9561 | setKey.keyId = key_index; // Store Key ID |
| 9562 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 9563 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 9564 | setKey.paeRole = 0 ; // the PAE role |
| 9565 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 9566 | { |
| 9567 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 9568 | } |
| 9569 | else |
| 9570 | { |
| 9571 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 9572 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 9573 | } |
| 9574 | setKey.keyLength = key_Len; |
| 9575 | pKeyPtr = setKey.Key; |
| 9576 | memcpy( pKeyPtr, key, key_Len); |
| 9577 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9578 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9579 | __func__, key_Len); |
| 9580 | for (n = 0 ; n < key_Len; n++) |
| 9581 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 9582 | __func__,n,setKey.Key[n]); |
| 9583 | |
| 9584 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 9585 | if ( isConnected ) |
| 9586 | { |
| 9587 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9588 | pAdapter->sessionId, &setKey, &roamId ); |
| 9589 | } |
| 9590 | if ( status != 0 ) |
| 9591 | { |
| 9592 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9593 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 9594 | __LINE__, status ); |
| 9595 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 9596 | } |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 9597 | /* Need to clear any trace of key value in the memory. |
| 9598 | * Thus zero out the memory even though it is local |
| 9599 | * variable. |
| 9600 | */ |
| 9601 | vos_mem_zero(&setKey, sizeof(setKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9602 | } |
| 9603 | #endif /* FEATURE_WLAN_WAPI*/ |
| 9604 | |
| 9605 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9606 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9607 | beacon_data_t **ppBeacon, |
| 9608 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9609 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9610 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9611 | beacon_data_t **ppBeacon, |
| 9612 | struct cfg80211_beacon_data *params, |
| 9613 | int dtim_period) |
| 9614 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9615 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9616 | int size; |
| 9617 | beacon_data_t *beacon = NULL; |
| 9618 | beacon_data_t *old = NULL; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9619 | int head_len, tail_len, proberesp_ies_len, assocresp_ies_len; |
| 9620 | const u8 *head, *tail, *proberesp_ies, *assocresp_ies; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9621 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9622 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9623 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9624 | { |
| 9625 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9626 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9627 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9628 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9629 | |
| 9630 | old = pAdapter->sessionCtx.ap.beacon; |
| 9631 | |
| 9632 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9633 | { |
| 9634 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9635 | FL("session(%d) old and new heads points to NULL"), |
| 9636 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9637 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9638 | } |
| 9639 | |
| 9640 | if (params->tail && !params->tail_len) |
| 9641 | { |
| 9642 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9643 | FL("tail_len is zero but tail is not NULL")); |
| 9644 | return -EINVAL; |
| 9645 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9646 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9647 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 9648 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 9649 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9650 | { |
| 9651 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9652 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9653 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9654 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9655 | #endif |
| 9656 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9657 | if (params->head) |
| 9658 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9659 | head_len = params->head_len; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9660 | head = params->head; |
| 9661 | } else |
| 9662 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9663 | head_len = old->head_len; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9664 | head = old->head; |
| 9665 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9666 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9667 | if (params->tail || !old) |
| 9668 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9669 | tail_len = params->tail_len; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9670 | tail = params->tail; |
| 9671 | } else |
| 9672 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9673 | tail_len = old->tail_len; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9674 | tail = old->tail; |
| 9675 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9676 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9677 | if (params->proberesp_ies || !old) |
| 9678 | { |
| 9679 | proberesp_ies_len = params->proberesp_ies_len; |
| 9680 | proberesp_ies = params->proberesp_ies; |
| 9681 | } else |
| 9682 | { |
| 9683 | proberesp_ies_len = old->proberesp_ies_len; |
| 9684 | proberesp_ies = old->proberesp_ies; |
| 9685 | } |
| 9686 | |
| 9687 | if (params->assocresp_ies || !old) |
| 9688 | { |
| 9689 | assocresp_ies_len = params->assocresp_ies_len; |
| 9690 | assocresp_ies = params->assocresp_ies; |
| 9691 | } else |
| 9692 | { |
| 9693 | assocresp_ies_len = old->assocresp_ies_len; |
| 9694 | assocresp_ies = old->assocresp_ies; |
| 9695 | } |
| 9696 | |
| 9697 | size = sizeof(beacon_data_t) + head_len + tail_len + |
| 9698 | proberesp_ies_len + assocresp_ies_len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9699 | |
| 9700 | beacon = kzalloc(size, GFP_KERNEL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9701 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9702 | { |
| 9703 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9704 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9705 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9706 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9707 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9708 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9709 | if (params->dtim_period) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9710 | beacon->dtim_period = params->dtim_period; |
| 9711 | else |
| 9712 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9713 | #else |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9714 | if (dtim_period) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9715 | beacon->dtim_period = dtim_period; |
| 9716 | else |
| 9717 | beacon->dtim_period = old->dtim_period; |
| 9718 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9719 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9720 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 9721 | beacon->tail = beacon->head + head_len; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9722 | beacon->proberesp_ies = beacon->tail + tail_len; |
| 9723 | beacon->assocresp_ies = beacon->proberesp_ies + proberesp_ies_len; |
| 9724 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9725 | beacon->head_len = head_len; |
| 9726 | beacon->tail_len = tail_len; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9727 | beacon->proberesp_ies_len = proberesp_ies_len; |
| 9728 | beacon->assocresp_ies_len= assocresp_ies_len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9729 | |
c_manjee | 527ecac | 2017-01-25 12:25:27 +0530 | [diff] [blame] | 9730 | if (head && head_len) |
| 9731 | memcpy(beacon->head, head, head_len); |
| 9732 | if (tail && tail_len) |
| 9733 | memcpy(beacon->tail, tail, tail_len); |
| 9734 | if (proberesp_ies && proberesp_ies_len) |
| 9735 | memcpy(beacon->proberesp_ies, proberesp_ies, proberesp_ies_len); |
| 9736 | if (assocresp_ies && assocresp_ies_len) |
| 9737 | memcpy(beacon->assocresp_ies, assocresp_ies, assocresp_ies_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9738 | |
| 9739 | *ppBeacon = beacon; |
| 9740 | |
| 9741 | kfree(old); |
| 9742 | |
| 9743 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9744 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9745 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 9746 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr( |
| 9747 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 9748 | const v_U8_t *pIes, |
| 9749 | #else |
| 9750 | v_U8_t *pIes, |
| 9751 | #endif |
| 9752 | int length, v_U8_t eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9753 | { |
| 9754 | int left = length; |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 9755 | v_U8_t *ptr = (v_U8_t *)pIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9756 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9757 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9758 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9759 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9760 | elem_id = ptr[0]; |
| 9761 | elem_len = ptr[1]; |
| 9762 | left -= 2; |
| 9763 | if(elem_len > left) |
| 9764 | { |
| 9765 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 9766 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9767 | eid,elem_len,left); |
| 9768 | return NULL; |
| 9769 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9770 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9771 | { |
| 9772 | return ptr; |
| 9773 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9774 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9775 | left -= elem_len; |
| 9776 | ptr += (elem_len + 2); |
| 9777 | } |
| 9778 | return NULL; |
| 9779 | } |
| 9780 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9781 | /* Check if rate is 11g rate or not */ |
| 9782 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 9783 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 9784 | 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] | 9785 | u8 i; |
| 9786 | for (i = 0; i < 8; i++) |
| 9787 | { |
| 9788 | if(rate == gRateArray[i]) |
| 9789 | return TRUE; |
| 9790 | } |
| 9791 | return FALSE; |
| 9792 | } |
| 9793 | |
| 9794 | /* Check for 11g rate and set proper 11g only mode */ |
| 9795 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 9796 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 9797 | { |
| 9798 | u8 i, num_rates = pIe[0]; |
| 9799 | |
| 9800 | pIe += 1; |
| 9801 | for ( i = 0; i < num_rates; i++) |
| 9802 | { |
| 9803 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 9804 | { |
| 9805 | /* If rate set have 11g rate than change the mode to 11G */ |
| 9806 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 9807 | if (pIe[i] & BASIC_RATE_MASK) |
| 9808 | { |
| 9809 | /* If we have 11g rate as basic rate, it means mode |
| 9810 | is 11g only mode. |
| 9811 | */ |
| 9812 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 9813 | *pCheckRatesfor11g = FALSE; |
| 9814 | } |
| 9815 | } |
| 9816 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 9817 | { |
| 9818 | *require_ht = TRUE; |
| 9819 | } |
| 9820 | } |
| 9821 | return; |
| 9822 | } |
| 9823 | |
| 9824 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 9825 | { |
| 9826 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 9827 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 9828 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 9829 | u8 checkRatesfor11g = TRUE; |
| 9830 | u8 require_ht = FALSE; |
| 9831 | u8 *pIe=NULL; |
| 9832 | |
| 9833 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 9834 | |
| 9835 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 9836 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 9837 | if (pIe != NULL) |
| 9838 | { |
| 9839 | pIe += 1; |
| 9840 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 9841 | &pConfig->SapHw_mode); |
| 9842 | } |
| 9843 | |
| 9844 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 9845 | WLAN_EID_EXT_SUPP_RATES); |
| 9846 | if (pIe != NULL) |
| 9847 | { |
| 9848 | |
| 9849 | pIe += 1; |
| 9850 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 9851 | &pConfig->SapHw_mode); |
| 9852 | } |
| 9853 | |
| 9854 | if( pConfig->channel > 14 ) |
| 9855 | { |
| 9856 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 9857 | } |
| 9858 | |
| 9859 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 9860 | WLAN_EID_HT_CAPABILITY); |
| 9861 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9862 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9863 | { |
| 9864 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 9865 | if(require_ht) |
| 9866 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 9867 | } |
| 9868 | } |
| 9869 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9870 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 9871 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 9872 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 9873 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9874 | v_U8_t *pIe = NULL; |
| 9875 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 9876 | |
| 9877 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 9878 | pBeacon->tail, pBeacon->tail_len); |
| 9879 | |
| 9880 | if (pIe) |
| 9881 | { |
| 9882 | ielen = pIe[1] + 2; |
| 9883 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 9884 | { |
| 9885 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 9886 | } |
| 9887 | else |
| 9888 | { |
| 9889 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 9890 | return -EINVAL; |
| 9891 | } |
| 9892 | *total_ielen += ielen; |
| 9893 | } |
| 9894 | return 0; |
| 9895 | } |
| 9896 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 9897 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 9898 | v_U8_t *genie, v_U8_t *total_ielen) |
| 9899 | { |
| 9900 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 9901 | int left = pBeacon->tail_len; |
| 9902 | v_U8_t *ptr = pBeacon->tail; |
| 9903 | v_U8_t elem_id, elem_len; |
| 9904 | v_U16_t ielen = 0; |
| 9905 | |
| 9906 | if ( NULL == ptr || 0 == left ) |
| 9907 | return; |
| 9908 | |
| 9909 | while (left >= 2) |
| 9910 | { |
| 9911 | elem_id = ptr[0]; |
| 9912 | elem_len = ptr[1]; |
| 9913 | left -= 2; |
| 9914 | if (elem_len > left) |
| 9915 | { |
| 9916 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 9917 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 9918 | elem_id, elem_len, left); |
| 9919 | return; |
| 9920 | } |
Ashish Kumar Dhanotiya | 6af276b | 2017-08-22 16:53:48 +0530 | [diff] [blame] | 9921 | if ((IE_EID_VENDOR == elem_id) && (elem_len >= WPS_OUI_TYPE_SIZE)) |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 9922 | { |
| 9923 | /* skipping the VSIE's which we don't want to include or |
| 9924 | * it will be included by existing code |
| 9925 | */ |
| 9926 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 9927 | #ifdef WLAN_FEATURE_WFD |
| 9928 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 9929 | #endif |
| 9930 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 9931 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 9932 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 9933 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 9934 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 9935 | { |
| 9936 | ielen = ptr[1] + 2; |
| 9937 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 9938 | { |
| 9939 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 9940 | *total_ielen += ielen; |
| 9941 | } |
| 9942 | else |
| 9943 | { |
| 9944 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 9945 | "IE Length is too big " |
| 9946 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 9947 | elem_id, elem_len, *total_ielen); |
| 9948 | } |
| 9949 | } |
| 9950 | } |
| 9951 | |
| 9952 | left -= elem_len; |
| 9953 | ptr += (elem_len + 2); |
| 9954 | } |
| 9955 | return; |
| 9956 | } |
| 9957 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9958 | int wlan_hdd_cfg80211_update_apies(hdd_adapter_t *pHostapdAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9959 | { |
| 9960 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9961 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9962 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9963 | int ret = 0; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9964 | beacon_data_t *pBeacon = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9965 | |
| 9966 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 9967 | |
| 9968 | if(genie == NULL) { |
| 9969 | |
| 9970 | return -ENOMEM; |
| 9971 | } |
| 9972 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 9973 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9974 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 9975 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9976 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9977 | hddLog(LOGE, |
| 9978 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9979 | ret = -EINVAL; |
| 9980 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9981 | } |
| 9982 | |
| 9983 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9984 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 9985 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 9986 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9987 | hddLog(LOGE, |
| 9988 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9989 | ret = -EINVAL; |
| 9990 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9991 | } |
| 9992 | #endif |
| 9993 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9994 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 9995 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9996 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9997 | hddLog(LOGE, |
| 9998 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 9999 | ret = -EINVAL; |
| 10000 | goto done; |
| 10001 | } |
| 10002 | |
| 10003 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 10004 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 10005 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10006 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10007 | |
| 10008 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 10009 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 10010 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 10011 | { |
| 10012 | hddLog(LOGE, |
| 10013 | "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] | 10014 | ret = -EINVAL; |
| 10015 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10016 | } |
| 10017 | |
| 10018 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 10019 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 10020 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 10021 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 10022 | ==eHAL_STATUS_FAILURE) |
| 10023 | { |
| 10024 | hddLog(LOGE, |
| 10025 | "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] | 10026 | ret = -EINVAL; |
| 10027 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10028 | } |
| 10029 | |
| 10030 | // Added for ProResp IE |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10031 | if ((pBeacon->proberesp_ies != NULL) && (pBeacon->proberesp_ies_len != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10032 | { |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10033 | u16 rem_probe_resp_ie_len = pBeacon->proberesp_ies_len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10034 | u8 probe_rsp_ie_len[3] = {0}; |
| 10035 | u8 counter = 0; |
| 10036 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 10037 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 10038 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 10039 | Store More then 255 bytes into One Variable. |
| 10040 | */ |
| 10041 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 10042 | { |
| 10043 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 10044 | { |
| 10045 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 10046 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 10047 | } |
| 10048 | else |
| 10049 | { |
| 10050 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 10051 | rem_probe_resp_ie_len = 0; |
| 10052 | } |
| 10053 | } |
| 10054 | |
| 10055 | rem_probe_resp_ie_len = 0; |
| 10056 | |
| 10057 | if (probe_rsp_ie_len[0] > 0) |
| 10058 | { |
| 10059 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 10060 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10061 | (tANI_U8*)&pBeacon-> |
| 10062 | proberesp_ies[rem_probe_resp_ie_len], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10063 | probe_rsp_ie_len[0], NULL, |
| 10064 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 10065 | { |
| 10066 | hddLog(LOGE, |
| 10067 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10068 | ret = -EINVAL; |
| 10069 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10070 | } |
| 10071 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 10072 | } |
| 10073 | |
| 10074 | if (probe_rsp_ie_len[1] > 0) |
| 10075 | { |
| 10076 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 10077 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10078 | (tANI_U8*)&pBeacon-> |
| 10079 | proberesp_ies[rem_probe_resp_ie_len], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10080 | probe_rsp_ie_len[1], NULL, |
| 10081 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 10082 | { |
| 10083 | hddLog(LOGE, |
| 10084 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10085 | ret = -EINVAL; |
| 10086 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10087 | } |
| 10088 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 10089 | } |
| 10090 | |
| 10091 | if (probe_rsp_ie_len[2] > 0) |
| 10092 | { |
| 10093 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 10094 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10095 | (tANI_U8*)&pBeacon-> |
| 10096 | proberesp_ies[rem_probe_resp_ie_len], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10097 | probe_rsp_ie_len[2], NULL, |
| 10098 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 10099 | { |
| 10100 | hddLog(LOGE, |
| 10101 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10102 | ret = -EINVAL; |
| 10103 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10104 | } |
| 10105 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 10106 | } |
| 10107 | |
| 10108 | if (probe_rsp_ie_len[1] == 0 ) |
| 10109 | { |
| 10110 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 10111 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 10112 | eANI_BOOLEAN_FALSE) ) |
| 10113 | { |
| 10114 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10115 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10116 | } |
| 10117 | } |
| 10118 | |
| 10119 | if (probe_rsp_ie_len[2] == 0 ) |
| 10120 | { |
| 10121 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 10122 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 10123 | eANI_BOOLEAN_FALSE) ) |
| 10124 | { |
| 10125 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10126 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10127 | } |
| 10128 | } |
| 10129 | |
| 10130 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 10131 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 10132 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 10133 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 10134 | == eHAL_STATUS_FAILURE) |
| 10135 | { |
| 10136 | hddLog(LOGE, |
| 10137 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10138 | ret = -EINVAL; |
| 10139 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10140 | } |
| 10141 | } |
| 10142 | else |
| 10143 | { |
| 10144 | // Reset WNI_CFG_PROBE_RSP Flags |
| 10145 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 10146 | |
| 10147 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10148 | "%s: No Probe Response IE received in set beacon", |
| 10149 | __func__); |
| 10150 | } |
| 10151 | |
| 10152 | // Added for AssocResp IE |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10153 | if ((pBeacon->assocresp_ies != NULL) && (pBeacon->assocresp_ies_len != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10154 | { |
| 10155 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 10156 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)pBeacon->assocresp_ies, |
| 10157 | pBeacon->assocresp_ies_len, NULL, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10158 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 10159 | { |
| 10160 | hddLog(LOGE, |
| 10161 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10162 | ret = -EINVAL; |
| 10163 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10164 | } |
| 10165 | |
| 10166 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 10167 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 10168 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 10169 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 10170 | == eHAL_STATUS_FAILURE) |
| 10171 | { |
| 10172 | hddLog(LOGE, |
| 10173 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10174 | ret = -EINVAL; |
| 10175 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10176 | } |
| 10177 | } |
| 10178 | else |
| 10179 | { |
| 10180 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10181 | "%s: No Assoc Response IE received in set beacon", |
| 10182 | __func__); |
| 10183 | |
| 10184 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 10185 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 10186 | eANI_BOOLEAN_FALSE) ) |
| 10187 | { |
| 10188 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10189 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10190 | } |
| 10191 | } |
| 10192 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10193 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10194 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 10195 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10196 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10197 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10198 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10199 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 10200 | * called by wlan_hdd_cfg80211_start_bss() and |
| 10201 | * wlan_hdd_cfg80211_set_channel() |
| 10202 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10203 | * channel list. |
| 10204 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 10205 | 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] | 10206 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10207 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10208 | v_U32_t num_ch = 0; |
| 10209 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 10210 | u32 indx = 0; |
| 10211 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 10212 | v_U8_t fValidChannel = FALSE, count = 0; |
| 10213 | 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] | 10214 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10215 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 10216 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 10217 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10218 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 10219 | /* Validate the channel */ |
| 10220 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10221 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 10222 | if ( channel == rfChannels[count].channelNum ) |
| 10223 | { |
| 10224 | fValidChannel = TRUE; |
| 10225 | break; |
| 10226 | } |
| 10227 | } |
| 10228 | if (fValidChannel != TRUE) |
| 10229 | { |
| 10230 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10231 | "%s: Invalid Channel [%d]", __func__, channel); |
| 10232 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10233 | } |
| 10234 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 10235 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10236 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 10237 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 10238 | valid_ch, &num_ch)) |
| 10239 | { |
| 10240 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10241 | "%s: failed to get valid channel list", __func__); |
| 10242 | return VOS_STATUS_E_FAILURE; |
| 10243 | } |
| 10244 | for (indx = 0; indx < num_ch; indx++) |
| 10245 | { |
| 10246 | if (channel == valid_ch[indx]) |
| 10247 | { |
| 10248 | break; |
| 10249 | } |
| 10250 | } |
| 10251 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 10252 | if (indx >= num_ch) |
| 10253 | { |
| 10254 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 10255 | { |
| 10256 | eCsrBand band; |
| 10257 | unsigned int freq; |
| 10258 | |
| 10259 | sme_GetFreqBand(hHal, &band); |
| 10260 | |
| 10261 | if (eCSR_BAND_5G == band) |
| 10262 | { |
| 10263 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 10264 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 10265 | { |
| 10266 | freq = ieee80211_channel_to_frequency(channel, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 10267 | HDD_NL80211_BAND_2GHZ); |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 10268 | } |
| 10269 | else |
| 10270 | { |
| 10271 | freq = ieee80211_channel_to_frequency(channel, |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 10272 | HDD_NL80211_BAND_5GHZ); |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 10273 | } |
| 10274 | #else |
| 10275 | freq = ieee80211_channel_to_frequency(channel); |
| 10276 | #endif |
| 10277 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 10278 | return VOS_STATUS_SUCCESS; |
| 10279 | } |
| 10280 | } |
| 10281 | |
| 10282 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10283 | "%s: Invalid Channel [%d]", __func__, channel); |
| 10284 | return VOS_STATUS_E_FAILURE; |
| 10285 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10286 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 10287 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10288 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10289 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10290 | } |
| 10291 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10292 | /** |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 10293 | * FUNCTION: __wlan_hdd_cfg80211_set_channel |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10294 | * This function is used to set the channel number |
| 10295 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 10296 | 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] | 10297 | struct ieee80211_channel *chan, |
| 10298 | enum nl80211_channel_type channel_type |
| 10299 | ) |
| 10300 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10301 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10302 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 10303 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10304 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10305 | hdd_context_t *pHddCtx; |
| 10306 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10307 | |
| 10308 | ENTER(); |
| 10309 | |
| 10310 | if( NULL == dev ) |
| 10311 | { |
| 10312 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10313 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10314 | return -ENODEV; |
| 10315 | } |
| 10316 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10317 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10318 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10319 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 10320 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10321 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10322 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 10323 | hdd_device_modetoString(pAdapter->device_mode), |
| 10324 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10325 | |
| 10326 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10327 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10328 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10329 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10330 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10331 | } |
| 10332 | |
| 10333 | /* |
| 10334 | * Do freq to chan conversion |
| 10335 | * TODO: for 11a |
| 10336 | */ |
| 10337 | |
| 10338 | channel = ieee80211_frequency_to_channel(freq); |
| 10339 | |
| 10340 | /* Check freq range */ |
| 10341 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 10342 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 10343 | { |
| 10344 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10345 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10346 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 10347 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 10348 | return -EINVAL; |
| 10349 | } |
| 10350 | |
| 10351 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 10352 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 10353 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 10354 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10355 | { |
| 10356 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 10357 | { |
| 10358 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10359 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10360 | return -EINVAL; |
| 10361 | } |
| 10362 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 10363 | "%s: set channel to [%d] for device mode =%d", |
| 10364 | __func__, channel,pAdapter->device_mode); |
| 10365 | } |
| 10366 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10367 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10368 | ) |
| 10369 | { |
| 10370 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 10371 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 10372 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10373 | |
| 10374 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 10375 | { |
| 10376 | /* Link is up then return cant set channel*/ |
| 10377 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10378 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10379 | return -EINVAL; |
| 10380 | } |
| 10381 | |
| 10382 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 10383 | pHddStaCtx->conn_info.operationChannel = channel; |
| 10384 | pRoamProfile->ChannelInfo.ChannelList = |
| 10385 | &pHddStaCtx->conn_info.operationChannel; |
| 10386 | } |
| 10387 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10388 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10389 | ) |
| 10390 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 10391 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 10392 | { |
| 10393 | if(VOS_STATUS_SUCCESS != |
| 10394 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 10395 | { |
| 10396 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10397 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 10398 | return -EINVAL; |
| 10399 | } |
| 10400 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 10401 | } |
| 10402 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10403 | { |
| 10404 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 10405 | |
| 10406 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 10407 | channel set by supplicant |
| 10408 | */ |
| 10409 | if ( cfg_param->apAutoChannelSelection ) |
| 10410 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 10411 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 10412 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10413 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10414 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 10415 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10416 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10417 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 10418 | else |
| 10419 | { |
| 10420 | if(VOS_STATUS_SUCCESS != |
| 10421 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 10422 | { |
| 10423 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10424 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 10425 | return -EINVAL; |
| 10426 | } |
| 10427 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 10428 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10429 | } |
| 10430 | } |
| 10431 | else |
| 10432 | { |
| 10433 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 10434 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 10435 | return -EINVAL; |
| 10436 | } |
| 10437 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10438 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10439 | } |
| 10440 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 10441 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, |
| 10442 | struct net_device *dev, |
| 10443 | struct ieee80211_channel *chan, |
| 10444 | enum nl80211_channel_type channel_type |
| 10445 | ) |
| 10446 | { |
| 10447 | int ret; |
| 10448 | |
| 10449 | vos_ssr_protect(__func__); |
| 10450 | ret = __wlan_hdd_cfg80211_set_channel(wiphy, dev, chan, channel_type); |
| 10451 | vos_ssr_unprotect(__func__); |
| 10452 | |
| 10453 | return ret; |
| 10454 | } |
| 10455 | |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 10456 | #ifdef DHCP_SERVER_OFFLOAD |
| 10457 | void hdd_dhcp_server_offload_done(void *fw_dhcp_srv_offload_cb_context, |
| 10458 | VOS_STATUS status) |
| 10459 | { |
| 10460 | hdd_adapter_t* adapter = (hdd_adapter_t*)fw_dhcp_srv_offload_cb_context; |
| 10461 | |
| 10462 | ENTER(); |
| 10463 | |
| 10464 | if (NULL == adapter) |
| 10465 | { |
| 10466 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10467 | "%s: adapter is NULL",__func__); |
| 10468 | return; |
| 10469 | } |
| 10470 | |
| 10471 | adapter->dhcp_status.dhcp_offload_status = status; |
| 10472 | vos_event_set(&adapter->dhcp_status.vos_event); |
| 10473 | return; |
| 10474 | } |
| 10475 | |
| 10476 | /** |
| 10477 | * wlan_hdd_set_dhcp_server_offload() - set dhcp server offload |
| 10478 | * @hostapd_adapter: pointer to hostapd adapter. |
Anurag Chouhan | 638f5e2 | 2017-03-06 12:28:43 +0530 | [diff] [blame] | 10479 | * @re_init: flag set if api called post ssr |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 10480 | * |
| 10481 | * Return: None |
| 10482 | */ |
Anurag Chouhan | 638f5e2 | 2017-03-06 12:28:43 +0530 | [diff] [blame] | 10483 | VOS_STATUS wlan_hdd_set_dhcp_server_offload(hdd_adapter_t *hostapd_adapter, |
| 10484 | bool re_init) |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 10485 | { |
| 10486 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(hostapd_adapter); |
| 10487 | sir_dhcp_srv_offload_info dhcp_srv_info; |
| 10488 | tANI_U8 num_entries = 0; |
| 10489 | tANI_U8 srv_ip[IPADDR_NUM_ENTRIES]; |
| 10490 | tANI_U8 num; |
| 10491 | tANI_U32 temp; |
| 10492 | VOS_STATUS ret; |
| 10493 | |
| 10494 | ENTER(); |
| 10495 | |
Anurag Chouhan | 638f5e2 | 2017-03-06 12:28:43 +0530 | [diff] [blame] | 10496 | if (!re_init) { |
| 10497 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 10498 | if (0 != ret) |
| 10499 | return VOS_STATUS_E_INVAL; |
| 10500 | } |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 10501 | |
| 10502 | /* Prepare the request to send to SME */ |
| 10503 | dhcp_srv_info = vos_mem_malloc(sizeof(*dhcp_srv_info)); |
| 10504 | if (NULL == dhcp_srv_info) { |
| 10505 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10506 | "%s: could not allocate tDhcpSrvOffloadInfo!", __func__); |
| 10507 | return VOS_STATUS_E_NOMEM; |
| 10508 | } |
| 10509 | |
| 10510 | vos_mem_zero(dhcp_srv_info, sizeof(*dhcp_srv_info)); |
| 10511 | |
| 10512 | dhcp_srv_info->bssidx = hostapd_adapter->sessionId; |
| 10513 | dhcp_srv_info->dhcp_srv_offload_enabled = TRUE; |
| 10514 | dhcp_srv_info->dhcp_client_num = hdd_ctx->cfg_ini->dhcp_max_num_clients; |
| 10515 | dhcp_srv_info->start_lsb = hdd_ctx->cfg_ini->dhcp_start_lsb; |
| 10516 | dhcp_srv_info->dhcp_offload_callback = hdd_dhcp_server_offload_done; |
| 10517 | dhcp_srv_info->dhcp_server_offload_cb_context = hostapd_adapter; |
| 10518 | |
| 10519 | hdd_string_to_u8_array(hdd_ctx->cfg_ini->dhcp_srv_ip, |
| 10520 | srv_ip, |
| 10521 | &num_entries, |
Yeshwanth Sriram Guntuka | 8d9b29c | 2017-12-12 15:44:57 +0530 | [diff] [blame] | 10522 | IPADDR_NUM_ENTRIES, ".", false); |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 10523 | if (num_entries != IPADDR_NUM_ENTRIES) { |
| 10524 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10525 | "%s: incorrect IP address (%s) assigned for DHCP server!", |
| 10526 | __func__, hdd_ctx->cfg_ini->dhcp_srv_ip); |
| 10527 | vos_mem_free(dhcp_srv_info); |
| 10528 | return VOS_STATUS_E_FAILURE; |
| 10529 | } |
| 10530 | |
| 10531 | if ((srv_ip[0] >= 224) && (srv_ip[0] <= 239)) { |
| 10532 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10533 | "%s: invalid IP address (%s)! It could NOT be multicast IP address!", |
| 10534 | __func__, hdd_ctx->cfg_ini->dhcp_srv_ip); |
| 10535 | vos_mem_free(dhcp_srv_info); |
| 10536 | return VOS_STATUS_E_FAILURE; |
| 10537 | } |
| 10538 | |
| 10539 | if (srv_ip[IPADDR_NUM_ENTRIES-1] >= DHCP_START_POOL_ADDRESS) { |
| 10540 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10541 | "%s: invalid IP address (%s)! The last field must be less than 100!", |
| 10542 | __func__, hdd_ctx->cfg_ini->dhcp_srv_ip); |
| 10543 | vos_mem_free(dhcp_srv_info); |
| 10544 | return VOS_STATUS_E_FAILURE; |
| 10545 | } |
| 10546 | |
| 10547 | for (num = 0; num < num_entries; num++) { |
| 10548 | temp = srv_ip[num]; |
| 10549 | dhcp_srv_info->dhcp_srv_ip |= (temp << (8 * num)); |
| 10550 | } |
| 10551 | |
| 10552 | if (eHAL_STATUS_SUCCESS != |
| 10553 | sme_set_dhcp_srv_offload(hdd_ctx->hHal, dhcp_srv_info)) { |
| 10554 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10555 | "%s: sme_set_dhcp_srv_offload fail!", __func__); |
| 10556 | vos_mem_free(dhcp_srv_info); |
| 10557 | return VOS_STATUS_E_FAILURE; |
| 10558 | } |
| 10559 | |
| 10560 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 10561 | "%s: enable DHCP Server offload successfully!", __func__); |
| 10562 | |
| 10563 | vos_mem_free(dhcp_srv_info); |
| 10564 | return 0; |
| 10565 | } |
| 10566 | #endif /* DHCP_SERVER_OFFLOAD */ |
| 10567 | |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 10568 | /* |
| 10569 | * hdd_modify_indoor_channel_state_flags() - modify wiphy flags and cds state |
| 10570 | * @wiphy_chan: wiphy channel number |
| 10571 | * @rfChannel: channel hw value |
| 10572 | * @disable: Disable/enable the flags |
Sourav Mohapatra | 077057d | 2018-02-07 19:19:18 +0530 | [diff] [blame] | 10573 | * @hdd_ctx: The HDD context handler |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 10574 | * |
| 10575 | * Modify wiphy flags and cds state if channel is indoor. |
| 10576 | * |
| 10577 | * Return: void |
| 10578 | */ |
| 10579 | void hdd_modify_indoor_channel_state_flags(struct ieee80211_channel *wiphy_chan, |
Sourav Mohapatra | 077057d | 2018-02-07 19:19:18 +0530 | [diff] [blame] | 10580 | v_U32_t rfChannel, bool disable, hdd_context_t *hdd_ctx) |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 10581 | { |
| 10582 | v_U32_t channelLoop; |
| 10583 | eRfChannels channelEnum = INVALID_RF_CHANNEL; |
| 10584 | |
| 10585 | for (channelLoop = 0; channelLoop <= RF_CHAN_165; channelLoop++) { |
| 10586 | |
| 10587 | if (rfChannels[channelLoop].channelNum == rfChannel) { |
| 10588 | channelEnum = (eRfChannels)channelLoop; |
| 10589 | break; |
| 10590 | } |
| 10591 | } |
| 10592 | |
| 10593 | if (INVALID_RF_CHANNEL == channelEnum) |
| 10594 | return; |
| 10595 | |
| 10596 | if (disable) { |
| 10597 | if (wiphy_chan->flags & IEEE80211_CHAN_INDOOR_ONLY) { |
| 10598 | wiphy_chan->flags |= |
| 10599 | IEEE80211_CHAN_DISABLED; |
| 10600 | regChannels[channelEnum].enabled = |
| 10601 | NV_CHANNEL_DISABLE; |
Sourav Mohapatra | 077057d | 2018-02-07 19:19:18 +0530 | [diff] [blame] | 10602 | hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %d marked as DISABLE", |
| 10603 | channelEnum); |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 10604 | } |
| 10605 | } else { |
| 10606 | if (wiphy_chan->flags & IEEE80211_CHAN_INDOOR_ONLY) { |
| 10607 | wiphy_chan->flags &= |
| 10608 | ~IEEE80211_CHAN_DISABLED; |
| 10609 | /* |
| 10610 | * Indoor channels are marked as DFS |
| 10611 | * during regulatory processing |
| 10612 | */ |
Sourav Mohapatra | 077057d | 2018-02-07 19:19:18 +0530 | [diff] [blame] | 10613 | if ((wiphy_chan->flags & (IEEE80211_CHAN_RADAR | |
| 10614 | IEEE80211_CHAN_PASSIVE_SCAN)) || |
| 10615 | ((hdd_ctx->cfg_ini->indoor_channel_support == false) |
| 10616 | && (wiphy_chan->flags & |
| 10617 | IEEE80211_CHAN_INDOOR_ONLY))) { |
| 10618 | regChannels[channelEnum].enabled = NV_CHANNEL_DFS; |
| 10619 | hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %d marked as DFS", |
| 10620 | channelEnum); |
| 10621 | } else { |
| 10622 | regChannels[channelEnum].enabled = |
| 10623 | NV_CHANNEL_ENABLE; |
| 10624 | hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %d marked as ENABLE", |
| 10625 | channelEnum); |
| 10626 | } |
| 10627 | } |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 10628 | |
Sourav Mohapatra | 077057d | 2018-02-07 19:19:18 +0530 | [diff] [blame] | 10629 | } |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 10630 | } |
| 10631 | |
Sourav Mohapatra | 077057d | 2018-02-07 19:19:18 +0530 | [diff] [blame] | 10632 | void hdd_update_indoor_channel(hdd_context_t *hdd_ctx, bool disable) |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 10633 | { |
| 10634 | int band_num; |
| 10635 | int chan_num; |
| 10636 | v_U32_t rfChannel; |
| 10637 | struct ieee80211_channel *wiphy_chan; |
| 10638 | struct wiphy *wiphy; |
| 10639 | |
| 10640 | ENTER(); |
| 10641 | hddLog(VOS_TRACE_LEVEL_INFO, "disable: %d", disable); |
| 10642 | |
| 10643 | wiphy = hdd_ctx->wiphy; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 10644 | for (band_num = 0; band_num < HDD_NUM_NL80211_BANDS; band_num++) { |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 10645 | |
| 10646 | if (wiphy->bands[band_num] == NULL) |
| 10647 | continue; |
| 10648 | |
| 10649 | for (chan_num = 0; |
| 10650 | chan_num < wiphy->bands[band_num]->n_channels; |
| 10651 | chan_num++) { |
| 10652 | |
| 10653 | wiphy_chan = |
| 10654 | &(wiphy->bands[band_num]->channels[chan_num]); |
| 10655 | rfChannel = wiphy->bands[band_num]->channels[chan_num].hw_value; |
| 10656 | |
| 10657 | hdd_modify_indoor_channel_state_flags(wiphy_chan, rfChannel, |
Sourav Mohapatra | 077057d | 2018-02-07 19:19:18 +0530 | [diff] [blame] | 10658 | disable, hdd_ctx); |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 10659 | } |
| 10660 | } |
| 10661 | EXIT(); |
| 10662 | } |
| 10663 | |
Ganesh Kondabattini | 19813af | 2018-01-25 17:32:44 +0530 | [diff] [blame] | 10664 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 10665 | { |
Dundi Raviteja | 49de66b | 2018-07-27 12:22:57 +0530 | [diff] [blame] | 10666 | eHalStatus status; |
| 10667 | int result = 0; |
Ganesh Kondabattini | 19813af | 2018-01-25 17:32:44 +0530 | [diff] [blame] | 10668 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10669 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10670 | long ret; |
| 10671 | eConnectionState prev_conn_state; |
| 10672 | uint32_t wait_time = WLAN_WAIT_TIME_DISCONNECT; |
| 10673 | |
| 10674 | ENTER(); |
| 10675 | |
Ganesh Kondabattini | 19813af | 2018-01-25 17:32:44 +0530 | [diff] [blame] | 10676 | /* Indicate sme of disconnect so that in progress connection or preauth |
| 10677 | * can be aborted |
| 10678 | */ |
| 10679 | sme_abortConnection(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10680 | pAdapter->sessionId); |
| 10681 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 10682 | |
| 10683 | /* Need to apply spin lock before decreasing active sessions |
| 10684 | * as there can be chance for double decrement if context switch |
| 10685 | * Calls hdd_DisConnectHandler. |
| 10686 | */ |
| 10687 | |
| 10688 | prev_conn_state = pHddStaCtx->conn_info.connState; |
| 10689 | |
| 10690 | spin_lock_bh(&pAdapter->lock_for_active_session); |
| 10691 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 10692 | { |
| 10693 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 10694 | } |
| 10695 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 10696 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
| 10697 | vos_flush_delayed_work(&pHddCtx->ecsa_chan_change_work); |
| 10698 | |
| 10699 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10700 | FL( "Set HDD connState to eConnectionState_Disconnecting" )); |
| 10701 | |
| 10702 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 10703 | |
| 10704 | /* |
| 10705 | * stop tx queues before deleting STA/BSS context from the firmware. |
| 10706 | * tx has to be disabled because the firmware can get busy dropping |
| 10707 | * the tx frames after BSS/STA has been deleted and will not send |
| 10708 | * back a response resulting in WDI timeout |
| 10709 | */ |
| 10710 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
| 10711 | netif_tx_disable(pAdapter->dev); |
| 10712 | netif_carrier_off(pAdapter->dev); |
| 10713 | |
| 10714 | wlan_hdd_check_and_stop_mon(pAdapter, true); |
| 10715 | |
| 10716 | /*issue disconnect*/ |
| 10717 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10718 | pAdapter->sessionId, reason); |
| 10719 | if((eHAL_STATUS_CMD_NOT_QUEUED == status) && |
| 10720 | prev_conn_state != eConnectionState_Connecting) |
| 10721 | { |
| 10722 | hddLog(LOG1, |
| 10723 | FL("status = %d, already disconnected"), status); |
| 10724 | result = 0; |
| 10725 | /* |
| 10726 | * Wait here instead of returning directly. This will block the |
| 10727 | * next connect command and allow processing of the disconnect |
| 10728 | * in SME else we might hit some race conditions leading to SME |
| 10729 | * and HDD out of sync. As disconnect is already in progress, |
| 10730 | * wait here for 1 sec instead of 5 sec. |
| 10731 | */ |
| 10732 | wait_time = WLAN_WAIT_DISCONNECT_ALREADY_IN_PROGRESS; |
| 10733 | goto wait_for_disconnect; |
| 10734 | } |
| 10735 | /* |
| 10736 | * Wait here instead of returning directly, this will block the next |
| 10737 | * connect command and allow processing of the scan for ssid and |
| 10738 | * the previous connect command in CSR. Else we might hit some |
| 10739 | * race conditions leading to SME and HDD out of sync. |
| 10740 | */ |
| 10741 | else if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
| 10742 | { |
| 10743 | hddLog(LOG1, |
| 10744 | FL("Already disconnected or connect was in sme/roam pending list and removed by disconnect")); |
| 10745 | } |
| 10746 | else if ( 0 != status ) |
| 10747 | { |
| 10748 | hddLog(LOGE, |
| 10749 | FL("csrRoamDisconnect failure, returned %d"), |
| 10750 | (int)status); |
| 10751 | result = -EINVAL; |
| 10752 | goto disconnected; |
| 10753 | } |
| 10754 | wait_for_disconnect: |
| 10755 | ret = wait_for_completion_timeout(&pAdapter->disconnect_comp_var, |
| 10756 | msecs_to_jiffies(wait_time)); |
| 10757 | if (!ret && (eHAL_STATUS_CMD_NOT_QUEUED != status)) |
| 10758 | { |
| 10759 | hddLog(LOGE, |
| 10760 | "%s: Failed to disconnect, timed out", __func__); |
| 10761 | result = -ETIMEDOUT; |
| 10762 | } |
| 10763 | disconnected: |
| 10764 | hddLog(LOG1, |
| 10765 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 10766 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 10767 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0) |
| 10768 | /* Sending disconnect event to userspace for kernel version < 3.11 |
| 10769 | * is handled by __cfg80211_disconnect call to __cfg80211_disconnected |
| 10770 | */ |
| 10771 | hddLog(LOG1, FL("Send disconnected event to userspace")); |
| 10772 | |
| 10773 | wlan_hdd_cfg80211_indicate_disconnect(pAdapter->dev, true, |
| 10774 | WLAN_REASON_UNSPECIFIED); |
| 10775 | #endif |
| 10776 | |
| 10777 | EXIT(); |
| 10778 | return result; |
| 10779 | } |
| 10780 | |
| 10781 | /* |
| 10782 | * hdd_check_and_disconnect_sta_on_invalid_channel() - Disconnect STA if it is |
| 10783 | * on indoor channel |
| 10784 | * @hdd_ctx: pointer to hdd context |
| 10785 | * |
| 10786 | * STA should be disconnected before starting the SAP if it is on indoor |
| 10787 | * channel. |
| 10788 | * |
| 10789 | * Return: void |
| 10790 | */ |
| 10791 | void hdd_check_and_disconnect_sta_on_invalid_channel(hdd_context_t *hdd_ctx) |
| 10792 | { |
| 10793 | |
| 10794 | hdd_adapter_t *sta_adapter; |
| 10795 | tANI_U8 sta_chan; |
| 10796 | |
| 10797 | sta_chan = hdd_get_operating_channel(hdd_ctx, WLAN_HDD_INFRA_STATION); |
| 10798 | |
| 10799 | if (!sta_chan) { |
| 10800 | hddLog(LOG1, FL("STA not connected")); |
| 10801 | return; |
| 10802 | } |
| 10803 | |
| 10804 | hddLog(LOG1, FL("STA connected on chan %hu"), sta_chan); |
| 10805 | |
| 10806 | if (sme_IsChannelValid(hdd_ctx->hHal, sta_chan)) { |
| 10807 | hddLog(LOG1, FL("STA connected on chan %hu and it is valid"), |
| 10808 | sta_chan); |
| 10809 | return; |
| 10810 | } |
| 10811 | |
| 10812 | sta_adapter = hdd_get_adapter(hdd_ctx, WLAN_HDD_INFRA_STATION); |
| 10813 | |
| 10814 | if (!sta_adapter) { |
| 10815 | hddLog(LOG1, FL("STA adapter doesn't exist")); |
| 10816 | return; |
| 10817 | } |
| 10818 | |
| 10819 | hddLog(LOG1, FL("chan %hu not valid, issue disconnect"), sta_chan); |
| 10820 | /* Issue Disconnect request */ |
| 10821 | wlan_hdd_disconnect(sta_adapter, eCSR_DISCONNECT_REASON_DEAUTH); |
| 10822 | } |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 10823 | |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 10824 | int wlan_hdd_restore_channels(hdd_context_t *hdd_ctx) |
| 10825 | { |
| 10826 | struct hdd_cache_channels *cache_chann; |
| 10827 | struct wiphy *wiphy; |
| 10828 | int freq, status, rfChannel; |
| 10829 | int i, band_num, channel_num; |
| 10830 | struct ieee80211_channel *wiphy_channel; |
| 10831 | |
| 10832 | ENTER(); |
| 10833 | |
| 10834 | if (!hdd_ctx) { |
| 10835 | hddLog(VOS_TRACE_LEVEL_FATAL, "HDD Context is NULL"); |
| 10836 | return -EINVAL; |
| 10837 | } |
| 10838 | |
| 10839 | wiphy = hdd_ctx->wiphy; |
| 10840 | |
| 10841 | mutex_lock(&hdd_ctx->cache_channel_lock); |
| 10842 | |
Ashish Kumar Dhanotiya | 95e5bc2 | 2018-04-19 17:06:33 +0530 | [diff] [blame] | 10843 | cache_chann = hdd_ctx->original_channels; |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 10844 | |
| 10845 | if (!cache_chann || !cache_chann->num_channels) { |
| 10846 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10847 | "%s channel list is NULL or num channels are zero", |
| 10848 | __func__); |
| 10849 | mutex_unlock(&hdd_ctx->cache_channel_lock); |
| 10850 | return -EINVAL; |
| 10851 | } |
| 10852 | |
| 10853 | for (i = 0; i < cache_chann->num_channels; i++) { |
| 10854 | status = hdd_wlan_get_freq( |
| 10855 | cache_chann->channel_info[i].channel_num, |
| 10856 | &freq); |
| 10857 | |
Rajeev Kumar Sirasanagandla | 17b649a | 2018-03-19 16:58:30 +0530 | [diff] [blame] | 10858 | for (band_num = 0; band_num < HDD_NUM_NL80211_BANDS; |
| 10859 | band_num++) { |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 10860 | for (channel_num = 0; channel_num < |
| 10861 | wiphy->bands[band_num]->n_channels; |
| 10862 | channel_num++) { |
| 10863 | wiphy_channel = &(wiphy->bands[band_num]-> |
| 10864 | channels[channel_num]); |
| 10865 | if (wiphy_channel->center_freq == freq) { |
| 10866 | rfChannel = wiphy_channel->hw_value; |
| 10867 | /* |
| 10868 | *Restore the orginal states |
| 10869 | *of the channels |
| 10870 | */ |
| 10871 | vos_nv_set_channel_state( |
| 10872 | rfChannel, |
| 10873 | cache_chann-> |
| 10874 | channel_info[i].reg_status); |
| 10875 | wiphy_channel->flags = |
| 10876 | cache_chann-> |
| 10877 | channel_info[i].wiphy_status; |
| 10878 | break; |
| 10879 | } |
| 10880 | } |
| 10881 | if (channel_num < wiphy->bands[band_num]->n_channels) |
| 10882 | break; |
| 10883 | } |
| 10884 | } |
| 10885 | |
| 10886 | mutex_unlock(&hdd_ctx->cache_channel_lock); |
| 10887 | |
| 10888 | status = sme_update_channel_list((tpAniSirGlobal)hdd_ctx->hHal); |
| 10889 | if (status) |
| 10890 | hddLog(VOS_TRACE_LEVEL_ERROR, "Can't Restore channel list"); |
| 10891 | EXIT(); |
| 10892 | |
| 10893 | return 0; |
| 10894 | } |
| 10895 | |
| 10896 | /* |
| 10897 | * wlan_hdd_disable_channels() - Cache the the channels |
| 10898 | * and current state of the channels from the channel list |
| 10899 | * received in the command and disable the channels on the |
| 10900 | * wiphy and NV table. |
| 10901 | * @hdd_ctx: Pointer to hdd context |
| 10902 | * |
| 10903 | * @return: 0 on success, Error code on failure |
| 10904 | */ |
| 10905 | |
| 10906 | static int wlan_hdd_disable_channels(hdd_context_t *hdd_ctx) |
| 10907 | { |
| 10908 | struct hdd_cache_channels *cache_chann; |
| 10909 | struct wiphy *wiphy; |
| 10910 | int freq, status, rfChannel; |
| 10911 | int i, band_num, band_ch_num; |
| 10912 | struct ieee80211_channel *wiphy_channel; |
| 10913 | |
| 10914 | if (!hdd_ctx) { |
| 10915 | hddLog(VOS_TRACE_LEVEL_FATAL, "HDD Context is NULL"); |
| 10916 | return -EINVAL; |
| 10917 | } |
| 10918 | |
| 10919 | wiphy = hdd_ctx->wiphy; |
| 10920 | |
| 10921 | mutex_lock(&hdd_ctx->cache_channel_lock); |
Ashish Kumar Dhanotiya | 95e5bc2 | 2018-04-19 17:06:33 +0530 | [diff] [blame] | 10922 | cache_chann = hdd_ctx->original_channels; |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 10923 | |
| 10924 | if (!cache_chann || !cache_chann->num_channels) { |
| 10925 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10926 | "%s channel list is NULL or num channels are zero", |
| 10927 | __func__); |
| 10928 | mutex_unlock(&hdd_ctx->cache_channel_lock); |
| 10929 | return -EINVAL; |
| 10930 | } |
| 10931 | |
| 10932 | for (i = 0; i < cache_chann->num_channels; i++) { |
| 10933 | status = hdd_wlan_get_freq( |
| 10934 | cache_chann->channel_info[i].channel_num, |
| 10935 | &freq); |
| 10936 | |
Rajeev Kumar Sirasanagandla | 17b649a | 2018-03-19 16:58:30 +0530 | [diff] [blame] | 10937 | for (band_num = 0; band_num < HDD_NUM_NL80211_BANDS; |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 10938 | band_num++) { |
| 10939 | for (band_ch_num = 0; band_ch_num < |
| 10940 | wiphy->bands[band_num]->n_channels; |
| 10941 | band_ch_num++) { |
| 10942 | wiphy_channel = &(wiphy->bands[band_num]-> |
| 10943 | channels[band_ch_num]); |
| 10944 | if (wiphy_channel->center_freq == freq) { |
| 10945 | rfChannel = wiphy_channel->hw_value; |
| 10946 | /* |
| 10947 | * Cache the current states of |
| 10948 | * the channels |
| 10949 | */ |
| 10950 | cache_chann-> |
| 10951 | channel_info[i].reg_status = |
| 10952 | vos_nv_getChannelEnabledState( |
| 10953 | rfChannel); |
| 10954 | |
| 10955 | cache_chann-> |
| 10956 | channel_info[i].wiphy_status = |
| 10957 | wiphy_channel->flags; |
| 10958 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10959 | "Disable channel %d reg_stat %d wiphy_stat 0x%x", |
| 10960 | cache_chann-> |
| 10961 | channel_info[i].channel_num, |
| 10962 | cache_chann-> |
| 10963 | channel_info[i].reg_status, |
| 10964 | wiphy_channel->flags); |
| 10965 | |
| 10966 | vos_nv_set_channel_state( |
| 10967 | rfChannel, |
| 10968 | NV_CHANNEL_DISABLE); |
| 10969 | wiphy_channel->flags |= |
| 10970 | IEEE80211_CHAN_DISABLED; |
| 10971 | break; |
| 10972 | } |
| 10973 | } |
| 10974 | if (band_ch_num < wiphy->bands[band_num]->n_channels) |
| 10975 | break; |
| 10976 | } |
| 10977 | } |
| 10978 | |
| 10979 | mutex_unlock(&hdd_ctx->cache_channel_lock); |
| 10980 | sme_update_channel_list((tpAniSirGlobal)hdd_ctx->hHal); |
| 10981 | return 0; |
| 10982 | } |
| 10983 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10984 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 10985 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 10986 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10987 | #else |
| 10988 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 10989 | struct cfg80211_beacon_data *params, |
| 10990 | const u8 *ssid, size_t ssid_len, |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 10991 | enum nl80211_hidden_ssid hidden_ssid, |
| 10992 | v_U8_t auth_type) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10993 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10994 | { |
| 10995 | tsap_Config_t *pConfig; |
| 10996 | beacon_data_t *pBeacon = NULL; |
| 10997 | struct ieee80211_mgmt *pMgmt_frame; |
| 10998 | v_U8_t *pIe=NULL; |
| 10999 | v_U16_t capab_info; |
| 11000 | eCsrAuthType RSNAuthType; |
| 11001 | eCsrEncryptionType RSNEncryptType; |
| 11002 | eCsrEncryptionType mcRSNEncryptType; |
Hanumanth Reddy Pothula | 1428c61 | 2017-03-06 11:35:34 +0530 | [diff] [blame] | 11003 | int status = VOS_STATUS_SUCCESS, ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11004 | tpWLAN_SAPEventCB pSapEventCallback; |
| 11005 | hdd_hostapd_state_t *pHostapdState; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11006 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 11007 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11008 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 11009 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11010 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 11011 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Vignesh Viswanathan | 36575f8 | 2018-06-14 16:52:21 +0530 | [diff] [blame] | 11012 | hdd_adapter_t *sta_adapter; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 11013 | tSmeConfigParams *psmeConfig; |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 11014 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 11015 | v_BOOL_t MFPRequired = VOS_FALSE; |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 11016 | v_BOOL_t sapEnable11AC = |
| 11017 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapEnable11AC; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 11018 | u_int16_t prev_rsn_length = 0; |
| 11019 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11020 | ENTER(); |
| 11021 | |
Nitesh Shah | 9b06628 | 2017-06-06 18:05:52 +0530 | [diff] [blame] | 11022 | wlan_hdd_tdls_disable_offchan_and_teardown_links(pHddCtx); |
Vignesh Viswanathan | 36575f8 | 2018-06-14 16:52:21 +0530 | [diff] [blame] | 11023 | |
| 11024 | /* |
| 11025 | * For STA+SAP concurrency support from GUI, first STA connection gets |
| 11026 | * triggered and while it is in progress, SAP start also comes up. |
| 11027 | * Once STA association is successful, STA connect event is sent to |
| 11028 | * kernel which gets queued in kernel workqueue and supplicant won't |
| 11029 | * process M1 received from AP and send M2 until this NL80211_CONNECT |
| 11030 | * event is received. Workqueue is not scheduled as RTNL lock is already |
| 11031 | * taken by hostapd thread which has issued start_bss command to driver. |
| 11032 | * Driver cannot complete start_bss as the pending command at the head |
| 11033 | * of the SME command pending list is hw_mode_update for STA session |
| 11034 | * which cannot be processed as SME is in WAITforKey state for STA |
| 11035 | * interface. The start_bss command for SAP interface is queued behind |
| 11036 | * the hw_mode_update command and so it cannot be processed until |
| 11037 | * hw_mode_update command is processed. This is causing a deadlock so |
| 11038 | * disconnect the STA interface first if connection or key exchange is |
| 11039 | * in progress and then start SAP interface. |
| 11040 | */ |
| 11041 | sta_adapter = hdd_get_sta_connection_in_progress(pHddCtx); |
| 11042 | if (sta_adapter) { |
| 11043 | hddLog(LOG1, FL("Disconnecting STA with session id: %d"), |
| 11044 | sta_adapter->sessionId); |
| 11045 | wlan_hdd_disconnect(sta_adapter, eCSR_DISCONNECT_REASON_DEAUTH); |
| 11046 | } |
| 11047 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 11048 | iniConfig = pHddCtx->cfg_ini; |
| 11049 | |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 11050 | /* Mark the indoor channel (passive) to disable */ |
Sourav Mohapatra | 8b14933 | 2018-03-06 14:28:18 +0530 | [diff] [blame] | 11051 | if (iniConfig->disable_indoor_channel && |
| 11052 | pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) { |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 11053 | hdd_update_indoor_channel(pHddCtx, true); |
| 11054 | |
| 11055 | if (!VOS_IS_STATUS_SUCCESS( |
| 11056 | sme_update_channel_list((tpAniSirGlobal)pHddCtx->hHal))) { |
| 11057 | hdd_update_indoor_channel(pHddCtx, false); |
| 11058 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_ERROR, |
| 11059 | FL("Can't start BSS: update channel list failed")); |
Bala Venkatesh | 5c06a25 | 2018-07-12 16:08:04 +0530 | [diff] [blame] | 11060 | ret = eHAL_STATUS_FAILURE; |
| 11061 | goto tdls_enable; |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 11062 | } |
Ganesh Kondabattini | 19813af | 2018-01-25 17:32:44 +0530 | [diff] [blame] | 11063 | |
| 11064 | /* check if STA is on indoor channel */ |
| 11065 | if (hdd_is_sta_sap_scc_allowed_on_dfs_chan(pHddCtx)) |
| 11066 | hdd_check_and_disconnect_sta_on_invalid_channel(pHddCtx); |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 11067 | } |
| 11068 | |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 11069 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) { |
| 11070 | /* Disable the channels received in command SET_DISABLE_CHANNEL_LIST*/ |
| 11071 | wlan_hdd_disable_channels(pHddCtx); |
| 11072 | hdd_check_and_disconnect_sta_on_invalid_channel(pHddCtx); |
| 11073 | } |
| 11074 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11075 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 11076 | |
| 11077 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 11078 | |
| 11079 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 11080 | |
| 11081 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 11082 | |
| 11083 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 11084 | |
| 11085 | //channel is already set in the set_channel Call back |
| 11086 | //pConfig->channel = pCommitConfig->channel; |
| 11087 | |
| 11088 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11089 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11090 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 11091 | |
| 11092 | pConfig->dtim_period = pBeacon->dtim_period; |
| 11093 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11094 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11095 | pConfig->dtim_period); |
| 11096 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 11097 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11098 | { |
| 11099 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11100 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 11101 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 11102 | { |
| 11103 | tANI_BOOLEAN restartNeeded; |
| 11104 | pConfig->ieee80211d = 1; |
| 11105 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 11106 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 11107 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 11108 | } |
| 11109 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11110 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11111 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11112 | pConfig->ieee80211d = 1; |
| 11113 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 11114 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 11115 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11116 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11117 | else |
| 11118 | { |
| 11119 | pConfig->ieee80211d = 0; |
| 11120 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 11121 | /* |
| 11122 | * If auto channel is configured i.e. channel is 0, |
| 11123 | * so skip channel validation. |
| 11124 | */ |
| 11125 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 11126 | { |
| 11127 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 11128 | { |
| 11129 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11130 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 11131 | ret = -EINVAL; |
| 11132 | goto error; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 11133 | } |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 11134 | pConfig->user_config_channel = pConfig->channel; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 11135 | } |
| 11136 | else |
| 11137 | { |
| 11138 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 11139 | { |
| 11140 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 11141 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 11142 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 11143 | } |
Ganesh Kondabattini | 3655a6d | 2018-01-08 20:25:39 +0530 | [diff] [blame] | 11144 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 11145 | pConfig->user_config_channel = SAP_DEFAULT_24GHZ_CHANNEL; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 11146 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11147 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11148 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11149 | { |
| 11150 | pConfig->ieee80211d = 0; |
| 11151 | } |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 11152 | |
| 11153 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 11154 | if (params->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
| 11155 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 11156 | else if (params->auth_type == NL80211_AUTHTYPE_SHARED_KEY) |
| 11157 | pConfig->authType = eSAP_SHARED_KEY; |
| 11158 | else |
| 11159 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 11160 | #else |
| 11161 | if (auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
| 11162 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 11163 | else if (auth_type == NL80211_AUTHTYPE_SHARED_KEY) |
| 11164 | pConfig->authType = eSAP_SHARED_KEY; |
| 11165 | else |
| 11166 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 11167 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11168 | |
| 11169 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11170 | |
| 11171 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11172 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
Agrawal Ashish | a8e8a72 | 2016-10-18 19:07:45 +0530 | [diff] [blame] | 11173 | #ifdef SAP_AUTH_OFFLOAD |
| 11174 | /* In case of sap offload, hostapd.conf is configuted with open mode and |
| 11175 | * security is configured from ini file. Due to open mode in hostapd.conf |
| 11176 | * privacy bit is set to false which will result in not sending, |
| 11177 | * data packets as encrypted. |
| 11178 | * If enable_sap_auth_offload is enabled in ini and |
| 11179 | * sap_auth_offload_sec_type is type of WPA2-PSK, |
| 11180 | * driver will set privacy bit to 1. |
| 11181 | */ |
| 11182 | if (pHddCtx->cfg_ini->enable_sap_auth_offload && |
| 11183 | pHddCtx->cfg_ini->sap_auth_offload_sec_type) |
| 11184 | pConfig->privacy = VOS_TRUE; |
| 11185 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11186 | |
| 11187 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 11188 | |
| 11189 | /*Set wps station to configured*/ |
| 11190 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 11191 | |
| 11192 | if(pIe) |
| 11193 | { |
| 11194 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 11195 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11196 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 11197 | ret = -EINVAL; |
| 11198 | goto error; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11199 | } |
| 11200 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 11201 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 11202 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11203 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 11204 | * WPS state |
| 11205 | */ |
| 11206 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 11207 | { |
| 11208 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 11209 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 11210 | { |
| 11211 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 11212 | } |
| 11213 | } |
| 11214 | } |
| 11215 | else |
| 11216 | { |
| 11217 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 11218 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11219 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11220 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 11221 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 11222 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 11223 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 11224 | eCSR_ENCRYPT_TYPE_NONE; |
| 11225 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11226 | pConfig->RSNWPAReqIELength = 0; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 11227 | memset(&pConfig->RSNWPAReqIE[0], 0, sizeof(pConfig->RSNWPAReqIE)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11228 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11229 | WLAN_EID_RSN); |
| 11230 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11231 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11232 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 11233 | if (pConfig->RSNWPAReqIELength <= sizeof(pConfig->RSNWPAReqIE)) |
| 11234 | memcpy(&pConfig->RSNWPAReqIE[0], pIe, |
| 11235 | pConfig->RSNWPAReqIELength); |
| 11236 | else |
| 11237 | hddLog(LOGE, "RSNWPA IE MAX Length exceeded; length =%d", |
| 11238 | pConfig->RSNWPAReqIELength); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11239 | /* The actual processing may eventually be more extensive than |
| 11240 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11241 | * by the app. |
| 11242 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11243 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11244 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 11245 | &RSNEncryptType, |
| 11246 | &mcRSNEncryptType, |
| 11247 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 11248 | &MFPCapable, |
| 11249 | &MFPRequired, |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 11250 | pConfig->RSNWPAReqIE[1]+2, |
| 11251 | pConfig->RSNWPAReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11252 | |
| 11253 | if( VOS_STATUS_SUCCESS == status ) |
| 11254 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11255 | /* Now copy over all the security attributes you have |
| 11256 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11257 | * */ |
| 11258 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 11259 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 11260 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 11261 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 11262 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11263 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11264 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 11265 | } |
| 11266 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11268 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 11269 | pBeacon->tail, pBeacon->tail_len); |
| 11270 | |
| 11271 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 11272 | { |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 11273 | if (pConfig->RSNWPAReqIE[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11274 | { |
| 11275 | /*Mixed mode WPA/WPA2*/ |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 11276 | prev_rsn_length = pConfig->RSNWPAReqIELength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11277 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 11278 | if (pConfig->RSNWPAReqIELength <= |
| 11279 | (sizeof(pConfig->RSNWPAReqIE) - prev_rsn_length)) |
| 11280 | memcpy(&pConfig->RSNWPAReqIE[0] + prev_rsn_length, pIe, |
| 11281 | pIe[1] + 2); |
| 11282 | else |
| 11283 | hddLog(LOGE, "RSNWPA IE MAX Length exceeded; length =%d", |
| 11284 | pConfig->RSNWPAReqIELength); |
| 11285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11286 | } |
| 11287 | else |
| 11288 | { |
| 11289 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 11290 | if (pConfig->RSNWPAReqIELength <= sizeof(pConfig->RSNWPAReqIE)) |
| 11291 | memcpy(&pConfig->RSNWPAReqIE[0], pIe, |
| 11292 | pConfig->RSNWPAReqIELength); |
| 11293 | else |
| 11294 | hddLog(LOGE, "RSNWPA IE MAX Length exceeded; length =%d", |
| 11295 | pConfig->RSNWPAReqIELength); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11296 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11297 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 11298 | &RSNEncryptType, |
| 11299 | &mcRSNEncryptType, |
| 11300 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 11301 | &MFPCapable, |
| 11302 | &MFPRequired, |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 11303 | pConfig->RSNWPAReqIE[1]+2, |
| 11304 | pConfig->RSNWPAReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11305 | |
| 11306 | if( VOS_STATUS_SUCCESS == status ) |
| 11307 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11308 | /* Now copy over all the security attributes you have |
| 11309 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11310 | * */ |
| 11311 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 11312 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 11313 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 11314 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 11315 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11316 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11317 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 11318 | } |
| 11319 | } |
| 11320 | } |
| 11321 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 11322 | if (pConfig->RSNWPAReqIELength > sizeof(pConfig->RSNWPAReqIE)) { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 11323 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 11324 | ret = -EINVAL; |
| 11325 | goto error; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 11326 | } |
| 11327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11328 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 11329 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11330 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11331 | if (params->ssid != NULL) |
| 11332 | { |
| 11333 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 11334 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 11335 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 11336 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 11337 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11338 | #else |
| 11339 | if (ssid != NULL) |
| 11340 | { |
| 11341 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 11342 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 11343 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 11344 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 11345 | } |
| 11346 | #endif |
| 11347 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11348 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11349 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11350 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11351 | /* default value */ |
| 11352 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 11353 | pConfig->num_accept_mac = 0; |
| 11354 | pConfig->num_deny_mac = 0; |
| 11355 | |
| 11356 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 11357 | pBeacon->tail, pBeacon->tail_len); |
| 11358 | |
| 11359 | /* pIe for black list is following form: |
| 11360 | type : 1 byte |
| 11361 | length : 1 byte |
| 11362 | OUI : 4 bytes |
| 11363 | acl type : 1 byte |
| 11364 | no of mac addr in black list: 1 byte |
| 11365 | 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] | 11366 | */ |
| 11367 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11368 | { |
| 11369 | pConfig->SapMacaddr_acl = pIe[6]; |
| 11370 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11371 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11372 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 11373 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 11374 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11375 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 11376 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 11377 | { |
| 11378 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 11379 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11380 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11381 | } |
| 11382 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 11383 | pBeacon->tail, pBeacon->tail_len); |
| 11384 | |
| 11385 | /* pIe for white list is following form: |
| 11386 | type : 1 byte |
| 11387 | length : 1 byte |
| 11388 | OUI : 4 bytes |
| 11389 | acl type : 1 byte |
| 11390 | no of mac addr in white list: 1 byte |
| 11391 | 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] | 11392 | */ |
| 11393 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11394 | { |
| 11395 | pConfig->SapMacaddr_acl = pIe[6]; |
| 11396 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11397 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11398 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 11399 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 11400 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11401 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 11402 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 11403 | { |
| 11404 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 11405 | acl_entry++; |
| 11406 | } |
| 11407 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 11408 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11409 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 11410 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11411 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 11412 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 11413 | * This is valid only if mode is set to 11n in hostapd, sapEnable11AC |
| 11414 | * 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] | 11415 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 11416 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 11417 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 11418 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 11419 | (sapEnable11AC) && (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 11420 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11421 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 11422 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11423 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 11424 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 11425 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 11426 | /* If ACS disable and selected channel <= 14 |
| 11427 | * OR |
| 11428 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 11429 | * AND |
| 11430 | * VHT in 2.4G Disabled |
| 11431 | * THEN |
| 11432 | * Fallback to 11N mode |
| 11433 | */ |
| 11434 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 11435 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 11436 | operatingBand == eSAP_RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 11437 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 11438 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 11439 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 11440 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 11441 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 11442 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11443 | } |
| 11444 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11445 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11446 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 11447 | pConfig->ht_capab = |
| 11448 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 11449 | |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 11450 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11451 | { |
| 11452 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 11453 | ret = -EINVAL; |
| 11454 | goto error; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11455 | } |
| 11456 | |
| 11457 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11458 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11459 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 11460 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11461 | pConfig->obssProtEnabled = |
| 11462 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11463 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 11464 | #ifdef WLAN_FEATURE_11W |
| 11465 | pConfig->mfpCapable = MFPCapable; |
| 11466 | pConfig->mfpRequired = MFPRequired; |
| 11467 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 11468 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 11469 | #endif |
| 11470 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11471 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11472 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11473 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 11474 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 11475 | (int)pConfig->channel); |
| 11476 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 11477 | pConfig->SapHw_mode, pConfig->privacy, |
| 11478 | pConfig->authType); |
| 11479 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 11480 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 11481 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 11482 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11483 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11484 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11485 | { |
| 11486 | //Bss already started. just return. |
| 11487 | //TODO Probably it should update some beacon params. |
| 11488 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 11489 | EXIT(); |
| 11490 | return 0; |
| 11491 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11492 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11493 | if (vos_max_concurrent_connections_reached()) { |
| 11494 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 11495 | ret = -EINVAL; |
| 11496 | goto error; |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11497 | } |
| 11498 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11499 | pConfig->persona = pHostapdAdapter->device_mode; |
| 11500 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 11501 | psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams)); |
| 11502 | if ( NULL != psmeConfig) |
| 11503 | { |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 11504 | vos_mem_zero(psmeConfig, sizeof (tSmeConfigParams)); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 11505 | sme_GetConfigParam(hHal, psmeConfig); |
| 11506 | pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference; |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 11507 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 11508 | if (((pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 11509 | || (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 11510 | && pHddCtx->cfg_ini->apHT40_24GEnabled) |
| 11511 | { |
| 11512 | psmeConfig->csrConfig.apHT40_24GEnabled = 1; |
| 11513 | sme_UpdateConfig (hHal, psmeConfig); |
| 11514 | } |
| 11515 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 11516 | vos_mem_free(psmeConfig); |
| 11517 | } |
Peng Xu | afc34e3 | 2014-09-25 13:23:55 +0530 | [diff] [blame] | 11518 | pConfig->acsBandSwitchThreshold = iniConfig->acsBandSwitchThreshold; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 11519 | |
Hanumanth Reddy Pothula | 1428c61 | 2017-03-06 11:35:34 +0530 | [diff] [blame] | 11520 | set_bit(SOFTAP_INIT_DONE, &pHostapdAdapter->event_flags); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11521 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
Hanumanth Reddy Pothula | 74ba68c | 2018-06-22 17:52:09 +0530 | [diff] [blame] | 11522 | |
| 11523 | vos_event_reset(&pHostapdState->vosEvent); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11524 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 11525 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 11526 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11527 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Hanumanth Reddy Pothula | 1428c61 | 2017-03-06 11:35:34 +0530 | [diff] [blame] | 11528 | ret = -EINVAL; |
| 11529 | goto error; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11530 | } |
| 11531 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11532 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11533 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 11534 | |
| 11535 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11536 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11537 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11538 | { |
| 11539 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11540 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 11541 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11542 | VOS_ASSERT(0); |
| 11543 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11544 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11545 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Nishank Aggarwal | c11826c | 2016-12-15 18:54:10 +0530 | [diff] [blame] | 11546 | if (WLANSAP_get_sessionId(pVosContext, &pHostapdAdapter->sessionId) != |
| 11547 | VOS_STATUS_SUCCESS) |
| 11548 | { |
| 11549 | hddLog(LOGE,FL("Fail to get Softap sessionID")); |
| 11550 | VOS_ASSERT(0); |
| 11551 | } |
Kaushik, Sushant | f607080 | 2014-10-15 15:09:23 +0530 | [diff] [blame] | 11552 | /* Initialize WMM configuation */ |
| 11553 | hdd_wmm_init(pHostapdAdapter); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11554 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11555 | |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 11556 | #ifdef DHCP_SERVER_OFFLOAD |
| 11557 | /* set dhcp server offload */ |
| 11558 | if (iniConfig->enable_dhcp_srv_offload && |
| 11559 | sme_IsFeatureSupportedByFW(SAP_OFFLOADS)) { |
Anurag Chouhan | b2951ae | 2017-03-12 13:41:35 +0530 | [diff] [blame] | 11560 | vos_event_reset(&pHostapdAdapter->dhcp_status.vos_event); |
Anurag Chouhan | 638f5e2 | 2017-03-06 12:28:43 +0530 | [diff] [blame] | 11561 | status = wlan_hdd_set_dhcp_server_offload(pHostapdAdapter, false); |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 11562 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 11563 | { |
| 11564 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11565 | ("HDD DHCP Server Offload Failed!!")); |
Anurag Chouhan | b2951ae | 2017-03-12 13:41:35 +0530 | [diff] [blame] | 11566 | vos_event_reset(&pHostapdState->vosEvent); |
| 11567 | if (VOS_STATUS_SUCCESS == WLANSAP_StopBss(pHddCtx->pvosContext)) { |
| 11568 | status = vos_wait_single_event(&pHostapdState->vosEvent, |
| 11569 | 10000); |
| 11570 | if (!VOS_IS_STATUS_SUCCESS(status)) { |
| 11571 | hddLog(LOGE, FL("SAP Stop Failed")); |
Hanumanth Reddy Pothula | 1428c61 | 2017-03-06 11:35:34 +0530 | [diff] [blame] | 11572 | ret = -EINVAL; |
| 11573 | goto error; |
Anurag Chouhan | b2951ae | 2017-03-12 13:41:35 +0530 | [diff] [blame] | 11574 | } |
| 11575 | } |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 11576 | } |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 11577 | status = vos_wait_single_event(&pHostapdAdapter->dhcp_status.vos_event, 2000); |
| 11578 | if (!VOS_IS_STATUS_SUCCESS(status) || pHostapdAdapter->dhcp_status.dhcp_offload_status) |
| 11579 | { |
| 11580 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11581 | ("ERROR: DHCP HDD vos wait for single_event failed!! %d"), |
| 11582 | pHostapdAdapter->dhcp_status.dhcp_offload_status); |
Anurag Chouhan | b2951ae | 2017-03-12 13:41:35 +0530 | [diff] [blame] | 11583 | vos_event_reset(&pHostapdState->vosEvent); |
| 11584 | if (VOS_STATUS_SUCCESS == WLANSAP_StopBss(pHddCtx->pvosContext)) { |
| 11585 | status = vos_wait_single_event(&pHostapdState->vosEvent, |
| 11586 | 10000); |
| 11587 | if (!VOS_IS_STATUS_SUCCESS(status)) { |
| 11588 | hddLog(LOGE, FL("SAP Stop Failed")); |
Hanumanth Reddy Pothula | 1428c61 | 2017-03-06 11:35:34 +0530 | [diff] [blame] | 11589 | ret = -EINVAL; |
| 11590 | goto error; |
Anurag Chouhan | b2951ae | 2017-03-12 13:41:35 +0530 | [diff] [blame] | 11591 | } |
| 11592 | } |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 11593 | } |
Anurag Chouhan | 0b29de0 | 2016-12-16 13:18:40 +0530 | [diff] [blame] | 11594 | #ifdef MDNS_OFFLOAD |
| 11595 | if (iniConfig->enable_mdns_offload) { |
Anurag Chouhan | b2951ae | 2017-03-12 13:41:35 +0530 | [diff] [blame] | 11596 | vos_event_reset(&pHostapdAdapter->mdns_status.vos_event); |
Anurag Chouhan | 0b29de0 | 2016-12-16 13:18:40 +0530 | [diff] [blame] | 11597 | status = wlan_hdd_set_mdns_offload(pHostapdAdapter); |
| 11598 | if (VOS_IS_STATUS_SUCCESS(status)) |
| 11599 | { |
| 11600 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11601 | ("HDD MDNS Server Offload Failed!!")); |
Anurag Chouhan | b2951ae | 2017-03-12 13:41:35 +0530 | [diff] [blame] | 11602 | vos_event_reset(&pHostapdState->vosEvent); |
| 11603 | if (VOS_STATUS_SUCCESS == |
| 11604 | WLANSAP_StopBss(pHddCtx->pvosContext)) { |
| 11605 | status = vos_wait_single_event(&pHostapdState->vosEvent, |
| 11606 | 10000); |
| 11607 | if (!VOS_IS_STATUS_SUCCESS(status)) { |
| 11608 | hddLog(LOGE, FL("SAP Stop Failed")); |
Hanumanth Reddy Pothula | 1428c61 | 2017-03-06 11:35:34 +0530 | [diff] [blame] | 11609 | ret = -EINVAL; |
| 11610 | goto error; |
Anurag Chouhan | b2951ae | 2017-03-12 13:41:35 +0530 | [diff] [blame] | 11611 | } |
| 11612 | } |
Anurag Chouhan | 0b29de0 | 2016-12-16 13:18:40 +0530 | [diff] [blame] | 11613 | } |
Anurag Chouhan | 0b29de0 | 2016-12-16 13:18:40 +0530 | [diff] [blame] | 11614 | status = vos_wait_single_event(&pHostapdAdapter-> |
| 11615 | mdns_status.vos_event, 2000); |
| 11616 | if (!VOS_IS_STATUS_SUCCESS(status) || |
| 11617 | pHostapdAdapter->mdns_status.mdns_enable_status || |
| 11618 | pHostapdAdapter->mdns_status.mdns_fqdn_status || |
| 11619 | pHostapdAdapter->mdns_status.mdns_resp_status) |
| 11620 | { |
| 11621 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11622 | ("MDNS HDD vos wait for single_event failed!! enable %d fqdn %d resp %d"), |
| 11623 | pHostapdAdapter->mdns_status.mdns_enable_status, |
| 11624 | pHostapdAdapter->mdns_status.mdns_fqdn_status, |
| 11625 | pHostapdAdapter->mdns_status.mdns_resp_status); |
Anurag Chouhan | b2951ae | 2017-03-12 13:41:35 +0530 | [diff] [blame] | 11626 | vos_event_reset(&pHostapdState->vosEvent); |
| 11627 | if (VOS_STATUS_SUCCESS == |
| 11628 | WLANSAP_StopBss(pHddCtx->pvosContext)) { |
| 11629 | status = vos_wait_single_event(&pHostapdState->vosEvent, |
| 11630 | 10000); |
| 11631 | if (!VOS_IS_STATUS_SUCCESS(status)) { |
| 11632 | hddLog(LOGE, FL("SAP Stop Failed")); |
Hanumanth Reddy Pothula | 1428c61 | 2017-03-06 11:35:34 +0530 | [diff] [blame] | 11633 | ret = -EINVAL; |
| 11634 | goto error; |
Anurag Chouhan | b2951ae | 2017-03-12 13:41:35 +0530 | [diff] [blame] | 11635 | } |
| 11636 | } |
Anurag Chouhan | 0b29de0 | 2016-12-16 13:18:40 +0530 | [diff] [blame] | 11637 | } |
| 11638 | } |
| 11639 | #endif /* MDNS_OFFLOAD */ |
| 11640 | } else { |
| 11641 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11642 | ("DHCP Disabled ini %d, FW %d"), |
| 11643 | iniConfig->enable_dhcp_srv_offload, |
| 11644 | sme_IsFeatureSupportedByFW(SAP_OFFLOADS)); |
Anurag Chouhan | 8302600 | 2016-12-13 22:46:21 +0530 | [diff] [blame] | 11645 | } |
| 11646 | #endif /* DHCP_SERVER_OFFLOAD */ |
| 11647 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 11648 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 11649 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 11650 | { |
| 11651 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 11652 | { |
| 11653 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 11654 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 11655 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 11656 | } |
| 11657 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 11658 | { |
| 11659 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 11660 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 11661 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 11662 | } |
| 11663 | } |
| 11664 | #endif |
Ashish Kumar Dhanotiya | 42aa515 | 2017-01-03 20:25:57 +0530 | [diff] [blame] | 11665 | /* Check and restart SAP if it is on Unsafe channel */ |
| 11666 | hdd_check_for_unsafe_ch(pHostapdAdapter, pHddCtx); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 11667 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11668 | pHostapdState->bCommit = TRUE; |
| 11669 | EXIT(); |
| 11670 | |
| 11671 | return 0; |
Hanumanth Reddy Pothula | 1428c61 | 2017-03-06 11:35:34 +0530 | [diff] [blame] | 11672 | error: |
Ashish Kumar Dhanotiya | 32d092b | 2018-02-20 21:43:57 +0530 | [diff] [blame] | 11673 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 11674 | wlan_hdd_restore_channels(pHddCtx); |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 11675 | /* Revert the indoor to passive marking if START BSS fails */ |
Sourav Mohapatra | 8b14933 | 2018-03-06 14:28:18 +0530 | [diff] [blame] | 11676 | if (iniConfig->disable_indoor_channel && |
| 11677 | pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) { |
Sourav Mohapatra | 5817dc4 | 2017-12-18 17:45:16 +0530 | [diff] [blame] | 11678 | hdd_update_indoor_channel(pHddCtx, false); |
| 11679 | sme_update_channel_list((tpAniSirGlobal)pHddCtx->hHal); |
| 11680 | } |
| 11681 | |
Hanumanth Reddy Pothula | 1428c61 | 2017-03-06 11:35:34 +0530 | [diff] [blame] | 11682 | clear_bit(SOFTAP_INIT_DONE, &pHostapdAdapter->event_flags); |
Bala Venkatesh | 5c06a25 | 2018-07-12 16:08:04 +0530 | [diff] [blame] | 11683 | |
| 11684 | tdls_enable: |
| 11685 | if (ret != eHAL_STATUS_SUCCESS) |
| 11686 | wlan_hdd_tdls_reenable(pHddCtx); |
| 11687 | |
Hanumanth Reddy Pothula | 1428c61 | 2017-03-06 11:35:34 +0530 | [diff] [blame] | 11688 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11689 | } |
| 11690 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11691 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 11692 | static int __wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11693 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11694 | struct beacon_parameters *params) |
| 11695 | { |
| 11696 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11697 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11698 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11699 | |
| 11700 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11701 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11702 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11703 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 11704 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11705 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 11706 | hdd_device_modetoString(pAdapter->device_mode), |
| 11707 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11708 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11709 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11710 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11711 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11712 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11713 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11714 | } |
| 11715 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11716 | if (vos_max_concurrent_connections_reached()) { |
| 11717 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 11718 | return -EINVAL; |
| 11719 | } |
| 11720 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11721 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11722 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11723 | ) |
| 11724 | { |
| 11725 | beacon_data_t *old,*new; |
| 11726 | |
| 11727 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11728 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11729 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11730 | { |
| 11731 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 11732 | FL("already beacon info added to session(%d)"), |
| 11733 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11734 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11735 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11736 | |
| 11737 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 11738 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11739 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11740 | { |
| 11741 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11742 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11743 | return -EINVAL; |
| 11744 | } |
| 11745 | |
| 11746 | pAdapter->sessionCtx.ap.beacon = new; |
| 11747 | |
| 11748 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 11749 | } |
| 11750 | |
| 11751 | EXIT(); |
| 11752 | return status; |
| 11753 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11754 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 11755 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 11756 | struct net_device *dev, |
| 11757 | struct beacon_parameters *params) |
| 11758 | { |
| 11759 | int ret; |
| 11760 | |
| 11761 | vos_ssr_protect(__func__); |
| 11762 | ret = __wlan_hdd_cfg80211_add_beacon(wiphy, dev, params); |
| 11763 | vos_ssr_unprotect(__func__); |
| 11764 | |
| 11765 | return ret; |
| 11766 | } |
| 11767 | |
| 11768 | static int __wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11769 | struct net_device *dev, |
| 11770 | struct beacon_parameters *params) |
| 11771 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11772 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11773 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11774 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11775 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11776 | |
| 11777 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 11778 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11779 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11780 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 11781 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 11782 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 11783 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 11784 | pAdapter->device_mode); |
| 11785 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11786 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11787 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11788 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11789 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11790 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11791 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11792 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11793 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11794 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11795 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11796 | { |
| 11797 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11798 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11799 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11800 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11801 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11802 | { |
| 11803 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11804 | FL("session(%d) old and new heads points to NULL"), |
| 11805 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11806 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11807 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11808 | |
| 11809 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 11810 | |
| 11811 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11812 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11813 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11814 | return -EINVAL; |
| 11815 | } |
| 11816 | |
| 11817 | pAdapter->sessionCtx.ap.beacon = new; |
| 11818 | |
| 11819 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 11820 | } |
| 11821 | |
| 11822 | EXIT(); |
| 11823 | return status; |
| 11824 | } |
| 11825 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 11826 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
| 11827 | struct net_device *dev, |
| 11828 | struct beacon_parameters *params) |
| 11829 | { |
| 11830 | int ret; |
| 11831 | |
| 11832 | vos_ssr_protect(__func__); |
| 11833 | ret = __wlan_hdd_cfg80211_set_beacon(wiphy, dev, params); |
| 11834 | vos_ssr_unprotect(__func__); |
| 11835 | |
| 11836 | return ret; |
| 11837 | } |
| 11838 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11839 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 11840 | |
| 11841 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 11842 | static int __wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11843 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11844 | #else |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 11845 | static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11846 | struct net_device *dev) |
| 11847 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11848 | { |
| 11849 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Vignesh Viswanathan | 5caacc2 | 2018-06-14 17:14:20 +0530 | [diff] [blame] | 11850 | hdd_adapter_t *staAdapter = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11851 | hdd_context_t *pHddCtx = NULL; |
| 11852 | hdd_scaninfo_t *pScanInfo = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11853 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 11854 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11855 | |
| 11856 | ENTER(); |
| 11857 | |
| 11858 | if (NULL == pAdapter) |
| 11859 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11860 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 11861 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11862 | return -ENODEV; |
| 11863 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 11864 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11865 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11866 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 11867 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11868 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11869 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11870 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 11871 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11872 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 11873 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 11874 | |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 11875 | pScanInfo = &pHddCtx->scan_info; |
| 11876 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11877 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 11878 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 11879 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11880 | |
Vignesh Viswanathan | 5caacc2 | 2018-06-14 17:14:20 +0530 | [diff] [blame] | 11881 | /* |
| 11882 | * if a sta connection is in progress in another adapter, disconnect |
| 11883 | * the sta and complete the sap operation. sta will reconnect |
| 11884 | * after sap stop is done. |
| 11885 | */ |
| 11886 | staAdapter = hdd_get_sta_connection_in_progress(pHddCtx); |
| 11887 | if (staAdapter) { |
| 11888 | hddLog(LOG1, FL("disconnecting sta with session id: %d"), |
| 11889 | staAdapter->sessionId); |
| 11890 | wlan_hdd_disconnect(staAdapter, eCSR_DISCONNECT_REASON_DEAUTH); |
| 11891 | } |
| 11892 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 11893 | ret = wlan_hdd_scan_abort(pAdapter); |
| 11894 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 11895 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11896 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 11897 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11898 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11899 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 11900 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11901 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 11902 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11903 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 11904 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11905 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 11906 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11907 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 11908 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11909 | } |
| 11910 | |
Rashmi Ramanna | 1f0948d | 2014-08-28 15:33:48 +0530 | [diff] [blame] | 11911 | /* Delete all associated STAs before stopping AP/P2P GO */ |
| 11912 | hdd_del_all_sta(pAdapter); |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 11913 | hdd_hostapd_stop(dev); |
| 11914 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11915 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11916 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11917 | ) |
| 11918 | { |
| 11919 | beacon_data_t *old; |
| 11920 | |
| 11921 | old = pAdapter->sessionCtx.ap.beacon; |
| 11922 | |
| 11923 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11924 | { |
| 11925 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11926 | FL("session(%d) beacon data points to NULL"), |
| 11927 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11928 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11929 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11930 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11931 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11932 | |
| 11933 | mutex_lock(&pHddCtx->sap_lock); |
| 11934 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 11935 | { |
Hanumanth Reddy Pothula | 74ba68c | 2018-06-22 17:52:09 +0530 | [diff] [blame] | 11936 | hdd_hostapd_state_t *pHostapdState = |
| 11937 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 11938 | |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 11939 | vos_flush_delayed_work(&pHddCtx->ecsa_chan_change_work); |
| 11940 | hdd_wait_for_ecsa_complete(pHddCtx); |
Hanumanth Reddy Pothula | 74ba68c | 2018-06-22 17:52:09 +0530 | [diff] [blame] | 11941 | vos_event_reset(&pHostapdState->vosEvent); |
| 11942 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 11943 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11944 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11945 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 11946 | |
| 11947 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 11948 | { |
| 11949 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11950 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11951 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11952 | } |
| 11953 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11954 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 11955 | /* BSS stopped, clear the active sessions for this device mode */ |
| 11956 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11957 | } |
| 11958 | mutex_unlock(&pHddCtx->sap_lock); |
| 11959 | |
| 11960 | if(status != VOS_STATUS_SUCCESS) |
| 11961 | { |
| 11962 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11963 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11964 | return -EINVAL; |
| 11965 | } |
| 11966 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 11967 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11968 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 11969 | ==eHAL_STATUS_FAILURE) |
| 11970 | { |
| 11971 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11972 | "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] | 11973 | } |
| 11974 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 11975 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11976 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 11977 | eANI_BOOLEAN_FALSE) ) |
| 11978 | { |
| 11979 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11980 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11981 | } |
| 11982 | |
| 11983 | // Reset WNI_CFG_PROBE_RSP Flags |
| 11984 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 11985 | |
Hanumanth Reddy Pothula | 1428c61 | 2017-03-06 11:35:34 +0530 | [diff] [blame] | 11986 | clear_bit(SOFTAP_INIT_DONE, &pAdapter->event_flags); |
| 11987 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11988 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 11989 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 11990 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 11991 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 11992 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 11993 | { |
| 11994 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 11995 | "GO got removed"); |
| 11996 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 11997 | } |
| 11998 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11999 | } |
| 12000 | EXIT(); |
| 12001 | return status; |
| 12002 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12003 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 12004 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 12005 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 12006 | struct net_device *dev) |
| 12007 | { |
| 12008 | int ret; |
| 12009 | |
| 12010 | vos_ssr_protect(__func__); |
| 12011 | ret = __wlan_hdd_cfg80211_del_beacon(wiphy, dev); |
| 12012 | vos_ssr_unprotect(__func__); |
| 12013 | |
| 12014 | return ret; |
| 12015 | } |
| 12016 | #else |
| 12017 | static int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, |
| 12018 | struct net_device *dev) |
| 12019 | { |
| 12020 | int ret; |
| 12021 | |
| 12022 | vos_ssr_protect(__func__); |
| 12023 | ret = __wlan_hdd_cfg80211_stop_ap(wiphy, dev); |
| 12024 | vos_ssr_unprotect(__func__); |
| 12025 | |
| 12026 | return ret; |
| 12027 | } |
| 12028 | #endif |
| 12029 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12030 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 12031 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 12032 | static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 12033 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12034 | struct cfg80211_ap_settings *params) |
| 12035 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 12036 | hdd_adapter_t *pAdapter; |
| 12037 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12038 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12039 | |
| 12040 | ENTER(); |
| 12041 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 12042 | if (NULL == dev || NULL == params) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 12043 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12044 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 12045 | "%s: Device or params is Null", __func__); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 12046 | return -ENODEV; |
| 12047 | } |
| 12048 | |
| 12049 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12050 | if (NULL == pAdapter) |
| 12051 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12052 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 12053 | "%s: HDD adapter is Null", __func__); |
| 12054 | return -ENODEV; |
| 12055 | } |
| 12056 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12057 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12058 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 12059 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 12060 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 12061 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12062 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 12063 | "%s: HDD adapter magic is invalid", __func__); |
| 12064 | return -ENODEV; |
| 12065 | } |
| 12066 | |
Hanumanth Reddy Pothula | 1428c61 | 2017-03-06 11:35:34 +0530 | [diff] [blame] | 12067 | clear_bit(SOFTAP_INIT_DONE, &pAdapter->event_flags); |
| 12068 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 12069 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12070 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12071 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 12072 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12073 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 12074 | } |
| 12075 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12076 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 12077 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12078 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 12079 | |
| 12080 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12081 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12082 | ) |
| 12083 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 12084 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12085 | |
| 12086 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 12087 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12088 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12089 | { |
| 12090 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 12091 | FL("already beacon info added to session(%d)"), |
| 12092 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12093 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12094 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12095 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 12096 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 12097 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 12098 | &new, |
| 12099 | ¶ms->beacon); |
| 12100 | #else |
| 12101 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 12102 | &new, |
| 12103 | ¶ms->beacon, |
| 12104 | params->dtim_period); |
| 12105 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12106 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 12107 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12108 | { |
| 12109 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 12110 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12111 | return -EINVAL; |
| 12112 | } |
| 12113 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 12114 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12115 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 12116 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 12117 | params->channel, params->channel_type); |
| 12118 | #else |
| 12119 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 12120 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 12121 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12122 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 12123 | params->ssid_len, params->hidden_ssid, |
| 12124 | params->auth_type); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12125 | } |
| 12126 | |
| 12127 | EXIT(); |
| 12128 | return status; |
| 12129 | } |
| 12130 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 12131 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 12132 | struct net_device *dev, |
| 12133 | struct cfg80211_ap_settings *params) |
| 12134 | { |
| 12135 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12136 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 12137 | vos_ssr_protect(__func__); |
| 12138 | ret = __wlan_hdd_cfg80211_start_ap(wiphy, dev, params); |
| 12139 | vos_ssr_unprotect(__func__); |
| 12140 | |
| 12141 | return ret; |
| 12142 | } |
| 12143 | |
| 12144 | static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12145 | struct net_device *dev, |
| 12146 | struct cfg80211_beacon_data *params) |
| 12147 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12148 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12149 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12150 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12151 | |
| 12152 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12153 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12154 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12155 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 12156 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12157 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12158 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12159 | |
| 12160 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12161 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12162 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 12163 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12164 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 12165 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12166 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12167 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12168 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12169 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12170 | { |
| 12171 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12172 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12173 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12174 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12175 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12176 | { |
| 12177 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12178 | FL("session(%d) beacon data points to NULL"), |
| 12179 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12180 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12181 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12182 | |
| 12183 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 12184 | |
| 12185 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12186 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12187 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12188 | return -EINVAL; |
| 12189 | } |
| 12190 | |
| 12191 | pAdapter->sessionCtx.ap.beacon = new; |
| 12192 | |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 12193 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0, |
| 12194 | pAdapter->sessionCtx.ap.sapConfig.authType); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12195 | } |
| 12196 | |
| 12197 | EXIT(); |
| 12198 | return status; |
| 12199 | } |
| 12200 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 12201 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
| 12202 | struct net_device *dev, |
| 12203 | struct cfg80211_beacon_data *params) |
| 12204 | { |
| 12205 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12206 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 12207 | vos_ssr_protect(__func__); |
| 12208 | ret = __wlan_hdd_cfg80211_change_beacon(wiphy, dev, params); |
| 12209 | vos_ssr_unprotect(__func__); |
| 12210 | |
| 12211 | return ret; |
| 12212 | } |
| 12213 | |
| 12214 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12215 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12216 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12217 | struct net_device *dev, |
| 12218 | struct bss_parameters *params) |
| 12219 | { |
| 12220 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 12221 | hdd_context_t *pHddCtx; |
| 12222 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12223 | |
| 12224 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12225 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 12226 | if (NULL == pAdapter) |
| 12227 | { |
| 12228 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12229 | "%s: HDD adapter is Null", __func__); |
| 12230 | return -ENODEV; |
| 12231 | } |
| 12232 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 12233 | ret = wlan_hdd_validate_context(pHddCtx); |
| 12234 | if (0 != ret) |
| 12235 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 12236 | return ret; |
| 12237 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12238 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12239 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 12240 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12241 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 12242 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12243 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12244 | |
| 12245 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12246 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12247 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12248 | { |
| 12249 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 12250 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12251 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12252 | { |
| 12253 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12254 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12255 | } |
| 12256 | |
| 12257 | EXIT(); |
| 12258 | return 0; |
| 12259 | } |
| 12260 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 12261 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 12262 | struct net_device *dev, |
| 12263 | struct bss_parameters *params) |
| 12264 | { |
| 12265 | int ret; |
| 12266 | |
| 12267 | vos_ssr_protect(__func__); |
| 12268 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 12269 | vos_ssr_unprotect(__func__); |
| 12270 | |
| 12271 | return ret; |
| 12272 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 12273 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 12274 | * to wait for contry code completion |
| 12275 | */ |
| 12276 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 12277 | { |
| 12278 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 12279 | complete(&call_back_pAdapter->change_country_code); |
| 12280 | return NULL; |
| 12281 | } |
| 12282 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12283 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 12284 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12285 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 12286 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 12287 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12288 | struct net_device *ndev, |
| 12289 | enum nl80211_iftype type, |
| 12290 | u32 *flags, |
| 12291 | struct vif_params *params |
| 12292 | ) |
| 12293 | { |
| 12294 | struct wireless_dev *wdev; |
| 12295 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 12296 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 12297 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12298 | tCsrRoamProfile *pRoamProfile = NULL; |
| 12299 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12300 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12301 | eMib_dot11DesiredBssType connectedBssType; |
| 12302 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12303 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12304 | |
| 12305 | ENTER(); |
| 12306 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12307 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 12308 | { |
| 12309 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12310 | "%s: Adapter context is null", __func__); |
| 12311 | return VOS_STATUS_E_FAILURE; |
| 12312 | } |
| 12313 | |
| 12314 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12315 | if (!pHddCtx) |
| 12316 | { |
| 12317 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12318 | "%s: HDD context is null", __func__); |
| 12319 | return VOS_STATUS_E_FAILURE; |
| 12320 | } |
| 12321 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12322 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12323 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 12324 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12325 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12326 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12327 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12328 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12329 | } |
| 12330 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12331 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 12332 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12333 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12334 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 12335 | if (pHddCtx->concurrency_mode == VOS_STA_MON) { |
| 12336 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 12337 | "%s: STA + MON is in progress, cannot change interface", |
| 12338 | __func__); |
| 12339 | } |
| 12340 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12341 | if (vos_max_concurrent_connections_reached()) { |
| 12342 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 12343 | return -EINVAL; |
| 12344 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12345 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12346 | wdev = ndev->ieee80211_ptr; |
| 12347 | |
| 12348 | #ifdef WLAN_BTAMP_FEATURE |
| 12349 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 12350 | (NL80211_IFTYPE_ADHOC == type)|| |
| 12351 | (NL80211_IFTYPE_AP == type)|| |
| 12352 | (NL80211_IFTYPE_P2P_GO == type)) |
| 12353 | { |
| 12354 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 12355 | // stop AMP traffic |
| 12356 | status = WLANBAP_StopAmp(); |
| 12357 | if(VOS_STATUS_SUCCESS != status ) |
| 12358 | { |
| 12359 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 12360 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 12361 | "%s: Failed to stop AMP", __func__); |
| 12362 | return -EINVAL; |
| 12363 | } |
| 12364 | } |
| 12365 | #endif //WLAN_BTAMP_FEATURE |
| 12366 | /* Reset the current device mode bit mask*/ |
| 12367 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 12368 | |
Bala Venkatesh | 5c06a25 | 2018-07-12 16:08:04 +0530 | [diff] [blame] | 12369 | if (((pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) && |
| 12370 | (type == NL80211_IFTYPE_P2P_CLIENT || type == NL80211_IFTYPE_P2P_GO)) || |
| 12371 | type == NL80211_IFTYPE_AP) |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 12372 | { |
| 12373 | /* Notify Mode change in case of concurrency. |
| 12374 | * Below function invokes TDLS teardown Functionality Since TDLS is |
| 12375 | * not Supported in case of concurrency i.e Once P2P session |
| 12376 | * is detected disable offchannel and teardown TDLS links |
| 12377 | */ |
| 12378 | hddLog(LOG1, |
| 12379 | FL("Device mode = %d Interface type = %d"), |
| 12380 | pAdapter->device_mode, type); |
| 12381 | hdd_tdls_notify_mode_change(pAdapter, pHddCtx); |
| 12382 | } |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 12383 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12384 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12385 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12386 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12387 | ) |
| 12388 | { |
| 12389 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 12390 | if (!pWextState) |
| 12391 | { |
| 12392 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12393 | "%s: pWextState is null", __func__); |
| 12394 | return VOS_STATUS_E_FAILURE; |
| 12395 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12396 | pRoamProfile = &pWextState->roamProfile; |
| 12397 | LastBSSType = pRoamProfile->BSSType; |
| 12398 | |
| 12399 | switch (type) |
| 12400 | { |
| 12401 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12402 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12403 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12404 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 12405 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12406 | #ifdef WLAN_FEATURE_11AC |
| 12407 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 12408 | { |
| 12409 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 12410 | } |
| 12411 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12412 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12413 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12414 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 12415 | //Check for sub-string p2p to confirm its a p2p interface |
| 12416 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12417 | { |
Mahesh A Saptasagar | c48ae8a | 2015-08-09 00:04:35 +0530 | [diff] [blame] | 12418 | #ifdef FEATURE_WLAN_TDLS |
| 12419 | mutex_lock(&pHddCtx->tdls_lock); |
| 12420 | wlan_hdd_tdls_exit(pAdapter, TRUE); |
| 12421 | mutex_unlock(&pHddCtx->tdls_lock); |
| 12422 | #endif |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 12423 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 12424 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 12425 | } |
| 12426 | else |
| 12427 | { |
| 12428 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12429 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 12430 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12431 | break; |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 12432 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12433 | case NL80211_IFTYPE_ADHOC: |
| 12434 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12435 | "%s: setting interface Type to ADHOC", __func__); |
| 12436 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 12437 | pRoamProfile->phyMode = |
| 12438 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 12439 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12440 | wdev->iftype = type; |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 12441 | hdd_set_ibss_ops( pAdapter ); |
| 12442 | hdd_ibss_init_tx_rx( pAdapter ); |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 12443 | |
| 12444 | status = hdd_sta_id_hash_attach(pAdapter); |
| 12445 | if (VOS_STATUS_SUCCESS != status) { |
| 12446 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12447 | FL("Failed to initialize hash for IBSS")); |
| 12448 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12449 | break; |
| 12450 | |
| 12451 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12452 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12453 | { |
| 12454 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 12455 | "%s: setting interface Type to %s", __func__, |
| 12456 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 12457 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 12458 | //Cancel any remain on channel for GO mode |
| 12459 | if (NL80211_IFTYPE_P2P_GO == type) |
| 12460 | { |
| 12461 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 12462 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 12463 | if (NL80211_IFTYPE_AP == type) |
| 12464 | { |
| 12465 | /* As Loading WLAN Driver one interface being created for p2p device |
| 12466 | * address. This will take one HW STA and the max number of clients |
| 12467 | * that can connect to softAP will be reduced by one. so while changing |
| 12468 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 12469 | * interface as it is not required in SoftAP mode. |
| 12470 | */ |
| 12471 | |
| 12472 | // Get P2P Adapter |
| 12473 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 12474 | |
| 12475 | if (pP2pAdapter) |
| 12476 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 12477 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 12478 | hdd_deinit_adapter(pHddCtx, pP2pAdapter, TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 12479 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 12480 | } |
| 12481 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 12482 | //Disable IMPS & BMPS for SAP/GO |
| 12483 | if(VOS_STATUS_E_FAILURE == |
| 12484 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 12485 | { |
| 12486 | //Fail to Exit BMPS |
| 12487 | VOS_ASSERT(0); |
| 12488 | } |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 12489 | |
| 12490 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
| 12491 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 12492 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 12493 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 12494 | /* A Mutex Lock is introduced while changing the mode to |
| 12495 | * protect the concurrent access for the Adapters by TDLS |
| 12496 | * module. |
| 12497 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 12498 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 12499 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12500 | //De-init the adapter. |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 12501 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12502 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12503 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 12504 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 12505 | #ifdef FEATURE_WLAN_TDLS |
| 12506 | mutex_unlock(&pHddCtx->tdls_lock); |
| 12507 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 12508 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 12509 | (pConfig->apRandomBssidEnabled)) |
| 12510 | { |
| 12511 | /* To meet Android requirements create a randomized |
| 12512 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 12513 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 12514 | ndev->dev_addr[0] = 0x02; |
| 12515 | ndev->dev_addr[1] = 0x1A; |
| 12516 | ndev->dev_addr[2] = 0x11; |
| 12517 | ndev->dev_addr[3] |= 0xF0; |
| 12518 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 12519 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12520 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 12521 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 12522 | } |
| 12523 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12524 | hdd_set_ap_ops( pAdapter->dev ); |
| 12525 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 12526 | /* This is for only SAP mode where users can |
| 12527 | * control country through ini. |
| 12528 | * P2P GO follows station country code |
| 12529 | * acquired during the STA scanning. */ |
| 12530 | if((NL80211_IFTYPE_AP == type) && |
| 12531 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 12532 | { |
| 12533 | int status = 0; |
| 12534 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 12535 | "%s: setting country code from INI ", __func__); |
| 12536 | init_completion(&pAdapter->change_country_code); |
| 12537 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 12538 | (void *)(tSmeChangeCountryCallback) |
| 12539 | wlan_hdd_change_country_code_cb, |
| 12540 | pConfig->apCntryCode, pAdapter, |
| 12541 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 12542 | eSIR_FALSE, |
| 12543 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 12544 | if (eHAL_STATUS_SUCCESS == status) |
| 12545 | { |
| 12546 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12547 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 12548 | &pAdapter->change_country_code, |
| 12549 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12550 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 12551 | { |
| 12552 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12553 | FL("SME Timed out while setting country code %ld"), |
| 12554 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 12555 | |
| 12556 | if (pHddCtx->isLogpInProgress) |
| 12557 | { |
| 12558 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12559 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 12560 | return -EAGAIN; |
| 12561 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 12562 | } |
| 12563 | } |
| 12564 | else |
| 12565 | { |
| 12566 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12567 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 12568 | return -EINVAL; |
| 12569 | } |
| 12570 | } |
Hanumanth Reddy Pothula | 15bc0fa | 2017-02-03 17:24:17 +0530 | [diff] [blame] | 12571 | status = hdd_init_ap_mode(pAdapter, false); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12572 | if(status != VOS_STATUS_SUCCESS) |
| 12573 | { |
| 12574 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 12575 | "%s: Error initializing the ap mode", __func__); |
| 12576 | return -EINVAL; |
| 12577 | } |
| 12578 | hdd_set_conparam(1); |
| 12579 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 12580 | status = hdd_sta_id_hash_attach(pAdapter); |
| 12581 | if (VOS_STATUS_SUCCESS != status) |
| 12582 | { |
| 12583 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12584 | FL("Failed to initialize hash for AP")); |
| 12585 | return -EINVAL; |
| 12586 | } |
| 12587 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12588 | /*interface type changed update in wiphy structure*/ |
| 12589 | if(wdev) |
| 12590 | { |
| 12591 | wdev->iftype = type; |
| 12592 | pHddCtx->change_iface = type; |
| 12593 | } |
| 12594 | else |
| 12595 | { |
| 12596 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12597 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 12598 | return -EINVAL; |
| 12599 | } |
| 12600 | goto done; |
| 12601 | } |
| 12602 | |
| 12603 | default: |
| 12604 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 12605 | __func__); |
| 12606 | return -EOPNOTSUPP; |
| 12607 | } |
| 12608 | } |
| 12609 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12610 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12611 | ) |
| 12612 | { |
| 12613 | switch(type) |
| 12614 | { |
| 12615 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12616 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12617 | case NL80211_IFTYPE_ADHOC: |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 12618 | |
| 12619 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 12620 | #ifdef FEATURE_WLAN_TDLS |
| 12621 | |
| 12622 | /* A Mutex Lock is introduced while changing the mode to |
| 12623 | * protect the concurrent access for the Adapters by TDLS |
| 12624 | * module. |
| 12625 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 12626 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 12627 | #endif |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 12628 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12629 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 12630 | //Check for sub-string p2p to confirm its a p2p interface |
| 12631 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 12632 | { |
| 12633 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 12634 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 12635 | } |
| 12636 | else |
| 12637 | { |
| 12638 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12639 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 12640 | } |
Agrawal Ashish | cfe8328 | 2016-09-29 13:03:45 +0530 | [diff] [blame] | 12641 | |
| 12642 | /* set con_mode to STA only when no SAP concurrency mode */ |
| 12643 | if (!(hdd_get_concurrency_mode() & (VOS_SAP | VOS_P2P_GO))) |
| 12644 | hdd_set_conparam(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12645 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12646 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 12647 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 12648 | #ifdef FEATURE_WLAN_TDLS |
| 12649 | mutex_unlock(&pHddCtx->tdls_lock); |
| 12650 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 12651 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12652 | if( VOS_STATUS_SUCCESS != status ) |
| 12653 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12654 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 12655 | * This is the right place to enable back bmps_imps() |
| 12656 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 12657 | if (pHddCtx->hdd_wlan_suspended) |
| 12658 | { |
| 12659 | hdd_set_pwrparams(pHddCtx); |
| 12660 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12661 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12662 | goto done; |
| 12663 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12664 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12665 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12666 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 12667 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12668 | goto done; |
| 12669 | default: |
| 12670 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 12671 | __func__); |
| 12672 | return -EOPNOTSUPP; |
| 12673 | |
| 12674 | } |
| 12675 | |
| 12676 | } |
| 12677 | else |
| 12678 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12679 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 12680 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12681 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12682 | return -EOPNOTSUPP; |
| 12683 | } |
| 12684 | |
| 12685 | |
| 12686 | if(pRoamProfile) |
| 12687 | { |
| 12688 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 12689 | { |
| 12690 | /*interface type changed update in wiphy structure*/ |
| 12691 | wdev->iftype = type; |
| 12692 | |
| 12693 | /*the BSS mode changed, We need to issue disconnect |
| 12694 | if connected or in IBSS disconnect state*/ |
| 12695 | if ( hdd_connGetConnectedBssType( |
| 12696 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 12697 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 12698 | { |
| 12699 | /*need to issue a disconnect to CSR.*/ |
| 12700 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 12701 | if( eHAL_STATUS_SUCCESS == |
| 12702 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 12703 | pAdapter->sessionId, |
| 12704 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 12705 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12706 | ret = wait_for_completion_interruptible_timeout( |
| 12707 | &pAdapter->disconnect_comp_var, |
| 12708 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 12709 | if (ret <= 0) |
| 12710 | { |
| 12711 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12712 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 12713 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12714 | } |
| 12715 | } |
| 12716 | } |
| 12717 | } |
| 12718 | |
| 12719 | done: |
| 12720 | /*set bitmask based on updated value*/ |
| 12721 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 12722 | |
| 12723 | /* Only STA mode support TM now |
| 12724 | * all other mode, TM feature should be disabled */ |
| 12725 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 12726 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 12727 | { |
| 12728 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 12729 | } |
| 12730 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12731 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12732 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 12733 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12734 | { |
| 12735 | //we are ok to do AMP |
| 12736 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 12737 | } |
| 12738 | #endif //WLAN_BTAMP_FEATURE |
| 12739 | EXIT(); |
| 12740 | return 0; |
| 12741 | } |
| 12742 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 12743 | /* |
| 12744 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 12745 | * wrapper function to protect the actual implementation from SSR. |
| 12746 | */ |
| 12747 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 12748 | struct net_device *ndev, |
| 12749 | enum nl80211_iftype type, |
| 12750 | u32 *flags, |
| 12751 | struct vif_params *params |
| 12752 | ) |
| 12753 | { |
| 12754 | int ret; |
| 12755 | |
| 12756 | vos_ssr_protect(__func__); |
| 12757 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 12758 | vos_ssr_unprotect(__func__); |
| 12759 | |
| 12760 | return ret; |
| 12761 | } |
| 12762 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12763 | #ifdef FEATURE_WLAN_TDLS |
| 12764 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 12765 | struct net_device *dev, |
| 12766 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 12767 | const u8 *mac, |
| 12768 | #else |
| 12769 | u8 *mac, |
| 12770 | #endif |
| 12771 | bool update, tCsrStaParams *StaParams) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12772 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12773 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 12774 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12775 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 12776 | tANI_U16 numCurrTdlsPeers; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12777 | hdd_adapter_t *pAdapter; |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 12778 | VOS_STATUS status; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12779 | |
| 12780 | ENTER(); |
| 12781 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12782 | if (!dev) { |
| 12783 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 12784 | return -EINVAL; |
| 12785 | } |
| 12786 | |
| 12787 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 12788 | if (!pAdapter) { |
| 12789 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 12790 | return -EINVAL; |
| 12791 | } |
| 12792 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 12793 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12794 | { |
| 12795 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12796 | "Invalid arguments"); |
| 12797 | return -EINVAL; |
| 12798 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 12799 | |
| 12800 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 12801 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 12802 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12803 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 12804 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 12805 | MAC_ADDRESS_STR " Request declined.", |
| 12806 | __func__, MAC_ADDR_ARRAY(mac)); |
| 12807 | return -ENOTSUPP; |
| 12808 | } |
| 12809 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12810 | if (pHddCtx->isLogpInProgress) |
| 12811 | { |
| 12812 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12813 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 12814 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 12815 | mac, |
| 12816 | eTDLS_LINK_IDLE, |
| 12817 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12818 | return -EBUSY; |
| 12819 | } |
| 12820 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 12821 | mutex_lock(&pHddCtx->tdls_lock); |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 12822 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 12823 | |
| 12824 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12825 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 12826 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 12827 | __func__, MAC_ADDR_ARRAY(mac), update); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 12828 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 12829 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 12830 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 12831 | |
| 12832 | /* in add station, we accept existing valid staId if there is */ |
| 12833 | if ((0 == update) && |
| 12834 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 12835 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 12836 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12837 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 12838 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 12839 | " link_status %d. staId %d. add station ignored.", |
| 12840 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 12841 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 12842 | return 0; |
| 12843 | } |
| 12844 | /* in change station, we accept only when staId is valid */ |
| 12845 | if ((1 == update) && |
| 12846 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 12847 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 12848 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 12849 | tANI_U16 staId = pTdlsPeer->staId; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12850 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 12851 | "%s: " MAC_ADDRESS_STR |
| 12852 | " link status %d. staId %d. change station %s.", |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 12853 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, staId, |
| 12854 | (TDLS_STA_INDEX_VALID(staId)) ? "ignored" : "declined"); |
| 12855 | mutex_unlock(&pHddCtx->tdls_lock); |
| 12856 | return (TDLS_STA_INDEX_VALID(staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 12857 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 12858 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 12859 | |
| 12860 | /* 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] | 12861 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12862 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12863 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12864 | "%s: " MAC_ADDRESS_STR |
| 12865 | " TDLS setup is ongoing. Request declined.", |
| 12866 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 12867 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12868 | } |
| 12869 | |
| 12870 | /* first to check if we reached to maximum supported TDLS peer. |
| 12871 | TODO: for now, return -EPERM looks working fine, |
| 12872 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 12873 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 12874 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12875 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12876 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12877 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 12878 | " TDLS Max peer already connected. Request declined." |
| 12879 | " Num of peers (%d), Max allowed (%d).", |
| 12880 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 12881 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 12882 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12883 | } |
| 12884 | else |
| 12885 | { |
| 12886 | hddTdlsPeer_t *pTdlsPeer; |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 12887 | mutex_lock(&pHddCtx->tdls_lock); |
| 12888 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 12889 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12890 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 12891 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 12892 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12893 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 12894 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12895 | return -EPERM; |
| 12896 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 12897 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12898 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 12899 | if (0 == update) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 12900 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 12901 | mac, |
| 12902 | eTDLS_LINK_CONNECTING, |
| 12903 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12904 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 12905 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 12906 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 12907 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12908 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 12909 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 12910 | if(StaParams->htcap_present) |
| 12911 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12912 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 12913 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12914 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 12915 | "ht_capa->extended_capabilities: %0x", |
| 12916 | StaParams->HTCap.extendedHtCapInfo); |
| 12917 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12918 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 12919 | "params->capability: %0x",StaParams->capability); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12920 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 12921 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 12922 | if(StaParams->vhtcap_present) |
| 12923 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12924 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 12925 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 12926 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 12927 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 12928 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 12929 | { |
| 12930 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 12931 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 12932 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 12933 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 12934 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 12935 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 12936 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 12937 | else if ((1 == update) && (NULL == StaParams)) |
| 12938 | { |
| 12939 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12940 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 12941 | return -EPERM; |
| 12942 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12943 | |
| 12944 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 12945 | |
| 12946 | if (!update) |
| 12947 | { |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 12948 | /*Before adding sta make sure that device exited from BMPS*/ |
| 12949 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 12950 | { |
| 12951 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12952 | "%s: Adding tdls peer sta. Disable BMPS", __func__); |
| 12953 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 12954 | if (status != VOS_STATUS_SUCCESS) { |
| 12955 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
| 12956 | } |
| 12957 | } |
| 12958 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 12959 | ret = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12960 | pAdapter->sessionId, mac); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 12961 | if (ret != eHAL_STATUS_SUCCESS) { |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 12962 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12963 | FL("Failed to add TDLS peer STA. Enable Bmps")); |
| 12964 | wlan_hdd_tdls_check_bmps(pAdapter); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 12965 | return -EPERM; |
| 12966 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12967 | } |
| 12968 | else |
| 12969 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 12970 | ret = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12971 | pAdapter->sessionId, mac, StaParams); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 12972 | if (ret != eHAL_STATUS_SUCCESS) { |
| 12973 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to change TDLS peer STA params")); |
| 12974 | return -EPERM; |
| 12975 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12976 | } |
| 12977 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12978 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12979 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 12980 | |
Masti, Narayanraddi | 255d8c5 | 2016-01-07 16:26:06 +0530 | [diff] [blame] | 12981 | mutex_lock(&pHddCtx->tdls_lock); |
| 12982 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE); |
| 12983 | |
Masti, Narayanraddi | 0726246 | 2016-01-19 12:40:06 +0530 | [diff] [blame] | 12984 | if ((pTdlsPeer != NULL) && |
| 12985 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12986 | { |
Masti, Narayanraddi | 0726246 | 2016-01-19 12:40:06 +0530 | [diff] [blame] | 12987 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12988 | FL("peer link status %u"), pTdlsPeer->link_status); |
| 12989 | mutex_unlock(&pHddCtx->tdls_lock); |
| 12990 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12991 | } |
Masti, Narayanraddi | 255d8c5 | 2016-01-07 16:26:06 +0530 | [diff] [blame] | 12992 | mutex_unlock(&pHddCtx->tdls_lock); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12993 | |
Masti, Narayanraddi | 0726246 | 2016-01-19 12:40:06 +0530 | [diff] [blame] | 12994 | if (ret <= 0) |
| 12995 | { |
| 12996 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12997 | "%s: timeout waiting for tdls add station indication %ld", |
| 12998 | __func__, ret); |
| 12999 | goto error; |
| 13000 | } |
| 13001 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13002 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 13003 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 13004 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13005 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 13006 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13007 | } |
| 13008 | |
| 13009 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 13010 | |
| 13011 | error: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 13012 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 13013 | mac, |
| 13014 | eTDLS_LINK_IDLE, |
| 13015 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 13016 | return -EPERM; |
| 13017 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13018 | } |
| 13019 | #endif |
| 13020 | |
Hanumanth Reddy Pothula | 852449b | 2018-03-08 13:21:10 +0530 | [diff] [blame] | 13021 | VOS_STATUS wlan_hdd_send_sta_authorized_event( |
| 13022 | hdd_adapter_t *adapter, |
| 13023 | hdd_context_t *hdd_ctx, |
| 13024 | const v_MACADDR_t *mac_addr) |
| 13025 | { |
| 13026 | struct sk_buff *vendor_event; |
| 13027 | uint32_t sta_flags = 0; |
| 13028 | VOS_STATUS status; |
| 13029 | |
| 13030 | ENTER(); |
| 13031 | |
| 13032 | if (!hdd_ctx) { |
| 13033 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is null")); |
| 13034 | return -EINVAL; |
| 13035 | } |
| 13036 | |
| 13037 | vendor_event = |
| 13038 | cfg80211_vendor_event_alloc( |
Ashish Kumar Dhanotiya | c99fbef | 2018-04-11 12:23:32 +0530 | [diff] [blame] | 13039 | hdd_ctx->wiphy, |
| 13040 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 13041 | &adapter->wdev, |
| 13042 | #endif |
| 13043 | sizeof(sta_flags) + |
Hanumanth Reddy Pothula | 852449b | 2018-03-08 13:21:10 +0530 | [diff] [blame] | 13044 | VOS_MAC_ADDR_SIZE + NLMSG_HDRLEN, |
| 13045 | QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES_INDEX, |
| 13046 | GFP_KERNEL); |
| 13047 | if (!vendor_event) { |
| 13048 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13049 | FL("cfg80211_vendor_event_alloc failed")); |
| 13050 | return -EINVAL; |
| 13051 | } |
| 13052 | |
| 13053 | sta_flags |= BIT(NL80211_STA_FLAG_AUTHORIZED); |
| 13054 | |
| 13055 | status = nla_put_u32(vendor_event, |
| 13056 | QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_STA_FLAGS, |
| 13057 | sta_flags); |
| 13058 | if (status) { |
| 13059 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("STA flag put fails")); |
| 13060 | kfree_skb(vendor_event); |
| 13061 | return VOS_STATUS_E_FAILURE; |
| 13062 | } |
| 13063 | status = nla_put(vendor_event, |
| 13064 | QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_STA_MAC, |
| 13065 | VOS_MAC_ADDR_SIZE, mac_addr->bytes); |
| 13066 | if (status) { |
| 13067 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("STA MAC put fails")); |
| 13068 | kfree_skb(vendor_event); |
| 13069 | return VOS_STATUS_E_FAILURE; |
| 13070 | } |
| 13071 | |
| 13072 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 13073 | |
| 13074 | EXIT(); |
| 13075 | return 0; |
| 13076 | } |
| 13077 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13078 | static int __wlan_hdd_change_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13079 | struct net_device *dev, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 13080 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 13081 | const u8 *mac, |
| 13082 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13083 | u8 *mac, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 13084 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13085 | struct station_parameters *params) |
| 13086 | { |
| 13087 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13088 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13089 | hdd_context_t *pHddCtx; |
| 13090 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13091 | v_MACADDR_t STAMacAddress; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 13092 | int ret = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 13093 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13094 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13095 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 13096 | tANI_U8 isOffChannelSupported = 0; |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 13097 | tANI_U8 isQosWmmSta = FALSE; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 13098 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13099 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13100 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13101 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 13102 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13103 | if ((NULL == pAdapter)) |
| 13104 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13105 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13106 | "invalid adapter "); |
| 13107 | return -EINVAL; |
| 13108 | } |
| 13109 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13110 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13111 | TRACE_CODE_HDD_CHANGE_STATION, |
| 13112 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13113 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13114 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 13115 | ret = wlan_hdd_validate_context(pHddCtx); |
| 13116 | if (0 != ret) |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13117 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 13118 | return ret; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13119 | } |
| 13120 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 13121 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13122 | |
| 13123 | if (NULL == pHddStaCtx) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13124 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 13125 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 13126 | "invalid HDD station context"); |
| 13127 | return -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13128 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13129 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 13130 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13131 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 13132 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13133 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13134 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13135 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13136 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13137 | WLANTL_STA_AUTHENTICATED); |
| 13138 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13139 | if (status != VOS_STATUS_SUCCESS) |
| 13140 | { |
| 13141 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13142 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 13143 | return -EINVAL; |
| 13144 | } |
Hanumanth Reddy Pothula | 852449b | 2018-03-08 13:21:10 +0530 | [diff] [blame] | 13145 | status = wlan_hdd_send_sta_authorized_event(pAdapter, pHddCtx, |
| 13146 | &STAMacAddress); |
| 13147 | if (status != VOS_STATUS_SUCCESS) |
| 13148 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13149 | } |
| 13150 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 13151 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 13152 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13153 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13154 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 13155 | StaParams.capability = params->capability; |
| 13156 | StaParams.uapsd_queues = params->uapsd_queues; |
| 13157 | StaParams.max_sp = params->max_sp; |
| 13158 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 13159 | /* Convert (first channel , number of channels) tuple to |
| 13160 | * the total list of channels. This goes with the assumption |
| 13161 | * that if the first channel is < 14, then the next channels |
| 13162 | * are an incremental of 1 else an incremental of 4 till the number |
| 13163 | * of channels. |
| 13164 | */ |
| 13165 | if (0 != params->supported_channels_len) { |
| 13166 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
Ashish Kumar Dhanotiya | f01ec75 | 2018-04-25 15:50:15 +0530 | [diff] [blame] | 13167 | for ( i = 0 ; i < params->supported_channels_len |
| 13168 | && j < SIR_MAC_MAX_SUPP_CHANNELS; i+=2) |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 13169 | { |
| 13170 | int wifi_chan_index; |
| 13171 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 13172 | wifi_chan_index = |
| 13173 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 13174 | no_of_channels = params->supported_channels[i+1]; |
Ashish Kumar Dhanotiya | f01ec75 | 2018-04-25 15:50:15 +0530 | [diff] [blame] | 13175 | for(k=1; k <= no_of_channels |
| 13176 | && j < SIR_MAC_MAX_SUPP_CHANNELS - 1; k++) |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 13177 | { |
| 13178 | StaParams.supported_channels[j+1] = |
| 13179 | StaParams.supported_channels[j] + wifi_chan_index; |
| 13180 | j+=1; |
| 13181 | } |
| 13182 | } |
| 13183 | StaParams.supported_channels_len = j; |
| 13184 | } |
SaidiReddy Yenuga | 0f1a159 | 2017-04-05 13:18:26 +0530 | [diff] [blame] | 13185 | if (params->supported_oper_classes_len > |
| 13186 | SIR_MAC_MAX_SUPP_OPER_CLASSES) { |
| 13187 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13188 | "received oper classes:%d, resetting it to max supported %d", |
| 13189 | params->supported_oper_classes_len, |
| 13190 | SIR_MAC_MAX_SUPP_OPER_CLASSES); |
| 13191 | params->supported_oper_classes_len = |
| 13192 | SIR_MAC_MAX_SUPP_OPER_CLASSES; |
| 13193 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 13194 | vos_mem_copy(StaParams.supported_oper_classes, |
| 13195 | params->supported_oper_classes, |
| 13196 | params->supported_oper_classes_len); |
| 13197 | StaParams.supported_oper_classes_len = |
| 13198 | params->supported_oper_classes_len; |
| 13199 | |
SaidiReddy Yenuga | 96d8ca5 | 2017-06-06 13:01:29 +0530 | [diff] [blame] | 13200 | if (params->ext_capab_len > sizeof(StaParams.extn_capability)) { |
| 13201 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13202 | "received extn capabilities:%d, resetting it to max supported", |
| 13203 | params->ext_capab_len); |
| 13204 | params->ext_capab_len = sizeof(StaParams.extn_capability); |
| 13205 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13206 | if (0 != params->ext_capab_len) |
| 13207 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
SaidiReddy Yenuga | 96d8ca5 | 2017-06-06 13:01:29 +0530 | [diff] [blame] | 13208 | params->ext_capab_len); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13209 | |
| 13210 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 13211 | { |
| 13212 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13213 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 13214 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13215 | |
| 13216 | StaParams.supported_rates_len = params->supported_rates_len; |
| 13217 | |
| 13218 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 13219 | * The supported_rates array , for all the structures propogating till Add Sta |
| 13220 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 13221 | * modified to send more rates. |
| 13222 | */ |
| 13223 | |
| 13224 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 13225 | */ |
| 13226 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 13227 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 13228 | |
| 13229 | if (0 != StaParams.supported_rates_len) { |
| 13230 | int i = 0; |
| 13231 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 13232 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13233 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13234 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 13235 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 13236 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13237 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 13238 | } |
| 13239 | |
| 13240 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 13241 | { |
| 13242 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13243 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 13244 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 13245 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13246 | if (0 != params->ext_capab_len ) { |
| 13247 | /*Define A Macro : TODO Sunil*/ |
| 13248 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 13249 | isBufSta = 1; |
| 13250 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 13251 | /* TDLS Channel Switching Support */ |
| 13252 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 13253 | isOffChannelSupported = 1; |
| 13254 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13255 | } |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 13256 | |
| 13257 | if (pHddCtx->cfg_ini->fEnableTDLSWmmMode && |
Nitesh Shah | 48df4c0 | 2016-08-12 16:27:33 +0530 | [diff] [blame] | 13258 | (params->ht_capa || params->vht_capa || |
| 13259 | (params->sta_flags_set & BIT(NL80211_STA_FLAG_WME)))) |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 13260 | /* TDLS Peer is WME/QoS capable */ |
| 13261 | isQosWmmSta = TRUE; |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 13262 | |
| 13263 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13264 | "%s: TDLS Peer is QOS capable isQosWmmSta= %d HTcapPresent= %d", |
| 13265 | __func__, isQosWmmSta, StaParams.htcap_present); |
| 13266 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 13267 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 13268 | &StaParams, isBufSta, |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 13269 | isOffChannelSupported, |
| 13270 | isQosWmmSta); |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 13271 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 13272 | if (VOS_STATUS_SUCCESS != status) { |
| 13273 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13274 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 13275 | return -EINVAL; |
| 13276 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13277 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 13278 | |
| 13279 | if (VOS_STATUS_SUCCESS != status) { |
| 13280 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13281 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 13282 | return -EINVAL; |
| 13283 | } |
| 13284 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 13285 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 13286 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13287 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13288 | return status; |
| 13289 | } |
| 13290 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 13291 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 13292 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 13293 | struct net_device *dev, |
| 13294 | const u8 *mac, |
| 13295 | struct station_parameters *params) |
| 13296 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13297 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 13298 | struct net_device *dev, |
| 13299 | u8 *mac, |
| 13300 | struct station_parameters *params) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 13301 | #endif |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13302 | { |
| 13303 | int ret; |
| 13304 | |
| 13305 | vos_ssr_protect(__func__); |
| 13306 | ret = __wlan_hdd_change_station(wiphy, dev, mac, params); |
| 13307 | vos_ssr_unprotect(__func__); |
| 13308 | |
| 13309 | return ret; |
| 13310 | } |
| 13311 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13312 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 13313 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13314 | * This function is used to initialize the key information |
| 13315 | */ |
| 13316 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 13317 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13318 | struct net_device *ndev, |
| 13319 | u8 key_index, bool pairwise, |
| 13320 | const u8 *mac_addr, |
| 13321 | struct key_params *params |
| 13322 | ) |
| 13323 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 13324 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13325 | struct net_device *ndev, |
| 13326 | u8 key_index, const u8 *mac_addr, |
| 13327 | struct key_params *params |
| 13328 | ) |
| 13329 | #endif |
| 13330 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13331 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13332 | tCsrRoamSetKey setKey; |
| 13333 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13334 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13335 | v_U32_t roamId= 0xFF; |
| 13336 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13337 | hdd_hostapd_state_t *pHostapdState; |
| 13338 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13339 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13340 | hdd_context_t *pHddCtx; |
Sravan Kumar Kairam | 9397a40 | 2017-11-10 16:23:10 +0530 | [diff] [blame] | 13341 | uint8_t i; |
Sravan Kumar Kairam | 8bb90ca | 2017-11-01 19:00:23 +0530 | [diff] [blame] | 13342 | v_MACADDR_t *peerMacAddr; |
| 13343 | u64 rsc_counter = 0; |
Sravan Kumar Kairam | 9397a40 | 2017-11-10 16:23:10 +0530 | [diff] [blame] | 13344 | uint8_t staid = HDD_MAX_STA_COUNT; |
| 13345 | bool pairwise_set_key = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13346 | |
| 13347 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13348 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 13349 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13350 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 13351 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13352 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13353 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13354 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13355 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 13356 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13357 | } |
| 13358 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 13359 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 13360 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 13361 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13362 | |
| 13363 | if (CSR_MAX_NUM_KEY <= key_index) |
| 13364 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13365 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13366 | key_index); |
| 13367 | |
| 13368 | return -EINVAL; |
| 13369 | } |
| 13370 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13371 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 13372 | { |
| 13373 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 13374 | params->key_len); |
| 13375 | |
| 13376 | return -EINVAL; |
| 13377 | } |
| 13378 | |
Jingxiang Ge | c438aea | 2017-10-26 16:44:00 +0800 | [diff] [blame] | 13379 | if (CSR_MAX_RSC_LEN < params->seq_len) |
| 13380 | { |
| 13381 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Invalid seq length %d", __func__, |
| 13382 | params->seq_len); |
Ashish Kumar Dhanotiya | 9783b18 | 2017-12-08 14:50:46 +0530 | [diff] [blame] | 13383 | |
| 13384 | return -EINVAL; |
Jingxiang Ge | c438aea | 2017-10-26 16:44:00 +0800 | [diff] [blame] | 13385 | } |
| 13386 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13387 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jingxiang Ge | c438aea | 2017-10-26 16:44:00 +0800 | [diff] [blame] | 13388 | "%s: called with key index = %d & key length %d & seq length %d", |
| 13389 | __func__, key_index, params->key_len, params->seq_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13390 | |
Sravan Kumar Kairam | 8bb90ca | 2017-11-01 19:00:23 +0530 | [diff] [blame] | 13391 | peerMacAddr = (v_MACADDR_t *)mac_addr; |
| 13392 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13393 | /*extract key idx, key len and key*/ |
| 13394 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 13395 | setKey.keyId = key_index; |
| 13396 | setKey.keyLength = params->key_len; |
| 13397 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
Jingxiang Ge | c438aea | 2017-10-26 16:44:00 +0800 | [diff] [blame] | 13398 | vos_mem_copy(&setKey.keyRsc[0], params->seq, params->seq_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13399 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13400 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13401 | { |
| 13402 | case WLAN_CIPHER_SUITE_WEP40: |
| 13403 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 13404 | break; |
| 13405 | |
| 13406 | case WLAN_CIPHER_SUITE_WEP104: |
| 13407 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 13408 | break; |
| 13409 | |
| 13410 | case WLAN_CIPHER_SUITE_TKIP: |
| 13411 | { |
| 13412 | u8 *pKey = &setKey.Key[0]; |
| 13413 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 13414 | |
| 13415 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 13416 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13417 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13418 | |
| 13419 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13420 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13421 | |--------------|----------|----------| |
| 13422 | <---16bytes---><--8bytes--><--8bytes--> |
| 13423 | |
| 13424 | */ |
| 13425 | /*Sme expects the 32 bytes key to be in the below order |
| 13426 | |
| 13427 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13428 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13429 | |--------------|----------|----------| |
| 13430 | <---16bytes---><--8bytes--><--8bytes--> |
| 13431 | */ |
| 13432 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13433 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13434 | |
| 13435 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13436 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13437 | |
| 13438 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13439 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13440 | |
| 13441 | |
| 13442 | break; |
| 13443 | } |
| 13444 | |
| 13445 | case WLAN_CIPHER_SUITE_CCMP: |
| 13446 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 13447 | break; |
| 13448 | |
| 13449 | #ifdef FEATURE_WLAN_WAPI |
| 13450 | case WLAN_CIPHER_SUITE_SMS4: |
| 13451 | { |
| 13452 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 13453 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 13454 | params->key, params->key_len); |
| 13455 | return 0; |
| 13456 | } |
| 13457 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 13458 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13459 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13460 | case WLAN_CIPHER_SUITE_KRK: |
| 13461 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 13462 | break; |
| 13463 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 13464 | |
| 13465 | #ifdef WLAN_FEATURE_11W |
| 13466 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 13467 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 13468 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 13469 | #endif |
| 13470 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13471 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 13472 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13473 | __func__, params->cipher); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 13474 | status = -EOPNOTSUPP; |
| 13475 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13476 | } |
| 13477 | |
| 13478 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 13479 | __func__, setKey.encType); |
| 13480 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 13481 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13482 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13483 | (!pairwise) |
| 13484 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13485 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13486 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 13487 | ) |
| 13488 | { |
| 13489 | /* set group key*/ |
| 13490 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13491 | "%s- %d: setting Broadcast key", |
| 13492 | __func__, __LINE__); |
| 13493 | setKey.keyDirection = eSIR_RX_ONLY; |
| 13494 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 13495 | } |
| 13496 | else |
| 13497 | { |
| 13498 | /* set pairwise key*/ |
| 13499 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13500 | "%s- %d: setting pairwise key", |
| 13501 | __func__, __LINE__); |
| 13502 | setKey.keyDirection = eSIR_TX_RX; |
| 13503 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
Sravan Kumar Kairam | 9397a40 | 2017-11-10 16:23:10 +0530 | [diff] [blame] | 13504 | pairwise_set_key = true; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 13505 | } |
| 13506 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 13507 | { |
| 13508 | setKey.keyDirection = eSIR_TX_RX; |
| 13509 | /*Set the group key*/ |
| 13510 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 13511 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13512 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 13513 | if ( 0 != status ) |
| 13514 | { |
| 13515 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13516 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 13517 | status = -EINVAL; |
| 13518 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 13519 | } |
| 13520 | /*Save the keys here and call sme_RoamSetKey for setting |
| 13521 | the PTK after peer joins the IBSS network*/ |
| 13522 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 13523 | &setKey, sizeof(tCsrRoamSetKey)); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 13524 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 13525 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13526 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 13527 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 13528 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13529 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13530 | if( pHostapdState->bssState == BSS_START ) |
| 13531 | { |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 13532 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13533 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 13534 | |
Sravan Kumar Kairam | 9397a40 | 2017-11-10 16:23:10 +0530 | [diff] [blame] | 13535 | if (peerMacAddr && (pairwise_set_key == true)) |
| 13536 | staid = hdd_sta_id_find_from_mac_addr(pAdapter, peerMacAddr); |
Sravan Kumar Kairam | 8bb90ca | 2017-11-01 19:00:23 +0530 | [diff] [blame] | 13537 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 13538 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 13539 | { |
| 13540 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13541 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 13542 | __LINE__, vos_status ); |
| 13543 | |
| 13544 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 13545 | |
| 13546 | status = -EINVAL; |
| 13547 | goto end; |
| 13548 | } |
| 13549 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13550 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 13551 | |
| 13552 | if ( status != eHAL_STATUS_SUCCESS ) |
| 13553 | { |
| 13554 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13555 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 13556 | __LINE__, status ); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 13557 | status = -EINVAL; |
| 13558 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13559 | } |
| 13560 | } |
| 13561 | |
| 13562 | /* Saving WEP keys */ |
| 13563 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 13564 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 13565 | { |
| 13566 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 13567 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 13568 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 13569 | } |
| 13570 | else |
| 13571 | { |
| 13572 | //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] | 13573 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13574 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 13575 | } |
| 13576 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13577 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 13578 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13579 | { |
| 13580 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 13581 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13582 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 13583 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13584 | if (!pairwise) |
| 13585 | #else |
| 13586 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 13587 | #endif |
| 13588 | { |
| 13589 | /* set group key*/ |
| 13590 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 13591 | { |
| 13592 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13593 | "%s- %d: Perform Set key Complete", |
| 13594 | __func__, __LINE__); |
| 13595 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 13596 | } |
| 13597 | } |
| 13598 | |
Sravan Kumar Kairam | 9397a40 | 2017-11-10 16:23:10 +0530 | [diff] [blame] | 13599 | if (pairwise_set_key == true) |
| 13600 | staid = pHddStaCtx->conn_info.staId[0]; |
Sravan Kumar Kairam | 8bb90ca | 2017-11-01 19:00:23 +0530 | [diff] [blame] | 13601 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13602 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 13603 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 13604 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 13605 | |
| 13606 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 13607 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13608 | params->key, params->key_len); |
| 13609 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 13610 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13611 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 13612 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13613 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13614 | "%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] | 13615 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 13616 | setKey.peerMac[2], setKey.peerMac[3], |
| 13617 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13618 | setKey.keyDirection); |
| 13619 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 13620 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 13621 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 13622 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 13623 | { |
| 13624 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13625 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 13626 | __LINE__, vos_status ); |
| 13627 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 13628 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13629 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 13630 | status = -EINVAL; |
| 13631 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13632 | |
| 13633 | } |
| 13634 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13635 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 13636 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 13637 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 13638 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13639 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 13640 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13641 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 13642 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 13643 | "%s: Update PreAuth Key success", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 13644 | status = 0; |
| 13645 | goto end; |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 13646 | } |
| 13647 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 13648 | { |
| 13649 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13650 | "%s: Update PreAuth Key failed", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 13651 | status = -EINVAL; |
| 13652 | goto end; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13653 | } |
| 13654 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13655 | |
| 13656 | /* issue set key request to SME*/ |
| 13657 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 13658 | pAdapter->sessionId, &setKey, &roamId ); |
| 13659 | |
| 13660 | if ( 0 != status ) |
| 13661 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13662 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13663 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 13664 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 13665 | status = -EINVAL; |
| 13666 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13667 | } |
| 13668 | |
| 13669 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13670 | /* in case of IBSS as there was no information available about WEP keys during |
| 13671 | * 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] | 13672 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13673 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 13674 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 13675 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13676 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 13677 | ) |
| 13678 | && |
| 13679 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 13680 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 13681 | ) |
| 13682 | ) |
| 13683 | { |
| 13684 | setKey.keyDirection = eSIR_RX_ONLY; |
| 13685 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 13686 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13687 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13688 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13689 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 13690 | setKey.peerMac[2], setKey.peerMac[3], |
| 13691 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13692 | setKey.keyDirection); |
| 13693 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13694 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13695 | pAdapter->sessionId, &setKey, &roamId ); |
| 13696 | |
| 13697 | if ( 0 != status ) |
| 13698 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13699 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13700 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13701 | __func__, status); |
| 13702 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 13703 | status = -EINVAL; |
| 13704 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13705 | } |
| 13706 | } |
| 13707 | } |
| 13708 | |
Sravan Kumar Kairam | 9397a40 | 2017-11-10 16:23:10 +0530 | [diff] [blame] | 13709 | if (pairwise_set_key == true) { |
Sravan Kumar Kairam | 8bb90ca | 2017-11-01 19:00:23 +0530 | [diff] [blame] | 13710 | for (i = 0; i < params->seq_len; i++) { |
| 13711 | rsc_counter |= (params->seq[i] << i*8); |
| 13712 | } |
Sravan Kumar Kairam | 8bb90ca | 2017-11-01 19:00:23 +0530 | [diff] [blame] | 13713 | WLANTL_SetKeySeqCounter(pVosContext, rsc_counter, staid); |
| 13714 | } |
| 13715 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 13716 | end: |
| 13717 | /* Need to clear any trace of key value in the memory. |
| 13718 | * Thus zero out the memory even though it is local |
| 13719 | * variable. |
| 13720 | */ |
| 13721 | vos_mem_zero(&setKey, sizeof(setKey)); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13722 | EXIT(); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 13723 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13724 | } |
| 13725 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 13726 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13727 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 13728 | struct net_device *ndev, |
| 13729 | u8 key_index, bool pairwise, |
| 13730 | const u8 *mac_addr, |
| 13731 | struct key_params *params |
| 13732 | ) |
| 13733 | #else |
| 13734 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 13735 | struct net_device *ndev, |
| 13736 | u8 key_index, const u8 *mac_addr, |
| 13737 | struct key_params *params |
| 13738 | ) |
| 13739 | #endif |
| 13740 | { |
| 13741 | int ret; |
| 13742 | vos_ssr_protect(__func__); |
| 13743 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13744 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 13745 | mac_addr, params); |
| 13746 | #else |
| 13747 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 13748 | params); |
| 13749 | #endif |
| 13750 | vos_ssr_unprotect(__func__); |
| 13751 | |
| 13752 | return ret; |
| 13753 | } |
| 13754 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13755 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 13756 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13757 | * This function is used to get the key information |
| 13758 | */ |
| 13759 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 13760 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13761 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13762 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13763 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13764 | const u8 *mac_addr, void *cookie, |
| 13765 | void (*callback)(void *cookie, struct key_params*) |
| 13766 | ) |
| 13767 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 13768 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13769 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13770 | struct net_device *ndev, |
| 13771 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 13772 | void (*callback)(void *cookie, struct key_params*) |
| 13773 | ) |
| 13774 | #endif |
| 13775 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13776 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 13777 | hdd_wext_state_t *pWextState = NULL; |
| 13778 | tCsrRoamProfile *pRoamProfile = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13779 | struct key_params params; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 13780 | hdd_context_t *pHddCtx; |
| 13781 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13782 | |
| 13783 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13784 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 13785 | if (NULL == pAdapter) |
| 13786 | { |
| 13787 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13788 | "%s: HDD adapter is Null", __func__); |
| 13789 | return -ENODEV; |
| 13790 | } |
| 13791 | |
| 13792 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13793 | ret = wlan_hdd_validate_context(pHddCtx); |
| 13794 | if (0 != ret) |
| 13795 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 13796 | return ret; |
| 13797 | } |
| 13798 | |
| 13799 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 13800 | pRoamProfile = &(pWextState->roamProfile); |
| 13801 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 13802 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 13803 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 13804 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13805 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13806 | memset(¶ms, 0, sizeof(params)); |
| 13807 | |
| 13808 | if (CSR_MAX_NUM_KEY <= key_index) |
| 13809 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 13810 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13811 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13812 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13813 | |
| 13814 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 13815 | { |
| 13816 | case eCSR_ENCRYPT_TYPE_NONE: |
| 13817 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 13818 | break; |
| 13819 | |
| 13820 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 13821 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 13822 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 13823 | break; |
| 13824 | |
| 13825 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 13826 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 13827 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 13828 | break; |
| 13829 | |
| 13830 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 13831 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 13832 | break; |
| 13833 | |
| 13834 | case eCSR_ENCRYPT_TYPE_AES: |
| 13835 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 13836 | break; |
| 13837 | |
| 13838 | default: |
| 13839 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 13840 | break; |
| 13841 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13842 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 13843 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13844 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 13845 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 13846 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13847 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 13848 | params.seq_len = 0; |
| 13849 | params.seq = NULL; |
| 13850 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 13851 | callback(cookie, ¶ms); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 13852 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13853 | return 0; |
| 13854 | } |
| 13855 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 13856 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13857 | static int wlan_hdd_cfg80211_get_key( |
| 13858 | struct wiphy *wiphy, |
| 13859 | struct net_device *ndev, |
| 13860 | u8 key_index, bool pairwise, |
| 13861 | const u8 *mac_addr, void *cookie, |
| 13862 | void (*callback)(void *cookie, struct key_params*) |
| 13863 | ) |
| 13864 | #else |
| 13865 | static int wlan_hdd_cfg80211_get_key( |
| 13866 | struct wiphy *wiphy, |
| 13867 | struct net_device *ndev, |
| 13868 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 13869 | void (*callback)(void *cookie, struct key_params*) |
| 13870 | ) |
| 13871 | #endif |
| 13872 | { |
| 13873 | int ret; |
| 13874 | |
| 13875 | vos_ssr_protect(__func__); |
| 13876 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13877 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 13878 | mac_addr, cookie, callback); |
| 13879 | #else |
| 13880 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 13881 | callback); |
| 13882 | #endif |
| 13883 | vos_ssr_unprotect(__func__); |
| 13884 | |
| 13885 | return ret; |
| 13886 | } |
| 13887 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13888 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13889 | * FUNCTION: __wlan_hdd_cfg80211_del_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13890 | * This function is used to delete the key information |
| 13891 | */ |
| 13892 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13893 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13894 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13895 | u8 key_index, |
| 13896 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13897 | const u8 *mac_addr |
| 13898 | ) |
| 13899 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13900 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13901 | struct net_device *ndev, |
| 13902 | u8 key_index, |
| 13903 | const u8 *mac_addr |
| 13904 | ) |
| 13905 | #endif |
| 13906 | { |
| 13907 | int status = 0; |
| 13908 | |
| 13909 | //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] | 13910 | //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] | 13911 | //it is observed that this is invalidating peer |
| 13912 | //key index whenever re-key is done. This is affecting data link. |
| 13913 | //It should be ok to ignore del_key. |
| 13914 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13915 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 13916 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13917 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 13918 | tCsrRoamSetKey setKey; |
| 13919 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13920 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13921 | ENTER(); |
| 13922 | |
| 13923 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 13924 | __func__,pAdapter->device_mode); |
| 13925 | |
| 13926 | if (CSR_MAX_NUM_KEY <= key_index) |
| 13927 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13928 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13929 | key_index); |
| 13930 | |
| 13931 | return -EINVAL; |
| 13932 | } |
| 13933 | |
| 13934 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 13935 | setKey.keyId = key_index; |
| 13936 | |
| 13937 | if (mac_addr) |
| 13938 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 13939 | else |
| 13940 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 13941 | |
| 13942 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 13943 | |
| 13944 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13945 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13946 | ) |
| 13947 | { |
| 13948 | |
| 13949 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13950 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 13951 | if( pHostapdState->bssState == BSS_START) |
| 13952 | { |
| 13953 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13954 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13955 | if ( status != eHAL_STATUS_SUCCESS ) |
| 13956 | { |
| 13957 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13958 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 13959 | __LINE__, status ); |
| 13960 | } |
| 13961 | } |
| 13962 | } |
| 13963 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13964 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13965 | ) |
| 13966 | { |
| 13967 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13968 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13969 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 13970 | |
| 13971 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13972 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13973 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 13974 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13975 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13976 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 13977 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13978 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13979 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13980 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13981 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13982 | if ( 0 != status ) |
| 13983 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13984 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13985 | "%s: sme_RoamSetKey failure, returned %d", |
| 13986 | __func__, status); |
| 13987 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 13988 | return -EINVAL; |
| 13989 | } |
| 13990 | } |
| 13991 | } |
| 13992 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13993 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13994 | return status; |
| 13995 | } |
| 13996 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 13997 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 13998 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 13999 | struct net_device *ndev, |
| 14000 | u8 key_index, |
| 14001 | bool pairwise, |
| 14002 | const u8 *mac_addr |
| 14003 | ) |
| 14004 | #else |
| 14005 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 14006 | struct net_device *ndev, |
| 14007 | u8 key_index, |
| 14008 | const u8 *mac_addr |
| 14009 | ) |
| 14010 | #endif |
| 14011 | { |
| 14012 | int ret; |
| 14013 | |
| 14014 | vos_ssr_protect(__func__); |
| 14015 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 14016 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, pairwise, |
| 14017 | mac_addr); |
| 14018 | #else |
| 14019 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, mac_addr); |
| 14020 | #endif |
| 14021 | vos_ssr_unprotect(__func__); |
| 14022 | |
| 14023 | return ret; |
| 14024 | } |
| 14025 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14026 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 14027 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14028 | * This function is used to set the default tx key index |
| 14029 | */ |
| 14030 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 14031 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14032 | struct net_device *ndev, |
| 14033 | u8 key_index, |
| 14034 | bool unicast, bool multicast) |
| 14035 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 14036 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14037 | struct net_device *ndev, |
| 14038 | u8 key_index) |
| 14039 | #endif |
| 14040 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14041 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14042 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 14043 | hdd_wext_state_t *pWextState; |
| 14044 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14045 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14046 | |
| 14047 | ENTER(); |
| 14048 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 14049 | if ((NULL == pAdapter)) |
| 14050 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14051 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 14052 | "invalid adapter"); |
| 14053 | return -EINVAL; |
| 14054 | } |
| 14055 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14056 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14057 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 14058 | pAdapter->sessionId, key_index)); |
| 14059 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 14060 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 14061 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 14062 | |
| 14063 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 14064 | { |
| 14065 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 14066 | "invalid Wext state or HDD context"); |
| 14067 | return -EINVAL; |
| 14068 | } |
| 14069 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14070 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14071 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14072 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14073 | if (CSR_MAX_NUM_KEY <= key_index) |
| 14074 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14075 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14076 | key_index); |
| 14077 | |
| 14078 | return -EINVAL; |
| 14079 | } |
| 14080 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14081 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14082 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14083 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14084 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14085 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14086 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14087 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14088 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14089 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14090 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14091 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 14092 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 14093 | pHddStaCtx->conn_info.ucEncryptionType) && |
Hu Wang | b1f68cb | 2017-08-23 20:01:49 +0800 | [diff] [blame] | 14094 | #ifdef FEATURE_WLAN_WAPI |
| 14095 | (eCSR_ENCRYPT_TYPE_WPI != |
| 14096 | pHddStaCtx->conn_info.ucEncryptionType) && |
| 14097 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14098 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 14099 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14100 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14101 | { |
| 14102 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14103 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14104 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14105 | tCsrRoamSetKey setKey; |
| 14106 | v_U32_t roamId= 0xFF; |
| 14107 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14108 | |
| 14109 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14110 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14111 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14112 | Keys->defaultIndex = (u8)key_index; |
| 14113 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 14114 | setKey.keyId = key_index; |
| 14115 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14116 | |
| 14117 | vos_mem_copy(&setKey.Key[0], |
| 14118 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14119 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14120 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 14121 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14122 | |
| 14123 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14124 | &pHddStaCtx->conn_info.bssId[0], |
| 14125 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14126 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 14127 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 14128 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 14129 | eCSR_ENCRYPT_TYPE_WEP104) |
| 14130 | { |
| 14131 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 14132 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 14133 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 14134 | type(104) and switching encryption type to 40*/ |
| 14135 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 14136 | eCSR_ENCRYPT_TYPE_WEP40; |
| 14137 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 14138 | eCSR_ENCRYPT_TYPE_WEP40; |
| 14139 | } |
| 14140 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14141 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14142 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14143 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14144 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14145 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14146 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14147 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14148 | if ( 0 != status ) |
| 14149 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14150 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 14151 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14152 | status); |
| 14153 | return -EINVAL; |
| 14154 | } |
| 14155 | } |
| 14156 | } |
| 14157 | |
| 14158 | /* In SoftAp mode setting key direction for default mode */ |
| 14159 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 14160 | { |
| 14161 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 14162 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 14163 | (eCSR_ENCRYPT_TYPE_AES != |
| 14164 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 14165 | ) |
| 14166 | { |
| 14167 | /* Saving key direction for default key index to TX default */ |
| 14168 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 14169 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 14170 | } |
| 14171 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14172 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14173 | return status; |
| 14174 | } |
| 14175 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 14176 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 14177 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 14178 | struct net_device *ndev, |
| 14179 | u8 key_index, |
| 14180 | bool unicast, bool multicast) |
| 14181 | #else |
| 14182 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 14183 | struct net_device *ndev, |
| 14184 | u8 key_index) |
| 14185 | #endif |
| 14186 | { |
| 14187 | int ret; |
| 14188 | vos_ssr_protect(__func__); |
| 14189 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 14190 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 14191 | multicast); |
| 14192 | #else |
| 14193 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 14194 | #endif |
| 14195 | vos_ssr_unprotect(__func__); |
| 14196 | |
| 14197 | return ret; |
| 14198 | } |
| 14199 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14200 | /* |
| 14201 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 14202 | * This function is used to inform the BSS details to nl80211 interface. |
| 14203 | */ |
| 14204 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 14205 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 14206 | { |
| 14207 | struct net_device *dev = pAdapter->dev; |
| 14208 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 14209 | struct wiphy *wiphy = wdev->wiphy; |
| 14210 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 14211 | int chan_no; |
| 14212 | int ie_length; |
| 14213 | const char *ie; |
| 14214 | unsigned int freq; |
| 14215 | struct ieee80211_channel *chan; |
| 14216 | int rssi = 0; |
| 14217 | struct cfg80211_bss *bss = NULL; |
| 14218 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14219 | if( NULL == pBssDesc ) |
| 14220 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14221 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14222 | return bss; |
| 14223 | } |
| 14224 | |
| 14225 | chan_no = pBssDesc->channelId; |
| 14226 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 14227 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 14228 | |
| 14229 | if( NULL == ie ) |
| 14230 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14231 | 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] | 14232 | return bss; |
| 14233 | } |
| 14234 | |
| 14235 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 14236 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 14237 | { |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 14238 | freq = ieee80211_channel_to_frequency(chan_no, HDD_NL80211_BAND_2GHZ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14239 | } |
| 14240 | else |
| 14241 | { |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 14242 | freq = ieee80211_channel_to_frequency(chan_no, HDD_NL80211_BAND_5GHZ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14243 | } |
| 14244 | #else |
| 14245 | freq = ieee80211_channel_to_frequency(chan_no); |
| 14246 | #endif |
| 14247 | |
| 14248 | chan = __ieee80211_get_channel(wiphy, freq); |
| 14249 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 14250 | if (!chan) { |
| 14251 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 14252 | return NULL; |
| 14253 | } |
| 14254 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 14255 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14256 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 14257 | return cfg80211_inform_bss(wiphy, chan, |
| 14258 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 14259 | CFG80211_BSS_FTYPE_UNKNOWN, |
| 14260 | #endif |
| 14261 | pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14262 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14263 | pBssDesc->capabilityInfo, |
| 14264 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 14265 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14266 | } |
| 14267 | |
Abhishek Singh | 72c2f4e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 14268 | /* |
| 14269 | * wlan_hdd_cfg80211_update_bss_list :to inform nl80211 |
| 14270 | * interface that BSS might have been lost. |
| 14271 | * @pAdapter: adaptor |
| 14272 | * @bssid: bssid which might have been lost |
| 14273 | * |
| 14274 | * Return: bss which is unlinked from kernel cache |
| 14275 | */ |
| 14276 | struct cfg80211_bss* wlan_hdd_cfg80211_update_bss_list( |
| 14277 | hdd_adapter_t *pAdapter, tSirMacAddr bssid) |
| 14278 | { |
| 14279 | struct net_device *dev = pAdapter->dev; |
| 14280 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 14281 | struct wiphy *wiphy = wdev->wiphy; |
| 14282 | struct cfg80211_bss *bss = NULL; |
| 14283 | |
Abhishek Singh | 5a597e6 | 2016-12-05 15:16:30 +0530 | [diff] [blame] | 14284 | bss = hdd_get_bss_entry(wiphy, |
| 14285 | NULL, bssid, |
| 14286 | NULL, 0); |
Abhishek Singh | 72c2f4e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 14287 | if (bss == NULL) { |
| 14288 | hddLog(LOGE, FL("BSS not present")); |
| 14289 | } else { |
| 14290 | hddLog(LOG1, FL("cfg80211_unlink_bss called for BSSID " |
| 14291 | MAC_ADDRESS_STR), MAC_ADDR_ARRAY(bssid)); |
| 14292 | cfg80211_unlink_bss(wiphy, bss); |
| 14293 | } |
| 14294 | return bss; |
| 14295 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14296 | |
| 14297 | |
| 14298 | /* |
| 14299 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 14300 | * This function is used to inform the BSS details to nl80211 interface. |
| 14301 | */ |
| 14302 | struct cfg80211_bss* |
| 14303 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 14304 | tSirBssDescription *bss_desc |
| 14305 | ) |
| 14306 | { |
| 14307 | /* |
| 14308 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 14309 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 14310 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 14311 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 14312 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 14313 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 14314 | cfg80211_inform_bss_frame. |
| 14315 | */ |
| 14316 | struct net_device *dev = pAdapter->dev; |
| 14317 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 14318 | struct wiphy *wiphy = wdev->wiphy; |
| 14319 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 14320 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 14321 | qcom_ie_age *qie_age = NULL; |
| 14322 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 14323 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14324 | 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] | 14325 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14326 | const char *ie = |
| 14327 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 14328 | unsigned int freq; |
| 14329 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 14330 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14331 | struct cfg80211_bss *bss_status = NULL; |
Hanumanth Reddy Pothula | e04e06c | 2018-05-31 14:41:36 +0530 | [diff] [blame] | 14332 | size_t frame_len = ie_length + offsetof(struct ieee80211_mgmt, |
| 14333 | u.probe_resp.variable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14334 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 14335 | hdd_context_t *pHddCtx; |
| 14336 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14337 | #ifdef WLAN_OPEN_SOURCE |
| 14338 | struct timespec ts; |
| 14339 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14340 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14341 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 14342 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14343 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 14344 | if (0 != status) |
| 14345 | { |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 14346 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 14347 | } |
| 14348 | |
Hanumanth Reddy Pothula | 33548e2 | 2018-05-31 13:28:51 +0530 | [diff] [blame] | 14349 | mgmt = kzalloc(frame_len, GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 14350 | if (!mgmt) |
| 14351 | { |
| 14352 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14353 | "%s: memory allocation failed ", __func__); |
| 14354 | return NULL; |
| 14355 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 14356 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14357 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14358 | |
| 14359 | #ifdef WLAN_OPEN_SOURCE |
| 14360 | /* Android does not want the timestamp from the frame. |
| 14361 | Instead it wants a monotonic increasing value */ |
| 14362 | get_monotonic_boottime(&ts); |
| 14363 | mgmt->u.probe_resp.timestamp = |
| 14364 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 14365 | #else |
| 14366 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14367 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 14368 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14369 | |
| 14370 | #endif |
| 14371 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14372 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 14373 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 14374 | |
| 14375 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 14376 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 14377 | /* Assuming this is the last IE, copy at the end */ |
| 14378 | ie_length -=sizeof(qcom_ie_age); |
| 14379 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 14380 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 14381 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 14382 | qie_age->oui_1 = QCOM_OUI1; |
| 14383 | qie_age->oui_2 = QCOM_OUI2; |
| 14384 | qie_age->oui_3 = QCOM_OUI3; |
| 14385 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
Selvaraj, Sridhar | 4b3a836 | 2016-10-12 12:34:08 +0530 | [diff] [blame] | 14386 | /* Lowi expects the timestamp of bss in units of 1/10 ms. In driver all |
| 14387 | * bss related timestamp is in units of ms. Due to this when scan results |
| 14388 | * are sent to lowi the scan age is high.To address this, send age in units |
| 14389 | * of 1/10 ms. |
| 14390 | */ |
| 14391 | qie_age->age = (vos_timer_get_system_time() - |
| 14392 | bss_desc->nReceivedTime)/10; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 14393 | #endif |
| 14394 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14395 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 14396 | if (bss_desc->fProbeRsp) |
| 14397 | { |
| 14398 | mgmt->frame_control |= |
| 14399 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 14400 | } |
| 14401 | else |
| 14402 | { |
| 14403 | mgmt->frame_control |= |
| 14404 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 14405 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14406 | |
| 14407 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14408 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 14409 | (wiphy->bands[HDD_NL80211_BAND_2GHZ] != NULL)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14410 | { |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 14411 | freq = ieee80211_channel_to_frequency(chan_no, HDD_NL80211_BAND_2GHZ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14412 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14413 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 14414 | (wiphy->bands[HDD_NL80211_BAND_5GHZ] != NULL)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14415 | |
| 14416 | { |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 14417 | freq = ieee80211_channel_to_frequency(chan_no, HDD_NL80211_BAND_5GHZ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14418 | } |
| 14419 | else |
| 14420 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 14421 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 14422 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14423 | kfree(mgmt); |
| 14424 | return NULL; |
| 14425 | } |
| 14426 | #else |
| 14427 | freq = ieee80211_channel_to_frequency(chan_no); |
| 14428 | #endif |
| 14429 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 14430 | /*when the band is changed on the fly using the GUI, three things are done |
| 14431 | * 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) |
| 14432 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 14433 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 14434 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 14435 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 14436 | * 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 |
| 14437 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 14438 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 14439 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 14440 | * So drop the bss and continue to next bss. |
| 14441 | */ |
| 14442 | if(chan == NULL) |
| 14443 | { |
Deepthi Gowri | 306657b | 2016-04-28 17:10:41 +0530 | [diff] [blame] | 14444 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 14445 | FL("chan pointer is NULL, chan_no: %d freq: %d"), |
| 14446 | chan_no, freq); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 14447 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 14448 | return NULL; |
| 14449 | } |
Hanumantha Reddy Pothula | 904bcef | 2015-06-19 11:56:29 +0530 | [diff] [blame] | 14450 | /*To keep the rssi icon of the connected AP in the scan window |
| 14451 | *and the rssi icon of the wireless networks in sync |
| 14452 | * */ |
| 14453 | if (( eConnectionState_Associated == |
| 14454 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 14455 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 14456 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 14457 | WNI_CFG_BSSID_LEN)) && |
| 14458 | (pHddCtx->hdd_wlan_suspended == FALSE)) |
| 14459 | { |
| 14460 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 14461 | rssi = (pAdapter->rssi * 100); |
| 14462 | } |
| 14463 | else |
| 14464 | { |
| 14465 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 14466 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14467 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 14468 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
Sushant Kaushik | 0b34342 | 2015-05-25 17:15:55 +0530 | [diff] [blame] | 14469 | " RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 14470 | vos_freq_to_chan(chan->center_freq), (int)(rssi/100)); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 14471 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14472 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 14473 | frame_len, rssi, GFP_KERNEL); |
| 14474 | kfree(mgmt); |
| 14475 | return bss_status; |
| 14476 | } |
| 14477 | |
| 14478 | /* |
| 14479 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 14480 | * This function is used to update the BSS data base of CFG8011 |
| 14481 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14482 | 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] | 14483 | tCsrRoamInfo *pRoamInfo |
| 14484 | ) |
| 14485 | { |
| 14486 | tCsrRoamConnectedProfile roamProfile; |
| 14487 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14488 | struct cfg80211_bss *bss = NULL; |
| 14489 | |
| 14490 | ENTER(); |
| 14491 | |
| 14492 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 14493 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 14494 | |
| 14495 | if (NULL != roamProfile.pBssDesc) |
| 14496 | { |
Girish Gowli | f4b6802 | 2014-08-28 23:18:57 +0530 | [diff] [blame] | 14497 | bss = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 14498 | roamProfile.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14499 | |
| 14500 | if (NULL == bss) |
| 14501 | { |
| 14502 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 14503 | __func__); |
| 14504 | } |
| 14505 | |
| 14506 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 14507 | } |
| 14508 | else |
| 14509 | { |
| 14510 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 14511 | __func__); |
| 14512 | } |
| 14513 | return bss; |
| 14514 | } |
| 14515 | |
| 14516 | /* |
| 14517 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 14518 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14519 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 14520 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14521 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14522 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14523 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14524 | tCsrScanResultInfo *pScanResult; |
| 14525 | eHalStatus status = 0; |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 14526 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14527 | tScanResultHandle pResult; |
| 14528 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 14529 | hdd_context_t *pHddCtx; |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 14530 | bool is_p2p_scan = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14531 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14532 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14533 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14534 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 14535 | NO_SESSION, pAdapter->sessionId)); |
| 14536 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 14537 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 14538 | ret = wlan_hdd_validate_context(pHddCtx); |
| 14539 | if (0 != ret) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14540 | { |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 14541 | return ret; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 14542 | } |
| 14543 | |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 14544 | if (pAdapter->request != NULL) |
| 14545 | { |
| 14546 | if ((pAdapter->request->n_ssids == 1) |
| 14547 | && (pAdapter->request->ssids != NULL) |
| 14548 | && vos_mem_compare(&pAdapter->request->ssids[0], "DIRECT-", 7)) |
| 14549 | is_p2p_scan = true; |
| 14550 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14551 | /* |
| 14552 | * start getting scan results and populate cgf80211 BSS database |
| 14553 | */ |
| 14554 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 14555 | |
| 14556 | /* no scan results */ |
| 14557 | if (NULL == pResult) |
| 14558 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 14559 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 14560 | __func__, status); |
Mahesh A Saptasagar | 51dc36c | 2015-06-16 12:07:15 +0530 | [diff] [blame] | 14561 | wlan_hdd_get_frame_logs(pAdapter, |
| 14562 | WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14563 | return status; |
| 14564 | } |
| 14565 | |
| 14566 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 14567 | |
| 14568 | while (pScanResult) |
| 14569 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14570 | /* |
| 14571 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 14572 | * entry already exists in bss data base of cfg80211 for that |
| 14573 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 14574 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 14575 | * mgmt packet as input. As of now there is no possibility to get |
| 14576 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14577 | * ieee80211_mgmt(probe response) and passing to c |
| 14578 | * fg80211_inform_bss_frame. |
| 14579 | * */ |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 14580 | if(is_p2p_scan && (pScanResult->ssId.ssId != NULL) && |
| 14581 | !vos_mem_compare( pScanResult->ssId.ssId, "DIRECT-", 7) ) |
| 14582 | { |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 14583 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 14584 | continue; //Skip the non p2p bss entries |
| 14585 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14586 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 14587 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14588 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14589 | |
| 14590 | if (NULL == bss_status) |
| 14591 | { |
| 14592 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14593 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14594 | } |
| 14595 | else |
| 14596 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 14597 | cfg80211_put_bss( |
| 14598 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 14599 | wiphy, |
| 14600 | #endif |
| 14601 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14602 | } |
| 14603 | |
| 14604 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 14605 | } |
| 14606 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14607 | sme_ScanResultPurge(hHal, pResult); |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 14608 | is_p2p_scan = false; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14609 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14610 | } |
| 14611 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14612 | void |
| 14613 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 14614 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14615 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 14616 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14617 | } /****** end hddPrintMacAddr() ******/ |
| 14618 | |
| 14619 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 14620 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14621 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14622 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14623 | "%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] | 14624 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 14625 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 14626 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14627 | } /****** end hddPrintPmkId() ******/ |
| 14628 | |
| 14629 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 14630 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 14631 | |
| 14632 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 14633 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 14634 | |
| 14635 | #define dump_bssid(bssid) \ |
| 14636 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14637 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 14638 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14639 | } |
| 14640 | |
| 14641 | #define dump_pmkid(pMac, pmkid) \ |
| 14642 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14643 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 14644 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14645 | } |
| 14646 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 14647 | #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] | 14648 | /* |
| 14649 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 14650 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 14651 | */ |
| 14652 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14653 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14654 | int index, bool preauth ) |
| 14655 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14656 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14657 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 14658 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14659 | |
| 14660 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14661 | 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] | 14662 | |
| 14663 | if( NULL == pRoamInfo ) |
| 14664 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14665 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14666 | return -EINVAL; |
| 14667 | } |
| 14668 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 14669 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 14670 | { |
| 14671 | dump_bssid(pRoamInfo->bssid); |
| 14672 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14673 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 14674 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14675 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14676 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 14677 | } |
| 14678 | #endif //FEATURE_WLAN_LFR |
| 14679 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 14680 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 14681 | /* |
| 14682 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 14683 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 14684 | * |
| 14685 | */ |
| 14686 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 14687 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 14688 | tCsrRoamInfo *pRoamInfo) |
| 14689 | { |
| 14690 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 14691 | union iwreq_data wrqu; |
| 14692 | |
| 14693 | ENTER(); |
| 14694 | |
| 14695 | if (NULL == pAdapter) |
| 14696 | { |
| 14697 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 14698 | return VOS_STATUS_E_FAILURE; |
| 14699 | } |
| 14700 | |
| 14701 | /* create the event */ |
| 14702 | memset(&wrqu, 0, sizeof(wrqu)); |
| 14703 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 14704 | |
| 14705 | wrqu.data.pointer = metrics_notification; |
| 14706 | wrqu.data.length = scnprintf(metrics_notification, |
| 14707 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 14708 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 14709 | |
| 14710 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 14711 | |
| 14712 | EXIT(); |
| 14713 | |
| 14714 | return VOS_STATUS_SUCCESS; |
| 14715 | } |
| 14716 | |
| 14717 | /* |
| 14718 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 14719 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 14720 | * or failure |
| 14721 | */ |
| 14722 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 14723 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 14724 | { |
| 14725 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 14726 | union iwreq_data wrqu; |
| 14727 | |
| 14728 | ENTER(); |
| 14729 | |
| 14730 | if (NULL == pAdapter) |
| 14731 | { |
| 14732 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 14733 | return VOS_STATUS_E_FAILURE; |
| 14734 | } |
| 14735 | |
| 14736 | /* create the event */ |
| 14737 | memset(&wrqu, 0, sizeof(wrqu)); |
| 14738 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 14739 | |
| 14740 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 14741 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 14742 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 14743 | |
| 14744 | if (1 == preauth_status) |
| 14745 | strncat(metrics_notification, " TRUE", 5); |
| 14746 | else |
| 14747 | strncat(metrics_notification, " FALSE", 6); |
| 14748 | |
| 14749 | wrqu.data.pointer = metrics_notification; |
| 14750 | wrqu.data.length = strlen(metrics_notification); |
| 14751 | |
| 14752 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 14753 | |
| 14754 | EXIT(); |
| 14755 | |
| 14756 | return VOS_STATUS_SUCCESS; |
| 14757 | } |
| 14758 | |
| 14759 | /* |
| 14760 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 14761 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 14762 | * |
| 14763 | */ |
| 14764 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 14765 | tCsrRoamInfo *pRoamInfo) |
| 14766 | { |
| 14767 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 14768 | union iwreq_data wrqu; |
| 14769 | |
| 14770 | ENTER(); |
| 14771 | |
| 14772 | if (NULL == pAdapter) |
| 14773 | { |
| 14774 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 14775 | return VOS_STATUS_E_FAILURE; |
| 14776 | } |
| 14777 | |
| 14778 | /* create the event */ |
| 14779 | memset(&wrqu, 0, sizeof(wrqu)); |
| 14780 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 14781 | |
| 14782 | wrqu.data.pointer = metrics_notification; |
| 14783 | wrqu.data.length = scnprintf(metrics_notification, |
| 14784 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 14785 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 14786 | |
| 14787 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 14788 | |
| 14789 | EXIT(); |
| 14790 | |
| 14791 | return VOS_STATUS_SUCCESS; |
| 14792 | } |
| 14793 | #endif |
| 14794 | |
Manjeet Singh | aaee9cd | 2016-09-13 19:23:30 +0530 | [diff] [blame] | 14795 | |
| 14796 | /** |
| 14797 | * wlan_hdd_cfg80211_validate_scan_req - validate scan request |
| 14798 | * @scan_req: scan request to be checked |
| 14799 | * |
| 14800 | * Return: true or false |
| 14801 | */ |
| 14802 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) |
| 14803 | static inline bool wlan_hdd_cfg80211_validate_scan_req(struct |
| 14804 | cfg80211_scan_request |
Hanumanth Reddy Pothula | d4c817e | 2017-07-14 20:30:59 +0530 | [diff] [blame] | 14805 | *scan_req, hdd_context_t |
| 14806 | *hdd_ctx) |
Manjeet Singh | aaee9cd | 2016-09-13 19:23:30 +0530 | [diff] [blame] | 14807 | { |
Hanumanth Reddy Pothula | d4c817e | 2017-07-14 20:30:59 +0530 | [diff] [blame] | 14808 | if (!scan_req || !scan_req->wiphy || |
| 14809 | scan_req->wiphy != hdd_ctx->wiphy) { |
Manjeet Singh | aaee9cd | 2016-09-13 19:23:30 +0530 | [diff] [blame] | 14810 | hddLog(VOS_TRACE_LEVEL_ERROR, "Invalid scan request"); |
| 14811 | return false; |
| 14812 | } |
| 14813 | if (vos_is_load_unload_in_progress(VOS_MODULE_ID_HDD, NULL)) { |
| 14814 | hddLog(VOS_TRACE_LEVEL_ERROR, "Load/Unload in progress"); |
| 14815 | return false; |
| 14816 | } |
| 14817 | return true; |
| 14818 | } |
| 14819 | #else |
| 14820 | static inline bool wlan_hdd_cfg80211_validate_scan_req(struct |
| 14821 | cfg80211_scan_request |
Hanumanth Reddy Pothula | d4c817e | 2017-07-14 20:30:59 +0530 | [diff] [blame] | 14822 | *scan_req, hdd_context_t |
| 14823 | *hdd_ctx) |
Manjeet Singh | aaee9cd | 2016-09-13 19:23:30 +0530 | [diff] [blame] | 14824 | { |
Hanumanth Reddy Pothula | d4c817e | 2017-07-14 20:30:59 +0530 | [diff] [blame] | 14825 | if (!scan_req || !scan_req->wiphy || |
| 14826 | scan_req->wiphy != hdd_ctx->wiphy) { |
Manjeet Singh | aaee9cd | 2016-09-13 19:23:30 +0530 | [diff] [blame] | 14827 | hddLog(VOS_TRACE_LEVEL_ERROR, "Invalid scan request"); |
| 14828 | return false; |
| 14829 | } |
| 14830 | return true; |
| 14831 | } |
| 14832 | #endif |
| 14833 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 14834 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) |
| 14835 | /** |
| 14836 | * hdd_cfg80211_scan_done() - Scan completed callback to cfg80211 |
| 14837 | * @adapter: Pointer to the adapter |
| 14838 | * @req : Scan request |
| 14839 | * @aborted : true scan aborted false scan success |
| 14840 | * |
| 14841 | * This function notifies scan done to cfg80211 |
| 14842 | * |
| 14843 | * Return: none |
| 14844 | */ |
| 14845 | static void hdd_cfg80211_scan_done(hdd_adapter_t *adapter, |
| 14846 | struct cfg80211_scan_request *req, |
| 14847 | bool aborted) |
| 14848 | { |
| 14849 | struct cfg80211_scan_info info = { |
| 14850 | .aborted = aborted |
| 14851 | }; |
| 14852 | |
| 14853 | if (adapter->dev->flags & IFF_UP) |
| 14854 | cfg80211_scan_done(req, &info); |
| 14855 | else |
| 14856 | hddLog(LOGW, |
| 14857 | FL("IFF_UP flag reset for %s"), adapter->dev->name); |
| 14858 | } |
| 14859 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) |
| 14860 | /** |
| 14861 | * hdd_cfg80211_scan_done() - Scan completed callback to cfg80211 |
| 14862 | * @adapter: Pointer to the adapter |
| 14863 | * @req : Scan request |
| 14864 | * @aborted : true scan aborted false scan success |
| 14865 | * |
| 14866 | * This function notifies scan done to cfg80211 |
| 14867 | * |
| 14868 | * Return: none |
| 14869 | */ |
| 14870 | static void hdd_cfg80211_scan_done(hdd_adapter_t *adapter, |
| 14871 | struct cfg80211_scan_request *req, |
| 14872 | bool aborted) |
| 14873 | { |
| 14874 | if (adapter->dev->flags & IFF_UP) |
| 14875 | cfg80211_scan_done(req, aborted); |
| 14876 | else |
| 14877 | hddLog(LOGW, |
| 14878 | FL("IFF_UP flag reset for %s"), adapter->dev->name); |
| 14879 | } |
| 14880 | #else |
| 14881 | /** |
| 14882 | * hdd_cfg80211_scan_done() - Scan completed callback to cfg80211 |
| 14883 | * @adapter: Pointer to the adapter |
| 14884 | * @req : Scan request |
| 14885 | * @aborted : true scan aborted false scan success |
| 14886 | * |
| 14887 | * This function notifies scan done to cfg80211 |
| 14888 | * |
| 14889 | * Return: none |
| 14890 | */ |
| 14891 | static void hdd_cfg80211_scan_done(hdd_adapter_t *adapter, |
| 14892 | struct cfg80211_scan_request *req, |
| 14893 | bool aborted) |
| 14894 | { |
| 14895 | cfg80211_scan_done(req, aborted); |
| 14896 | } |
| 14897 | #endif |
| 14898 | |
Mukul Sharma | b392b64 | 2017-08-17 17:45:29 +0530 | [diff] [blame] | 14899 | #define NET_DEV_IS_IFF_UP(pAdapter) (pAdapter->dev->flags & IFF_UP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14900 | /* |
| 14901 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 14902 | * scanning callback function, called after finishing scan |
| 14903 | * |
| 14904 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14905 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14906 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 14907 | { |
| 14908 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14909 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14910 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 14911 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14912 | struct cfg80211_scan_request *req = NULL; |
| 14913 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 14914 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 14915 | long waitRet = 0; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 14916 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14917 | |
| 14918 | ENTER(); |
| 14919 | |
c_manjee | 1b4ab9a | 2016-10-26 11:36:55 +0530 | [diff] [blame] | 14920 | if (!pAdapter || pAdapter->magic != WLAN_HDD_ADAPTER_MAGIC || |
| 14921 | !pAdapter->dev) { |
| 14922 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Adapter is not valid")); |
| 14923 | return 0; |
| 14924 | } |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 14925 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Siddharth Bhal | 5c2e02d | 2015-05-05 17:35:29 +0530 | [diff] [blame] | 14926 | if (NULL == pHddCtx) { |
| 14927 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is Null")); |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 14928 | return 0; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 14929 | } |
| 14930 | |
Mahesh A Saptasagar | 1129675 | 2016-01-07 17:53:02 +0530 | [diff] [blame] | 14931 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
Mukul Sharma | b392b64 | 2017-08-17 17:45:29 +0530 | [diff] [blame] | 14932 | if (!NET_DEV_IS_IFF_UP(pAdapter)) |
Mahesh A Saptasagar | 1129675 | 2016-01-07 17:53:02 +0530 | [diff] [blame] | 14933 | { |
| 14934 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Interface is down")); |
Mahesh A Saptasagar | 1129675 | 2016-01-07 17:53:02 +0530 | [diff] [blame] | 14935 | } |
| 14936 | #endif |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 14937 | pScanInfo = &pHddCtx->scan_info; |
| 14938 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14939 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 14940 | "%s called with halHandle = %pK, pContext = %pK," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14941 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14942 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 14943 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 14944 | pScanInfo->mScanPendingCounter = 0; |
| 14945 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14946 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 14947 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14948 | &pScanInfo->scan_req_completion_event, |
| 14949 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 14950 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14951 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 14952 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 14953 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14954 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14955 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14956 | } |
| 14957 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 14958 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14959 | { |
| 14960 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14961 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14962 | } |
| 14963 | |
| 14964 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14965 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14966 | { |
| 14967 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14968 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14969 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14970 | (int) scanId); |
| 14971 | } |
| 14972 | |
Mahesh A Saptasagar | 9dd7284 | 2016-04-15 19:45:14 +0530 | [diff] [blame] | 14973 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
Mukul Sharma | b392b64 | 2017-08-17 17:45:29 +0530 | [diff] [blame] | 14974 | if (NET_DEV_IS_IFF_UP(pAdapter)) |
Mahesh A Saptasagar | 9dd7284 | 2016-04-15 19:45:14 +0530 | [diff] [blame] | 14975 | #endif |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 14976 | { |
| 14977 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
| 14978 | pAdapter); |
| 14979 | if (0 > ret) |
| 14980 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | 9dd7284 | 2016-04-15 19:45:14 +0530 | [diff] [blame] | 14981 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14982 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14983 | /* If any client wait scan result through WEXT |
| 14984 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 14985 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14986 | { |
| 14987 | /* The other scan request waiting for current scan finish |
| 14988 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 14989 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14990 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 14991 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14992 | } |
| 14993 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 14994 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14995 | { |
| 14996 | struct net_device *dev = pAdapter->dev; |
| 14997 | union iwreq_data wrqu; |
| 14998 | int we_event; |
| 14999 | char *msg; |
| 15000 | |
| 15001 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 15002 | we_event = SIOCGIWSCAN; |
| 15003 | msg = NULL; |
| 15004 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 15005 | } |
| 15006 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 15007 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15008 | |
| 15009 | /* Get the Scan Req */ |
| 15010 | req = pAdapter->request; |
mukul sharma | e704182 | 2015-12-03 15:09:21 +0530 | [diff] [blame] | 15011 | pAdapter->request = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15012 | |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 15013 | /* Scan is no longer pending */ |
| 15014 | pScanInfo->mScanPending = VOS_FALSE; |
| 15015 | |
Hanumanth Reddy Pothula | d4c817e | 2017-07-14 20:30:59 +0530 | [diff] [blame] | 15016 | if (!wlan_hdd_cfg80211_validate_scan_req(req, pHddCtx)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15017 | { |
Manjeet Singh | aaee9cd | 2016-09-13 19:23:30 +0530 | [diff] [blame] | 15018 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 15019 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("interface state %s"), |
Mukul Sharma | b392b64 | 2017-08-17 17:45:29 +0530 | [diff] [blame] | 15020 | NET_DEV_IS_IFF_UP(pAdapter) ? "up" : "down"); |
Manjeet Singh | aaee9cd | 2016-09-13 19:23:30 +0530 | [diff] [blame] | 15021 | #endif |
| 15022 | |
| 15023 | if (pAdapter->dev) { |
| 15024 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("device name %s"), |
| 15025 | pAdapter->dev->name); |
| 15026 | } |
mukul sharma | e704182 | 2015-12-03 15:09:21 +0530 | [diff] [blame] | 15027 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15028 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15029 | } |
| 15030 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 15031 | /* last_scan_timestamp is used to decide if new scan |
| 15032 | * is needed or not on station interface. If last station |
| 15033 | * scan time and new station scan time is less then |
| 15034 | * last_scan_timestamp ; driver will return cached scan. |
Hanumanth Reddy Pothula | f31f65c | 2018-01-30 19:51:27 +0530 | [diff] [blame] | 15035 | * Also only last_scan_timestamp is updated here last_scan_channellist |
| 15036 | * is updated on receiving scan request itself to make sure kernel |
| 15037 | * allocated scan request(scan_req) object is not dereferenced here, |
| 15038 | * because interface down, where kernel frees scan_req, may happen any |
| 15039 | * time while driver is processing scan_done_callback. So it's better |
| 15040 | * not to access scan_req in this routine. |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 15041 | */ |
Hanumanth Reddy Pothula | f31f65c | 2018-01-30 19:51:27 +0530 | [diff] [blame] | 15042 | if (pScanInfo->no_cck == FALSE) { // no_cck will be set during p2p find |
| 15043 | if (status == eCSR_SCAN_SUCCESS) |
| 15044 | pScanInfo->last_scan_timestamp = vos_timer_get_system_time(); |
| 15045 | else { |
| 15046 | vos_mem_zero(pHddCtx->scan_info.last_scan_channelList, |
| 15047 | sizeof(pHddCtx->scan_info.last_scan_channelList)); |
| 15048 | pHddCtx->scan_info.last_scan_numChannels = 0; |
| 15049 | pScanInfo->last_scan_timestamp = 0; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 15050 | } |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 15051 | } |
| 15052 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 15053 | /* |
| 15054 | * cfg80211_scan_done informing NL80211 about completion |
| 15055 | * of scanning |
| 15056 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 15057 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 15058 | { |
| 15059 | aborted = true; |
| 15060 | } |
mukul sharma | e704182 | 2015-12-03 15:09:21 +0530 | [diff] [blame] | 15061 | |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 15062 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
Mukul Sharma | b392b64 | 2017-08-17 17:45:29 +0530 | [diff] [blame] | 15063 | if (NET_DEV_IS_IFF_UP(pAdapter) && |
| 15064 | wlan_hdd_cfg80211_validate_scan_req(req, pHddCtx)) |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 15065 | #endif |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 15066 | hdd_cfg80211_scan_done(pAdapter, req, aborted); |
mukul sharma | e704182 | 2015-12-03 15:09:21 +0530 | [diff] [blame] | 15067 | |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 15068 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15069 | |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 15070 | allow_suspend: |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 15071 | if ((pHddCtx->cfg_ini->enableMacSpoofing == MAC_ADDR_SPOOFING_FW_HOST_ENABLE |
| 15072 | ) && (pHddCtx->spoofMacAddr.isEnabled |
| 15073 | || pHddCtx->spoofMacAddr.isReqDeferred)) { |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 15074 | /* Generate new random mac addr for next scan */ |
| 15075 | 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] | 15076 | |
| 15077 | schedule_delayed_work(&pHddCtx->spoof_mac_addr_work, |
| 15078 | msecs_to_jiffies(MAC_ADDR_SPOOFING_DEFER_INTERVAL)); |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 15079 | } |
| 15080 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 15081 | /* release the wake lock at the end of the scan*/ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 15082 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15083 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 15084 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 15085 | * immediatly after the driver gets connect request(i.e after scan) |
| 15086 | * from supplicant, this result in app's is suspending and not able |
| 15087 | * to process the connect request to AP */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 15088 | hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 15089 | |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 15090 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
Mukul Sharma | b392b64 | 2017-08-17 17:45:29 +0530 | [diff] [blame] | 15091 | if (NET_DEV_IS_IFF_UP(pAdapter)) |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 15092 | #endif |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 15093 | #ifdef FEATURE_WLAN_TDLS |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 15094 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 15095 | #endif |
| 15096 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15097 | EXIT(); |
| 15098 | return 0; |
| 15099 | } |
| 15100 | |
| 15101 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 15102 | * FUNCTION: hdd_isConnectionInProgress |
| 15103 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 15104 | * |
| 15105 | */ |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 15106 | v_BOOL_t hdd_isConnectionInProgress(hdd_context_t *pHddCtx, v_U8_t *session_id, |
| 15107 | scan_reject_states *reason) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 15108 | { |
| 15109 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 15110 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 15111 | hdd_adapter_t *pAdapter = NULL; |
| 15112 | VOS_STATUS status = 0; |
| 15113 | v_U8_t staId = 0; |
| 15114 | v_U8_t *staMac = NULL; |
| 15115 | |
| 15116 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 15117 | |
| 15118 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 15119 | { |
| 15120 | pAdapter = pAdapterNode->pAdapter; |
| 15121 | |
| 15122 | if( pAdapter ) |
| 15123 | { |
| 15124 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15125 | "%s: Adapter with device mode %s (%d) exists", |
| 15126 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 15127 | pAdapter->device_mode); |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 15128 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 15129 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 15130 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 15131 | (eConnectionState_Connecting == |
| 15132 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 15133 | { |
Vignesh Viswanathan | e0a3f92 | 2017-08-10 19:15:44 +0530 | [diff] [blame] | 15134 | hddLog(LOG1, |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 15135 | "%s: %pK(%d) Connection is in progress", __func__, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 15136 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 15137 | if (session_id && reason) |
| 15138 | { |
| 15139 | *session_id = pAdapter->sessionId; |
| 15140 | *reason = eHDD_CONNECTION_IN_PROGRESS; |
| 15141 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 15142 | return VOS_TRUE; |
| 15143 | } |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 15144 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Padma, Santhosh Kumar | 3b9657d | 2015-02-04 19:37:32 +0530 | [diff] [blame] | 15145 | smeNeighborMiddleOfRoaming(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 15146 | { |
Vignesh Viswanathan | e0a3f92 | 2017-08-10 19:15:44 +0530 | [diff] [blame] | 15147 | hddLog(LOG1, |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 15148 | "%s: %pK(%d) Reassociation is in progress", __func__, |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 15149 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 15150 | if (session_id && reason) |
| 15151 | { |
| 15152 | *session_id = pAdapter->sessionId; |
| 15153 | *reason = eHDD_REASSOC_IN_PROGRESS; |
| 15154 | } |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 15155 | return VOS_TRUE; |
| 15156 | } |
| 15157 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15158 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 15159 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 15160 | { |
| 15161 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15162 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Vignesh Viswanathan | 0ac8e56 | 2018-06-14 17:24:10 +0530 | [diff] [blame] | 15163 | sme_is_sta_key_exchange_in_progress(pHddCtx->hHal, |
| 15164 | pAdapter->sessionId)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 15165 | { |
| 15166 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
Vignesh Viswanathan | e0a3f92 | 2017-08-10 19:15:44 +0530 | [diff] [blame] | 15167 | hddLog(LOG1, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 15168 | "%s: client " MAC_ADDRESS_STR |
| 15169 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 15170 | MAC_ADDR_ARRAY(staMac)); |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 15171 | if (session_id && reason) |
| 15172 | { |
| 15173 | *session_id = pAdapter->sessionId; |
| 15174 | *reason = eHDD_EAPOL_IN_PROGRESS; |
| 15175 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 15176 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 15177 | } |
| 15178 | } |
| 15179 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 15180 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 15181 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 15182 | v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 15183 | ptSapContext pSapCtx = NULL; |
| 15184 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 15185 | if(pSapCtx == NULL){ |
| 15186 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15187 | FL("psapCtx is NULL")); |
| 15188 | return VOS_FALSE; |
| 15189 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 15190 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 15191 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 15192 | if ((pSapCtx->aStaInfo[staId].isUsed) && |
| 15193 | (WLANTL_STA_CONNECTED == pSapCtx->aStaInfo[staId].tlSTAState)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 15194 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 15195 | staMac = (v_U8_t *) &(pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 15196 | |
Vignesh Viswanathan | e0a3f92 | 2017-08-10 19:15:44 +0530 | [diff] [blame] | 15197 | hddLog(LOG1, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 15198 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 15199 | "middle of WPS/EAPOL exchange.", __func__, |
| 15200 | MAC_ADDR_ARRAY(staMac)); |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 15201 | if (session_id && reason) |
| 15202 | { |
| 15203 | *session_id = pAdapter->sessionId; |
| 15204 | *reason = eHDD_SAP_EAPOL_IN_PROGRESS; |
| 15205 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 15206 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 15207 | } |
| 15208 | } |
| 15209 | } |
| 15210 | } |
| 15211 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 15212 | pAdapterNode = pNext; |
| 15213 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 15214 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15215 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 15216 | |
Selvaraj, Sridhar | d2b078a | 2016-06-18 10:44:37 +0530 | [diff] [blame] | 15217 | /** |
| 15218 | * csr_scan_request_assign_bssid() - Set the BSSID received from Supplicant |
| 15219 | * to the Scan request |
| 15220 | * @scanRequest: Pointer to the csr scan request |
| 15221 | * @request: Pointer to the scan request from supplicant |
| 15222 | * |
| 15223 | * Return: None |
| 15224 | */ |
| 15225 | #ifdef CFG80211_SCAN_BSSID |
| 15226 | static inline void csr_scan_request_assign_bssid(tCsrScanRequest *scanRequest, |
| 15227 | struct cfg80211_scan_request *request) |
| 15228 | { |
| 15229 | vos_mem_copy(scanRequest->bssid, request->bssid, VOS_MAC_ADDR_SIZE); |
| 15230 | } |
| 15231 | #else |
| 15232 | static inline void csr_scan_request_assign_bssid(tCsrScanRequest *scanRequest, |
| 15233 | struct cfg80211_scan_request *request) |
| 15234 | { |
| 15235 | } |
| 15236 | #endif |
| 15237 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 15238 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 15239 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15240 | * this scan respond to scan trigger and update cfg80211 scan database |
| 15241 | * later, scan dump command can be used to recieve scan results |
| 15242 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 15243 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 15244 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 15245 | struct net_device *dev, |
| 15246 | #endif |
| 15247 | struct cfg80211_scan_request *request) |
| 15248 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 15249 | hdd_adapter_t *pAdapter = NULL; |
| 15250 | hdd_context_t *pHddCtx = NULL; |
| 15251 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15252 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15253 | tCsrScanRequest scanRequest; |
| 15254 | tANI_U8 *channelList = NULL, i; |
| 15255 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15256 | int status; |
| 15257 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15258 | v_U8_t* pP2pIe = NULL; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 15259 | int ret = 0; |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 15260 | v_U8_t *pWpsIe=NULL; |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 15261 | bool is_p2p_scan = false; |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 15262 | v_U8_t curr_session_id; |
| 15263 | scan_reject_states curr_reason; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15264 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 15265 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 15266 | struct net_device *dev = NULL; |
| 15267 | if (NULL == request) |
| 15268 | { |
| 15269 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15270 | "%s: scan req param null", __func__); |
| 15271 | return -EINVAL; |
| 15272 | } |
| 15273 | dev = request->wdev->netdev; |
| 15274 | #endif |
| 15275 | |
| 15276 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 15277 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 15278 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 15279 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15280 | ENTER(); |
| 15281 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15282 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 15283 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 15284 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15285 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15286 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15287 | if (0 != status) |
| 15288 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15289 | return status; |
| 15290 | } |
| 15291 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 15292 | if (NULL == pwextBuf) |
| 15293 | { |
| 15294 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 15295 | __func__); |
| 15296 | return -EIO; |
| 15297 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15298 | cfg_param = pHddCtx->cfg_ini; |
| 15299 | pScanInfo = &pHddCtx->scan_info; |
| 15300 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15301 | #ifdef WLAN_BTAMP_FEATURE |
| 15302 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 15303 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15304 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 15305 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15306 | "%s: No scanning when AMP is on", __func__); |
| 15307 | return -EOPNOTSUPP; |
| 15308 | } |
| 15309 | #endif |
| 15310 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 15311 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15312 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 15313 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15314 | "%s: Not scanning on device_mode = %s (%d)", |
| 15315 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 15316 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15317 | return -EOPNOTSUPP; |
| 15318 | } |
| 15319 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 15320 | if (pAdapter->device_mode == WLAN_HDD_MONITOR) { |
| 15321 | hddLog(LOGE, FL("Scan is not supported for monitor adapter")); |
| 15322 | return -EOPNOTSUPP; |
| 15323 | } |
| 15324 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15325 | if (TRUE == pScanInfo->mScanPending) |
| 15326 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 15327 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 15328 | { |
| 15329 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 15330 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 15331 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15332 | } |
| 15333 | |
Hanumantha Reddy Pothula | 4b6be06 | 2015-08-18 14:06:24 +0530 | [diff] [blame] | 15334 | // Don't allow scan if PNO scan is going on. |
| 15335 | if (pHddCtx->isPnoEnable) |
| 15336 | { |
| 15337 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15338 | FL("pno scan in progress")); |
| 15339 | return -EBUSY; |
| 15340 | } |
| 15341 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15342 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 15343 | //Channel and action frame is pending |
| 15344 | //Otherwise Cancel Remain On Channel and allow Scan |
| 15345 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 15346 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 15347 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 15348 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 15349 | return -EBUSY; |
| 15350 | } |
| 15351 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15352 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 15353 | { |
| 15354 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 15355 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15356 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15357 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15358 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 15359 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 15360 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15361 | "%s: MAX TM Level Scan not allowed", __func__); |
| 15362 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15363 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15364 | } |
| 15365 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 15366 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 15367 | /* Check if scan is allowed at this point of time. |
| 15368 | */ |
Hanumanth Reddy Pothula | ec96084 | 2016-09-14 19:04:26 +0530 | [diff] [blame] | 15369 | if (TRUE == pHddCtx->btCoexModeSet) |
| 15370 | { |
| 15371 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15372 | FL("BTCoex Mode operation in progress")); |
| 15373 | return -EBUSY; |
| 15374 | } |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 15375 | if (hdd_isConnectionInProgress(pHddCtx, &curr_session_id, &curr_reason)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 15376 | { |
Vignesh Viswanathan | e0a3f92 | 2017-08-10 19:15:44 +0530 | [diff] [blame] | 15377 | |
| 15378 | if (!(pHddCtx->scan_reject_cnt % HDD_SCAN_REJECT_RATE_LIMIT)) |
| 15379 | hddLog(LOGE, FL("Scan not allowed Session %d reason %d"), |
| 15380 | curr_session_id, curr_reason); |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 15381 | if (pHddCtx->last_scan_reject_session_id != curr_session_id || |
| 15382 | pHddCtx->last_scan_reject_reason != curr_reason || |
| 15383 | !pHddCtx->last_scan_reject_timestamp) |
| 15384 | { |
| 15385 | pHddCtx->last_scan_reject_session_id = curr_session_id; |
| 15386 | pHddCtx->last_scan_reject_reason = curr_reason; |
Abhishek Singh | 3e50077 | 2017-07-17 10:13:43 +0530 | [diff] [blame] | 15387 | pHddCtx->last_scan_reject_timestamp = |
Abhinav Kumar | 61d1bfe | 2018-07-26 00:30:22 +0530 | [diff] [blame^] | 15388 | jiffies + msecs_to_jiffies(SCAN_REJECT_THRESHOLD_TIME); |
Abhishek Singh | e4b1256 | 2017-06-20 16:53:39 +0530 | [diff] [blame] | 15389 | pHddCtx->scan_reject_cnt = 0; |
Agrawal Ashish | c932a8d | 2016-08-17 19:21:02 +0530 | [diff] [blame] | 15390 | } |
Abhishek Singh | e4b1256 | 2017-06-20 16:53:39 +0530 | [diff] [blame] | 15391 | else |
| 15392 | { |
| 15393 | pHddCtx->scan_reject_cnt++; |
| 15394 | |
Abhishek Singh | e4b1256 | 2017-06-20 16:53:39 +0530 | [diff] [blame] | 15395 | if ((pHddCtx->scan_reject_cnt >= |
| 15396 | SCAN_REJECT_THRESHOLD) && |
Abhinav Kumar | 61d1bfe | 2018-07-26 00:30:22 +0530 | [diff] [blame^] | 15397 | vos_system_time_after(jiffies, |
Abhishek Singh | 3e50077 | 2017-07-17 10:13:43 +0530 | [diff] [blame] | 15398 | pHddCtx->last_scan_reject_timestamp)) |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 15399 | { |
Abhinav Kumar | 61d1bfe | 2018-07-26 00:30:22 +0530 | [diff] [blame^] | 15400 | hddLog(LOGE, FL("Session %d reason %d reject cnt %d reject timestamp %lu jiffies %lu"), |
Vignesh Viswanathan | e0a3f92 | 2017-08-10 19:15:44 +0530 | [diff] [blame] | 15401 | curr_session_id, curr_reason, pHddCtx->scan_reject_cnt, |
Abhinav Kumar | 61d1bfe | 2018-07-26 00:30:22 +0530 | [diff] [blame^] | 15402 | pHddCtx->last_scan_reject_timestamp, jiffies); |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 15403 | pHddCtx->last_scan_reject_timestamp = 0; |
Abhishek Singh | e4b1256 | 2017-06-20 16:53:39 +0530 | [diff] [blame] | 15404 | pHddCtx->scan_reject_cnt = 0; |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 15405 | if (pHddCtx->cfg_ini->enableFatalEvent) |
| 15406 | vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL, |
| 15407 | WLAN_LOG_INDICATOR_HOST_DRIVER, |
| 15408 | WLAN_LOG_REASON_SCAN_NOT_ALLOWED, |
| 15409 | FALSE, FALSE); |
| 15410 | else |
| 15411 | { |
| 15412 | hddLog(LOGE, FL("Triggering SSR")); |
Anurag Chouhan | f0d0ba1 | 2018-02-09 15:13:43 +0530 | [diff] [blame] | 15413 | vos_wlanRestart(VOS_SCAN_REQ_EXPIRED); |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 15414 | } |
| 15415 | } |
| 15416 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 15417 | return -EBUSY; |
| 15418 | } |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 15419 | pHddCtx->last_scan_reject_timestamp = 0; |
| 15420 | pHddCtx->last_scan_reject_session_id = 0xFF; |
| 15421 | pHddCtx->last_scan_reject_reason = 0; |
Abhishek Singh | e4b1256 | 2017-06-20 16:53:39 +0530 | [diff] [blame] | 15422 | pHddCtx->scan_reject_cnt = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15423 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15424 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 15425 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15426 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 15427 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 15428 | * is not aging out the scan results. |
| 15429 | */ |
Hanumanth Reddy Pothula | 998efeb | 2017-10-31 15:43:19 +0530 | [diff] [blame] | 15430 | if ((request->ssids) && (request->n_ssids == 1) && |
| 15431 | ('\0' == request->ssids->ssid[0])) { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15432 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15433 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15434 | |
| 15435 | if ((request->ssids) && (0 < request->n_ssids)) |
| 15436 | { |
| 15437 | tCsrSSIDInfo *SsidInfo; |
| 15438 | int j; |
| 15439 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 15440 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 15441 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 15442 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 15443 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 15444 | |
| 15445 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 15446 | { |
| 15447 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15448 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 15449 | return -ENOMEM; |
| 15450 | } |
| 15451 | |
| 15452 | /* copy all the ssid's and their length */ |
| 15453 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 15454 | { |
| 15455 | /* get the ssid length */ |
| 15456 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 15457 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 15458 | SsidInfo->SSID.length); |
| 15459 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 15460 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 15461 | j, SsidInfo->SSID.ssId); |
| 15462 | } |
| 15463 | /* set the scan type to active */ |
| 15464 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 15465 | } |
| 15466 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15467 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 15468 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15469 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 15470 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15471 | /* set the scan type to active */ |
| 15472 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15473 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15474 | else |
| 15475 | { |
| 15476 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 15477 | scanRequest.scanType = pScanInfo->scan_mode; |
| 15478 | } |
| 15479 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 15480 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15481 | |
Selvaraj, Sridhar | d2b078a | 2016-06-18 10:44:37 +0530 | [diff] [blame] | 15482 | csr_scan_request_assign_bssid(&scanRequest, request); |
| 15483 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15484 | /* set BSSType to default type */ |
| 15485 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 15486 | |
| 15487 | /*TODO: scan the requested channels only*/ |
| 15488 | |
| 15489 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15490 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15491 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15492 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 15493 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 15494 | request->n_channels = MAX_CHANNEL; |
| 15495 | } |
| 15496 | |
| 15497 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 15498 | "No of Scan Channels: %d", request->n_channels); |
| 15499 | |
| 15500 | |
| 15501 | if( request->n_channels ) |
| 15502 | { |
| 15503 | char chList [(request->n_channels*5)+1]; |
| 15504 | int len; |
| 15505 | channelList = vos_mem_malloc( request->n_channels ); |
| 15506 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 15507 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15508 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15509 | "%s: memory alloc failed channelList", __func__); |
| 15510 | status = -ENOMEM; |
| 15511 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 15512 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15513 | |
| 15514 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 15515 | { |
| 15516 | channelList[i] = request->channels[i]->hw_value; |
| 15517 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 15518 | } |
| 15519 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 15520 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15521 | "Channel-List: %s ", chList); |
| 15522 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 15523 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15524 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 15525 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 15526 | |
| 15527 | /* set requestType to full scan */ |
| 15528 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 15529 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 15530 | /* if there is back to back scan happening in driver with in |
| 15531 | * nDeferScanTimeInterval interval driver should defer new scan request |
| 15532 | * and should provide last cached scan results instead of new channel list. |
| 15533 | * This rule is not applicable if scan is p2p scan. |
| 15534 | * This condition will work only in case when last request no of channels |
| 15535 | * and channels are exactly same as new request. |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 15536 | * This should be done only in connected state |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 15537 | * Scan shouldn't be defered for WPS scan case. |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 15538 | */ |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 15539 | |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 15540 | pWpsIe = wlan_hdd_get_wps_ie_ptr((v_U8_t*)request->ie,request->ie_len); |
| 15541 | /* if wps ie is NULL , then only defer scan */ |
| 15542 | if ( pWpsIe == NULL && |
| 15543 | (VOS_STATUS_SUCCESS == hdd_is_any_session_connected(pHddCtx))) |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 15544 | { |
| 15545 | if ( pScanInfo->last_scan_timestamp !=0 && |
| 15546 | ((vos_timer_get_system_time() - pScanInfo->last_scan_timestamp ) < pHddCtx->cfg_ini->nDeferScanTimeInterval)) |
| 15547 | { |
| 15548 | if ( request->no_cck == FALSE && scanRequest.ChannelInfo.numOfChannels != 1 && |
| 15549 | (pScanInfo->last_scan_numChannels == scanRequest.ChannelInfo.numOfChannels) && |
| 15550 | vos_mem_compare(pScanInfo->last_scan_channelList, |
| 15551 | channelList, pScanInfo->last_scan_numChannels)) |
| 15552 | { |
| 15553 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 15554 | " New and old station scan time differ is less then %u", |
| 15555 | pHddCtx->cfg_ini->nDeferScanTimeInterval); |
| 15556 | |
| 15557 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 15558 | pAdapter); |
| 15559 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 15560 | hddLog(VOS_TRACE_LEVEL_WARN, |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 15561 | "Return old cached scan as all channels and no of channels are same"); |
| 15562 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 15563 | if (0 > ret) |
| 15564 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 15565 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 15566 | hdd_cfg80211_scan_done(pAdapter, request, eCSR_SCAN_SUCCESS); |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 15567 | |
| 15568 | status = eHAL_STATUS_SUCCESS; |
| 15569 | goto free_mem; |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 15570 | } |
| 15571 | } |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 15572 | } |
| 15573 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15574 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 15575 | * search (Flush on both full scan and social scan but not on single |
| 15576 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 15577 | */ |
| 15578 | |
| 15579 | /* Supplicant does single channel scan after 8-way handshake |
| 15580 | * and in that case driver shoudnt flush scan results. If |
| 15581 | * driver flushes the scan results here and unfortunately if |
| 15582 | * the AP doesnt respond to our probe req then association |
| 15583 | * fails which is not desired |
| 15584 | */ |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 15585 | if ((request->n_ssids == 1) |
| 15586 | && (request->ssids != NULL) |
| 15587 | && vos_mem_compare(&request->ssids[0], "DIRECT-", 7)) |
| 15588 | is_p2p_scan = true; |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15589 | |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 15590 | if( is_p2p_scan || |
| 15591 | (request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN) ) |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15592 | { |
| 15593 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 15594 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15595 | pAdapter->sessionId ); |
| 15596 | } |
| 15597 | |
| 15598 | if( request->ie_len ) |
| 15599 | { |
| 15600 | /* save this for future association (join requires this) */ |
| 15601 | /*TODO: Array needs to be converted to dynamic allocation, |
| 15602 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 15603 | * CR 597966 |
| 15604 | */ |
| 15605 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 15606 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 15607 | pScanInfo->scanAddIE.length = request->ie_len; |
| 15608 | |
| 15609 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 15610 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 15611 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15612 | { |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 15613 | if (request->ie_len <= SIR_MAC_MAX_ADD_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15614 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15615 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 15616 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 15617 | request->ie, request->ie_len); |
| 15618 | } |
| 15619 | else |
| 15620 | { |
| 15621 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 15622 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15623 | } |
| 15624 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15625 | } |
| 15626 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 15627 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 15628 | |
| 15629 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 15630 | request->ie_len); |
| 15631 | if (pP2pIe != NULL) |
| 15632 | { |
| 15633 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 15634 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 15635 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 15636 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 15637 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15638 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 15639 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 15640 | "Go nego completed to Connection is started"); |
| 15641 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 15642 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 15643 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15644 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 15645 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15646 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15647 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 15648 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 15649 | "Disconnected state to Connection is started"); |
| 15650 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 15651 | "for 4way Handshake"); |
| 15652 | } |
| 15653 | #endif |
| 15654 | |
| 15655 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 15656 | if(TRUE == request->no_cck) |
| 15657 | { |
| 15658 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 15659 | "%s: This is a P2P Search", __func__); |
| 15660 | scanRequest.p2pSearch = 1; |
| 15661 | |
| 15662 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 15663 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15664 | /* set requestType to P2P Discovery */ |
| 15665 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 15666 | } |
| 15667 | |
| 15668 | /* |
| 15669 | Skip Dfs Channel in case of P2P Search |
| 15670 | if it is set in ini file |
| 15671 | */ |
| 15672 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 15673 | { |
| 15674 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 15675 | } |
| 15676 | else |
| 15677 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 15678 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 15679 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15680 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 15681 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15682 | } |
| 15683 | } |
| 15684 | |
| 15685 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 15686 | |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 15687 | #ifdef FEATURE_WLAN_TDLS |
| 15688 | /* if tdls disagree scan right now, return immediately. |
| 15689 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 15690 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 15691 | */ |
| 15692 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 15693 | wiphy, |
| 15694 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 15695 | dev, |
| 15696 | #endif |
| 15697 | request); |
Abhishek Singh | e2b6395 | 2016-01-05 18:27:29 +0530 | [diff] [blame] | 15698 | if (status <= 0) |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 15699 | { |
Abhishek Singh | e2b6395 | 2016-01-05 18:27:29 +0530 | [diff] [blame] | 15700 | if (!status) |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 15701 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 15702 | "scan rejected %d", __func__, status); |
| 15703 | else |
| 15704 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 15705 | __func__, status); |
Abhishek Singh | e2b6395 | 2016-01-05 18:27:29 +0530 | [diff] [blame] | 15706 | hdd_wlan_block_scan_by_tdls(); |
Gupta, Kapil | 2ebf3e0 | 2016-03-17 19:45:19 +0530 | [diff] [blame] | 15707 | goto free_mem; |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 15708 | } |
| 15709 | #endif |
| 15710 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 15711 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 15712 | * address the following issues. |
| 15713 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 15714 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 15715 | * for long time, this result in apps running at full power for long time. |
| 15716 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 15717 | * be stuck in full power because of resume BMPS |
| 15718 | */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 15719 | hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15720 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 15721 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 15722 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15723 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 15724 | scanRequest.requestType, scanRequest.scanType, |
| 15725 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 15726 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 15727 | |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 15728 | if (pHddCtx->spoofMacAddr.isEnabled && |
| 15729 | pHddCtx->cfg_ini->enableMacSpoofing == 1) |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 15730 | { |
| 15731 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 15732 | "%s: MAC Spoofing enabled for current scan", __func__); |
| 15733 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 15734 | * to fill TxBds for probe request during current scan |
| 15735 | */ |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 15736 | status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 15737 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 15738 | |
| 15739 | if(status != VOS_STATUS_SUCCESS) |
| 15740 | { |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 15741 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 15742 | status = -EFAULT; |
Ganesh Kondabattini | 6d3b490 | 2015-05-12 23:19:22 +0530 | [diff] [blame] | 15743 | #ifdef FEATURE_WLAN_TDLS |
| 15744 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 15745 | #endif |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 15746 | goto free_mem; |
| 15747 | } |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 15748 | } |
Mahesh A Saptasagar | 51dc36c | 2015-06-16 12:07:15 +0530 | [diff] [blame] | 15749 | 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] | 15750 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15751 | pAdapter->sessionId, &scanRequest, &scanId, |
| 15752 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15753 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15754 | if (eHAL_STATUS_SUCCESS != status) |
| 15755 | { |
| 15756 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15757 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 15758 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 15759 | if(eHAL_STATUS_RESOURCES == status) |
| 15760 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 15761 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 15762 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 15763 | status = -EBUSY; |
| 15764 | } else { |
| 15765 | status = -EIO; |
| 15766 | } |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 15767 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 15768 | |
| 15769 | #ifdef FEATURE_WLAN_TDLS |
| 15770 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 15771 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15772 | goto free_mem; |
| 15773 | } |
| 15774 | |
| 15775 | pScanInfo->mScanPending = TRUE; |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 15776 | pScanInfo->sessionId = pAdapter->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15777 | pAdapter->request = request; |
| 15778 | pScanInfo->scanId = scanId; |
Hanumanth Reddy Pothula | f31f65c | 2018-01-30 19:51:27 +0530 | [diff] [blame] | 15779 | pScanInfo->no_cck = request->no_cck; |
| 15780 | pHddCtx->scan_info.last_scan_numChannels = request->n_channels; |
| 15781 | for (i = 0; i < pHddCtx->scan_info.last_scan_numChannels; i++) { |
| 15782 | pHddCtx->scan_info.last_scan_channelList[i] = |
| 15783 | request->channels[i]->hw_value; |
| 15784 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15785 | |
| 15786 | complete(&pScanInfo->scan_req_completion_event); |
| 15787 | |
| 15788 | free_mem: |
| 15789 | if( scanRequest.SSIDs.SSIDList ) |
| 15790 | { |
| 15791 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 15792 | } |
| 15793 | |
| 15794 | if( channelList ) |
| 15795 | vos_mem_free( channelList ); |
| 15796 | |
| 15797 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15798 | return status; |
| 15799 | } |
| 15800 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 15801 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 15802 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 15803 | struct net_device *dev, |
| 15804 | #endif |
| 15805 | struct cfg80211_scan_request *request) |
| 15806 | { |
| 15807 | int ret; |
| 15808 | |
| 15809 | vos_ssr_protect(__func__); |
| 15810 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 15811 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 15812 | dev, |
| 15813 | #endif |
| 15814 | request); |
| 15815 | vos_ssr_unprotect(__func__); |
| 15816 | |
| 15817 | return ret; |
| 15818 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 15819 | |
| 15820 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 15821 | { |
| 15822 | v_U8_t iniDot11Mode = |
| 15823 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 15824 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 15825 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 15826 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 15827 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 15828 | switch ( iniDot11Mode ) |
| 15829 | { |
| 15830 | case eHDD_DOT11_MODE_AUTO: |
| 15831 | case eHDD_DOT11_MODE_11ac: |
| 15832 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 15833 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 4b1d235 | 2014-08-01 21:59:28 +0530 | [diff] [blame] | 15834 | if ( sme_IsFeatureSupportedByDriver(DOT11AC) && |
| 15835 | sme_IsFeatureSupportedByFW(DOT11AC) ) |
| 15836 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 15837 | else |
| 15838 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 15839 | #else |
| 15840 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 15841 | #endif |
| 15842 | break; |
| 15843 | case eHDD_DOT11_MODE_11n: |
| 15844 | case eHDD_DOT11_MODE_11n_ONLY: |
| 15845 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 15846 | break; |
| 15847 | default: |
| 15848 | hddDot11Mode = iniDot11Mode; |
| 15849 | break; |
| 15850 | } |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 15851 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 15852 | if (operationChannel > SIR_11B_CHANNEL_END) |
| 15853 | #endif |
| 15854 | { |
| 15855 | /* This call decides required channel bonding mode */ |
| 15856 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 15857 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
Abhishek Singh | 02b823e | 2017-10-30 17:53:20 +0530 | [diff] [blame] | 15858 | operationChannel, eHT_MAX_CHANNEL_WIDTH); |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 15859 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 15860 | } |
| 15861 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15862 | /* |
| 15863 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15864 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15865 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15866 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Hanumantha Reddy Pothula | 64081b7 | 2015-09-11 15:47:32 +0530 | [diff] [blame] | 15867 | const u8 *ssid, size_t ssid_len, const u8 *bssid, |
| 15868 | const u8 *bssid_hint, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15869 | { |
| 15870 | int status = 0; |
| 15871 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 15872 | hdd_context_t *pHddCtx; |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 15873 | hdd_station_ctx_t *hdd_sta_ctx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15874 | v_U32_t roamId; |
| 15875 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15876 | eCsrAuthType RSNAuthType; |
| 15877 | |
| 15878 | ENTER(); |
| 15879 | |
| 15880 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 15881 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 15882 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 15883 | |
| 15884 | status = wlan_hdd_validate_context(pHddCtx); |
| 15885 | if (status) |
| 15886 | { |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 15887 | return status; |
| 15888 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15889 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15890 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 15891 | { |
| 15892 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 15893 | return -EINVAL; |
| 15894 | } |
| 15895 | |
Nitesh Shah | 9b06628 | 2017-06-06 18:05:52 +0530 | [diff] [blame] | 15896 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15897 | pRoamProfile = &pWextState->roamProfile; |
| 15898 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15899 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15900 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15901 | hdd_station_ctx_t *pHddStaCtx; |
| 15902 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Abhishek Singh | 6782c9e | 2017-06-06 13:37:45 +0530 | [diff] [blame] | 15903 | pHddStaCtx->get_mgmt_log_sent = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15904 | |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 15905 | wlan_hdd_get_frame_logs(pAdapter, WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR); |
| 15906 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15907 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15908 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 15909 | { |
| 15910 | /*QoS not enabled in cfg file*/ |
| 15911 | pRoamProfile->uapsd_mask = 0; |
| 15912 | } |
| 15913 | else |
| 15914 | { |
| 15915 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15916 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15917 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 15918 | } |
| 15919 | |
| 15920 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 15921 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 15922 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15923 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15924 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 15925 | ssid, ssid_len); |
| 15926 | |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 15927 | vos_mem_zero(pRoamProfile->BSSIDs.bssid, WNI_CFG_BSSID_LEN); |
| 15928 | vos_mem_zero(pRoamProfile->bssid_hint, WNI_CFG_BSSID_LEN); |
| 15929 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15930 | if (bssid) |
| 15931 | { |
| 15932 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 15933 | vos_mem_copy(pRoamProfile->BSSIDs.bssid, bssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15934 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15935 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 15936 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15937 | case of join failure we should send valid BSSID to supplicant |
| 15938 | */ |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 15939 | vos_mem_copy(pWextState->req_bssId, bssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15940 | WNI_CFG_BSSID_LEN); |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 15941 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15942 | } |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 15943 | else if (bssid_hint) |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 15944 | { |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 15945 | /* Store bssid_hint to use in the scan filter. */ |
| 15946 | vos_mem_copy(pRoamProfile->bssid_hint, bssid_hint, |
| 15947 | WNI_CFG_BSSID_LEN); |
| 15948 | /* |
| 15949 | * Save BSSID in seperate variable as well, as RoamProfile |
| 15950 | * BSSID is getting zeroed out in the association process. And in |
| 15951 | * case of join failure we should send valid BSSID to supplicant |
| 15952 | */ |
| 15953 | vos_mem_copy(pWextState->req_bssId, bssid_hint, |
| 15954 | WNI_CFG_BSSID_LEN); |
| 15955 | hddLog(LOG1, FL(" bssid_hint: "MAC_ADDRESS_STR), |
| 15956 | MAC_ADDR_ARRAY(pRoamProfile->bssid_hint)); |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 15957 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15958 | |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 15959 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 15960 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 15961 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15962 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 15963 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15964 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15965 | /*set gen ie*/ |
| 15966 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 15967 | /*set auth*/ |
| 15968 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 15969 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15970 | #ifdef FEATURE_WLAN_WAPI |
| 15971 | if (pAdapter->wapi_info.nWapiMode) |
| 15972 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 15973 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15974 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 15975 | { |
| 15976 | case WAPI_AUTH_MODE_PSK: |
| 15977 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 15978 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15979 | pAdapter->wapi_info.wapiAuthMode); |
| 15980 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 15981 | break; |
| 15982 | } |
| 15983 | case WAPI_AUTH_MODE_CERT: |
| 15984 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 15985 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15986 | pAdapter->wapi_info.wapiAuthMode); |
| 15987 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 15988 | break; |
| 15989 | } |
| 15990 | } // End of switch |
| 15991 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 15992 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 15993 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 15994 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15995 | pRoamProfile->AuthType.numEntries = 1; |
| 15996 | pRoamProfile->EncryptionType.numEntries = 1; |
| 15997 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 15998 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 15999 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 16000 | } |
| 16001 | } |
| 16002 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16003 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 16004 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16005 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 16006 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 16007 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 16008 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 16009 | sizeof (tSirGtkOffloadParams)); |
| 16010 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 16011 | } |
| 16012 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16013 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 16014 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 16015 | if( operatingChannel ) |
| 16016 | { |
| 16017 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 16018 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 16019 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 16020 | else |
| 16021 | { |
| 16022 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 16023 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 16024 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 16025 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 16026 | { |
| 16027 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 16028 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 16029 | |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 16030 | /* |
| 16031 | * Change conn_state to connecting before sme_RoamConnect(), |
| 16032 | * because sme_RoamConnect() has a direct path to call |
| 16033 | * hdd_smeRoamCallback(), which will change the conn_state |
| 16034 | * If direct path, conn_state will be accordingly changed |
| 16035 | * to NotConnected or Associated by either |
| 16036 | * hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() |
| 16037 | * in sme_RoamCallback() |
| 16038 | * if sme_RomConnect is to be queued, |
| 16039 | * Connecting state will remain until it is completed. |
| 16040 | * If connection state is not changed, |
| 16041 | * connection state will remain in eConnectionState_NotConnected state. |
| 16042 | * In hdd_AssociationCompletionHandler, "hddDisconInProgress" is set to true |
| 16043 | * if conn state is eConnectionState_NotConnected. |
| 16044 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 16045 | * informed of connect result indication which is an issue. |
| 16046 | */ |
| 16047 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 16048 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 16049 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 16050 | { |
| 16051 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 16052 | FL("Set HDD connState to eConnectionState_Connecting")); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 16053 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 16054 | eConnectionState_Connecting); |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 16055 | vos_flush_delayed_work(&pHddCtx->ecsa_chan_change_work); |
| 16056 | hdd_wait_for_ecsa_complete(pHddCtx); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 16057 | } |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 16058 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16059 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16060 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 16061 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 16062 | if ((eHAL_STATUS_SUCCESS != status) && |
| 16063 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 16064 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 16065 | |
| 16066 | { |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 16067 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 16068 | FL("sme_RoamConnect (session %d) failed with status %d. -> NotConnected"), |
| 16069 | pAdapter->sessionId, status); |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 16070 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 16071 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 16072 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 16073 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 16074 | |
| 16075 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 16076 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 16077 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16078 | } |
| 16079 | else |
| 16080 | { |
| 16081 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 16082 | return -EINVAL; |
| 16083 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 16084 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16085 | return status; |
| 16086 | } |
| 16087 | |
| 16088 | /* |
| 16089 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 16090 | * This function is used to set the authentication type (OPEN/SHARED). |
| 16091 | * |
| 16092 | */ |
| 16093 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 16094 | enum nl80211_auth_type auth_type) |
| 16095 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16096 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16097 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 16098 | |
| 16099 | ENTER(); |
| 16100 | |
| 16101 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16102 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16103 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16104 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 16105 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 16106 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 16107 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 16108 | break; |
| 16109 | |
| 16110 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16111 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 16112 | case NL80211_AUTHTYPE_FT: |
| 16113 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16114 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16115 | "%s: set authentication type to OPEN", __func__); |
| 16116 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 16117 | break; |
| 16118 | |
| 16119 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16120 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16121 | "%s: set authentication type to SHARED", __func__); |
| 16122 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 16123 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 16124 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16125 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16126 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16127 | "%s: set authentication type to CCKM WPA", __func__); |
| 16128 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 16129 | break; |
| 16130 | #endif |
| 16131 | |
| 16132 | |
| 16133 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16134 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 16135 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16136 | auth_type); |
| 16137 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 16138 | return -EINVAL; |
| 16139 | } |
| 16140 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16141 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16142 | pHddStaCtx->conn_info.authType; |
| 16143 | return 0; |
| 16144 | } |
| 16145 | |
| 16146 | /* |
| 16147 | * FUNCTION: wlan_hdd_set_akm_suite |
| 16148 | * This function is used to set the key mgmt type(PSK/8021x). |
| 16149 | * |
| 16150 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16151 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16152 | u32 key_mgmt |
| 16153 | ) |
| 16154 | { |
| 16155 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 16156 | ENTER(); |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 16157 | /* Should be in ieee802_11_defs.h */ |
Vidyullatha Kanchanapally | 0819768 | 2017-04-18 16:30:11 +0530 | [diff] [blame] | 16158 | #ifndef WLAN_AKM_SUITE_8021X_SHA256 |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 16159 | #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05 |
Vidyullatha Kanchanapally | 0819768 | 2017-04-18 16:30:11 +0530 | [diff] [blame] | 16160 | #endif |
| 16161 | #ifndef WLAN_AKM_SUITE_PSK_SHA256 |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 16162 | #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06 |
Vidyullatha Kanchanapally | 0819768 | 2017-04-18 16:30:11 +0530 | [diff] [blame] | 16163 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16164 | /*set key mgmt type*/ |
| 16165 | switch(key_mgmt) |
| 16166 | { |
| 16167 | case WLAN_AKM_SUITE_PSK: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 16168 | case WLAN_AKM_SUITE_PSK_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 16169 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 16170 | case WLAN_AKM_SUITE_FT_PSK: |
| 16171 | #endif |
| 16172 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16173 | __func__); |
| 16174 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 16175 | break; |
| 16176 | |
| 16177 | case WLAN_AKM_SUITE_8021X: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 16178 | case WLAN_AKM_SUITE_8021X_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 16179 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 16180 | case WLAN_AKM_SUITE_FT_8021X: |
| 16181 | #endif |
| 16182 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16183 | __func__); |
| 16184 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 16185 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 16186 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16187 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 16188 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 16189 | case WLAN_AKM_SUITE_CCKM: |
| 16190 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 16191 | __func__); |
| 16192 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 16193 | break; |
| 16194 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 16195 | #ifndef WLAN_AKM_SUITE_OSEN |
| 16196 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 16197 | case WLAN_AKM_SUITE_OSEN: |
| 16198 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 16199 | __func__); |
| 16200 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 16201 | break; |
| 16202 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16203 | |
| 16204 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16205 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16206 | __func__, key_mgmt); |
| 16207 | return -EINVAL; |
| 16208 | |
| 16209 | } |
| 16210 | return 0; |
| 16211 | } |
| 16212 | |
| 16213 | /* |
| 16214 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16215 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16216 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 16217 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16218 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 16219 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16220 | bool ucast |
| 16221 | ) |
| 16222 | { |
| 16223 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16224 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16225 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 16226 | |
| 16227 | ENTER(); |
| 16228 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16229 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16230 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 16231 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16232 | __func__, cipher); |
| 16233 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 16234 | } |
| 16235 | else |
| 16236 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16237 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16238 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16239 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16240 | { |
| 16241 | case IW_AUTH_CIPHER_NONE: |
| 16242 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 16243 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16244 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16245 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 16246 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16247 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16248 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16249 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 16250 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16251 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16252 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16253 | case WLAN_CIPHER_SUITE_TKIP: |
| 16254 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 16255 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16256 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16257 | case WLAN_CIPHER_SUITE_CCMP: |
| 16258 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 16259 | break; |
| 16260 | #ifdef FEATURE_WLAN_WAPI |
| 16261 | case WLAN_CIPHER_SUITE_SMS4: |
| 16262 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 16263 | break; |
| 16264 | #endif |
| 16265 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 16266 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16267 | case WLAN_CIPHER_SUITE_KRK: |
| 16268 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 16269 | break; |
| 16270 | #endif |
| 16271 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16272 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16273 | __func__, cipher); |
| 16274 | return -EOPNOTSUPP; |
| 16275 | } |
| 16276 | } |
| 16277 | |
| 16278 | if (ucast) |
| 16279 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16280 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16281 | __func__, encryptionType); |
| 16282 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 16283 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16284 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16285 | encryptionType; |
| 16286 | } |
| 16287 | else |
| 16288 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16289 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16290 | __func__, encryptionType); |
| 16291 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 16292 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 16293 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 16294 | } |
| 16295 | |
| 16296 | return 0; |
| 16297 | } |
| 16298 | |
| 16299 | |
| 16300 | /* |
| 16301 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 16302 | * This function is used to parse WPA/RSN IE's. |
| 16303 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16304 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16305 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 16306 | const u8 *ie, |
| 16307 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16308 | u8 *ie, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16309 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16310 | size_t ie_len |
| 16311 | ) |
| 16312 | { |
| 16313 | 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] | 16314 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 16315 | const u8 *genie = ie; |
| 16316 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16317 | u8 *genie = ie; |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16318 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16319 | v_U16_t remLen = ie_len; |
| 16320 | #ifdef FEATURE_WLAN_WAPI |
| 16321 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 16322 | u16 *tmp; |
| 16323 | v_U16_t akmsuiteCount; |
| 16324 | int *akmlist; |
| 16325 | #endif |
| 16326 | ENTER(); |
| 16327 | |
| 16328 | /* clear previous assocAddIE */ |
| 16329 | pWextState->assocAddIE.length = 0; |
| 16330 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 16331 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16332 | |
| 16333 | while (remLen >= 2) |
| 16334 | { |
| 16335 | v_U16_t eLen = 0; |
| 16336 | v_U8_t elementId; |
| 16337 | elementId = *genie++; |
| 16338 | eLen = *genie++; |
| 16339 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16340 | |
Nachiket Kukade | 4aba5f0 | 2017-06-09 15:43:48 +0530 | [diff] [blame] | 16341 | /* Sanity check on eLen */ |
| 16342 | if (eLen > remLen) { |
| 16343 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Invalid IE length[%d] for IE[0x%X]", |
| 16344 | __func__, eLen, elementId); |
| 16345 | VOS_ASSERT(0); |
| 16346 | return -EINVAL; |
| 16347 | } |
| 16348 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16349 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16350 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16351 | |
| 16352 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16353 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16354 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 16355 | 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] | 16356 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16357 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16358 | "%s: Invalid WPA IE", __func__); |
| 16359 | return -EINVAL; |
| 16360 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16361 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16362 | { |
| 16363 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16364 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16365 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16366 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 16367 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16368 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 16369 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 16370 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16371 | VOS_ASSERT(0); |
| 16372 | return -ENOMEM; |
| 16373 | } |
| 16374 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 16375 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 16376 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16377 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16378 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 16379 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 16380 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 16381 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16382 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 16383 | { |
Nachiket Kukade | 3d72b7e | 2017-06-09 16:58:24 +0530 | [diff] [blame] | 16384 | if (eLen > (MAX_WPA_RSN_IE_LEN - 2)) { |
| 16385 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Invalid WPA RSN IE length[%d]", |
| 16386 | __func__, eLen); |
| 16387 | VOS_ASSERT(0); |
| 16388 | return -EINVAL; |
| 16389 | } |
| 16390 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16391 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 16392 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 16393 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 16394 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 16395 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 16396 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16397 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 16398 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16399 | { |
| 16400 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16401 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16402 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16403 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 16404 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16405 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 16406 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 16407 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16408 | VOS_ASSERT(0); |
| 16409 | return -ENOMEM; |
| 16410 | } |
| 16411 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 16412 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 16413 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16414 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16415 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 16416 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 16417 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16418 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16419 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 16420 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16421 | /*Consider WFD IE, only for P2P Client */ |
| 16422 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 16423 | { |
| 16424 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16425 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16426 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16427 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 16428 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16429 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 16430 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 16431 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16432 | VOS_ASSERT(0); |
| 16433 | return -ENOMEM; |
| 16434 | } |
| 16435 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 16436 | // WPS IE + P2P IE + WFD IE |
| 16437 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 16438 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16440 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 16441 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 16442 | } |
| 16443 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 16444 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16445 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 16446 | HS20_OUI_TYPE_SIZE)) ) |
| 16447 | { |
| 16448 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16449 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 16450 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 16451 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 16452 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 16453 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 16454 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 16455 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 16456 | VOS_ASSERT(0); |
| 16457 | return -ENOMEM; |
| 16458 | } |
| 16459 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 16460 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 16461 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 16462 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 16463 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 16464 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 16465 | /* Appending OSEN Information Element in Assiciation Request */ |
| 16466 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 16467 | OSEN_OUI_TYPE_SIZE)) ) |
| 16468 | { |
| 16469 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 16470 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 16471 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 16472 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 16473 | 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] | 16474 | { |
| 16475 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 16476 | "Need bigger buffer space"); |
| 16477 | VOS_ASSERT(0); |
| 16478 | return -ENOMEM; |
| 16479 | } |
| 16480 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 16481 | pWextState->assocAddIE.length += eLen + 2; |
| 16482 | |
| 16483 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 16484 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 16485 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 16486 | } |
| 16487 | |
Abhishek Singh | 4322e62 | 2015-06-10 15:42:54 +0530 | [diff] [blame] | 16488 | /* Update only for WPA IE */ |
| 16489 | if (!memcmp(genie, WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) && |
| 16490 | (WLAN_HDD_IBSS == pAdapter->device_mode)) { |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 16491 | |
| 16492 | /* populating as ADDIE in beacon frames */ |
| 16493 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16494 | 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] | 16495 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 16496 | { |
| 16497 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 16498 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 16499 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 16500 | { |
| 16501 | hddLog(LOGE, |
| 16502 | "Coldn't pass " |
| 16503 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 16504 | } |
| 16505 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 16506 | else |
| 16507 | hddLog(LOGE, |
| 16508 | "Could not pass on " |
| 16509 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 16510 | |
| 16511 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 16512 | beaconIE's need to be populated in probe response frames */ |
| 16513 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 16514 | { |
| 16515 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 16516 | u8 probe_rsp_ie_len[3] = {0}; |
| 16517 | u8 counter = 0; |
| 16518 | |
| 16519 | /* Check Probe Resp Length if it is greater then 255 then |
| 16520 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 16521 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 16522 | not able Store More then 255 bytes into One Variable */ |
| 16523 | |
| 16524 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 16525 | { |
| 16526 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 16527 | { |
| 16528 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 16529 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 16530 | } |
| 16531 | else |
| 16532 | { |
| 16533 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 16534 | rem_probe_resp_ie_len = 0; |
| 16535 | } |
| 16536 | } |
| 16537 | |
| 16538 | rem_probe_resp_ie_len = 0; |
| 16539 | |
| 16540 | if (probe_rsp_ie_len[0] > 0) |
| 16541 | { |
| 16542 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 16543 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 16544 | (tANI_U8*)(genie - 2), |
| 16545 | probe_rsp_ie_len[0], NULL, |
| 16546 | eANI_BOOLEAN_FALSE) |
| 16547 | == eHAL_STATUS_FAILURE) |
| 16548 | { |
| 16549 | hddLog(LOGE, |
| 16550 | "Could not pass" |
| 16551 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 16552 | } |
| 16553 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 16554 | } |
| 16555 | |
| 16556 | if (probe_rsp_ie_len[1] > 0) |
| 16557 | { |
| 16558 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 16559 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 16560 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 16561 | probe_rsp_ie_len[1], NULL, |
| 16562 | eANI_BOOLEAN_FALSE) |
| 16563 | == eHAL_STATUS_FAILURE) |
| 16564 | { |
| 16565 | hddLog(LOGE, |
| 16566 | "Could not pass" |
| 16567 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 16568 | } |
| 16569 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 16570 | } |
| 16571 | |
| 16572 | if (probe_rsp_ie_len[2] > 0) |
| 16573 | { |
| 16574 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 16575 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 16576 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 16577 | probe_rsp_ie_len[2], NULL, |
| 16578 | eANI_BOOLEAN_FALSE) |
| 16579 | == eHAL_STATUS_FAILURE) |
| 16580 | { |
| 16581 | hddLog(LOGE, |
| 16582 | "Could not pass" |
| 16583 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 16584 | } |
| 16585 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 16586 | } |
| 16587 | |
| 16588 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 16589 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 16590 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 16591 | { |
| 16592 | hddLog(LOGE, |
| 16593 | "Could not pass" |
| 16594 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 16595 | } |
| 16596 | } |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 16597 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16598 | break; |
| 16599 | case DOT11F_EID_RSN: |
Nachiket Kukade | 307d489 | 2018-01-23 23:36:25 +0530 | [diff] [blame] | 16600 | if (eLen > (MAX_WPA_RSN_IE_LEN - 2)) { |
| 16601 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Invalid WPA RSN IE length[%d], exceeds %d bytes", |
| 16602 | __func__, eLen, MAX_WPA_RSN_IE_LEN - 2); |
| 16603 | VOS_ASSERT(0); |
| 16604 | return -EINVAL; |
| 16605 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16606 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 16607 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 16608 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 16609 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 16610 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 16611 | break; |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 16612 | |
Abhishek Singh | b16f356 | 2016-01-20 11:08:32 +0530 | [diff] [blame] | 16613 | /* Appending extended capabilities with Interworking or |
| 16614 | * bsstransition bit set in Assoc Req. |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 16615 | * |
| 16616 | * 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] | 16617 | * interworkingService or bsstransition bit is set to 1. |
| 16618 | * Driver is only interested in interworkingService and |
| 16619 | * bsstransition capability from supplicant. |
| 16620 | * If in future any other EXT Cap info is |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 16621 | * required from supplicat, it needs to be handled while |
| 16622 | * sending Assoc Req in LIM. |
| 16623 | */ |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 16624 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16625 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 16626 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16627 | 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] | 16628 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16629 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 16630 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 16631 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 16632 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 16633 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 16634 | VOS_ASSERT(0); |
| 16635 | return -ENOMEM; |
| 16636 | } |
| 16637 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 16638 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16639 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 16640 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 16641 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 16642 | break; |
| 16643 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16644 | #ifdef FEATURE_WLAN_WAPI |
| 16645 | case WLAN_EID_WAPI: |
| 16646 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 16647 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16648 | pAdapter->wapi_info.nWapiMode); |
| 16649 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16650 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16651 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 16652 | tmp = tmp + 1; |
| 16653 | akmlist = (int *)(tmp); |
| 16654 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 16655 | { |
| 16656 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 16657 | } |
| 16658 | else |
| 16659 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16660 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16661 | VOS_ASSERT(0); |
| 16662 | return -EINVAL; |
| 16663 | } |
| 16664 | |
| 16665 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 16666 | { |
| 16667 | 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] | 16668 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16669 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16670 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16671 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16672 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16673 | 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] | 16674 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16675 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 16676 | } |
| 16677 | break; |
| 16678 | #endif |
| 16679 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16680 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16681 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 16682 | /* when Unknown IE is received we should break and continue |
| 16683 | * to the next IE in the buffer instead we were returning |
| 16684 | * so changing this to break */ |
| 16685 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16686 | } |
| 16687 | genie += eLen; |
| 16688 | remLen -= eLen; |
| 16689 | } |
| 16690 | EXIT(); |
| 16691 | return 0; |
| 16692 | } |
| 16693 | |
| 16694 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 16695 | * FUNCTION: hdd_isWPAIEPresent |
| 16696 | * Parse the received IE to find the WPA IE |
| 16697 | * |
| 16698 | */ |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16699 | static bool hdd_isWPAIEPresent( |
| 16700 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 16701 | const u8 *ie, |
| 16702 | #else |
| 16703 | u8 *ie, |
| 16704 | #endif |
| 16705 | u8 ie_len) |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 16706 | { |
| 16707 | v_U8_t eLen = 0; |
| 16708 | v_U16_t remLen = ie_len; |
| 16709 | v_U8_t elementId = 0; |
| 16710 | |
| 16711 | while (remLen >= 2) |
| 16712 | { |
| 16713 | elementId = *ie++; |
| 16714 | eLen = *ie++; |
| 16715 | remLen -= 2; |
| 16716 | if (eLen > remLen) |
| 16717 | { |
| 16718 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 16719 | "%s: IE length is wrong %d", __func__, eLen); |
| 16720 | return FALSE; |
| 16721 | } |
| 16722 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 16723 | { |
| 16724 | /* OUI - 0x00 0X50 0XF2 |
| 16725 | WPA Information Element - 0x01 |
| 16726 | WPA version - 0x01*/ |
| 16727 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 16728 | return TRUE; |
| 16729 | } |
| 16730 | ie += eLen; |
| 16731 | remLen -= eLen; |
| 16732 | } |
| 16733 | return FALSE; |
| 16734 | } |
| 16735 | |
| 16736 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16737 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16738 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16739 | * parameters during connect operation. |
| 16740 | */ |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16741 | int wlan_hdd_cfg80211_set_privacy(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16742 | struct cfg80211_connect_params *req |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16743 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16744 | { |
| 16745 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16746 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16747 | ENTER(); |
| 16748 | |
| 16749 | /*set wpa version*/ |
| 16750 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 16751 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16752 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16753 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 16754 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16755 | { |
| 16756 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 16757 | } |
| 16758 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 16759 | { |
| 16760 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 16761 | } |
| 16762 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16763 | |
| 16764 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16765 | pWextState->wpaVersion); |
| 16766 | |
| 16767 | /*set authentication type*/ |
| 16768 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 16769 | |
| 16770 | if (0 > status) |
| 16771 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16772 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16773 | "%s: failed to set authentication type ", __func__); |
| 16774 | return status; |
| 16775 | } |
| 16776 | |
| 16777 | /*set key mgmt type*/ |
| 16778 | if (req->crypto.n_akm_suites) |
| 16779 | { |
| 16780 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 16781 | if (0 > status) |
| 16782 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16783 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16784 | __func__); |
| 16785 | return status; |
| 16786 | } |
| 16787 | } |
| 16788 | |
| 16789 | /*set pairwise cipher type*/ |
| 16790 | if (req->crypto.n_ciphers_pairwise) |
| 16791 | { |
| 16792 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 16793 | req->crypto.ciphers_pairwise[0], true); |
| 16794 | if (0 > status) |
| 16795 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16796 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16797 | "%s: failed to set unicast cipher type", __func__); |
| 16798 | return status; |
| 16799 | } |
| 16800 | } |
| 16801 | else |
| 16802 | { |
| 16803 | /*Reset previous cipher suite to none*/ |
| 16804 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 16805 | if (0 > status) |
| 16806 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16807 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16808 | "%s: failed to set unicast cipher type", __func__); |
| 16809 | return status; |
| 16810 | } |
| 16811 | } |
| 16812 | |
| 16813 | /*set group cipher type*/ |
| 16814 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 16815 | false); |
| 16816 | |
| 16817 | if (0 > status) |
| 16818 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16819 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16820 | __func__); |
| 16821 | return status; |
| 16822 | } |
| 16823 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 16824 | #ifdef WLAN_FEATURE_11W |
| 16825 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 16826 | #endif |
| 16827 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16828 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 16829 | if (req->ie_len) |
| 16830 | { |
| 16831 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 16832 | if ( 0 > status) |
| 16833 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16834 | 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] | 16835 | __func__); |
| 16836 | return status; |
| 16837 | } |
| 16838 | } |
| 16839 | |
| 16840 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16841 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16842 | { |
| 16843 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 16844 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 16845 | ) |
| 16846 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16847 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16848 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 16849 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16850 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16851 | __func__); |
| 16852 | return -EOPNOTSUPP; |
| 16853 | } |
| 16854 | else |
| 16855 | { |
| 16856 | u8 key_len = req->key_len; |
| 16857 | u8 key_idx = req->key_idx; |
| 16858 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16859 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16860 | && (CSR_MAX_NUM_KEY > key_idx) |
| 16861 | ) |
| 16862 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16863 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 16864 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16865 | __func__, key_idx, key_len); |
| 16866 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16867 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16868 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16869 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16870 | (u8)key_len; |
| 16871 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 16872 | } |
| 16873 | } |
| 16874 | } |
| 16875 | } |
| 16876 | |
| 16877 | return status; |
| 16878 | } |
| 16879 | |
| 16880 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16881 | * FUNCTION: wlan_hdd_try_disconnect |
| 16882 | * This function is used to disconnect from previous |
| 16883 | * connection |
| 16884 | */ |
Agrawal Ashish | c407f19 | 2017-01-23 17:18:35 +0530 | [diff] [blame] | 16885 | int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16886 | { |
| 16887 | long ret = 0; |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 16888 | int status, result = 0; |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16889 | hdd_station_ctx_t *pHddStaCtx; |
| 16890 | eMib_dot11DesiredBssType connectedBssType; |
Abhishek Singh | 19a7dd9 | 2015-12-30 16:31:51 +0530 | [diff] [blame] | 16891 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16892 | |
Abhishek Singh | 19a7dd9 | 2015-12-30 16:31:51 +0530 | [diff] [blame] | 16893 | ret = wlan_hdd_validate_context(pHddCtx); |
| 16894 | if (0 != ret) |
| 16895 | { |
| 16896 | return ret; |
| 16897 | } |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16898 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 16899 | |
| 16900 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 16901 | |
| 16902 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 16903 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
Abhishek Singh | 630ff59 | 2016-01-07 18:15:53 +0530 | [diff] [blame] | 16904 | (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) || |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16905 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 16906 | { |
Abhishek Singh | 9f4df78 | 2017-03-15 17:29:10 +0530 | [diff] [blame] | 16907 | /* Indicate disconnect to SME so that in-progress connection or preauth |
| 16908 | * can be aborted |
| 16909 | */ |
| 16910 | sme_abortConnection(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 16911 | pAdapter->sessionId); |
Abhishek Singh | 19a7dd9 | 2015-12-30 16:31:51 +0530 | [diff] [blame] | 16912 | spin_lock_bh(&pAdapter->lock_for_active_session); |
| 16913 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 16914 | { |
| 16915 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 16916 | } |
| 16917 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Abhishek Singh | f796258 | 2015-10-23 10:54:06 +0530 | [diff] [blame] | 16918 | hdd_connSetConnectionState(pHddStaCtx, |
| 16919 | eConnectionState_Disconnecting); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16920 | /* Issue disconnect to CSR */ |
| 16921 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 16922 | status = sme_RoamDisconnect(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16923 | pAdapter->sessionId, |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 16924 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 16925 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) { |
| 16926 | hddLog(LOG1, |
| 16927 | FL("Already disconnected or connect was in sme/roam pending list and removed by disconnect")); |
| 16928 | } else if ( 0 != status ) { |
| 16929 | hddLog(LOGE, |
| 16930 | FL("csrRoamDisconnect failure, returned %d"), |
| 16931 | (int)status ); |
| 16932 | result = -EINVAL; |
| 16933 | goto disconnected; |
| 16934 | } |
| 16935 | ret = wait_for_completion_timeout( |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16936 | &pAdapter->disconnect_comp_var, |
| 16937 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 16938 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status)) { |
| 16939 | hddLog(LOGE, |
| 16940 | "%s: Failed to disconnect, timed out", __func__); |
| 16941 | result = -ETIMEDOUT; |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16942 | } |
| 16943 | } |
| 16944 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 16945 | { |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 16946 | ret = wait_for_completion_timeout( |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16947 | &pAdapter->disconnect_comp_var, |
| 16948 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 16949 | if (!ret) |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16950 | { |
| 16951 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 16952 | result = -ETIMEDOUT; |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16953 | } |
| 16954 | } |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 16955 | disconnected: |
| 16956 | hddLog(LOG1, |
| 16957 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 16958 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 16959 | return result; |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 16960 | } |
| 16961 | |
Selvaraj, Sridhar | 95e226f | 2016-06-18 12:27:25 +0530 | [diff] [blame] | 16962 | /** |
| 16963 | * wlan_hdd_reassoc_bssid_hint() - Start reassociation if bssid is present |
| 16964 | * @adapter: Pointer to the HDD adapter |
| 16965 | * @req: Pointer to the structure cfg_connect_params receieved from user space |
| 16966 | * |
| 16967 | * This function will start reassociation if bssid hint, channel hint and |
| 16968 | * previous bssid parameters are present in the connect request |
| 16969 | * |
| 16970 | * Return: success if reassociation is happening |
| 16971 | * Error code if reassociation is not permitted or not happening |
| 16972 | */ |
| 16973 | #ifdef CFG80211_CONNECT_PREV_BSSID |
| 16974 | static int wlan_hdd_reassoc_bssid_hint(hdd_adapter_t *adapter, |
| 16975 | struct cfg80211_connect_params *req) |
| 16976 | { |
| 16977 | int status = -EPERM; |
| 16978 | if (req->bssid_hint && req->channel_hint && req->prev_bssid) { |
| 16979 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 16980 | FL("REASSOC Attempt on channel %d to "MAC_ADDRESS_STR), |
| 16981 | req->channel_hint->hw_value, |
| 16982 | MAC_ADDR_ARRAY(req->bssid_hint)); |
| 16983 | status = hdd_reassoc(adapter, req->bssid_hint, |
| 16984 | req->channel_hint->hw_value, |
| 16985 | CONNECT_CMD_USERSPACE); |
| 16986 | } |
| 16987 | return status; |
| 16988 | } |
| 16989 | #else |
| 16990 | static int wlan_hdd_reassoc_bssid_hint(hdd_adapter_t *adapter, |
| 16991 | struct cfg80211_connect_params *req) |
| 16992 | { |
| 16993 | return -EPERM; |
| 16994 | } |
| 16995 | #endif |
| 16996 | |
Abhishek Singh | e3beee2 | 2017-07-31 15:35:40 +0530 | [diff] [blame] | 16997 | /** |
| 16998 | * wlan_hdd_check_ht20_ht40_ind() - check if Supplicant has indicated to |
| 16999 | * connect in HT20 mode |
| 17000 | * @hdd_ctx: hdd context |
| 17001 | * @adapter: Pointer to the HDD adapter |
| 17002 | * @req: Pointer to the structure cfg_connect_params receieved from user space |
| 17003 | * |
| 17004 | * This function will check if supplicant has indicated to to connect in HT20 |
| 17005 | * mode. this is currently applicable only for 2.4Ghz mode only. |
| 17006 | * if feature is enabled and supplicant indicate HT20 set |
| 17007 | * force_24ghz_in_ht20 to true to force 2.4Ghz in HT20 else set it to false. |
| 17008 | * |
| 17009 | * Return: void |
| 17010 | */ |
| 17011 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) |
| 17012 | static void wlan_hdd_check_ht20_ht40_ind(hdd_context_t *hdd_ctx, |
| 17013 | hdd_adapter_t *adapter, |
| 17014 | struct cfg80211_connect_params *req) |
| 17015 | { |
| 17016 | hdd_wext_state_t *wext_state = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
| 17017 | tCsrRoamProfile *roam_profile; |
| 17018 | |
| 17019 | roam_profile = &wext_state->roamProfile; |
| 17020 | roam_profile->force_24ghz_in_ht20 = false; |
| 17021 | if (hdd_ctx->cfg_ini->override_ht20_40_24g && |
| 17022 | !(req->ht_capa.cap_info & |
| 17023 | IEEE80211_HT_CAP_SUP_WIDTH_20_40)) |
| 17024 | roam_profile->force_24ghz_in_ht20 = true; |
| 17025 | |
| 17026 | hddLog(LOG1, FL("req->ht_capa.cap_info %x override_ht20_40_24g %d"), |
| 17027 | req->ht_capa.cap_info, hdd_ctx->cfg_ini->override_ht20_40_24g); |
| 17028 | } |
| 17029 | #else |
| 17030 | static inline void wlan_hdd_check_ht20_ht40_ind(hdd_context_t *hdd_ctx, |
| 17031 | hdd_adapter_t *adapter, |
| 17032 | struct cfg80211_connect_params *req) |
| 17033 | { |
| 17034 | hdd_wext_state_t *wext_state = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
| 17035 | tCsrRoamProfile *roam_profile; |
| 17036 | |
| 17037 | roam_profile = &wext_state->roamProfile; |
| 17038 | roam_profile->force_24ghz_in_ht20 = false; |
| 17039 | } |
| 17040 | #endif |
| 17041 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 17042 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 17043 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 17044 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17045 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 17046 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17047 | struct net_device *ndev, |
| 17048 | struct cfg80211_connect_params *req |
| 17049 | ) |
| 17050 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17051 | int status; |
Sreelakshmi Konamki | e652174 | 2016-03-18 12:44:27 +0530 | [diff] [blame] | 17052 | u16 channel; |
Edhar, Mahesh Kumar | 496c7f7 | 2016-03-18 12:47:44 +0530 | [diff] [blame] | 17053 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) || \ |
| 17054 | defined(CFG80211_BSSID_HINT_BACKPORT) |
Sreelakshmi Konamki | e652174 | 2016-03-18 12:44:27 +0530 | [diff] [blame] | 17055 | const u8 *bssid_hint = req->bssid_hint; |
| 17056 | #else |
| 17057 | const u8 *bssid_hint = NULL; |
| 17058 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17059 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17060 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 17061 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17062 | |
| 17063 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 17064 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17065 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17066 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 17067 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17068 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 17069 | "%s: device_mode = %s (%d)", __func__, |
| 17070 | hdd_device_modetoString(pAdapter->device_mode), |
| 17071 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17072 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17073 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 17074 | if (!pHddCtx) |
| 17075 | { |
| 17076 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17077 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 17078 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 17079 | } |
| 17080 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17081 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17082 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17083 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17084 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17085 | } |
| 17086 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 17087 | if (wlan_hdd_check_and_stop_mon(pAdapter, true)) |
| 17088 | return -EINVAL; |
| 17089 | |
Selvaraj, Sridhar | 95e226f | 2016-06-18 12:27:25 +0530 | [diff] [blame] | 17090 | status = wlan_hdd_reassoc_bssid_hint(pAdapter, req); |
| 17091 | if (0 == status) |
| 17092 | return status; |
| 17093 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 17094 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17095 | #ifdef WLAN_BTAMP_FEATURE |
| 17096 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17097 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17098 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17099 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17100 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 17101 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17102 | } |
| 17103 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 17104 | |
| 17105 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 17106 | //P2P Mode will be taken care in Open/close adapter |
| 17107 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 17108 | (vos_concurrent_open_sessions_running())) { |
| 17109 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 17110 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 17111 | } |
| 17112 | |
| 17113 | /*Try disconnecting if already in connected state*/ |
| 17114 | status = wlan_hdd_try_disconnect(pAdapter); |
| 17115 | if ( 0 > status) |
| 17116 | { |
| 17117 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 17118 | " connection")); |
| 17119 | return -EALREADY; |
| 17120 | } |
Agrawal Ashish | 559530c | 2015-12-01 18:04:20 +0530 | [diff] [blame] | 17121 | /* Check for max concurrent connections after doing disconnect if any*/ |
| 17122 | if (vos_max_concurrent_connections_reached()) { |
| 17123 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 17124 | return -ECONNREFUSED; |
| 17125 | } |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 17126 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17127 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17128 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17129 | |
| 17130 | if ( 0 > status) |
| 17131 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17132 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17133 | __func__); |
| 17134 | return status; |
| 17135 | } |
Sravan Kumar Kairam | 589c572 | 2016-01-27 20:28:53 +0530 | [diff] [blame] | 17136 | |
| 17137 | if (pHddCtx->spoofMacAddr.isEnabled) |
| 17138 | { |
| 17139 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 17140 | "%s: MAC Spoofing enabled ", __func__); |
| 17141 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 17142 | * to fill TxBds for probe request during SSID scan which may happen |
| 17143 | * as part of connect command |
| 17144 | */ |
| 17145 | status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
| 17146 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
| 17147 | if (status != VOS_STATUS_SUCCESS) |
| 17148 | return -ECONNREFUSED; |
| 17149 | } |
| 17150 | |
Sreelakshmi Konamki | e652174 | 2016-03-18 12:44:27 +0530 | [diff] [blame] | 17151 | if (req->channel) |
| 17152 | channel = req->channel->hw_value; |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 17153 | else |
Sreelakshmi Konamki | e652174 | 2016-03-18 12:44:27 +0530 | [diff] [blame] | 17154 | channel = 0; |
Kapil Gupta | 312028a | 2016-10-25 14:15:20 +0530 | [diff] [blame] | 17155 | |
| 17156 | /* Abort if any scan is going on */ |
| 17157 | status = wlan_hdd_scan_abort(pAdapter); |
| 17158 | if (0 != status) |
| 17159 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("scan abort failed")); |
| 17160 | |
Abhishek Singh | e3beee2 | 2017-07-31 15:35:40 +0530 | [diff] [blame] | 17161 | wlan_hdd_check_ht20_ht40_ind(pHddCtx, pAdapter, req); |
| 17162 | |
Sreelakshmi Konamki | e652174 | 2016-03-18 12:44:27 +0530 | [diff] [blame] | 17163 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 17164 | req->ssid_len, req->bssid, |
| 17165 | bssid_hint, channel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17166 | |
Sushant Kaushik | d708398 | 2015-03-18 14:33:24 +0530 | [diff] [blame] | 17167 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17168 | { |
| 17169 | //ReEnable BMPS if disabled |
| 17170 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 17171 | (NULL != pHddCtx)) |
| 17172 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 17173 | if (pHddCtx->hdd_wlan_suspended) |
| 17174 | { |
| 17175 | hdd_set_pwrparams(pHddCtx); |
| 17176 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17177 | //ReEnable Bmps and Imps back |
| 17178 | hdd_enable_bmps_imps(pHddCtx); |
| 17179 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 17180 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17181 | return status; |
| 17182 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17183 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17184 | EXIT(); |
| 17185 | return status; |
| 17186 | } |
| 17187 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 17188 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 17189 | struct net_device *ndev, |
| 17190 | struct cfg80211_connect_params *req) |
| 17191 | { |
| 17192 | int ret; |
| 17193 | vos_ssr_protect(__func__); |
| 17194 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 17195 | vos_ssr_unprotect(__func__); |
| 17196 | |
| 17197 | return ret; |
| 17198 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17199 | |
| 17200 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 17201 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17202 | * This function is used to issue a disconnect request to SME |
| 17203 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 17204 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17205 | struct net_device *dev, |
| 17206 | u16 reason |
| 17207 | ) |
| 17208 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17209 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17210 | int status; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 17211 | tCsrRoamProfile *pRoamProfile; |
| 17212 | hdd_station_ctx_t *pHddStaCtx; |
| 17213 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 17214 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 17215 | tANI_U8 staIdx; |
| 17216 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17217 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17218 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 17219 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 17220 | if (!pAdapter) { |
| 17221 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 17222 | return -EINVAL; |
| 17223 | } |
| 17224 | |
| 17225 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 17226 | if (!pHddStaCtx) { |
| 17227 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD STA context is NULL")); |
| 17228 | return -EINVAL; |
| 17229 | } |
| 17230 | |
| 17231 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 17232 | status = wlan_hdd_validate_context(pHddCtx); |
| 17233 | if (0 != status) |
| 17234 | { |
| 17235 | return status; |
| 17236 | } |
| 17237 | |
| 17238 | pRoamProfile = &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
| 17239 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17240 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17241 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 17242 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 17243 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 17244 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 17245 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17246 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17247 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 17248 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17249 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17250 | if (NULL != pRoamProfile) |
| 17251 | { |
| 17252 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 17253 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 17254 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17255 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17256 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17257 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 17258 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17259 | switch(reason) |
| 17260 | { |
| 17261 | case WLAN_REASON_MIC_FAILURE: |
| 17262 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 17263 | break; |
| 17264 | |
| 17265 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 17266 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 17267 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 17268 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 17269 | break; |
| 17270 | |
| 17271 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 17272 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 17273 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17274 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 17275 | break; |
| 17276 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17277 | default: |
| 17278 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 17279 | break; |
| 17280 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 17281 | pScanInfo = &pHddCtx->scan_info; |
| 17282 | if (pScanInfo->mScanPending) |
| 17283 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 17284 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 17285 | "Aborting Scan"); |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 17286 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 17287 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 17288 | } |
Agarwal Ashish | c089cec | 2015-08-10 13:10:04 +0530 | [diff] [blame] | 17289 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 17290 | #ifdef FEATURE_WLAN_TDLS |
| 17291 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 17292 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 17293 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 17294 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 17295 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 17296 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17297 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 17298 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 17299 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 17300 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 17301 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 17302 | MAC_ADDR_ARRAY(mac)); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17303 | status = sme_DeleteTdlsPeerSta( |
| 17304 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 17305 | pAdapter->sessionId, |
| 17306 | mac); |
| 17307 | if (status != eHAL_STATUS_SUCCESS) { |
| 17308 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 17309 | return -EPERM; |
| 17310 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 17311 | } |
| 17312 | } |
| 17313 | #endif |
Padma, Santhosh Kumar | 5f7d10e | 2016-12-05 18:55:06 +0530 | [diff] [blame] | 17314 | |
| 17315 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u connState %d"), |
| 17316 | reasonCode, |
| 17317 | pHddStaCtx->conn_info.connState); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 17318 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 17319 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17320 | { |
| 17321 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 17322 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17323 | __func__, (int)status ); |
| 17324 | return -EINVAL; |
| 17325 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17326 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 17327 | else |
| 17328 | { |
| 17329 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 17330 | "called while in %d state", __func__, |
| 17331 | pHddStaCtx->conn_info.connState); |
| 17332 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17333 | } |
| 17334 | else |
| 17335 | { |
| 17336 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 17337 | } |
| 17338 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17339 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17340 | return status; |
| 17341 | } |
| 17342 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 17343 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 17344 | struct net_device *dev, |
| 17345 | u16 reason |
| 17346 | ) |
| 17347 | { |
| 17348 | int ret; |
| 17349 | vos_ssr_protect(__func__); |
| 17350 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 17351 | vos_ssr_unprotect(__func__); |
| 17352 | |
| 17353 | return ret; |
| 17354 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 17355 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17356 | /* |
| 17357 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17358 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17359 | * settings in IBSS mode. |
| 17360 | */ |
| 17361 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17362 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17363 | struct cfg80211_ibss_params *params |
| 17364 | ) |
| 17365 | { |
| 17366 | int status = 0; |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 17367 | tANI_U32 ret; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17368 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17369 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 17370 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17371 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17372 | ENTER(); |
| 17373 | |
| 17374 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 17375 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17376 | |
| 17377 | if (params->ie_len && ( NULL != params->ie) ) |
| 17378 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 17379 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 17380 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17381 | { |
| 17382 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 17383 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 17384 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 17385 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17386 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 17387 | tDot11fIEWPA dot11WPAIE; |
| 17388 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 17389 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 17390 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 17391 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 17392 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 17393 | params->ie_len, DOT11F_EID_WPA); |
| 17394 | if ( NULL != ie ) |
| 17395 | { |
| 17396 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
Hanumanth Reddy Pothula | d6d2d2c | 2018-06-27 12:28:12 +0530 | [diff] [blame] | 17397 | |
| 17398 | if (ie[1] < DOT11F_IE_WPA_MIN_LEN || |
| 17399 | ie[1] > DOT11F_IE_WPA_MAX_LEN) { |
| 17400 | hddLog(LOGE, FL("invalid ie len:%d"), ie[1]); |
| 17401 | return -EINVAL; |
| 17402 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 17403 | // Unpack the WPA IE |
| 17404 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 17405 | ret = dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 17406 | &ie[2+4], |
| 17407 | ie[1] - 4, |
| 17408 | &dot11WPAIE); |
Pragaspathi Thilagaraj | b2041e8 | 2018-03-28 17:14:02 +0530 | [diff] [blame] | 17409 | if (DOT11F_FAILED(ret)) |
| 17410 | { |
| 17411 | hddLog(LOGE, |
| 17412 | FL("unpack failed status:(0x%08x)"), |
| 17413 | ret); |
| 17414 | return -EINVAL; |
| 17415 | } |
| 17416 | |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 17417 | /*Extract the multicast cipher, the encType for unicast |
| 17418 | cipher for wpa-none is none*/ |
| 17419 | encryptionType = |
| 17420 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 17421 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17422 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 17423 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17424 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 17425 | |
| 17426 | if (0 > status) |
| 17427 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17428 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17429 | __func__); |
| 17430 | return status; |
| 17431 | } |
| 17432 | } |
| 17433 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17434 | pWextState->roamProfile.AuthType.authType[0] = |
| 17435 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17436 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17437 | if (params->privacy) |
| 17438 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17439 | /* Security enabled IBSS, At this time there is no information available |
| 17440 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17441 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17442 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17443 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17444 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17445 | *enable privacy bit in beacons */ |
| 17446 | |
| 17447 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 17448 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 17449 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 17450 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17451 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 17452 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 17453 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17454 | return status; |
| 17455 | } |
| 17456 | |
| 17457 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17458 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17459 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17460 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17461 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17462 | struct net_device *dev, |
| 17463 | struct cfg80211_ibss_params *params |
| 17464 | ) |
| 17465 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17466 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17467 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 17468 | tCsrRoamProfile *pRoamProfile; |
| 17469 | int status; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 17470 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 17471 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 17472 | tSirMacAddr bssid; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17473 | |
| 17474 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 17475 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17476 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17477 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 17478 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17479 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 17480 | "%s: device_mode = %s (%d)", __func__, |
| 17481 | hdd_device_modetoString(pAdapter->device_mode), |
| 17482 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17483 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17484 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17485 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17486 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17487 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17488 | } |
| 17489 | |
| 17490 | if (NULL == pWextState) |
| 17491 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 17492 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17493 | __func__); |
| 17494 | return -EIO; |
| 17495 | } |
| 17496 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 17497 | if (vos_max_concurrent_connections_reached()) { |
| 17498 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 17499 | return -ECONNREFUSED; |
| 17500 | } |
| 17501 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 17502 | /*Try disconnecting if already in connected state*/ |
| 17503 | status = wlan_hdd_try_disconnect(pAdapter); |
| 17504 | if ( 0 > status) |
| 17505 | { |
| 17506 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 17507 | " IBSS connection")); |
| 17508 | return -EALREADY; |
| 17509 | } |
| 17510 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17511 | pRoamProfile = &pWextState->roamProfile; |
| 17512 | |
| 17513 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 17514 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17515 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 17516 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17517 | return -EINVAL; |
| 17518 | } |
| 17519 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 17520 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 17521 | if (NULL != params->bssid) { |
| 17522 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 17523 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 17524 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 17525 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 17526 | return -EIO; |
| 17527 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 17528 | 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] | 17529 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 17530 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 17531 | { |
| 17532 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 17533 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 17534 | { |
| 17535 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 17536 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 17537 | return -EIO; |
| 17538 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 17539 | |
| 17540 | vos_mem_copy((v_U8_t *)bssid, |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 17541 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 17542 | sizeof(bssid)); |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 17543 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 17544 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17545 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 17546 | if (NULL != |
| 17547 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 17548 | params->chandef.chan) |
| 17549 | #else |
| 17550 | params->channel) |
| 17551 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17552 | { |
| 17553 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 17554 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 17555 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 17556 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 17557 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17558 | |
| 17559 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17560 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 17561 | ieee80211_frequency_to_channel( |
| 17562 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 17563 | params->chandef.chan->center_freq); |
| 17564 | #else |
| 17565 | params->channel->center_freq); |
| 17566 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 17567 | |
| 17568 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 17569 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17570 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 17571 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 17572 | __func__); |
| 17573 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17574 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 17575 | |
| 17576 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17577 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 17578 | if (channelNum == validChan[indx]) |
| 17579 | { |
| 17580 | break; |
| 17581 | } |
| 17582 | } |
| 17583 | if (indx >= numChans) |
| 17584 | { |
| 17585 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17586 | __func__, channelNum); |
| 17587 | return -EINVAL; |
| 17588 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 17589 | /* Set the Operational Channel */ |
| 17590 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 17591 | channelNum); |
| 17592 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 17593 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 17594 | pRoamProfile->ChannelInfo.ChannelList = |
| 17595 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17596 | } |
| 17597 | |
| 17598 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17599 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17600 | if (status < 0) |
| 17601 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17602 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17603 | __func__); |
| 17604 | return status; |
| 17605 | } |
| 17606 | |
| 17607 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17608 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Abhishek Singh | 4d92468 | 2015-11-17 15:23:06 +0530 | [diff] [blame] | 17609 | params->ssid_len, (const u8 *)&bssid, NULL, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 17610 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17611 | |
| 17612 | if (0 > status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17613 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17614 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17615 | EXIT(); |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 17616 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17617 | } |
| 17618 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17619 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 17620 | struct net_device *dev, |
| 17621 | struct cfg80211_ibss_params *params |
| 17622 | ) |
| 17623 | { |
| 17624 | int ret = 0; |
| 17625 | |
| 17626 | vos_ssr_protect(__func__); |
| 17627 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 17628 | vos_ssr_unprotect(__func__); |
| 17629 | |
| 17630 | return ret; |
| 17631 | } |
| 17632 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17633 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17634 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17635 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17636 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17637 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17638 | struct net_device *dev |
| 17639 | ) |
| 17640 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17641 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 17642 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 17643 | tCsrRoamProfile *pRoamProfile; |
| 17644 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17645 | int status; |
Abhishek Singh | 69de330 | 2016-11-11 16:44:32 +0530 | [diff] [blame] | 17646 | eHalStatus hal_status; |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 17647 | #ifdef WLAN_FEATURE_RMC |
| 17648 | tANI_U8 addIE[WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN] = {0}; |
| 17649 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17650 | |
| 17651 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 17652 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17653 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17654 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 17655 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17656 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17657 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17658 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17659 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17660 | } |
| 17661 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 17662 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 17663 | hdd_device_modetoString(pAdapter->device_mode), |
| 17664 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17665 | if (NULL == pWextState) |
| 17666 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 17667 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17668 | __func__); |
| 17669 | return -EIO; |
| 17670 | } |
| 17671 | |
| 17672 | pRoamProfile = &pWextState->roamProfile; |
| 17673 | |
| 17674 | /* Issue disconnect only if interface type is set to IBSS */ |
| 17675 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 17676 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17677 | 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] | 17678 | __func__); |
| 17679 | return -EINVAL; |
| 17680 | } |
| 17681 | |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 17682 | #ifdef WLAN_FEATURE_RMC |
| 17683 | /* Clearing add IE of beacon */ |
| 17684 | if (ccmCfgSetStr(pHddCtx->hHal, |
| 17685 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, &addIE[0], |
| 17686 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN, |
| 17687 | NULL, eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS) |
| 17688 | { |
| 17689 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 17690 | "%s: unable to clear PROBE_RSP_BCN_ADDNIE_DATA", __func__); |
| 17691 | return -EINVAL; |
| 17692 | } |
| 17693 | if (ccmCfgSetInt(pHddCtx->hHal, |
| 17694 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0, NULL, |
| 17695 | eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS) |
| 17696 | { |
| 17697 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 17698 | "%s: unable to clear WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG", |
| 17699 | __func__); |
| 17700 | return -EINVAL; |
| 17701 | } |
| 17702 | |
| 17703 | // Reset WNI_CFG_PROBE_RSP Flags |
| 17704 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 17705 | |
| 17706 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 17707 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 0,NULL, |
| 17708 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 17709 | { |
| 17710 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 17711 | "%s: unable to clear WNI_CFG_PROBE_RSP_ADDNIE_FLAG", |
| 17712 | __func__); |
| 17713 | return -EINVAL; |
| 17714 | } |
| 17715 | #endif |
| 17716 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17717 | /* Issue Disconnect request */ |
| 17718 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Abhishek Singh | 69de330 | 2016-11-11 16:44:32 +0530 | [diff] [blame] | 17719 | hal_status = sme_RoamDisconnect(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 17720 | pAdapter->sessionId, |
| 17721 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 17722 | if (!HAL_STATUS_SUCCESS(hal_status)) { |
| 17723 | hddLog(LOGE, |
| 17724 | FL("sme_RoamDisconnect failed hal_status(%d)"), |
| 17725 | hal_status); |
| 17726 | return -EAGAIN; |
| 17727 | } |
| 17728 | status = wait_for_completion_timeout( |
| 17729 | &pAdapter->disconnect_comp_var, |
| 17730 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 17731 | if (!status) { |
| 17732 | hddLog(LOGE, |
| 17733 | FL("wait on disconnect_comp_var failed")); |
| 17734 | return -ETIMEDOUT; |
| 17735 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17736 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17737 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17738 | return 0; |
| 17739 | } |
| 17740 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17741 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 17742 | struct net_device *dev |
| 17743 | ) |
| 17744 | { |
| 17745 | int ret = 0; |
| 17746 | |
| 17747 | vos_ssr_protect(__func__); |
| 17748 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 17749 | vos_ssr_unprotect(__func__); |
| 17750 | |
| 17751 | return ret; |
| 17752 | } |
| 17753 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17754 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 17755 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17756 | * This function is used to set the phy parameters |
| 17757 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 17758 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 17759 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17760 | u32 changed) |
| 17761 | { |
| 17762 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 17763 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17764 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17765 | |
| 17766 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17767 | |
| 17768 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17769 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 17770 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17771 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17772 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17773 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17774 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17775 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17776 | } |
| 17777 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17778 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 17779 | { |
| 17780 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 17781 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 17782 | wiphy->rts_threshold; |
| 17783 | |
| 17784 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17785 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17786 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17787 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 17788 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17789 | __func__, rts_threshold); |
| 17790 | return -EINVAL; |
| 17791 | } |
| 17792 | |
| 17793 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 17794 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17795 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17796 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17797 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 17798 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17799 | __func__, rts_threshold); |
| 17800 | return -EIO; |
| 17801 | } |
| 17802 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17803 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17804 | rts_threshold); |
| 17805 | } |
| 17806 | |
| 17807 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 17808 | { |
| 17809 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 17810 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 17811 | wiphy->frag_threshold; |
| 17812 | |
| 17813 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17814 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17815 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17816 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 17817 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17818 | frag_threshold); |
| 17819 | return -EINVAL; |
| 17820 | } |
| 17821 | |
| 17822 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 17823 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17824 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17825 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17826 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 17827 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17828 | __func__, frag_threshold); |
| 17829 | return -EIO; |
| 17830 | } |
| 17831 | |
| 17832 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 17833 | frag_threshold); |
| 17834 | } |
| 17835 | |
| 17836 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 17837 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 17838 | { |
| 17839 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 17840 | wiphy->retry_short : |
| 17841 | wiphy->retry_long; |
| 17842 | |
| 17843 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 17844 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 17845 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17846 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17847 | __func__, retry_value); |
| 17848 | return -EINVAL; |
| 17849 | } |
| 17850 | |
| 17851 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 17852 | { |
| 17853 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 17854 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17855 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17856 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17857 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 17858 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17859 | __func__, retry_value); |
| 17860 | return -EIO; |
| 17861 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17862 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17863 | __func__, retry_value); |
| 17864 | } |
| 17865 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 17866 | { |
| 17867 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 17868 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17869 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17870 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17871 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 17872 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17873 | __func__, retry_value); |
| 17874 | return -EIO; |
| 17875 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17876 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17877 | __func__, retry_value); |
| 17878 | } |
| 17879 | } |
| 17880 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17881 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17882 | return 0; |
| 17883 | } |
| 17884 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 17885 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 17886 | u32 changed) |
| 17887 | { |
| 17888 | int ret; |
| 17889 | |
| 17890 | vos_ssr_protect(__func__); |
| 17891 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 17892 | vos_ssr_unprotect(__func__); |
| 17893 | |
| 17894 | return ret; |
| 17895 | } |
| 17896 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17897 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 17898 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17899 | * This function is used to set the txpower |
| 17900 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 17901 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 17902 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 17903 | struct wireless_dev *wdev, |
| 17904 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17905 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17906 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17907 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17908 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17909 | #endif |
| 17910 | int dbm) |
| 17911 | { |
| 17912 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17913 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17914 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 17915 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17916 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17917 | |
| 17918 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17919 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17920 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17921 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 17922 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17923 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17924 | if (0 != status) |
| 17925 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17926 | return status; |
| 17927 | } |
| 17928 | |
| 17929 | hHal = pHddCtx->hHal; |
| 17930 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17931 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 17932 | dbm, ccmCfgSetCallback, |
| 17933 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17934 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17935 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17936 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 17937 | return -EIO; |
| 17938 | } |
| 17939 | |
| 17940 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 17941 | dbm); |
| 17942 | |
| 17943 | switch(type) |
| 17944 | { |
| 17945 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 17946 | /* Fall through */ |
| 17947 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 17948 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 17949 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17950 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 17951 | __func__); |
| 17952 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17953 | } |
| 17954 | break; |
| 17955 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17956 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17957 | __func__); |
| 17958 | return -EOPNOTSUPP; |
| 17959 | break; |
| 17960 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17961 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 17962 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17963 | return -EIO; |
| 17964 | } |
| 17965 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17966 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17967 | return 0; |
| 17968 | } |
| 17969 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 17970 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 17971 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 17972 | struct wireless_dev *wdev, |
| 17973 | #endif |
| 17974 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 17975 | enum tx_power_setting type, |
| 17976 | #else |
| 17977 | enum nl80211_tx_power_setting type, |
| 17978 | #endif |
| 17979 | int dbm) |
| 17980 | { |
| 17981 | int ret; |
| 17982 | vos_ssr_protect(__func__); |
| 17983 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 17984 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 17985 | wdev, |
| 17986 | #endif |
| 17987 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 17988 | type, |
| 17989 | #else |
| 17990 | type, |
| 17991 | #endif |
| 17992 | dbm); |
| 17993 | vos_ssr_unprotect(__func__); |
| 17994 | |
| 17995 | return ret; |
| 17996 | } |
| 17997 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17998 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17999 | * FUNCTION: __wlan_hdd_cfg80211_get_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18000 | * This function is used to read the txpower |
| 18001 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18002 | static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 18003 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 18004 | struct wireless_dev *wdev, |
| 18005 | #endif |
| 18006 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18007 | { |
| 18008 | |
| 18009 | hdd_adapter_t *pAdapter; |
| 18010 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18011 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18012 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 18013 | ENTER(); |
| 18014 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18015 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18016 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 18017 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18018 | *dbm = 0; |
| 18019 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 18020 | } |
| 18021 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18022 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 18023 | if (NULL == pAdapter) |
| 18024 | { |
| 18025 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 18026 | return -ENOENT; |
| 18027 | } |
| 18028 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 18029 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 18030 | TRACE_CODE_HDD_CFG80211_GET_TXPOWER, |
| 18031 | pAdapter->sessionId, pAdapter->device_mode)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18032 | wlan_hdd_get_classAstats(pAdapter); |
| 18033 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 18034 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 18035 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18036 | return 0; |
| 18037 | } |
| 18038 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18039 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 18040 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 18041 | struct wireless_dev *wdev, |
| 18042 | #endif |
| 18043 | int *dbm) |
| 18044 | { |
| 18045 | int ret; |
| 18046 | |
| 18047 | vos_ssr_protect(__func__); |
| 18048 | ret = __wlan_hdd_cfg80211_get_txpower(wiphy, |
| 18049 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 18050 | wdev, |
| 18051 | #endif |
| 18052 | dbm); |
| 18053 | vos_ssr_unprotect(__func__); |
| 18054 | |
| 18055 | return ret; |
| 18056 | } |
| 18057 | |
Dustin Brown | 8c1d409 | 2017-07-28 18:08:01 +0530 | [diff] [blame] | 18058 | /* |
| 18059 | * wlan_hdd_fill_summary_stats() - populate station_info summary stats |
| 18060 | * @stats: summary stats to use as a source |
| 18061 | * @info: kernel station_info struct to use as a destination |
| 18062 | * |
| 18063 | * Return: None |
| 18064 | */ |
| 18065 | static void wlan_hdd_fill_summary_stats(tCsrSummaryStatsInfo *stats, |
| 18066 | struct station_info *info) |
| 18067 | { |
| 18068 | int i; |
| 18069 | |
| 18070 | info->rx_packets = stats->rx_frm_cnt; |
| 18071 | info->tx_packets = 0; |
| 18072 | info->tx_retries = 0; |
| 18073 | info->tx_failed = 0; |
| 18074 | |
| 18075 | for (i = 0; i < 4; ++i) { |
| 18076 | info->tx_packets += stats->tx_frm_cnt[i]; |
| 18077 | info->tx_retries += stats->multiple_retry_cnt[i]; |
| 18078 | info->tx_failed += stats->fail_cnt[i]; |
| 18079 | } |
| 18080 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18081 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)) && \ |
| 18082 | !defined(WITH_BACKPORTS) |
Dustin Brown | 8c1d409 | 2017-07-28 18:08:01 +0530 | [diff] [blame] | 18083 | info->filled |= STATION_INFO_TX_PACKETS | |
| 18084 | STATION_INFO_TX_RETRIES | |
| 18085 | STATION_INFO_TX_FAILED | |
| 18086 | STATION_INFO_RX_PACKETS; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18087 | #else |
| 18088 | info->filled |= BIT(NL80211_STA_INFO_TX_PACKETS) | |
| 18089 | BIT(NL80211_STA_INFO_TX_RETRIES) | |
| 18090 | BIT(NL80211_STA_INFO_TX_FAILED) | |
| 18091 | BIT(NL80211_STA_INFO_RX_PACKETS); |
| 18092 | #endif |
Dustin Brown | 8c1d409 | 2017-07-28 18:08:01 +0530 | [diff] [blame] | 18093 | } |
| 18094 | |
| 18095 | /** |
Sravan Kumar Kairam | e0e7844 | 2017-09-18 18:00:53 +0530 | [diff] [blame] | 18096 | * wlan_hdd_sap_get_sta_rssi() - get RSSI of the SAP client |
| 18097 | * @adapter: sap adapter pointer |
| 18098 | * @staid: station id of the client |
| 18099 | * @rssi: rssi value to fill |
| 18100 | * |
| 18101 | * Return: None |
| 18102 | */ |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 18103 | void |
Sravan Kumar Kairam | e0e7844 | 2017-09-18 18:00:53 +0530 | [diff] [blame] | 18104 | wlan_hdd_sap_get_sta_rssi(hdd_adapter_t *adapter, uint8_t staid, s8 *rssi) |
| 18105 | { |
| 18106 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(adapter))->pvosContext; |
| 18107 | |
| 18108 | WLANTL_GetSAPStaRSSi(pVosContext, staid, rssi); |
| 18109 | } |
| 18110 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18111 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)) && \ |
| 18112 | !defined(WITH_BACKPORTS) |
| 18113 | static inline void wlan_hdd_fill_station_info_signal(struct station_info |
| 18114 | *sinfo) |
| 18115 | { |
| 18116 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 18117 | } |
| 18118 | #else |
| 18119 | static inline void wlan_hdd_fill_station_info_signal(struct station_info |
| 18120 | *sinfo) |
| 18121 | { |
| 18122 | sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); |
| 18123 | } |
| 18124 | #endif |
| 18125 | |
Sravan Kumar Kairam | e0e7844 | 2017-09-18 18:00:53 +0530 | [diff] [blame] | 18126 | /** |
Dustin Brown | 8c1d409 | 2017-07-28 18:08:01 +0530 | [diff] [blame] | 18127 | * wlan_hdd_get_sap_stats() - get aggregate SAP stats |
| 18128 | * @adapter: sap adapter to get stats for |
Sravan Kumar Kairam | e0e7844 | 2017-09-18 18:00:53 +0530 | [diff] [blame] | 18129 | * @mac: mac address of the station |
Dustin Brown | 8c1d409 | 2017-07-28 18:08:01 +0530 | [diff] [blame] | 18130 | * @info: kernel station_info struct to populate |
| 18131 | * |
| 18132 | * Fetch the vdev-level aggregate stats for the given SAP adapter. This is to |
| 18133 | * support "station dump" and "station get" for SAP vdevs, even though they |
| 18134 | * aren't technically stations. |
| 18135 | * |
| 18136 | * Return: errno |
| 18137 | */ |
| 18138 | static int |
Sravan Kumar Kairam | e0e7844 | 2017-09-18 18:00:53 +0530 | [diff] [blame] | 18139 | wlan_hdd_get_sap_stats(hdd_adapter_t *adapter, |
| 18140 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 18141 | const u8* mac, |
| 18142 | #else |
| 18143 | u8* mac, |
| 18144 | #endif |
| 18145 | struct station_info *info) |
Dustin Brown | 8c1d409 | 2017-07-28 18:08:01 +0530 | [diff] [blame] | 18146 | { |
Sravan Kumar Kairam | e0e7844 | 2017-09-18 18:00:53 +0530 | [diff] [blame] | 18147 | v_MACADDR_t *peerMacAddr; |
| 18148 | uint8_t staid; |
Dustin Brown | 8c1d409 | 2017-07-28 18:08:01 +0530 | [diff] [blame] | 18149 | VOS_STATUS status; |
Sravan Kumar Kairam | e0e7844 | 2017-09-18 18:00:53 +0530 | [diff] [blame] | 18150 | bool bc_mac_addr; |
Dustin Brown | 8c1d409 | 2017-07-28 18:08:01 +0530 | [diff] [blame] | 18151 | |
| 18152 | status = wlan_hdd_get_station_stats(adapter); |
| 18153 | if (!VOS_IS_STATUS_SUCCESS(status)) { |
| 18154 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 18155 | "Failed to get SAP stats; status:%d", status); |
| 18156 | return 0; |
| 18157 | } |
| 18158 | |
Sravan Kumar Kairam | e0e7844 | 2017-09-18 18:00:53 +0530 | [diff] [blame] | 18159 | peerMacAddr = (v_MACADDR_t *)mac; |
| 18160 | bc_mac_addr = vos_is_macaddr_broadcast(peerMacAddr); |
| 18161 | staid = hdd_sta_id_find_from_mac_addr(adapter, peerMacAddr); |
| 18162 | hddLog(VOS_TRACE_LEVEL_INFO, "Get SAP stats for sta id:%d", staid); |
| 18163 | |
| 18164 | if (staid < WLAN_MAX_STA_COUNT && !bc_mac_addr) { |
| 18165 | wlan_hdd_sap_get_sta_rssi(adapter, staid, &info->signal); |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18166 | wlan_hdd_fill_station_info_signal(info); |
Sravan Kumar Kairam | e0e7844 | 2017-09-18 18:00:53 +0530 | [diff] [blame] | 18167 | } |
| 18168 | |
Dustin Brown | 8c1d409 | 2017-07-28 18:08:01 +0530 | [diff] [blame] | 18169 | wlan_hdd_fill_summary_stats(&adapter->hdd_stats.summary_stat, info); |
| 18170 | |
| 18171 | return 0; |
| 18172 | } |
| 18173 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18174 | 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] | 18175 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 18176 | const u8* mac, |
| 18177 | #else |
| 18178 | u8* mac, |
| 18179 | #endif |
| 18180 | struct station_info *sinfo) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18181 | { |
| 18182 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 18183 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 18184 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 18185 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18186 | |
| 18187 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 18188 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18189 | |
| 18190 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 18191 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 18192 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 18193 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 18194 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 18195 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 18196 | tANI_U16 maxRate = 0; |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 18197 | int8_t snr = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18198 | tANI_U16 myRate; |
| 18199 | tANI_U16 currentRate = 0; |
| 18200 | tANI_U8 maxSpeedMCS = 0; |
| 18201 | tANI_U8 maxMCSIdx = 0; |
| 18202 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 18203 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 18204 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18205 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18206 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18207 | #ifdef WLAN_FEATURE_11AC |
| 18208 | tANI_U32 vht_mcs_map; |
| 18209 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 18210 | #endif /* WLAN_FEATURE_11AC */ |
| 18211 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 18212 | ENTER(); |
| 18213 | |
Dustin Brown | 8c1d409 | 2017-07-28 18:08:01 +0530 | [diff] [blame] | 18214 | status = wlan_hdd_validate_context(pHddCtx); |
| 18215 | if (0 != status) |
| 18216 | { |
| 18217 | return status; |
| 18218 | } |
| 18219 | |
| 18220 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Sravan Kumar Kairam | e0e7844 | 2017-09-18 18:00:53 +0530 | [diff] [blame] | 18221 | return wlan_hdd_get_sap_stats(pAdapter, mac, sinfo); |
Dustin Brown | 8c1d409 | 2017-07-28 18:08:01 +0530 | [diff] [blame] | 18222 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18223 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 18224 | (0 == ssidlen)) |
| 18225 | { |
| 18226 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 18227 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 18228 | /*To keep GUI happy*/ |
| 18229 | return 0; |
| 18230 | } |
| 18231 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 18232 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 18233 | { |
| 18234 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18235 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
Sachin Ahuja | 81ab181 | 2016-08-19 21:35:58 +0530 | [diff] [blame] | 18236 | /* return a cached value */ |
| 18237 | sinfo->signal = pAdapter->rssi; |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 18238 | return 0; |
| 18239 | } |
| 18240 | |
Hanumantha Reddy Pothula | dce6674 | 2015-08-25 18:08:44 +0530 | [diff] [blame] | 18241 | wlan_hdd_get_station_stats(pAdapter); |
| 18242 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18243 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 18244 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 18245 | wlan_hdd_get_snr(pAdapter, &snr); |
| 18246 | pHddStaCtx->conn_info.signal = sinfo->signal; |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 18247 | pHddStaCtx->cache_conn_info.signal = sinfo->signal; |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 18248 | pHddStaCtx->conn_info.noise = pHddStaCtx->conn_info.signal - snr; |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 18249 | pHddStaCtx->cache_conn_info.noise = pHddStaCtx->conn_info.noise; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18250 | wlan_hdd_fill_station_info_signal(sinfo); |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 18251 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 18252 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 18253 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 18254 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 18255 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 18256 | { |
| 18257 | rate_flags = pAdapter->maxRateFlags; |
| 18258 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 18259 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18260 | //convert to the UI units of 100kbps |
| 18261 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 18262 | |
| 18263 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18264 | 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] | 18265 | sinfo->signal, |
| 18266 | pCfg->reportMaxLinkSpeed, |
| 18267 | myRate, |
| 18268 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 18269 | (int) pCfg->linkSpeedRssiMid, |
| 18270 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18271 | (int) rate_flags, |
| 18272 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18273 | #endif //LINKSPEED_DEBUG_ENABLED |
| 18274 | |
Hanumanth Reddy Pothula | 596b8b3 | 2018-05-01 20:17:38 +0530 | [diff] [blame] | 18275 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) || defined(WITH_BACKPORTS) |
| 18276 | /* assume basic BW. anything else will override this later */ |
| 18277 | sinfo->txrate.bw = RATE_INFO_BW_20; |
| 18278 | #endif |
| 18279 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18280 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 18281 | { |
| 18282 | // we do not want to necessarily report the current speed |
| 18283 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 18284 | { |
| 18285 | // report the max possible speed |
| 18286 | rssidx = 0; |
| 18287 | } |
| 18288 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 18289 | { |
| 18290 | // report the max possible speed with RSSI scaling |
| 18291 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 18292 | { |
| 18293 | // report the max possible speed |
| 18294 | rssidx = 0; |
| 18295 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 18296 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18297 | { |
| 18298 | // report middle speed |
| 18299 | rssidx = 1; |
| 18300 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 18301 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 18302 | { |
| 18303 | // report middle speed |
| 18304 | rssidx = 2; |
| 18305 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18306 | else |
| 18307 | { |
| 18308 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 18309 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18310 | } |
| 18311 | } |
| 18312 | else |
| 18313 | { |
| 18314 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 18315 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 18316 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 18317 | __func__, pCfg->reportMaxLinkSpeed); |
| 18318 | rssidx = 0; |
| 18319 | } |
| 18320 | |
| 18321 | maxRate = 0; |
| 18322 | |
| 18323 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 18324 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 18325 | OperationalRates, &ORLeng)) |
| 18326 | { |
| 18327 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 18328 | /*To keep GUI happy*/ |
| 18329 | return 0; |
| 18330 | } |
| 18331 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18332 | for (i = 0; i < ORLeng; i++) |
| 18333 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 18334 | 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] | 18335 | { |
| 18336 | /* Validate Rate Set */ |
| 18337 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 18338 | { |
| 18339 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 18340 | break; |
| 18341 | } |
| 18342 | } |
| 18343 | /* Update MAX rate */ |
| 18344 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 18345 | } |
| 18346 | |
| 18347 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 18348 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 18349 | ExtendedRates, &ERLeng)) |
| 18350 | { |
| 18351 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 18352 | /*To keep GUI happy*/ |
| 18353 | return 0; |
| 18354 | } |
| 18355 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18356 | for (i = 0; i < ERLeng; i++) |
| 18357 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 18358 | 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] | 18359 | { |
| 18360 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 18361 | { |
| 18362 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 18363 | break; |
| 18364 | } |
| 18365 | } |
| 18366 | /* Update MAX rate */ |
| 18367 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 18368 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 18369 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 18370 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 18371 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 18372 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 18373 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18374 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 18375 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 18376 | mode = 2; |
| 18377 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 18378 | mode = 1; |
| 18379 | else |
| 18380 | mode = 0; |
| 18381 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 18382 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 18383 | MCSRates, &MCSLeng)) |
| 18384 | { |
| 18385 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 18386 | /*To keep GUI happy*/ |
| 18387 | return 0; |
| 18388 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18389 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18390 | #ifdef WLAN_FEATURE_11AC |
| 18391 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18392 | 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] | 18393 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18394 | 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] | 18395 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18396 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18397 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18398 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18399 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18400 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18401 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18402 | maxMCSIdx = 7; |
| 18403 | } |
| 18404 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 18405 | { |
| 18406 | maxMCSIdx = 8; |
| 18407 | } |
| 18408 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 18409 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18410 | //VHT20 is supporting 0~8 |
| 18411 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 18412 | maxMCSIdx = 8; |
| 18413 | else |
| 18414 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18415 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18416 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 18417 | if (0 != rssidx)/*check for scaled */ |
| 18418 | { |
| 18419 | //get middle rate MCS index if rssi=1/2 |
| 18420 | for (i=0; i <= maxMCSIdx; i++) |
| 18421 | { |
| 18422 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 18423 | { |
| 18424 | maxMCSIdx = i; |
| 18425 | break; |
| 18426 | } |
| 18427 | } |
| 18428 | } |
| 18429 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18430 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 18431 | { |
| 18432 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 18433 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 18434 | } |
| 18435 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 18436 | { |
| 18437 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 18438 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 18439 | } |
| 18440 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 18441 | { |
| 18442 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 18443 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 18444 | } |
| 18445 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18446 | maxSpeedMCS = 1; |
| 18447 | if (currentRate > maxRate) |
| 18448 | { |
| 18449 | maxRate = currentRate; |
| 18450 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18451 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18452 | } |
| 18453 | else |
| 18454 | #endif /* WLAN_FEATURE_11AC */ |
| 18455 | { |
| 18456 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 18457 | { |
| 18458 | rateFlag |= 1; |
| 18459 | } |
| 18460 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 18461 | { |
| 18462 | rateFlag |= 2; |
| 18463 | } |
| 18464 | |
Girish Gowli | 01abcee | 2014-07-31 20:18:55 +0530 | [diff] [blame] | 18465 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 18466 | if (rssidx == 1 || rssidx == 2) |
| 18467 | { |
| 18468 | //get middle rate MCS index if rssi=1/2 |
| 18469 | for (i=0; i <= 7; i++) |
| 18470 | { |
| 18471 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 18472 | { |
| 18473 | temp = i+1; |
| 18474 | break; |
| 18475 | } |
| 18476 | } |
| 18477 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 18478 | |
| 18479 | for (i = 0; i < MCSLeng; i++) |
| 18480 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18481 | for (j = 0; j < temp; j++) |
| 18482 | { |
| 18483 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 18484 | { |
| 18485 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
Hanumantha Reddy Pothula | fa62374 | 2015-06-16 14:08:24 +0530 | [diff] [blame] | 18486 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18487 | break; |
| 18488 | } |
| 18489 | } |
| 18490 | if ((j < temp) && (currentRate > maxRate)) |
| 18491 | { |
| 18492 | maxRate = currentRate; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18493 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18494 | } |
Hanumantha Reddy Pothula | fa62374 | 2015-06-16 14:08:24 +0530 | [diff] [blame] | 18495 | maxSpeedMCS = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18496 | } |
| 18497 | } |
| 18498 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18499 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 18500 | { |
| 18501 | maxRate = myRate; |
| 18502 | maxSpeedMCS = 1; |
| 18503 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 18504 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18505 | // 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] | 18506 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18507 | { |
| 18508 | maxRate = myRate; |
| 18509 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 18510 | { |
| 18511 | maxSpeedMCS = 0; |
| 18512 | } |
| 18513 | else |
| 18514 | { |
| 18515 | maxSpeedMCS = 1; |
| 18516 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 18517 | } |
| 18518 | } |
| 18519 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18520 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18521 | { |
| 18522 | sinfo->txrate.legacy = maxRate; |
| 18523 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 18524 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 18525 | #endif //LINKSPEED_DEBUG_ENABLED |
| 18526 | } |
| 18527 | else |
| 18528 | { |
| 18529 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18530 | #ifdef WLAN_FEATURE_11AC |
| 18531 | sinfo->txrate.nss = 1; |
| 18532 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 18533 | { |
| 18534 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18535 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) || \ |
| 18536 | defined(WITH_BACKPORTS) |
| 18537 | sinfo->txrate.bw = RATE_INFO_BW_80; |
| 18538 | #else |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18539 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18540 | #endif |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18541 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18542 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18543 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18544 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18545 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) || \ |
| 18546 | defined(WITH_BACKPORTS) |
| 18547 | sinfo->txrate.bw = RATE_INFO_BW_40; |
| 18548 | #else |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18549 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18550 | #endif |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18551 | } |
| 18552 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 18553 | { |
| 18554 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 18555 | } |
| 18556 | #endif /* WLAN_FEATURE_11AC */ |
| 18557 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 18558 | { |
| 18559 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 18560 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 18561 | { |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18562 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) || \ |
| 18563 | defined(WITH_BACKPORTS) |
| 18564 | sinfo->txrate.bw = RATE_INFO_BW_40; |
| 18565 | #else |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18566 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18567 | #endif |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18568 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18569 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18570 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 18571 | { |
| 18572 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 18573 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 18574 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18575 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 18576 | pr_info("Reporting MCS rate %d flags %x\n", |
| 18577 | sinfo->txrate.mcs, |
| 18578 | sinfo->txrate.flags ); |
| 18579 | #endif //LINKSPEED_DEBUG_ENABLED |
| 18580 | } |
| 18581 | } |
| 18582 | else |
| 18583 | { |
| 18584 | // report current rate instead of max rate |
| 18585 | |
| 18586 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 18587 | { |
| 18588 | //provide to the UI in units of 100kbps |
| 18589 | sinfo->txrate.legacy = myRate; |
| 18590 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 18591 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 18592 | #endif //LINKSPEED_DEBUG_ENABLED |
| 18593 | } |
| 18594 | else |
| 18595 | { |
| 18596 | //must be MCS |
| 18597 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18598 | #ifdef WLAN_FEATURE_11AC |
| 18599 | sinfo->txrate.nss = 1; |
| 18600 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 18601 | { |
| 18602 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 18603 | } |
| 18604 | else |
| 18605 | #endif /* WLAN_FEATURE_11AC */ |
| 18606 | { |
| 18607 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 18608 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18609 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 18610 | { |
| 18611 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 18612 | } |
| 18613 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 18614 | { |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18615 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) || \ |
| 18616 | defined(WITH_BACKPORTS) |
| 18617 | sinfo->txrate.bw = RATE_INFO_BW_40; |
| 18618 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18619 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18620 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18621 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18622 | #ifdef WLAN_FEATURE_11AC |
| 18623 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 18624 | { |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18625 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) || \ |
| 18626 | defined(WITH_BACKPORTS) |
| 18627 | sinfo->txrate.bw = RATE_INFO_BW_80; |
| 18628 | #else |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18629 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18630 | #endif |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 18631 | } |
| 18632 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18633 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 18634 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 18635 | sinfo->txrate.mcs, |
| 18636 | sinfo->txrate.flags ); |
| 18637 | #endif //LINKSPEED_DEBUG_ENABLED |
| 18638 | } |
| 18639 | } |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18640 | |
| 18641 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)) && \ |
| 18642 | !defined(WITH_BACKPORTS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18643 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18644 | #else |
| 18645 | sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE); |
| 18646 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18647 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 18648 | sinfo->tx_packets = |
| 18649 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 18650 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 18651 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 18652 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 18653 | |
| 18654 | sinfo->tx_retries = |
| 18655 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 18656 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 18657 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 18658 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 18659 | |
| 18660 | sinfo->tx_failed = |
| 18661 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 18662 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 18663 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 18664 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 18665 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18666 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)) && \ |
| 18667 | !defined(WITH_BACKPORTS) |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 18668 | sinfo->filled |= |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18669 | STATION_INFO_RX_PACKETS | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 18670 | STATION_INFO_TX_PACKETS | |
| 18671 | STATION_INFO_TX_RETRIES | |
| 18672 | STATION_INFO_TX_FAILED; |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18673 | #else |
| 18674 | sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS) | |
| 18675 | BIT(NL80211_STA_INFO_TX_PACKETS) | |
| 18676 | BIT(NL80211_STA_INFO_TX_RETRIES) | |
| 18677 | BIT(NL80211_STA_INFO_TX_FAILED); |
| 18678 | #endif |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 18679 | |
Edhar, Mahesh Kumar | 3cc9f23 | 2015-12-29 14:41:01 +0530 | [diff] [blame] | 18680 | sinfo->rx_packets = pAdapter->hdd_stats.summary_stat.rx_frm_cnt; |
Edhar, Mahesh Kumar | 3cc9f23 | 2015-12-29 14:41:01 +0530 | [diff] [blame] | 18681 | |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 18682 | vos_mem_copy(&pHddStaCtx->conn_info.txrate, |
| 18683 | &sinfo->txrate, sizeof(sinfo->txrate)); |
Ashish Kumar Dhanotiya | bb8d230 | 2018-02-22 00:37:26 +0530 | [diff] [blame] | 18684 | vos_mem_copy(&pHddStaCtx->cache_conn_info.txrate, |
| 18685 | &sinfo->txrate, sizeof(sinfo->txrate)); |
| 18686 | |
Edhar, Mahesh Kumar | 3cc9f23 | 2015-12-29 14:41:01 +0530 | [diff] [blame] | 18687 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 18688 | hddLog(LOG1, FL("Reporting RSSI:%d legacy rate %d pkt cnt tx %d rx %d"), |
| 18689 | sinfo->signal, sinfo->txrate.legacy, sinfo->tx_packets, |
| 18690 | sinfo->rx_packets); |
| 18691 | else |
| 18692 | hddLog(LOG1, |
| 18693 | FL("Reporting RSSI:%d MCS rate %d flags 0x%x pkt cnt tx %d rx %d"), |
| 18694 | sinfo->signal, sinfo->txrate.mcs, sinfo->txrate.flags, |
| 18695 | sinfo->tx_packets, sinfo->rx_packets); |
| 18696 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 18697 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 18698 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 18699 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 18700 | EXIT(); |
| 18701 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18702 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 18703 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 18704 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 18705 | const u8* mac, struct station_info *sinfo) |
| 18706 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18707 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 18708 | u8* mac, struct station_info *sinfo) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 18709 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18710 | { |
| 18711 | int ret; |
| 18712 | |
| 18713 | vos_ssr_protect(__func__); |
| 18714 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 18715 | vos_ssr_unprotect(__func__); |
| 18716 | |
| 18717 | return ret; |
| 18718 | } |
| 18719 | |
| 18720 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 18721 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18722 | { |
| 18723 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 18724 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18725 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18726 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18727 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 18728 | ENTER(); |
| 18729 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18730 | if (NULL == pAdapter) |
| 18731 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 18732 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18733 | return -ENODEV; |
| 18734 | } |
| 18735 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 18736 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 18737 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 18738 | pAdapter->sessionId, timeout)); |
| 18739 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 18740 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18741 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18742 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 18743 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18744 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 18745 | } |
| 18746 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 18747 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 18748 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 18749 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 18750 | (eConnectionState_Associated == |
| 18751 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 18752 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 18753 | |
| 18754 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 18755 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 18756 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 18757 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 18758 | { |
| 18759 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 18760 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 18761 | __func__, vos_status); |
| 18762 | } |
| 18763 | } |
| 18764 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18765 | /**The get power cmd from the supplicant gets updated by the nl only |
| 18766 | *on successful execution of the function call |
| 18767 | *we are oppositely mapped w.r.t mode in the driver |
| 18768 | **/ |
| 18769 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 18770 | |
| 18771 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 18772 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 18773 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18774 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18775 | return -EINVAL; |
| 18776 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18777 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18778 | return 0; |
| 18779 | } |
| 18780 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18781 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 18782 | struct net_device *dev, bool mode, int timeout) |
| 18783 | { |
| 18784 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18785 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18786 | vos_ssr_protect(__func__); |
| 18787 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 18788 | vos_ssr_unprotect(__func__); |
| 18789 | |
| 18790 | return ret; |
| 18791 | } |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 18792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18793 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18794 | static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 18795 | struct net_device *netdev, |
| 18796 | u8 key_index) |
| 18797 | { |
| 18798 | ENTER(); |
| 18799 | return 0; |
| 18800 | } |
| 18801 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18802 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18803 | struct net_device *netdev, |
| 18804 | u8 key_index) |
| 18805 | { |
| 18806 | int ret; |
| 18807 | vos_ssr_protect(__func__); |
| 18808 | ret = __wlan_hdd_set_default_mgmt_key(wiphy, netdev, key_index); |
| 18809 | vos_ssr_unprotect(__func__); |
| 18810 | return ret; |
| 18811 | } |
| 18812 | #endif //LINUX_VERSION_CODE |
| 18813 | |
| 18814 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 18815 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 18816 | struct net_device *dev, |
| 18817 | struct ieee80211_txq_params *params) |
| 18818 | { |
| 18819 | ENTER(); |
| 18820 | return 0; |
| 18821 | } |
| 18822 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 18823 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 18824 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18825 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 18826 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18827 | return 0; |
| 18828 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 18829 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18830 | |
| 18831 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 18832 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18833 | struct net_device *dev, |
| 18834 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18835 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18836 | int ret; |
| 18837 | |
| 18838 | vos_ssr_protect(__func__); |
| 18839 | ret = __wlan_hdd_set_txq_params(wiphy, dev, params); |
| 18840 | vos_ssr_unprotect(__func__); |
| 18841 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18842 | } |
| 18843 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 18844 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 18845 | struct ieee80211_txq_params *params) |
| 18846 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18847 | int ret; |
| 18848 | |
| 18849 | vos_ssr_protect(__func__); |
| 18850 | ret = __wlan_hdd_set_txq_params(wiphy, params); |
| 18851 | vos_ssr_unprotect(__func__); |
| 18852 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18853 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18854 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18855 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 18856 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 18857 | struct net_device *dev, |
| 18858 | struct tagCsrDelStaParams *pDelStaParams) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18859 | { |
| 18860 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18861 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 18862 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18863 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 18864 | v_U8_t staId; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 18865 | v_CONTEXT_t pVosContext = NULL; |
| 18866 | ptSapContext pSapCtx = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18867 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 18868 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 18869 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18870 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18871 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18872 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18873 | return -EINVAL; |
| 18874 | } |
| 18875 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 18876 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 18877 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 18878 | pAdapter->sessionId, pAdapter->device_mode)); |
| 18879 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18880 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 18881 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18882 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 18883 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18884 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 18885 | } |
| 18886 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18887 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18888 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18889 | ) |
| 18890 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 18891 | pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 18892 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 18893 | if(pSapCtx == NULL){ |
| 18894 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18895 | FL("psapCtx is NULL")); |
| 18896 | return -ENOENT; |
| 18897 | } |
Agrawal Ashish | 306b75f | 2017-01-11 19:16:25 +0530 | [diff] [blame] | 18898 | if (pHddCtx->cfg_ini->enable_sap_auth_offload) |
| 18899 | { |
| 18900 | VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO, |
| 18901 | "Change reason code to eSIR_MAC_DISASSOC_LEAVING_BSS_REASON in sap auth offload"); |
| 18902 | pDelStaParams->reason_code = eSIR_MAC_DISASSOC_LEAVING_BSS_REASON; |
| 18903 | } |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 18904 | if (vos_is_macaddr_broadcast((v_MACADDR_t *)pDelStaParams->peerMacAddr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18905 | { |
| 18906 | v_U16_t i; |
| 18907 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 18908 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 18909 | if ((pSapCtx->aStaInfo[i].isUsed) && |
| 18910 | (!pSapCtx->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18911 | { |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 18912 | vos_mem_copy(pDelStaParams->peerMacAddr, |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 18913 | pSapCtx->aStaInfo[i].macAddrSTA.bytes, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 18914 | ETHER_ADDR_LEN); |
| 18915 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18916 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 18917 | "%s: Delete STA with MAC::" |
| 18918 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 18919 | __func__, |
| 18920 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
| 18921 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 18922 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 18923 | pSapCtx->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18924 | } |
| 18925 | } |
| 18926 | } |
| 18927 | else |
| 18928 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 18929 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 18930 | vos_status = hdd_softap_GetStaId(pAdapter, |
| 18931 | (v_MACADDR_t *)pDelStaParams->peerMacAddr, &staId); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 18932 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 18933 | { |
| 18934 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 18935 | "%s: Skip this DEL STA as this is not used::" |
| 18936 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 18937 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 18938 | return -ENOENT; |
| 18939 | } |
| 18940 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 18941 | if( pSapCtx->aStaInfo[staId].isDeauthInProgress == TRUE) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 18942 | { |
| 18943 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 18944 | "%s: Skip this DEL STA as deauth is in progress::" |
| 18945 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 18946 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 18947 | return -ENOENT; |
| 18948 | } |
| 18949 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 18950 | pSapCtx->aStaInfo[staId].isDeauthInProgress = TRUE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 18951 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18952 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 18953 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 18954 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18955 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 18956 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 18957 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 18958 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 18959 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 18960 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 18961 | pSapCtx->aStaInfo[staId].isDeauthInProgress = FALSE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 18962 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 18963 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 18964 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 18965 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 18966 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 18967 | return -ENOENT; |
| 18968 | } |
| 18969 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18970 | } |
| 18971 | } |
| 18972 | |
| 18973 | EXIT(); |
| 18974 | |
| 18975 | return 0; |
| 18976 | } |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 18977 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18978 | #ifdef USE_CFG80211_DEL_STA_V2 |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 18979 | int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 18980 | struct net_device *dev, |
| 18981 | struct station_del_parameters *param) |
| 18982 | #else |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 18983 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 18984 | int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 18985 | struct net_device *dev, const u8 *mac) |
| 18986 | #else |
Kapil Gupta | 137ef89 | 2016-12-13 19:38:00 +0530 | [diff] [blame] | 18987 | int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18988 | struct net_device *dev, u8 *mac) |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 18989 | #endif |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 18990 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18991 | { |
| 18992 | int ret; |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 18993 | struct tagCsrDelStaParams delStaParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 18994 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18995 | vos_ssr_protect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 18996 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 18997 | #ifdef USE_CFG80211_DEL_STA_V2 |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 18998 | if (NULL == param) { |
| 18999 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid argumet passed", __func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 19000 | vos_ssr_unprotect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 19001 | return -EINVAL; |
| 19002 | } |
| 19003 | |
| 19004 | WLANSAP_PopulateDelStaParams(param->mac, param->reason_code, |
| 19005 | param->subtype, &delStaParams); |
| 19006 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 19007 | #else |
Sushant Kaushik | 4cd28f6 | 2014-12-26 14:23:50 +0530 | [diff] [blame] | 19008 | WLANSAP_PopulateDelStaParams(mac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 19009 | (SIR_MAC_MGMT_DEAUTH >> 4), &delStaParams); |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 19010 | #endif |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 19011 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, &delStaParams); |
| 19012 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19013 | vos_ssr_unprotect(__func__); |
| 19014 | |
| 19015 | return ret; |
| 19016 | } |
| 19017 | |
| 19018 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 19019 | struct net_device *dev, |
| 19020 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 19021 | const u8 *mac, |
| 19022 | #else |
| 19023 | u8 *mac, |
| 19024 | #endif |
| 19025 | struct station_parameters *params) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 19026 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 19027 | hdd_adapter_t *pAdapter; |
| 19028 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 19029 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 19030 | #ifdef FEATURE_WLAN_TDLS |
| 19031 | u32 mask, set; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 19032 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 19033 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19034 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 19035 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 19036 | if (NULL == pAdapter) |
| 19037 | { |
| 19038 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19039 | "%s: Adapter is NULL",__func__); |
| 19040 | return -EINVAL; |
| 19041 | } |
| 19042 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 19043 | status = wlan_hdd_validate_context(pHddCtx); |
| 19044 | if (0 != status) |
| 19045 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 19046 | return status; |
| 19047 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 19048 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 19049 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 19050 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 19051 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19052 | mask = params->sta_flags_mask; |
| 19053 | |
| 19054 | set = params->sta_flags_set; |
| 19055 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 19056 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 19057 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 19058 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19059 | |
| 19060 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 19061 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 19062 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19063 | } |
| 19064 | } |
| 19065 | #endif |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19066 | EXIT(); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 19067 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19068 | } |
| 19069 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 19070 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 19071 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 19072 | struct net_device *dev, const u8 *mac, |
| 19073 | struct station_parameters *params) |
| 19074 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19075 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 19076 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 19077 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19078 | { |
| 19079 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19080 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19081 | vos_ssr_protect(__func__); |
| 19082 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 19083 | vos_ssr_unprotect(__func__); |
| 19084 | |
| 19085 | return ret; |
| 19086 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19087 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19088 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 19089 | 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] | 19090 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19091 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19092 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 19093 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 19094 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19095 | int status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19096 | hdd_context_t *pHddCtx; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 19097 | tPmkidCacheInfo pmk_id; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 19098 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19099 | ENTER(); |
| 19100 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 19101 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19102 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19103 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19104 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19105 | return -EINVAL; |
| 19106 | } |
| 19107 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 19108 | if (!pmksa) { |
| 19109 | hddLog(LOGE, FL("pmksa is NULL")); |
| 19110 | return -EINVAL; |
| 19111 | } |
| 19112 | |
| 19113 | if (!pmksa->bssid || !pmksa->pmkid) { |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 19114 | hddLog(LOGE, FL("pmksa->bssid(%pK) or pmksa->pmkid(%pK) is NULL"), |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 19115 | pmksa->bssid, pmksa->pmkid); |
| 19116 | return -EINVAL; |
| 19117 | } |
| 19118 | |
| 19119 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 19120 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 19121 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19122 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 19123 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19124 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19125 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 19126 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19127 | } |
| 19128 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 19129 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19130 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 19131 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 19132 | vos_mem_copy(pmk_id.BSSID, pmksa->bssid, ETHER_ADDR_LEN); |
| 19133 | vos_mem_copy(pmk_id.PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19134 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 19135 | /* Add to the PMKSA ID Cache in CSR */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 19136 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 19137 | &pmk_id, 1, FALSE); |
| 19138 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 19139 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 19140 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 19141 | pAdapter->sessionId, result)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 19142 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19143 | EXIT(); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 19144 | return HAL_STATUS_SUCCESS(result) ? 0 : -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19145 | } |
| 19146 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 19147 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 19148 | struct cfg80211_pmksa *pmksa) |
| 19149 | { |
| 19150 | int ret; |
| 19151 | |
| 19152 | vos_ssr_protect(__func__); |
| 19153 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 19154 | vos_ssr_unprotect(__func__); |
| 19155 | |
| 19156 | return ret; |
| 19157 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19158 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19159 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 19160 | 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] | 19161 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19162 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19163 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 19164 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19165 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 19166 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19167 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19168 | ENTER(); |
| 19169 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19170 | /* Validate pAdapter */ |
| 19171 | if (NULL == pAdapter) |
| 19172 | { |
| 19173 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 19174 | return -EINVAL; |
| 19175 | } |
| 19176 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 19177 | if (!pmksa) { |
| 19178 | hddLog(LOGE, FL("pmksa is NULL")); |
| 19179 | return -EINVAL; |
| 19180 | } |
| 19181 | |
| 19182 | if (!pmksa->bssid) { |
| 19183 | hddLog(LOGE, FL("pmksa->bssid is NULL")); |
| 19184 | return -EINVAL; |
| 19185 | } |
| 19186 | |
Kiet Lam | 98c46a1 | 2014-10-31 15:34:57 -0700 | [diff] [blame] | 19187 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 19188 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 19189 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19190 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 19191 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19192 | if (0 != status) |
| 19193 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19194 | return status; |
| 19195 | } |
| 19196 | |
| 19197 | /*Retrieve halHandle*/ |
| 19198 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 19199 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 19200 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 19201 | TRACE_CODE_HDD_CFG80211_DEL_PMKSA, |
| 19202 | pAdapter->sessionId, 0)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 19203 | /* Delete the PMKID CSR cache */ |
| 19204 | if (eHAL_STATUS_SUCCESS != |
| 19205 | sme_RoamDelPMKIDfromCache(halHandle, |
| 19206 | pAdapter->sessionId, pmksa->bssid, FALSE)) { |
| 19207 | hddLog(LOGE, FL("Failed to delete PMKSA for "MAC_ADDRESS_STR), |
| 19208 | MAC_ADDR_ARRAY(pmksa->bssid)); |
| 19209 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19210 | } |
| 19211 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19212 | EXIT(); |
| 19213 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19214 | } |
| 19215 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19216 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 19217 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 19218 | struct cfg80211_pmksa *pmksa) |
| 19219 | { |
| 19220 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19221 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 19222 | vos_ssr_protect(__func__); |
| 19223 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 19224 | vos_ssr_unprotect(__func__); |
| 19225 | |
| 19226 | return ret; |
| 19227 | |
| 19228 | } |
| 19229 | |
| 19230 | 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] | 19231 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19232 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 19233 | tHalHandle halHandle; |
| 19234 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 19235 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19236 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19237 | ENTER(); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19238 | |
| 19239 | /* Validate pAdapter */ |
| 19240 | if (NULL == pAdapter) |
| 19241 | { |
| 19242 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 19243 | "%s: Invalid Adapter" ,__func__); |
| 19244 | return -EINVAL; |
| 19245 | } |
| 19246 | |
| 19247 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 19248 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19249 | if (0 != status) |
| 19250 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19251 | return status; |
| 19252 | } |
| 19253 | |
| 19254 | /*Retrieve halHandle*/ |
| 19255 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 19256 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 19257 | /* Flush the PMKID cache in CSR */ |
| 19258 | if (eHAL_STATUS_SUCCESS != |
| 19259 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, NULL, TRUE)) { |
| 19260 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Cannot flush PMKIDCache")); |
| 19261 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 19262 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19263 | EXIT(); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 19264 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19265 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 19266 | |
| 19267 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 19268 | { |
| 19269 | int ret; |
| 19270 | |
| 19271 | vos_ssr_protect(__func__); |
| 19272 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 19273 | vos_ssr_unprotect(__func__); |
| 19274 | |
| 19275 | return ret; |
| 19276 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19277 | #endif |
| 19278 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19279 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19280 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 19281 | struct net_device *dev, |
| 19282 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19283 | { |
| 19284 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 19285 | hdd_station_ctx_t *pHddStaCtx; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 19286 | hdd_context_t *pHddCtx; |
| 19287 | int ret = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19288 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19289 | ENTER(); |
| 19290 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19291 | if (NULL == pAdapter) |
| 19292 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 19293 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19294 | return -ENODEV; |
| 19295 | } |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 19296 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 19297 | ret = wlan_hdd_validate_context(pHddCtx); |
| 19298 | if (0 != ret) |
| 19299 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 19300 | return ret; |
| 19301 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19302 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 19303 | if (NULL == pHddStaCtx) |
| 19304 | { |
| 19305 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: STA Context is NULL", __func__); |
| 19306 | return -EINVAL; |
| 19307 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19308 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 19309 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 19310 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 19311 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19312 | // Added for debug on reception of Re-assoc Req. |
| 19313 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 19314 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 19315 | 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] | 19316 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 19317 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19318 | } |
| 19319 | |
| 19320 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 19321 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19322 | ftie->ie_len); |
| 19323 | #endif |
| 19324 | |
| 19325 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 19326 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 19327 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19328 | ftie->ie_len); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19329 | |
| 19330 | EXIT(); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19331 | return 0; |
| 19332 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19333 | |
| 19334 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 19335 | struct net_device *dev, |
| 19336 | struct cfg80211_update_ft_ies_params *ftie) |
| 19337 | { |
| 19338 | int ret; |
| 19339 | |
| 19340 | vos_ssr_protect(__func__); |
| 19341 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 19342 | vos_ssr_unprotect(__func__); |
| 19343 | |
| 19344 | return ret; |
| 19345 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19346 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19347 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19348 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 19349 | |
| 19350 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 19351 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 19352 | { |
| 19353 | int ret; |
| 19354 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 19355 | hdd_context_t *pHddCtx; |
| 19356 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 19357 | ENTER(); |
| 19358 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19359 | if (NULL == pAdapter) |
| 19360 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 19361 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19362 | "%s: HDD adapter is Null", __func__); |
| 19363 | return ; |
| 19364 | } |
| 19365 | |
| 19366 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 19367 | if (NULL == pHddCtx) |
| 19368 | { |
| 19369 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19370 | "%s: HDD context is Null!!!", __func__); |
| 19371 | return ; |
| 19372 | } |
| 19373 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19374 | spin_lock(&pHddCtx->schedScan_lock); |
| 19375 | if (TRUE == pHddCtx->isWiphySuspended) |
| 19376 | { |
| 19377 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 19378 | spin_unlock(&pHddCtx->schedScan_lock); |
| 19379 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 19380 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 19381 | return ; |
| 19382 | } |
| 19383 | spin_unlock(&pHddCtx->schedScan_lock); |
| 19384 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19385 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 19386 | |
| 19387 | if (0 > ret) |
| 19388 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | fb49cdd | 2015-10-16 18:41:59 +0530 | [diff] [blame] | 19389 | else |
| 19390 | { |
| 19391 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 19392 | * immediatly after the driver gets connect request(i.e after pno) |
| 19393 | * from supplicant, this result in app's is suspending and not able |
| 19394 | * to process the connect request to AP */ |
| 19395 | hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_SCAN); |
| 19396 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19397 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19398 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19399 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19400 | } |
| 19401 | |
| 19402 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 19403 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 19404 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 19405 | */ |
| 19406 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 19407 | { |
| 19408 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 19409 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 19410 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 19411 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 19412 | int status = 0; |
Agrawal Ashish | cff3169 | 2016-12-16 17:17:50 +0530 | [diff] [blame] | 19413 | |
| 19414 | if (WLAN_HDD_INFRA_STATION != pAdapter->device_mode) |
| 19415 | { |
| 19416 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19417 | "%s: PNO is allowed only in STA interface", __func__); |
| 19418 | return eHAL_STATUS_FAILURE; |
| 19419 | } |
| 19420 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 19421 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 19422 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 19423 | /* The current firmware design does not allow PNO during any |
Agrawal Ashish | cff3169 | 2016-12-16 17:17:50 +0530 | [diff] [blame] | 19424 | * active sessions. PNO is allowed only in case when sap session |
| 19425 | * is present and sapo auth offload feature enabled in firmare. |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 19426 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 19427 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 19428 | { |
| 19429 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 19430 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 19431 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 19432 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 19433 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 19434 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 19435 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
Agrawal Ashish | cff3169 | 2016-12-16 17:17:50 +0530 | [diff] [blame] | 19436 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode && |
| 19437 | !pHddCtx->cfg_ini->enable_sap_auth_offload) |
Siddharth Bhal | 63a19a7 | 2014-11-07 14:31:56 +0530 | [diff] [blame] | 19438 | || (WLAN_HDD_TM_LEVEL_4 == pHddCtx->tmInfo.currentTmLevel) |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 19439 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 19440 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 19441 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 19442 | } |
| 19443 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 19444 | pAdapterNode = pNext; |
| 19445 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 19446 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 19447 | } |
| 19448 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 19449 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 19450 | { |
| 19451 | hdd_adapter_t *pAdapter = callbackContext; |
| 19452 | hdd_context_t *pHddCtx; |
| 19453 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19454 | ENTER(); |
| 19455 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 19456 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 19457 | { |
| 19458 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19459 | FL("Invalid adapter or adapter has invalid magic")); |
| 19460 | return; |
| 19461 | } |
| 19462 | |
| 19463 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 19464 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 19465 | { |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 19466 | return; |
| 19467 | } |
| 19468 | |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 19469 | if (VOS_STATUS_SUCCESS != status) |
| 19470 | { |
| 19471 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 19472 | FL("PNO enable response status = %d"), status); |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 19473 | pHddCtx->isPnoEnable = FALSE; |
| 19474 | } |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 19475 | |
| 19476 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 19477 | complete(&pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19478 | EXIT(); |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 19479 | } |
| 19480 | |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 19481 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)) || \ |
| 19482 | defined (CFG80211_MULTI_SCAN_PLAN_BACKPORT) |
| 19483 | /** |
| 19484 | * hdd_config_sched_scan_plan() - configures the sched scan plans |
| 19485 | * from the framework. |
| 19486 | * @pno_req: pointer to PNO scan request |
| 19487 | * @request: pointer to scan request from framework |
| 19488 | * |
| 19489 | * Return: None |
| 19490 | */ |
| 19491 | static void hdd_config_sched_scan_plan(tpSirPNOScanReq pno_req, |
| 19492 | struct cfg80211_sched_scan_request *request, |
| 19493 | hdd_context_t *hdd_ctx) |
| 19494 | { |
| 19495 | v_U32_t i = 0; |
| 19496 | |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 19497 | pno_req->scanTimers.ucScanTimersCount = request->n_scan_plans; |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 19498 | for (i = 0; i < request->n_scan_plans; i++) |
| 19499 | { |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 19500 | pno_req->scanTimers.aTimerValues[i].uTimerRepeat = |
| 19501 | request->scan_plans[i].iterations; |
| 19502 | pno_req->scanTimers.aTimerValues[i].uTimerValue = |
| 19503 | request->scan_plans[i].interval; |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 19504 | } |
| 19505 | } |
| 19506 | #else |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 19507 | static void hdd_config_sched_scan_plan(tpSirPNOScanReq pno_req, |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 19508 | struct cfg80211_sched_scan_request *request, |
| 19509 | hdd_context_t *hdd_ctx) |
| 19510 | { |
| 19511 | v_U32_t i, temp_int; |
| 19512 | /* Driver gets only one time interval which is hardcoded in |
| 19513 | * supplicant for 10000ms. Taking power consumption into account 6 |
| 19514 | * timers will be used, Timervalue is increased exponentially |
| 19515 | * i.e 10,20,40, 80,160,320 secs. And number of scan cycle for each |
| 19516 | * timer is configurable through INI param gPNOScanTimerRepeatValue. |
| 19517 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 19518 | * will be repeated after each interval specified by supplicant |
| 19519 | * till PNO is disabled. |
| 19520 | */ |
| 19521 | if (0 == hdd_ctx->cfg_ini->configPNOScanTimerRepeatValue) |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 19522 | pno_req->scanTimers.ucScanTimersCount = |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 19523 | HDD_PNO_SCAN_TIMERS_SET_ONE; |
| 19524 | else |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 19525 | pno_req->scanTimers.ucScanTimersCount = |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 19526 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 19527 | |
| 19528 | temp_int = (request->interval)/1000; |
| 19529 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19530 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 19531 | temp_int, hdd_ctx->cfg_ini->configPNOScanTimerRepeatValue); |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 19532 | for ( i = 0; i < pno_req->scanTimers.ucScanTimersCount; i++) |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 19533 | { |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 19534 | pno_req->scanTimers.aTimerValues[i].uTimerRepeat = |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 19535 | hdd_ctx->cfg_ini->configPNOScanTimerRepeatValue; |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 19536 | pno_req->scanTimers.aTimerValues[i].uTimerValue = temp_int; |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 19537 | temp_int *= 2; |
| 19538 | } |
| 19539 | //Repeat last timer until pno disabled. |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 19540 | pno_req->scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 19541 | } |
| 19542 | #endif |
| 19543 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 19544 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 19545 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 19546 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19547 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 19548 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19549 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 19550 | { |
| 19551 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19552 | tSirPNOScanReq pnoRequest = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19553 | hdd_context_t *pHddCtx; |
| 19554 | tHalHandle hHal; |
Anurag Chouhan | 343af7e | 2016-12-16 13:11:19 +0530 | [diff] [blame] | 19555 | v_U32_t i, indx, num_ch, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 19556 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 19557 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19558 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 19559 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19560 | int ret = 0; |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 19561 | hdd_config_t *pConfig = NULL; |
| 19562 | v_U32_t num_ignore_dfs_ch = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19563 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19564 | ENTER(); |
| 19565 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19566 | if (NULL == pAdapter) |
| 19567 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 19568 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19569 | "%s: HDD adapter is Null", __func__); |
| 19570 | return -ENODEV; |
| 19571 | } |
| 19572 | |
| 19573 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19574 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19575 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19576 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19577 | { |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19578 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19579 | } |
| 19580 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 19581 | pConfig = pHddCtx->cfg_ini; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19582 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 19583 | if (NULL == hHal) |
| 19584 | { |
| 19585 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19586 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19587 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19588 | } |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 19589 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 19590 | TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START, |
| 19591 | pAdapter->sessionId, pAdapter->device_mode)); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 19592 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 19593 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 19594 | { |
| 19595 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19596 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 19597 | return -EBUSY; |
| 19598 | } |
| 19599 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 19600 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 19601 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 19602 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 19603 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 19604 | return -EBUSY; |
| 19605 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19606 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 19607 | if (TRUE == pHddCtx->isPnoEnable) |
| 19608 | { |
| 19609 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 19610 | FL("already PNO is enabled")); |
| 19611 | return -EBUSY; |
| 19612 | } |
c_hpothu | 225aa7c | 2014-10-22 17:45:13 +0530 | [diff] [blame] | 19613 | |
| 19614 | if (VOS_STATUS_SUCCESS != wlan_hdd_cancel_remain_on_channel(pHddCtx)) |
| 19615 | { |
| 19616 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19617 | "%s: abort ROC failed ", __func__); |
| 19618 | return -EBUSY; |
| 19619 | } |
| 19620 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 19621 | pHddCtx->isPnoEnable = TRUE; |
| 19622 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19623 | pnoRequest.enable = 1; /*Enable PNO */ |
| 19624 | pnoRequest.ucNetworksCount = request->n_match_sets; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19625 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19626 | if (( !pnoRequest.ucNetworksCount ) || |
| 19627 | ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19628 | { |
| 19629 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 19630 | "%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] | 19631 | __func__, pnoRequest.ucNetworksCount, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 19632 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19633 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19634 | goto error; |
| 19635 | } |
| 19636 | |
| 19637 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 19638 | { |
| 19639 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 19640 | "%s: Incorrect number of channels %d", |
| 19641 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19642 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19643 | goto error; |
| 19644 | } |
| 19645 | |
| 19646 | /* Framework provides one set of channels(all) |
| 19647 | * common for all saved profile */ |
| 19648 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 19649 | channels_allowed, &num_channels_allowed)) |
| 19650 | { |
| 19651 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19652 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19653 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19654 | goto error; |
| 19655 | } |
| 19656 | /* Checking each channel against allowed channel list */ |
| 19657 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 19658 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19659 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 19660 | char chList [(request->n_channels*5)+1]; |
| 19661 | int len; |
| 19662 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19663 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 19664 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19665 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 19666 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 19667 | { |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 19668 | if ((!pConfig->enableDFSPnoChnlScan) && |
| 19669 | (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channels_allowed[indx]))) |
| 19670 | { |
| 19671 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19672 | "%s : Dropping DFS channel : %d", |
| 19673 | __func__,channels_allowed[indx]); |
| 19674 | num_ignore_dfs_ch++; |
| 19675 | break; |
| 19676 | } |
| 19677 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 19678 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 19679 | len += snprintf(chList+len, 5, "%d ", |
| 19680 | request->channels[i]->hw_value); |
| 19681 | break ; |
| 19682 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19683 | } |
| 19684 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 19685 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19686 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 19687 | /*If all channels are DFS and dropped, then ignore the PNO request*/ |
| 19688 | if (num_ignore_dfs_ch == request->n_channels) |
| 19689 | { |
| 19690 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19691 | "%s : All requested channels are DFS channels", __func__); |
| 19692 | ret = -EINVAL; |
| 19693 | goto error; |
| 19694 | } |
| 19695 | } |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19696 | |
| 19697 | pnoRequest.aNetworks = |
| 19698 | vos_mem_malloc(sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 19699 | if (pnoRequest.aNetworks == NULL) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19700 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19701 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 19702 | FL("failed to allocate memory aNetworks %u"), |
| 19703 | (uint32)sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 19704 | goto error; |
| 19705 | } |
| 19706 | vos_mem_zero(pnoRequest.aNetworks, |
| 19707 | sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 19708 | |
| 19709 | /* Filling per profile params */ |
| 19710 | for (i = 0; i < pnoRequest.ucNetworksCount; i++) |
| 19711 | { |
| 19712 | pnoRequest.aNetworks[i].ssId.length = |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19713 | request->match_sets[i].ssid.ssid_len; |
| 19714 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19715 | if (( 0 == pnoRequest.aNetworks[i].ssId.length ) || |
| 19716 | ( pnoRequest.aNetworks[i].ssId.length > 32 ) ) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19717 | { |
| 19718 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 19719 | "%s: SSID Len %d is not correct for network %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19720 | __func__, pnoRequest.aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19721 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19722 | goto error; |
| 19723 | } |
| 19724 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19725 | memcpy(pnoRequest.aNetworks[i].ssId.ssId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19726 | request->match_sets[i].ssid.ssid, |
| 19727 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 19728 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19729 | "%s: SSID of network %d is %s ", __func__, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19730 | i, pnoRequest.aNetworks[i].ssId.ssId); |
| 19731 | pnoRequest.aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 19732 | pnoRequest.aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 19733 | pnoRequest.aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19734 | |
| 19735 | /*Copying list of valid channel into request */ |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19736 | memcpy(pnoRequest.aNetworks[i].aChannels, valid_ch, num_ch); |
| 19737 | pnoRequest.aNetworks[i].ucChannelCount = num_ch; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19738 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19739 | pnoRequest.aNetworks[i].rssiThreshold = 0; //Default value |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19740 | } |
| 19741 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 19742 | for (i = 0; i < request->n_ssids; i++) |
| 19743 | { |
| 19744 | j = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19745 | while (j < pnoRequest.ucNetworksCount) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 19746 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19747 | if ((pnoRequest.aNetworks[j].ssId.length == |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 19748 | request->ssids[i].ssid_len) && |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19749 | (0 == memcmp(pnoRequest.aNetworks[j].ssId.ssId, |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 19750 | request->ssids[i].ssid, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19751 | pnoRequest.aNetworks[j].ssId.length))) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 19752 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19753 | pnoRequest.aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 19754 | break; |
| 19755 | } |
| 19756 | j++; |
| 19757 | } |
| 19758 | } |
| 19759 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19760 | "Number of hidden networks being Configured = %d", |
| 19761 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 19762 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 19763 | "request->ie_len = %zu", request->ie_len); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19764 | |
| 19765 | pnoRequest.p24GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 19766 | if (pnoRequest.p24GProbeTemplate == NULL) |
| 19767 | { |
| 19768 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 19769 | FL("failed to allocate memory p24GProbeTemplate %u"), |
| 19770 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 19771 | goto error; |
| 19772 | } |
| 19773 | |
| 19774 | pnoRequest.p5GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 19775 | if (pnoRequest.p5GProbeTemplate == NULL) |
| 19776 | { |
| 19777 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 19778 | FL("failed to allocate memory p5GProbeTemplate %u"), |
| 19779 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 19780 | goto error; |
| 19781 | } |
| 19782 | |
| 19783 | vos_mem_zero(pnoRequest.p24GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 19784 | vos_mem_zero(pnoRequest.p5GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 19785 | |
Hanumantha Reddy Pothula | 06e87b2 | 2015-03-02 18:02:23 +0530 | [diff] [blame] | 19786 | if ((0 < request->ie_len) && (request->ie_len <= SIR_PNO_MAX_PB_REQ_SIZE) && |
| 19787 | (NULL != request->ie)) |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 19788 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19789 | pnoRequest.us24GProbeTemplateLen = request->ie_len; |
| 19790 | memcpy(pnoRequest.p24GProbeTemplate, request->ie, |
| 19791 | pnoRequest.us24GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 19792 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19793 | pnoRequest.us5GProbeTemplateLen = request->ie_len; |
| 19794 | memcpy(pnoRequest.p5GProbeTemplate, request->ie, |
| 19795 | pnoRequest.us5GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 19796 | } |
| 19797 | |
Anurag Chouhan | f3e52b7 | 2016-12-21 11:33:37 +0530 | [diff] [blame] | 19798 | hdd_config_sched_scan_plan(&pnoRequest, request, pHddCtx); |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 19799 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19800 | pnoRequest.modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19801 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 19802 | INIT_COMPLETION(pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19803 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 19804 | pnoRequest.callbackContext = pAdapter; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 19805 | pAdapter->pno_req_status = 0; |
| 19806 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 19807 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19808 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19809 | pAdapter->sessionId, pnoRequest.enable, pnoRequest.modePNO, |
| 19810 | pnoRequest.scanTimers.ucScanTimersCount); |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 19811 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19812 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19813 | &pnoRequest, pAdapter->sessionId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19814 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 19815 | if (eHAL_STATUS_SUCCESS != status) |
| 19816 | { |
| 19817 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 19818 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19819 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19820 | goto error; |
| 19821 | } |
| 19822 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 19823 | ret = wait_for_completion_timeout( |
| 19824 | &pAdapter->pno_comp_var, |
| 19825 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 19826 | if (0 >= ret) |
| 19827 | { |
| 19828 | // Did not receive the response for PNO enable in time. |
| 19829 | // Assuming the PNO enable was success. |
| 19830 | // Returning error from here, because we timeout, results |
| 19831 | // in side effect of Wifi (Wifi Setting) not to work. |
| 19832 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19833 | FL("Timed out waiting for PNO to be Enabled")); |
| 19834 | ret = 0; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 19835 | } |
| 19836 | |
| 19837 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 19838 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19839 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19840 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 19841 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19842 | FL("PNO scanRequest offloaded ret = %d"), ret); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 19843 | pHddCtx->isPnoEnable = FALSE; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19844 | if (pnoRequest.aNetworks) |
| 19845 | vos_mem_free(pnoRequest.aNetworks); |
| 19846 | if (pnoRequest.p24GProbeTemplate) |
| 19847 | vos_mem_free(pnoRequest.p24GProbeTemplate); |
| 19848 | if (pnoRequest.p5GProbeTemplate) |
| 19849 | vos_mem_free(pnoRequest.p5GProbeTemplate); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19850 | |
| 19851 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19852 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19853 | } |
| 19854 | |
| 19855 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 19856 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 19857 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19858 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 19859 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 19860 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 19861 | { |
| 19862 | int ret; |
| 19863 | |
| 19864 | vos_ssr_protect(__func__); |
| 19865 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 19866 | vos_ssr_unprotect(__func__); |
| 19867 | |
| 19868 | return ret; |
| 19869 | } |
| 19870 | |
| 19871 | /* |
| 19872 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 19873 | * Function to disable PNO |
| 19874 | */ |
| 19875 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19876 | struct net_device *dev) |
| 19877 | { |
| 19878 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 19879 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 19880 | hdd_context_t *pHddCtx; |
| 19881 | tHalHandle hHal; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19882 | tSirPNOScanReq pnoRequest = {0}; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19883 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19884 | |
| 19885 | ENTER(); |
| 19886 | |
| 19887 | if (NULL == pAdapter) |
| 19888 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 19889 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19890 | "%s: HDD adapter is Null", __func__); |
| 19891 | return -ENODEV; |
| 19892 | } |
| 19893 | |
| 19894 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19895 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19896 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19897 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 19898 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19899 | "%s: HDD context is Null", __func__); |
| 19900 | return -ENODEV; |
| 19901 | } |
| 19902 | |
| 19903 | /* The return 0 is intentional when isLogpInProgress and |
| 19904 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 19905 | * failure in sched_scan_stop , especially for a case where the unload |
| 19906 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 19907 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 19908 | * success. If it returns a failure , then its next invocation due to the |
| 19909 | * clean up of the second interface will have the dev pointer corresponding |
| 19910 | * to the first one leading to a crash. |
| 19911 | */ |
| 19912 | if (pHddCtx->isLogpInProgress) |
| 19913 | { |
| 19914 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19915 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Mahesh A Saptasagar | 0c11d82 | 2015-10-08 19:54:08 +0530 | [diff] [blame] | 19916 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19917 | return ret; |
| 19918 | } |
| 19919 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 19920 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19921 | { |
| 19922 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19923 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 19924 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19925 | } |
| 19926 | |
| 19927 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 19928 | if (NULL == hHal) |
| 19929 | { |
| 19930 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19931 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19932 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19933 | } |
| 19934 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19935 | pnoRequest.enable = 0; /* Disable PNO */ |
| 19936 | pnoRequest.ucNetworksCount = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19937 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 19938 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 19939 | TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP, |
| 19940 | pAdapter->sessionId, pAdapter->device_mode)); |
Hanumantha Reddy Pothula | 0e408dc | 2015-11-23 12:04:53 +0530 | [diff] [blame] | 19941 | |
| 19942 | INIT_COMPLETION(pAdapter->pno_comp_var); |
| 19943 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 19944 | pnoRequest.callbackContext = pAdapter; |
| 19945 | pAdapter->pno_req_status = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 19946 | status = sme_SetPreferredNetworkList(hHal, &pnoRequest, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19947 | pAdapter->sessionId, |
| 19948 | NULL, pAdapter); |
| 19949 | if (eHAL_STATUS_SUCCESS != status) |
| 19950 | { |
| 19951 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19952 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19953 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 19954 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19955 | } |
Hanumantha Reddy Pothula | 0e408dc | 2015-11-23 12:04:53 +0530 | [diff] [blame] | 19956 | ret = wait_for_completion_timeout( |
| 19957 | &pAdapter->pno_comp_var, |
| 19958 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 19959 | if (0 >= ret) |
| 19960 | { |
| 19961 | // Did not receive the response for PNO disable in time. |
| 19962 | // Assuming the PNO disable was success. |
| 19963 | // Returning error from here, because we timeout, results |
| 19964 | // in side effect of Wifi (Wifi Setting) not to work. |
Anurag Chouhan | 96b41cb | 2016-09-28 18:54:47 +0530 | [diff] [blame] | 19965 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hanumantha Reddy Pothula | 0e408dc | 2015-11-23 12:04:53 +0530 | [diff] [blame] | 19966 | FL("Timed out waiting for PNO to be disabled")); |
| 19967 | ret = 0; |
| 19968 | } |
| 19969 | |
| 19970 | ret = pAdapter->pno_req_status; |
| 19971 | pHddCtx->isPnoEnable = (ret == 0) ? FALSE : TRUE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19972 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 19973 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19974 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 19975 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19976 | |
| 19977 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 19978 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19979 | } |
| 19980 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 19981 | /* |
| 19982 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 19983 | * NL interface to disable PNO |
| 19984 | */ |
| 19985 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 19986 | struct net_device *dev) |
| 19987 | { |
| 19988 | int ret; |
| 19989 | |
| 19990 | vos_ssr_protect(__func__); |
| 19991 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 19992 | vos_ssr_unprotect(__func__); |
| 19993 | |
| 19994 | return ret; |
| 19995 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19996 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 19997 | |
| 19998 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19999 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 20000 | #if TDLS_MGMT_VERSION2 |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 20001 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 20002 | struct net_device *dev, |
| 20003 | u8 *peer, u8 action_code, |
| 20004 | u8 dialog_token, |
| 20005 | u16 status_code, u32 peer_capability, |
| 20006 | const u8 *buf, size_t len) |
| 20007 | #else /* TDLS_MGMT_VERSION2 */ |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 20008 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || \ |
| 20009 | defined(WITH_BACKPORTS) |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 20010 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 20011 | struct net_device *dev, |
| 20012 | const u8 *peer, u8 action_code, |
| 20013 | u8 dialog_token, u16 status_code, |
| 20014 | u32 peer_capability, bool initiator, |
| 20015 | const u8 *buf, size_t len) |
| 20016 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) |
| 20017 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 20018 | struct net_device *dev, |
| 20019 | const u8 *peer, u8 action_code, |
| 20020 | u8 dialog_token, u16 status_code, |
| 20021 | u32 peer_capability, const u8 *buf, |
| 20022 | size_t len) |
| 20023 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 20024 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 20025 | struct net_device *dev, |
| 20026 | u8 *peer, u8 action_code, |
| 20027 | u8 dialog_token, |
| 20028 | u16 status_code, u32 peer_capability, |
| 20029 | const u8 *buf, size_t len) |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 20030 | #else |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 20031 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 20032 | struct net_device *dev, |
| 20033 | u8 *peer, u8 action_code, |
| 20034 | u8 dialog_token, |
| 20035 | u16 status_code, const u8 *buf, |
| 20036 | size_t len) |
| 20037 | #endif |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 20038 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20039 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 20040 | hdd_adapter_t *pAdapter; |
| 20041 | hdd_context_t *pHddCtx; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20042 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 20043 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 20044 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 20045 | long rc; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 20046 | int ret; |
Masti, Narayanraddi | 3b68193 | 2015-10-08 19:22:25 +0530 | [diff] [blame] | 20047 | hddTdlsPeer_t *pTdlsPeer; |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 20048 | #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] | 20049 | u32 peer_capability = 0; |
| 20050 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 20051 | tANI_U16 numCurrTdlsPeers; |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 20052 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Ganesh Kondabattini | 17e6066 | 2017-05-25 12:36:07 +0530 | [diff] [blame] | 20053 | tdlsCtx_t *pHddTdlsCtx; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 20054 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 20055 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 20056 | if (NULL == pAdapter) |
| 20057 | { |
| 20058 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20059 | "%s: Adapter is NULL",__func__); |
| 20060 | return -EINVAL; |
| 20061 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 20062 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 20063 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 20064 | pAdapter->sessionId, action_code)); |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 20065 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 20066 | pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 20067 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20068 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 20069 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20070 | "Invalid arguments"); |
| 20071 | return -EINVAL; |
| 20072 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 20073 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 20074 | if (pHddCtx->isLogpInProgress) |
| 20075 | { |
| 20076 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20077 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20078 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 20079 | peer, |
| 20080 | eTDLS_LINK_IDLE, |
| 20081 | eTDLS_LINK_UNSPECIFIED); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 20082 | return -EBUSY; |
| 20083 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 20084 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 20085 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
| 20086 | { |
| 20087 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20088 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 20089 | return -EAGAIN; |
| 20090 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 20091 | |
Ganesh Kondabattini | 17e6066 | 2017-05-25 12:36:07 +0530 | [diff] [blame] | 20092 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 20093 | if (!pHddTdlsCtx) { |
| 20094 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20095 | "%s: pHddTdlsCtx not valid.", __func__); |
Hanumanth Reddy Pothula | 36dfa52 | 2018-03-12 16:42:08 +0530 | [diff] [blame] | 20096 | return -EINVAL; |
Ganesh Kondabattini | 17e6066 | 2017-05-25 12:36:07 +0530 | [diff] [blame] | 20097 | } |
| 20098 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 20099 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20100 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 20101 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 20102 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 20103 | MAC_ADDRESS_STR " action %d declined.", |
| 20104 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20105 | return -ENOTSUPP; |
| 20106 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 20107 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 20108 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 20109 | |
| 20110 | if( NULL == pHddStaCtx ) |
| 20111 | { |
| 20112 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20113 | "%s: HDD station context NULL ",__func__); |
| 20114 | return -EINVAL; |
| 20115 | } |
| 20116 | |
| 20117 | /* STA should be connected and authenticated |
| 20118 | * before sending any TDLS frames |
| 20119 | */ |
| 20120 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 20121 | (FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 20122 | { |
| 20123 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20124 | "STA is not connected or unauthenticated. " |
| 20125 | "connState %u, uIsAuthenticated %u", |
| 20126 | pHddStaCtx->conn_info.connState, |
| 20127 | pHddStaCtx->conn_info.uIsAuthenticated); |
| 20128 | return -EAGAIN; |
| 20129 | } |
| 20130 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 20131 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 20132 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 20133 | { |
| 20134 | /* if tdls_mode is disabled to respond to peer's request */ |
| 20135 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 20136 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 20137 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 20138 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 20139 | " TDLS mode is disabled. action %d declined.", |
| 20140 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 20141 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 20142 | return -ENOTSUPP; |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 20143 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 20144 | |
| 20145 | if (vos_max_concurrent_connections_reached()) |
| 20146 | { |
| 20147 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 20148 | return -EINVAL; |
| 20149 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 20150 | } |
| 20151 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 20152 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 20153 | { |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 20154 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 20155 | { |
| 20156 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 20157 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 20158 | " TDLS setup is ongoing. action %d declined.", |
| 20159 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 20160 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 20161 | } |
| 20162 | } |
| 20163 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 20164 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 20165 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 20166 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 20167 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 20168 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 20169 | { |
| 20170 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 20171 | we return error code at 'add_station()'. Hence we have this |
| 20172 | check again in addtion to add_station(). |
| 20173 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 20174 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 20175 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 20176 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20177 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 20178 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 20179 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 20180 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 20181 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 20182 | } |
| 20183 | else |
| 20184 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 20185 | /* maximum reached. tweak to send error code to peer and return |
| 20186 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 20187 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 20188 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20189 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 20190 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 20191 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 20192 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 20193 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 20194 | /* fall through to send setup resp with failure status |
| 20195 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 20196 | } |
| 20197 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 20198 | else |
| 20199 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20200 | mutex_lock(&pHddCtx->tdls_lock); |
| 20201 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 20202 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 20203 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20204 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 20205 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 20206 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 20207 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 20208 | return -EPERM; |
| 20209 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20210 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 20211 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 20212 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20213 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 20214 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 20215 | "%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] | 20216 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 20217 | action_code, dialog_token, status_code, len); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20218 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 20219 | /*Except teardown responder will not be used so just make 0*/ |
| 20220 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 20221 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 20222 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 20223 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20224 | mutex_lock(&pHddCtx->tdls_lock); |
| 20225 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 20226 | |
| 20227 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 20228 | responder = pTdlsPeer->is_responder; |
| 20229 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 20230 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 20231 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 20232 | "%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] | 20233 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 20234 | dialog_token, status_code, len); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20235 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 20236 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 20237 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20238 | mutex_unlock(&pHddCtx->tdls_lock); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20239 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20240 | |
Masti, Narayanraddi | 3b68193 | 2015-10-08 19:22:25 +0530 | [diff] [blame] | 20241 | /* Discard TDLS setup if peer is removed by user app */ |
| 20242 | if ((pHddCtx->cfg_ini->fTDLSExternalControl) && |
| 20243 | ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 20244 | (SIR_MAC_TDLS_SETUP_CNF == action_code) || |
| 20245 | (SIR_MAC_TDLS_DIS_REQ == action_code))) { |
| 20246 | |
| 20247 | mutex_lock(&pHddCtx->tdls_lock); |
| 20248 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 20249 | if (pTdlsPeer && (FALSE == pTdlsPeer->isForcedPeer)) { |
| 20250 | mutex_unlock(&pHddCtx->tdls_lock); |
| 20251 | hddLog(LOGE, FL("TDLS External Control enabled, but peer " |
| 20252 | MAC_ADDRESS_STR " is not forced, so reject the action code %d"), |
| 20253 | MAC_ADDR_ARRAY(peer), action_code); |
| 20254 | return -EINVAL; |
| 20255 | } |
| 20256 | mutex_unlock(&pHddCtx->tdls_lock); |
| 20257 | } |
| 20258 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 20259 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 20260 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 20261 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Deepthi Gowri | f78f1f7 | 2016-03-21 13:13:28 +0530 | [diff] [blame] | 20262 | (SIR_MAC_TDLS_SETUP_CNF== action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 20263 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 20264 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 20265 | { |
Ganesh Kondabattini | 17e6066 | 2017-05-25 12:36:07 +0530 | [diff] [blame] | 20266 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 20267 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Ganesh Kondabattini | 17e6066 | 2017-05-25 12:36:07 +0530 | [diff] [blame] | 20268 | "%s: Sending frame action_code %u.Disable BMPS", __func__, |
| 20269 | action_code); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20270 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 20271 | if (status != VOS_STATUS_SUCCESS) { |
| 20272 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
Ganesh Kondabattini | 17e6066 | 2017-05-25 12:36:07 +0530 | [diff] [blame] | 20273 | } else { |
| 20274 | pHddTdlsCtx->is_tdls_disabled_bmps = true; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20275 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 20276 | } |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20277 | if (SIR_MAC_TDLS_DIS_REQ != action_code) { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 20278 | if (0 != wlan_hdd_tdls_set_cap(pAdapter, peer, eTDLS_CAP_SUPPORTED)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20279 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS capabilities")); |
| 20280 | } |
| 20281 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 20282 | } |
| 20283 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 20284 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 20285 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 20286 | { |
| 20287 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 20288 | "%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] | 20289 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 20290 | ret = -EBUSY; |
| 20291 | goto tx_failed; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 20292 | } |
| 20293 | |
| 20294 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 20295 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 20296 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 20297 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 20298 | pAdapter->sessionId, peer, action_code, dialog_token, |
| 20299 | status_code, peer_capability, (tANI_U8 *)buf, len, |
| 20300 | responder); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20301 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 20302 | if (VOS_STATUS_SUCCESS != status) |
| 20303 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20304 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20305 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 20306 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 20307 | ret = -EINVAL; |
| 20308 | goto tx_failed; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20309 | } |
| 20310 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 20311 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20312 | "%s: Wait for tdls_mgmt_comp. Timeout %u ms", __func__, |
| 20313 | WAIT_TIME_TDLS_MGMT); |
| 20314 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 20315 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 20316 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 20317 | |
| 20318 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 20319 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 20320 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 20321 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 20322 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 20323 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 20324 | |
| 20325 | if (pHddCtx->isLogpInProgress) |
| 20326 | { |
| 20327 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20328 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 20329 | return -EAGAIN; |
| 20330 | } |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 20331 | if (rc <= 0) |
| 20332 | vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL, |
| 20333 | WLAN_LOG_INDICATOR_HOST_DRIVER, |
| 20334 | WLAN_LOG_REASON_HDD_TIME_OUT, |
| 20335 | TRUE, TRUE); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 20336 | |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 20337 | ret = -EINVAL; |
| 20338 | goto tx_failed; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 20339 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 20340 | else |
| 20341 | { |
| 20342 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20343 | "%s: Mgmt Tx Completion status %ld TxCompletion %u", |
| 20344 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
| 20345 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 20346 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 20347 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 20348 | { |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 20349 | ret = max_sta_failed; |
| 20350 | goto tx_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 20351 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 20352 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 20353 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 20354 | { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 20355 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peer, TRUE)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20356 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 20357 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 20358 | } |
| 20359 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 20360 | { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 20361 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peer, FALSE)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20362 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 20363 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 20364 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20365 | |
| 20366 | return 0; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 20367 | |
| 20368 | tx_failed: |
| 20369 | /* add_station will be called before sending TDLS_SETUP_REQ and |
| 20370 | * TDLS_SETUP_RSP and as part of add_station driver will enable |
| 20371 | * BMPS. NL80211_TDLS_DISABLE_LINK will be called if the tx of |
| 20372 | * TDLS_SETUP_REQ or TDLS_SETUP_RSP fails. BMPS will be enabled |
| 20373 | * as part of processing NL80211_TDLS_DISABLE_LINK. So need to |
| 20374 | * enable BMPS for TDLS_SETUP_REQ and TDLS_SETUP_RSP if tx fails. |
| 20375 | */ |
| 20376 | |
| 20377 | if ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 20378 | (SIR_MAC_TDLS_SETUP_RSP == action_code)) |
| 20379 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 20380 | return ret; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20381 | } |
| 20382 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 20383 | #if TDLS_MGMT_VERSION2 |
| 20384 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 20385 | u8 *peer, u8 action_code, u8 dialog_token, |
| 20386 | u16 status_code, u32 peer_capability, |
| 20387 | const u8 *buf, size_t len) |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 20388 | #else /* TDLS_MGMT_VERSION2 */ |
| 20389 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) |
| 20390 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 20391 | struct net_device *dev, |
| 20392 | const u8 *peer, u8 action_code, |
| 20393 | u8 dialog_token, u16 status_code, |
| 20394 | u32 peer_capability, bool initiator, |
| 20395 | const u8 *buf, size_t len) |
| 20396 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 20397 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 20398 | struct net_device *dev, |
| 20399 | const u8 *peer, u8 action_code, |
| 20400 | u8 dialog_token, u16 status_code, |
| 20401 | u32 peer_capability, const u8 *buf, |
| 20402 | size_t len) |
| 20403 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 20404 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 20405 | struct net_device *dev, |
| 20406 | u8 *peer, u8 action_code, |
| 20407 | u8 dialog_token, |
| 20408 | u16 status_code, u32 peer_capability, |
| 20409 | const u8 *buf, size_t len) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 20410 | #else |
| 20411 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 20412 | u8 *peer, u8 action_code, u8 dialog_token, |
| 20413 | u16 status_code, const u8 *buf, size_t len) |
| 20414 | #endif |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 20415 | #endif |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 20416 | { |
| 20417 | int ret; |
| 20418 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 20419 | vos_ssr_protect(__func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 20420 | #if TDLS_MGMT_VERSION2 |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 20421 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 20422 | dialog_token, status_code, |
| 20423 | peer_capability, buf, len); |
| 20424 | #else /* TDLS_MGMT_VERSION2 */ |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 20425 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || \ |
| 20426 | defined(WITH_BACKPORTS) |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 20427 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 20428 | dialog_token, status_code, |
| 20429 | peer_capability, initiator, |
| 20430 | buf, len); |
| 20431 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) |
| 20432 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 20433 | dialog_token, status_code, |
| 20434 | peer_capability, buf, len); |
| 20435 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 20436 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 20437 | dialog_token, status_code, |
| 20438 | peer_capability, buf, len); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 20439 | #else |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 20440 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 20441 | dialog_token, status_code, buf, len); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 20442 | #endif |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 20443 | #endif |
| 20444 | vos_ssr_unprotect(__func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 20445 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 20446 | return ret; |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 20447 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20448 | |
| 20449 | int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 20450 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 20451 | const u8 *peer, |
| 20452 | #else |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20453 | u8 *peer, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 20454 | #endif |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20455 | tdls_req_params_t *tdls_peer_params, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20456 | cfg80211_exttdls_callback callback) |
| 20457 | { |
| 20458 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20459 | hddTdlsPeer_t *pTdlsPeer = NULL; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20460 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 20461 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20462 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20463 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 20464 | __func__, MAC_ADDR_ARRAY(peer)); |
| 20465 | |
| 20466 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 20467 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 20468 | |
| 20469 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20470 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 20471 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 20472 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20473 | return -ENOTSUPP; |
| 20474 | } |
| 20475 | |
| 20476 | /* To cater the requirement of establishing the TDLS link |
| 20477 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 20478 | */ |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 20479 | mutex_lock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20480 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 20481 | if (pTdlsPeer == NULL) { |
| 20482 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20483 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 20484 | __func__, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 20485 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20486 | return -EINVAL; |
| 20487 | } |
| 20488 | |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 20489 | /* check FW TDLS Off Channel capability */ |
| 20490 | if ((TRUE == sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)) && |
Pradeep Reddy POTTETI | 0cb99bc | 2015-06-08 12:59:09 +0530 | [diff] [blame] | 20491 | (TRUE == pHddCtx->cfg_ini->fEnableTDLSOffChannel) && |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 20492 | (NULL != tdls_peer_params)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20493 | { |
| 20494 | pTdlsPeer->peerParams.channel = tdls_peer_params->channel; |
| 20495 | pTdlsPeer->peerParams.global_operating_class = |
| 20496 | tdls_peer_params->global_operating_class; |
| 20497 | pTdlsPeer->peerParams.max_latency_ms = tdls_peer_params->max_latency_ms; |
| 20498 | pTdlsPeer->peerParams.min_bandwidth_kbps = |
| 20499 | tdls_peer_params->min_bandwidth_kbps; |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 20500 | /* check configured channel is valid, non dfs and |
| 20501 | * not current operating channel */ |
| 20502 | if ((sme_IsTdlsOffChannelValid(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 20503 | tdls_peer_params->channel)) && |
| 20504 | (pHddStaCtx) && |
| 20505 | (tdls_peer_params->channel != |
| 20506 | pHddStaCtx->conn_info.operationChannel)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20507 | { |
| 20508 | pTdlsPeer->isOffChannelConfigured = TRUE; |
| 20509 | } |
| 20510 | else |
| 20511 | { |
| 20512 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 20513 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20514 | "%s: Configured Tdls Off Channel is not valid", __func__); |
| 20515 | |
| 20516 | } |
| 20517 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 20518 | "%s: tdls_off_channel %d isOffChannelConfigured %d " |
| 20519 | "current operating channel %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20520 | __func__, pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 20521 | pTdlsPeer->isOffChannelConfigured, |
| 20522 | (pHddStaCtx ? pHddStaCtx->conn_info.operationChannel : 0)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20523 | } |
| 20524 | else |
| 20525 | { |
| 20526 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pradeep Reddy POTTETI | 0cb99bc | 2015-06-08 12:59:09 +0530 | [diff] [blame] | 20527 | "%s: TDLS off channel FW capability %d, " |
| 20528 | "host capab %d or Invalid TDLS Peer Params", __func__, |
| 20529 | sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL), |
| 20530 | pHddCtx->cfg_ini->fEnableTDLSOffChannel); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20531 | } |
| 20532 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20533 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 20534 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20535 | mutex_unlock(&pHddCtx->tdls_lock); |
| 20536 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20537 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20538 | " %s TDLS Add Force Peer Failed", |
| 20539 | __func__); |
| 20540 | return -EINVAL; |
| 20541 | } |
| 20542 | /*EXT TDLS*/ |
| 20543 | |
| 20544 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20545 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20546 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20547 | " %s TDLS set callback Failed", |
| 20548 | __func__); |
| 20549 | return -EINVAL; |
| 20550 | } |
| 20551 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20552 | mutex_unlock(&pHddCtx->tdls_lock); |
| 20553 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20554 | return(0); |
| 20555 | |
| 20556 | } |
| 20557 | |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 20558 | int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, |
| 20559 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 20560 | const u8 *peer |
| 20561 | #else |
| 20562 | u8 *peer |
| 20563 | #endif |
| 20564 | ) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20565 | { |
| 20566 | |
| 20567 | hddTdlsPeer_t *pTdlsPeer; |
| 20568 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | ff7c2f9 | 2016-01-05 15:28:12 +0530 | [diff] [blame] | 20569 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20570 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20571 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 20572 | __func__, MAC_ADDR_ARRAY(peer)); |
| 20573 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 20574 | if (0 != wlan_hdd_validate_context(pHddCtx)) { |
| 20575 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is NULL")); |
| 20576 | return -EINVAL; |
| 20577 | } |
| 20578 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20579 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 20580 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 20581 | |
| 20582 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20583 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 20584 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 20585 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20586 | return -ENOTSUPP; |
| 20587 | } |
| 20588 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20589 | mutex_lock(&pHddCtx->tdls_lock); |
| 20590 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20591 | |
| 20592 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20593 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20594 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 20595 | " peer not existing", |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20596 | __func__, MAC_ADDR_ARRAY(peer)); |
| 20597 | return -EINVAL; |
| 20598 | } |
| 20599 | else { |
| 20600 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 20601 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
Abhishek Singh | ff7c2f9 | 2016-01-05 15:28:12 +0530 | [diff] [blame] | 20602 | hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_EXT_CTRL, |
| 20603 | pTdlsPeer->peerMac); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20604 | /* if channel switch is configured, reset |
| 20605 | the channel for this peer */ |
| 20606 | if (TRUE == pTdlsPeer->isOffChannelConfigured) |
| 20607 | { |
| 20608 | pTdlsPeer->peerParams.channel = 0; |
| 20609 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 20610 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20611 | } |
| 20612 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20613 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20614 | mutex_unlock(&pHddCtx->tdls_lock); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20615 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set force peer")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20616 | return -EINVAL; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20617 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20618 | |
| 20619 | /*EXT TDLS*/ |
| 20620 | |
| 20621 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20622 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20623 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20624 | " %s TDLS set callback Failed", |
| 20625 | __func__); |
| 20626 | return -EINVAL; |
| 20627 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20628 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20629 | mutex_unlock(&pHddCtx->tdls_lock); |
| 20630 | |
| 20631 | return(0); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20632 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 20633 | 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] | 20634 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 20635 | const u8 *peer, |
| 20636 | #else |
| 20637 | u8 *peer, |
| 20638 | #endif |
| 20639 | enum nl80211_tdls_operation oper) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20640 | { |
| 20641 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 20642 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 20643 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 20644 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 20645 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 20646 | ENTER(); |
| 20647 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 20648 | if (!pAdapter) { |
| 20649 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 20650 | return -EINVAL; |
| 20651 | } |
| 20652 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 20653 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 20654 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 20655 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 20656 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20657 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 20658 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 20659 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20660 | return -EINVAL; |
| 20661 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 20662 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 20663 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 20664 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 20665 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 20666 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 20667 | } |
| 20668 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20669 | |
| 20670 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 20671 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20672 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 20673 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20674 | "TDLS Disabled in INI (%d) OR not enabled in FW (%d) " |
| 20675 | "Cannot process TDLS commands", |
| 20676 | pHddCtx->cfg_ini->fEnableTDLSSupport, |
| 20677 | sme_IsFeatureSupportedByFW(TDLS)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20678 | return -ENOTSUPP; |
| 20679 | } |
| 20680 | |
| 20681 | switch (oper) { |
| 20682 | case NL80211_TDLS_ENABLE_LINK: |
| 20683 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20684 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 20685 | long ret; |
Hanumantha Reddy Pothula | da38949 | 2016-02-11 17:29:27 +0530 | [diff] [blame] | 20686 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams = { {0}, 0, |
| 20687 | 0, 0, 0, 0, 0, 0, {0}, 0, {0} }; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 20688 | WLAN_STADescType staDesc; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20689 | tANI_U16 numCurrTdlsPeers = 0; |
| 20690 | hddTdlsPeer_t *connPeer = NULL; |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 20691 | tANI_U8 suppChannelLen = 0; |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 20692 | tSirMacAddr peerMac; |
| 20693 | int channel; |
| 20694 | tTDLSLinkStatus peer_status = eTDLS_LINK_IDLE; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 20695 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 20696 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20697 | " %s : NL80211_TDLS_ENABLE_LINK for " MAC_ADDRESS_STR, |
| 20698 | __func__, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20699 | |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 20700 | mutex_lock(&pHddCtx->tdls_lock); |
| 20701 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 20702 | memset(&staDesc, 0, sizeof(staDesc)); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 20703 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 20704 | mutex_unlock(&pHddCtx->tdls_lock); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 20705 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 20706 | " (oper %d) not exsting. ignored", |
| 20707 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 20708 | return -EINVAL; |
| 20709 | } |
| 20710 | |
| 20711 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20712 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 20713 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 20714 | "NL80211_TDLS_ENABLE_LINK"); |
| 20715 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 20716 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 20717 | { |
| 20718 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 20719 | MAC_ADDRESS_STR " failed", |
| 20720 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 20721 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 20722 | return -EINVAL; |
| 20723 | } |
| 20724 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 20725 | /* before starting tdls connection, set tdls |
| 20726 | * off channel established status to default value */ |
| 20727 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 20728 | |
| 20729 | mutex_unlock(&pHddCtx->tdls_lock); |
| 20730 | |
Deepthi Gowri | 2d85bbf | 2016-07-25 15:43:31 +0530 | [diff] [blame] | 20731 | wlan_hdd_tdls_set_cap(pAdapter, peer, eTDLS_CAP_SUPPORTED); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20732 | /* TDLS Off Channel, Disable tdls channel switch, |
| 20733 | when there are more than one tdls link */ |
| 20734 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 20735 | if (numCurrTdlsPeers == 2) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20736 | { |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 20737 | mutex_lock(&pHddCtx->tdls_lock); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20738 | /* get connected peer and send disable tdls off chan */ |
| 20739 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 20740 | if ((connPeer) && |
| 20741 | (connPeer->isOffChannelSupported == TRUE) && |
| 20742 | (connPeer->isOffChannelConfigured == TRUE)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20743 | { |
| 20744 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20745 | "%s: More then one peer connected, Disable " |
| 20746 | "TDLS channel switch", __func__); |
| 20747 | |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 20748 | connPeer->isOffChannelEstablished = FALSE; |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 20749 | vos_mem_copy(peerMac, connPeer->peerMac, sizeof (tSirMacAddr)); |
| 20750 | channel = connPeer->peerParams.channel; |
| 20751 | |
| 20752 | mutex_unlock(&pHddCtx->tdls_lock); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20753 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20754 | ret = sme_SendTdlsChanSwitchReq( |
| 20755 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20756 | pAdapter->sessionId, |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 20757 | peerMac, |
| 20758 | channel, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20759 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 20760 | TDLS_CHANNEL_SWITCH_DISABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20761 | if (ret != VOS_STATUS_SUCCESS) { |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 20762 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 20763 | FL("Failed to send TDLS switch channel request")); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20764 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20765 | } |
| 20766 | else |
| 20767 | { |
| 20768 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20769 | "%s: No TDLS Connected Peer or " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 20770 | "isOffChannelSupported %d " |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20771 | "isOffChannelConfigured %d", |
| 20772 | __func__, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 20773 | (connPeer ? (connPeer->isOffChannelSupported) |
| 20774 | : -1), |
| 20775 | (connPeer ? (connPeer->isOffChannelConfigured) |
| 20776 | : -1)); |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 20777 | mutex_unlock(&pHddCtx->tdls_lock); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20778 | } |
| 20779 | } |
| 20780 | |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 20781 | mutex_lock(&pHddCtx->tdls_lock); |
| 20782 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 20783 | if ( NULL == pTdlsPeer ) { |
| 20784 | mutex_unlock(&pHddCtx->tdls_lock); |
| 20785 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20786 | "%s: " MAC_ADDRESS_STR |
| 20787 | " (oper %d) peer got freed in other context. ignored", |
| 20788 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 20789 | return -EINVAL; |
| 20790 | } |
| 20791 | peer_status = pTdlsPeer->link_status; |
| 20792 | mutex_unlock(&pHddCtx->tdls_lock); |
| 20793 | |
| 20794 | if (eTDLS_LINK_CONNECTED != peer_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 20795 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 20796 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 20797 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 20798 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 20799 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20800 | 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] | 20801 | return -EINVAL; |
| 20802 | } |
| 20803 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 20804 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20805 | ret = sme_SendTdlsLinkEstablishParams( |
| 20806 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 20807 | pAdapter->sessionId, peer, |
| 20808 | &tdlsLinkEstablishParams); |
| 20809 | if (ret != VOS_STATUS_SUCCESS) { |
| 20810 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send link establishment params")); |
| 20811 | } |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 20812 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 20813 | * register with the TL on after the response for this operation |
| 20814 | * is received . |
| 20815 | */ |
| 20816 | ret = wait_for_completion_interruptible_timeout( |
| 20817 | &pAdapter->tdls_link_establish_req_comp, |
| 20818 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
Masti, Narayanraddi | e1892a5 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 20819 | |
| 20820 | mutex_lock(&pHddCtx->tdls_lock); |
| 20821 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 20822 | if ( NULL == pTdlsPeer ) { |
| 20823 | mutex_unlock(&pHddCtx->tdls_lock); |
| 20824 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20825 | "%s %d: " MAC_ADDRESS_STR |
| 20826 | " (oper %d) peer got freed in other context. ignored", |
| 20827 | __func__, __LINE__, MAC_ADDR_ARRAY(peer), |
| 20828 | (int)oper); |
| 20829 | return -EINVAL; |
| 20830 | } |
| 20831 | peer_status = pTdlsPeer->link_status; |
| 20832 | mutex_unlock(&pHddCtx->tdls_lock); |
| 20833 | |
| 20834 | if (ret <= 0 || (peer_status == eTDLS_LINK_TEARING)) |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 20835 | { |
| 20836 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 20837 | FL("Link Establish Request Failed Status %ld"), |
| 20838 | ret); |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 20839 | return -EINVAL; |
| 20840 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 20841 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 20842 | |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 20843 | mutex_lock(&pHddCtx->tdls_lock); |
| 20844 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 20845 | if ( NULL == pTdlsPeer ) { |
| 20846 | mutex_unlock(&pHddCtx->tdls_lock); |
| 20847 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20848 | "%s: " MAC_ADDRESS_STR |
| 20849 | " (oper %d) peer got freed in other context. ignored", |
| 20850 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 20851 | return -EINVAL; |
| 20852 | } |
| 20853 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 20854 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 20855 | eTDLS_LINK_CONNECTED, |
| 20856 | eTDLS_LINK_SUCCESS); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 20857 | staDesc.ucSTAId = pTdlsPeer->staId; |
| 20858 | staDesc.ucQosEnabled = tdlsLinkEstablishParams.qos; |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 20859 | |
| 20860 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20861 | "%s: tdlsLinkEstablishParams of peer " |
| 20862 | MAC_ADDRESS_STR "uapsdQueues: %d" |
| 20863 | "qos: %d maxSp: %d isBufSta: %d isOffChannelSupported: %d" |
| 20864 | "isResponder: %d peerstaId: %d", |
| 20865 | __func__, |
| 20866 | MAC_ADDR_ARRAY(tdlsLinkEstablishParams.peerMac), |
| 20867 | tdlsLinkEstablishParams.uapsdQueues, |
| 20868 | tdlsLinkEstablishParams.qos, |
| 20869 | tdlsLinkEstablishParams.maxSp, |
| 20870 | tdlsLinkEstablishParams.isBufSta, |
| 20871 | tdlsLinkEstablishParams.isOffChannelSupported, |
| 20872 | tdlsLinkEstablishParams.isResponder, |
| 20873 | pTdlsPeer->staId); |
| 20874 | |
| 20875 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20876 | "%s: StaDesc ucSTAId: %d ucQosEnabled: %d", |
| 20877 | __func__, |
| 20878 | staDesc.ucSTAId, |
| 20879 | staDesc.ucQosEnabled); |
| 20880 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20881 | ret = WLANTL_UpdateTdlsSTAClient( |
| 20882 | pHddCtx->pvosContext, |
| 20883 | &staDesc); |
| 20884 | if (ret != VOS_STATUS_SUCCESS) { |
| 20885 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to update TDLS STA params")); |
| 20886 | } |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 20887 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 20888 | /* Mark TDLS client Authenticated .*/ |
| 20889 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 20890 | pTdlsPeer->staId, |
| 20891 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 20892 | if (VOS_STATUS_SUCCESS == status) |
| 20893 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 20894 | if (pTdlsPeer->is_responder == 0) |
| 20895 | { |
| 20896 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
Ganesh Kondabattini | cbfdc39 | 2015-09-11 19:12:59 +0530 | [diff] [blame] | 20897 | tdlsConnInfo_t *tdlsInfo; |
| 20898 | |
| 20899 | tdlsInfo = wlan_hdd_get_conn_info(pHddCtx, staId); |
| 20900 | |
Hanumantha Reddy Pothula | c823840 | 2016-03-24 18:02:23 +0530 | [diff] [blame] | 20901 | if (!vos_timer_is_initialized( |
| 20902 | &pTdlsPeer->initiatorWaitTimeoutTimer)) |
| 20903 | { |
| 20904 | /* Initialize initiator wait callback */ |
| 20905 | vos_timer_init( |
Ganesh Kondabattini | cbfdc39 | 2015-09-11 19:12:59 +0530 | [diff] [blame] | 20906 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 20907 | VOS_TIMER_TYPE_SW, |
| 20908 | wlan_hdd_tdls_initiator_wait_cb, |
| 20909 | tdlsInfo); |
Hanumantha Reddy Pothula | c823840 | 2016-03-24 18:02:23 +0530 | [diff] [blame] | 20910 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 20911 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 20912 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 20913 | WAIT_TIME_TDLS_INITIATOR); |
| 20914 | /* suspend initiator TX until it receives direct packet from the |
| 20915 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20916 | ret = WLANTL_SuspendDataTx( |
| 20917 | (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 20918 | &staId, NULL); |
| 20919 | if (ret != VOS_STATUS_SUCCESS) { |
| 20920 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to suspend data tx")); |
| 20921 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 20922 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20923 | |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 20924 | if ((TRUE == pTdlsPeer->isOffChannelSupported) && |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 20925 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 20926 | { |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 20927 | suppChannelLen = |
| 20928 | tdlsLinkEstablishParams.supportedChannelsLen; |
| 20929 | |
| 20930 | if ((suppChannelLen > 0) && |
| 20931 | (suppChannelLen <= SIR_MAC_MAX_SUPP_CHANNELS)) |
| 20932 | { |
| 20933 | tANI_U8 suppPeerChannel = 0; |
| 20934 | int i = 0; |
| 20935 | for (i = 0U; i < suppChannelLen; i++) |
| 20936 | { |
| 20937 | suppPeerChannel = |
| 20938 | tdlsLinkEstablishParams.supportedChannels[i]; |
| 20939 | |
| 20940 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 20941 | if (suppPeerChannel == |
| 20942 | pTdlsPeer->peerParams.channel) |
| 20943 | { |
| 20944 | pTdlsPeer->isOffChannelSupported = TRUE; |
| 20945 | break; |
| 20946 | } |
| 20947 | } |
| 20948 | } |
| 20949 | else |
| 20950 | { |
| 20951 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 20952 | } |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 20953 | } |
| 20954 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20955 | "%s: TDLS channel switch request for channel " |
| 20956 | "%d isOffChannelConfigured %d suppChannelLen " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 20957 | "%d isOffChannelSupported %d", __func__, |
| 20958 | pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 20959 | pTdlsPeer->isOffChannelConfigured, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 20960 | suppChannelLen, |
| 20961 | pTdlsPeer->isOffChannelSupported); |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 20962 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20963 | /* TDLS Off Channel, Enable tdls channel switch, |
| 20964 | when their is only one tdls link and it supports */ |
| 20965 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 20966 | if ((numCurrTdlsPeers == 1) && |
| 20967 | (TRUE == pTdlsPeer->isOffChannelSupported) && |
| 20968 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
| 20969 | { |
| 20970 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 20971 | "%s: Send TDLS channel switch request for channel %d", |
| 20972 | __func__, pTdlsPeer->peerParams.channel); |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 20973 | |
| 20974 | pTdlsPeer->isOffChannelEstablished = TRUE; |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 20975 | vos_mem_copy(peerMac, pTdlsPeer->peerMac, sizeof (tSirMacAddr)); |
| 20976 | channel = pTdlsPeer->peerParams.channel; |
| 20977 | |
| 20978 | mutex_unlock(&pHddCtx->tdls_lock); |
| 20979 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20980 | ret = sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 20981 | pAdapter->sessionId, |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 20982 | peerMac, |
| 20983 | channel, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20984 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 20985 | TDLS_CHANNEL_SWITCH_ENABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 20986 | if (ret != VOS_STATUS_SUCCESS) { |
| 20987 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS offchannel: Failed to send TDLS switch channel req")); |
| 20988 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 20989 | } |
| 20990 | else |
| 20991 | { |
| 20992 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 20993 | "%s: TDLS channel switch request not sent" |
| 20994 | " numCurrTdlsPeers %d " |
| 20995 | "isOffChannelSupported %d " |
| 20996 | "isOffChannelConfigured %d", |
| 20997 | __func__, numCurrTdlsPeers, |
| 20998 | pTdlsPeer->isOffChannelSupported, |
| 20999 | pTdlsPeer->isOffChannelConfigured); |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 21000 | mutex_unlock(&pHddCtx->tdls_lock); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 21001 | } |
| 21002 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 21003 | } |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 21004 | else |
| 21005 | mutex_unlock(&pHddCtx->tdls_lock); |
| 21006 | |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 21007 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 21008 | |
| 21009 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 21010 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 21011 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 21012 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 21013 | int ac; |
| 21014 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 21015 | WLANTL_AC_VI, |
| 21016 | WLANTL_AC_BK, |
| 21017 | WLANTL_AC_BE }; |
| 21018 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 21019 | for(ac=0; ac < 4; ac++) |
| 21020 | { |
| 21021 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 21022 | pTdlsPeer->staId, ucAc[ac], |
| 21023 | tlTid[ac], tlTid[ac], 0, 0, |
| 21024 | WLANTL_BI_DIR ); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 21025 | if (status != VOS_STATUS_SUCCESS) { |
| 21026 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to enable UAPSD for AC")); |
| 21027 | } |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 21028 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 21029 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 21030 | } |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 21031 | |
Bhargav Shah | 6689679 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 21032 | /* stop TCP delack timer if TDLS is enable */ |
| 21033 | set_bit(WLAN_TDLS_MODE, &pHddCtx->mode); |
| 21034 | hdd_manage_delack_timer(pHddCtx); |
Abhishek Singh | 67fa6bc | 2016-01-05 15:57:19 +0530 | [diff] [blame] | 21035 | hdd_wlan_tdls_enable_link_event(peer, |
| 21036 | pTdlsPeer->isOffChannelSupported, |
| 21037 | pTdlsPeer->isOffChannelConfigured, |
| 21038 | pTdlsPeer->isOffChannelEstablished); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 21039 | } |
| 21040 | break; |
| 21041 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 21042 | { |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 21043 | tANI_U16 numCurrTdlsPeers = 0; |
| 21044 | hddTdlsPeer_t *connPeer = NULL; |
| 21045 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 21046 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 21047 | " %s : NL80211_TDLS_DISABLE_LINK for " MAC_ADDRESS_STR, |
| 21048 | __func__, MAC_ADDR_ARRAY(peer)); |
| 21049 | |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 21050 | mutex_lock(&pHddCtx->tdls_lock); |
| 21051 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 21052 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 21053 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 21054 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 21055 | mutex_unlock(&pHddCtx->tdls_lock); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 21056 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 21057 | " (oper %d) not exsting. ignored", |
| 21058 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 21059 | return -EINVAL; |
| 21060 | } |
| 21061 | |
| 21062 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21063 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 21064 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 21065 | "NL80211_TDLS_DISABLE_LINK"); |
| 21066 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 21067 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 21068 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 21069 | long status; |
| 21070 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 21071 | /* set tdls off channel status to false for this peer */ |
| 21072 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 21073 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 21074 | eTDLS_LINK_TEARING, |
| 21075 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 21076 | eTDLS_LINK_UNSPECIFIED: |
| 21077 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 21078 | mutex_unlock(&pHddCtx->tdls_lock); |
| 21079 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 21080 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 21081 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 21082 | status = sme_DeleteTdlsPeerSta( |
| 21083 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 21084 | pAdapter->sessionId, peer ); |
| 21085 | if (status != VOS_STATUS_SUCCESS) { |
| 21086 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 21087 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 21088 | |
| 21089 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 21090 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 21091 | |
| 21092 | mutex_lock(&pHddCtx->tdls_lock); |
| 21093 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 21094 | if ( NULL == pTdlsPeer ) { |
| 21095 | mutex_unlock(&pHddCtx->tdls_lock); |
| 21096 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 21097 | " peer was freed in other context", |
| 21098 | __func__, MAC_ADDR_ARRAY(peer)); |
| 21099 | return -EINVAL; |
| 21100 | } |
| 21101 | |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 21102 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
Atul Mittal | 454664b | 2014-10-10 11:03:46 +0530 | [diff] [blame] | 21103 | eTDLS_LINK_IDLE, |
| 21104 | eTDLS_LINK_UNSPECIFIED); |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 21105 | mutex_unlock(&pHddCtx->tdls_lock); |
| 21106 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 21107 | if (status <= 0) |
| 21108 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 21109 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21110 | "%s: Del station failed status %ld", |
| 21111 | __func__, status); |
| 21112 | return -EPERM; |
| 21113 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 21114 | |
| 21115 | /* TDLS Off Channel, Enable tdls channel switch, |
| 21116 | when their is only one tdls link and it supports */ |
| 21117 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 21118 | if (numCurrTdlsPeers == 1) |
| 21119 | { |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 21120 | tSirMacAddr peerMac; |
| 21121 | int channel; |
Masti, Narayanraddi | 3818aea | 2015-10-17 15:20:28 +0530 | [diff] [blame] | 21122 | |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 21123 | mutex_lock(&pHddCtx->tdls_lock); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 21124 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
Masti, Narayanraddi | 3818aea | 2015-10-17 15:20:28 +0530 | [diff] [blame] | 21125 | |
| 21126 | if (connPeer == NULL) { |
| 21127 | mutex_unlock(&pHddCtx->tdls_lock); |
| 21128 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 21129 | "%s connPeer is NULL", __func__); |
| 21130 | return -EINVAL; |
| 21131 | } |
| 21132 | |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 21133 | vos_mem_copy(peerMac, connPeer->peerMac, sizeof(tSirMacAddr)); |
| 21134 | channel = connPeer->peerParams.channel; |
| 21135 | |
| 21136 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 21137 | "%s: TDLS channel switch " |
| 21138 | "isOffChannelSupported %d " |
| 21139 | "isOffChannelConfigured %d " |
| 21140 | "isOffChannelEstablished %d", |
| 21141 | __func__, |
| 21142 | (connPeer ? connPeer->isOffChannelSupported : -1), |
| 21143 | (connPeer ? connPeer->isOffChannelConfigured : -1), |
| 21144 | (connPeer ? connPeer->isOffChannelEstablished : -1)); |
| 21145 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 21146 | if ((connPeer) && |
| 21147 | (connPeer->isOffChannelSupported == TRUE) && |
| 21148 | (connPeer->isOffChannelConfigured == TRUE)) |
| 21149 | { |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 21150 | connPeer->isOffChannelEstablished = TRUE; |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 21151 | mutex_unlock(&pHddCtx->tdls_lock); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 21152 | status = sme_SendTdlsChanSwitchReq( |
| 21153 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 21154 | pAdapter->sessionId, |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 21155 | peerMac, |
| 21156 | channel, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 21157 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 21158 | TDLS_CHANNEL_SWITCH_ENABLE); |
| 21159 | if (status != VOS_STATUS_SUCCESS) { |
| 21160 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel req")); |
| 21161 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 21162 | } |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 21163 | else |
| 21164 | mutex_unlock(&pHddCtx->tdls_lock); |
| 21165 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 21166 | else |
| 21167 | { |
| 21168 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21169 | "%s: TDLS channel switch request not sent " |
| 21170 | "numCurrTdlsPeers %d ", |
| 21171 | __func__, numCurrTdlsPeers); |
| 21172 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 21173 | } |
| 21174 | else |
| 21175 | { |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 21176 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 21177 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21178 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 21179 | } |
Bhargav Shah | 6689679 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 21180 | if (numCurrTdlsPeers == 0) { |
| 21181 | /* start TCP delack timer if TDLS is disable */ |
| 21182 | clear_bit(WLAN_TDLS_MODE, &pHddCtx->mode); |
| 21183 | hdd_manage_delack_timer(pHddCtx); |
| 21184 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 21185 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 21186 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 21187 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 21188 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 21189 | status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 21190 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 21191 | if (0 != status) |
| 21192 | { |
| 21193 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 21194 | FL("Error in TDLS Teardown")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 21195 | return status; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 21196 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 21197 | break; |
| 21198 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 21199 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 21200 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 21201 | status = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 21202 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 21203 | NULL, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 21204 | NULL); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 21205 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 21206 | if (0 != status) |
| 21207 | { |
| 21208 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 21209 | FL("Error in TDLS Setup")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 21210 | return status; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 21211 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 21212 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 21213 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 21214 | case NL80211_TDLS_DISCOVERY_REQ: |
| 21215 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 21216 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 21217 | "%s: Driver doesn't support in-driver setup/teardown/discovery " |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 21218 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 21219 | return -ENOTSUPP; |
| 21220 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 21221 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21222 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 21223 | return -ENOTSUPP; |
| 21224 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 21225 | |
| 21226 | EXIT(); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 21227 | return 0; |
| 21228 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 21229 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 21230 | 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] | 21231 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 21232 | const u8 *peer, |
| 21233 | #else |
| 21234 | u8 *peer, |
| 21235 | #endif |
| 21236 | enum nl80211_tdls_operation oper) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 21237 | { |
| 21238 | int ret; |
| 21239 | |
| 21240 | vos_ssr_protect(__func__); |
| 21241 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 21242 | vos_ssr_unprotect(__func__); |
| 21243 | |
| 21244 | return ret; |
| 21245 | } |
| 21246 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 21247 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 21248 | struct net_device *dev, u8 *peer) |
| 21249 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 21250 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 21251 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 21252 | MAC_ADDR_ARRAY(peer)); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 21253 | #if TDLS_MGMT_VERSION2 |
| 21254 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 21255 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 21256 | #else |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 21257 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) |
| 21258 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 21259 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, 0, NULL, 0); |
| 21260 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 21261 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 21262 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 21263 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 21264 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 21265 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 21266 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 21267 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 21268 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 21269 | #endif |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 21270 | #endif /* KERNEL_VERSION */ |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 21271 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 21272 | #endif |
| 21273 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21274 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 21275 | /* |
| 21276 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 21277 | * Callback rountine called upon receiving response for |
| 21278 | * get offload info |
| 21279 | */ |
| 21280 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 21281 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 21282 | { |
| 21283 | |
| 21284 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 21285 | tANI_U8 tempReplayCounter[8]; |
| 21286 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21287 | |
| 21288 | ENTER(); |
| 21289 | |
| 21290 | if (NULL == pAdapter) |
| 21291 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 21292 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21293 | "%s: HDD adapter is Null", __func__); |
| 21294 | return ; |
| 21295 | } |
| 21296 | |
| 21297 | if (NULL == pGtkOffloadGetInfoRsp) |
| 21298 | { |
| 21299 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21300 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 21301 | return ; |
| 21302 | } |
| 21303 | |
| 21304 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 21305 | { |
| 21306 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21307 | "%s: wlan Failed to get replay counter value", |
| 21308 | __func__); |
| 21309 | return ; |
| 21310 | } |
| 21311 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 21312 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 21313 | /* Update replay counter */ |
| 21314 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 21315 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 21316 | |
| 21317 | { |
| 21318 | /* changing from little to big endian since supplicant |
| 21319 | * works on big endian format |
| 21320 | */ |
| 21321 | int i; |
| 21322 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 21323 | |
| 21324 | for (i = 0; i < 8; i++) |
| 21325 | { |
| 21326 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 21327 | } |
| 21328 | } |
| 21329 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21330 | /* Update replay counter to NL */ |
| 21331 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 21332 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21333 | } |
| 21334 | |
| 21335 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 21336 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21337 | * This function is used to offload GTK rekeying job to the firmware. |
| 21338 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 21339 | 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] | 21340 | struct cfg80211_gtk_rekey_data *data) |
| 21341 | { |
| 21342 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 21343 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 21344 | hdd_station_ctx_t *pHddStaCtx; |
| 21345 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 21346 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 21347 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21348 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 21349 | |
| 21350 | ENTER(); |
| 21351 | |
| 21352 | if (NULL == pAdapter) |
| 21353 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 21354 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21355 | "%s: HDD adapter is Null", __func__); |
| 21356 | return -ENODEV; |
| 21357 | } |
| 21358 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 21359 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 21360 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 21361 | pAdapter->sessionId, pAdapter->device_mode)); |
| 21362 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 21363 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 21364 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21365 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 21366 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21367 | } |
| 21368 | |
| 21369 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 21370 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 21371 | if (NULL == hHal) |
| 21372 | { |
| 21373 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21374 | "%s: HAL context is Null!!!", __func__); |
| 21375 | return -EAGAIN; |
| 21376 | } |
| 21377 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 21378 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 21379 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 21380 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 21381 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21382 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 21383 | { |
| 21384 | /* changing from big to little endian since driver |
| 21385 | * works on little endian format |
| 21386 | */ |
| 21387 | tANI_U8 *p = |
| 21388 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 21389 | int i; |
| 21390 | |
| 21391 | for (i = 0; i < 8; i++) |
| 21392 | { |
| 21393 | p[7-i] = data->replay_ctr[i]; |
| 21394 | } |
| 21395 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21396 | |
| 21397 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 21398 | { |
| 21399 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 21400 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 21401 | sizeof (tSirGtkOffloadParams)); |
| 21402 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21403 | pAdapter->sessionId); |
| 21404 | |
| 21405 | if (eHAL_STATUS_SUCCESS != status) |
| 21406 | { |
| 21407 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21408 | "%s: sme_SetGTKOffload failed, returned %d", |
| 21409 | __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 21410 | |
| 21411 | /* Need to clear any trace of key value in the memory. |
| 21412 | * Thus zero out the memory even though it is local |
| 21413 | * variable. |
| 21414 | */ |
| 21415 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 21416 | sizeof(hddGtkOffloadReqParams)); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21417 | return status; |
| 21418 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21419 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 21420 | "%s: sme_SetGTKOffload successfull", __func__); |
| 21421 | } |
| 21422 | else |
| 21423 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21424 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 21425 | "%s: wlan not suspended GTKOffload request is stored", |
| 21426 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21427 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 21428 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 21429 | /* Need to clear any trace of key value in the memory. |
| 21430 | * Thus zero out the memory even though it is local |
| 21431 | * variable. |
| 21432 | */ |
| 21433 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 21434 | sizeof(hddGtkOffloadReqParams)); |
| 21435 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 21436 | EXIT(); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 21437 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21438 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 21439 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 21440 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 21441 | struct cfg80211_gtk_rekey_data *data) |
| 21442 | { |
| 21443 | int ret; |
| 21444 | |
| 21445 | vos_ssr_protect(__func__); |
| 21446 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 21447 | vos_ssr_unprotect(__func__); |
| 21448 | |
| 21449 | return ret; |
| 21450 | } |
| 21451 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 21452 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 21453 | * FUNCTION: __wlan_hdd_cfg80211_set_mac_acl |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 21454 | * This function is used to set access control policy |
| 21455 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 21456 | static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 21457 | struct net_device *dev, |
| 21458 | const struct cfg80211_acl_data *params) |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 21459 | { |
| 21460 | int i; |
| 21461 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 21462 | hdd_hostapd_state_t *pHostapdState; |
| 21463 | tsap_Config_t *pConfig; |
| 21464 | v_CONTEXT_t pVosContext = NULL; |
| 21465 | hdd_context_t *pHddCtx; |
| 21466 | int status; |
| 21467 | |
| 21468 | ENTER(); |
| 21469 | |
| 21470 | if (NULL == pAdapter) |
| 21471 | { |
| 21472 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 21473 | "%s: HDD adapter is Null", __func__); |
| 21474 | return -ENODEV; |
| 21475 | } |
| 21476 | |
| 21477 | if (NULL == params) |
| 21478 | { |
| 21479 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 21480 | "%s: params is Null", __func__); |
| 21481 | return -EINVAL; |
| 21482 | } |
| 21483 | |
| 21484 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 21485 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 21486 | if (0 != status) |
| 21487 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 21488 | return status; |
| 21489 | } |
| 21490 | |
| 21491 | pVosContext = pHddCtx->pvosContext; |
| 21492 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 21493 | |
| 21494 | if (NULL == pHostapdState) |
| 21495 | { |
| 21496 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 21497 | "%s: pHostapdState is Null", __func__); |
| 21498 | return -EINVAL; |
| 21499 | } |
| 21500 | |
| 21501 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 21502 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 21503 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 21504 | TRACE_CODE_HDD_CFG80211_SET_MAC_ACL, |
| 21505 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 21506 | |
| 21507 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 21508 | { |
| 21509 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 21510 | |
| 21511 | /* default value */ |
| 21512 | pConfig->num_accept_mac = 0; |
| 21513 | pConfig->num_deny_mac = 0; |
| 21514 | |
| 21515 | /** |
| 21516 | * access control policy |
| 21517 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 21518 | * listed in hostapd.deny file. |
| 21519 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 21520 | * listed in hostapd.accept file. |
| 21521 | */ |
| 21522 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 21523 | { |
| 21524 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 21525 | } |
| 21526 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 21527 | { |
| 21528 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 21529 | } |
| 21530 | else |
| 21531 | { |
| 21532 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21533 | "%s:Acl Policy : %d is not supported", |
| 21534 | __func__, params->acl_policy); |
| 21535 | return -ENOTSUPP; |
| 21536 | } |
| 21537 | |
| 21538 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 21539 | { |
| 21540 | pConfig->num_accept_mac = params->n_acl_entries; |
| 21541 | for (i = 0; i < params->n_acl_entries; i++) |
| 21542 | { |
| 21543 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 21544 | "** Add ACL MAC entry %i in WhiletList :" |
| 21545 | MAC_ADDRESS_STR, i, |
| 21546 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 21547 | |
| 21548 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 21549 | sizeof(qcmacaddr)); |
| 21550 | } |
| 21551 | } |
| 21552 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 21553 | { |
| 21554 | pConfig->num_deny_mac = params->n_acl_entries; |
| 21555 | for (i = 0; i < params->n_acl_entries; i++) |
| 21556 | { |
| 21557 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 21558 | "** Add ACL MAC entry %i in BlackList :" |
| 21559 | MAC_ADDRESS_STR, i, |
| 21560 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 21561 | |
| 21562 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 21563 | sizeof(qcmacaddr)); |
| 21564 | } |
| 21565 | } |
| 21566 | |
| 21567 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 21568 | { |
| 21569 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21570 | "%s: SAP Set Mac Acl fail", __func__); |
| 21571 | return -EINVAL; |
| 21572 | } |
| 21573 | } |
| 21574 | else |
| 21575 | { |
| 21576 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 21577 | "%s: Invalid device_mode = %s (%d)", |
| 21578 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 21579 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 21580 | return -EINVAL; |
| 21581 | } |
| 21582 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 21583 | EXIT(); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 21584 | return 0; |
| 21585 | } |
| 21586 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 21587 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 21588 | struct net_device *dev, |
| 21589 | const struct cfg80211_acl_data *params) |
| 21590 | { |
| 21591 | int ret; |
| 21592 | vos_ssr_protect(__func__); |
| 21593 | ret = __wlan_hdd_cfg80211_set_mac_acl(wiphy, dev, params); |
| 21594 | vos_ssr_unprotect(__func__); |
| 21595 | |
| 21596 | return ret; |
| 21597 | } |
| 21598 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21599 | #ifdef WLAN_NL80211_TESTMODE |
| 21600 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 21601 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21602 | ( |
| 21603 | void *pAdapter, |
| 21604 | void *indCont |
| 21605 | ) |
| 21606 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 21607 | tSirLPHBInd *lphbInd; |
| 21608 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 21609 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21610 | |
| 21611 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 21612 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21613 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 21614 | if (pAdapter == NULL) |
| 21615 | { |
| 21616 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21617 | "%s: pAdapter is NULL\n",__func__); |
| 21618 | return; |
| 21619 | } |
| 21620 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21621 | if (NULL == indCont) |
| 21622 | { |
| 21623 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 21624 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21625 | return; |
| 21626 | } |
| 21627 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 21628 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 21629 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21630 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 21631 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 21632 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21633 | GFP_ATOMIC); |
| 21634 | if (!skb) |
| 21635 | { |
| 21636 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21637 | "LPHB timeout, NL buffer alloc fail"); |
| 21638 | return; |
| 21639 | } |
| 21640 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 21641 | 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] | 21642 | { |
| 21643 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21644 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 21645 | goto nla_put_failure; |
| 21646 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 21647 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 21648 | { |
| 21649 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21650 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 21651 | goto nla_put_failure; |
| 21652 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 21653 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 21654 | sizeof(tSirLPHBInd), lphbInd)) |
| 21655 | { |
| 21656 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21657 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 21658 | goto nla_put_failure; |
| 21659 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21660 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 21661 | return; |
| 21662 | |
| 21663 | nla_put_failure: |
| 21664 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21665 | "NLA Put fail"); |
| 21666 | kfree_skb(skb); |
| 21667 | |
| 21668 | return; |
| 21669 | } |
| 21670 | #endif /* FEATURE_WLAN_LPHB */ |
| 21671 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 21672 | 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] | 21673 | { |
| 21674 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 21675 | int err = 0; |
| 21676 | #ifdef FEATURE_WLAN_LPHB |
| 21677 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 21678 | eHalStatus smeStatus; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 21679 | |
| 21680 | ENTER(); |
| 21681 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 21682 | err = wlan_hdd_validate_context(pHddCtx); |
| 21683 | if (0 != err) |
| 21684 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 21685 | return err; |
| 21686 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21687 | #endif /* FEATURE_WLAN_LPHB */ |
| 21688 | |
| 21689 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 21690 | if (err) |
| 21691 | { |
| 21692 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21693 | "%s Testmode INV ATTR", __func__); |
| 21694 | return err; |
| 21695 | } |
| 21696 | |
| 21697 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 21698 | { |
| 21699 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21700 | "%s Testmode INV CMD", __func__); |
| 21701 | return -EINVAL; |
| 21702 | } |
| 21703 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 21704 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 21705 | TRACE_CODE_HDD_CFG80211_TESTMODE, |
| 21706 | NO_SESSION, nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD]))); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21707 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 21708 | { |
| 21709 | #ifdef FEATURE_WLAN_LPHB |
| 21710 | /* Low Power Heartbeat configuration request */ |
| 21711 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 21712 | { |
| 21713 | int buf_len; |
| 21714 | void *buf; |
| 21715 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 21716 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21717 | |
| 21718 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 21719 | { |
| 21720 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21721 | "%s Testmode INV DATA", __func__); |
| 21722 | return -EINVAL; |
| 21723 | } |
| 21724 | |
| 21725 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 21726 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 21727 | |
Manjeet Singh | 3c57744 | 2017-02-10 19:03:38 +0530 | [diff] [blame] | 21728 | if (buf_len > sizeof(*hb_params)) { |
| 21729 | hddLog(LOGE, FL("buf_len=%d exceeded hb_params size limit"), |
| 21730 | buf_len); |
| 21731 | return -ERANGE; |
| 21732 | } |
| 21733 | |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 21734 | hb_params_temp =(tSirLPHBReq *)buf; |
| 21735 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 21736 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 21737 | return -EINVAL; |
| 21738 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21739 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 21740 | if (NULL == hb_params) |
| 21741 | { |
| 21742 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21743 | "%s Request Buffer Alloc Fail", __func__); |
| 21744 | return -EINVAL; |
| 21745 | } |
| 21746 | |
Ashish Kumar Dhanotiya | 3a8c0a7 | 2017-07-13 18:58:59 +0530 | [diff] [blame] | 21747 | vos_mem_zero(hb_params, sizeof(tSirLPHBReq)); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21748 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 21749 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 21750 | hb_params, |
| 21751 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 21752 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21753 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 21754 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21755 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21756 | vos_mem_free(hb_params); |
| 21757 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21758 | return 0; |
| 21759 | } |
| 21760 | #endif /* FEATURE_WLAN_LPHB */ |
| 21761 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 21762 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 21763 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21764 | return -EOPNOTSUPP; |
| 21765 | } |
| 21766 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 21767 | EXIT(); |
| 21768 | return err; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21769 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 21770 | |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 21771 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, |
| 21772 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) |
| 21773 | struct wireless_dev *wdev, |
| 21774 | #endif |
| 21775 | void *data, int len) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 21776 | { |
| 21777 | int ret; |
| 21778 | |
| 21779 | vos_ssr_protect(__func__); |
| 21780 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 21781 | vos_ssr_unprotect(__func__); |
| 21782 | |
| 21783 | return ret; |
| 21784 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 21785 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 21786 | |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 21787 | extern void hdd_set_wlan_suspend_mode(bool suspend); |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 21788 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 21789 | struct net_device *dev, |
| 21790 | int idx, struct survey_info *survey) |
| 21791 | { |
| 21792 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 21793 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 21794 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 21795 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 21796 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 21797 | v_S7_t snr,rssi; |
| 21798 | int status, i, j, filled = 0; |
| 21799 | |
| 21800 | ENTER(); |
| 21801 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 21802 | if (NULL == pAdapter) |
| 21803 | { |
| 21804 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 21805 | "%s: HDD adapter is Null", __func__); |
| 21806 | return -ENODEV; |
| 21807 | } |
| 21808 | |
| 21809 | if (NULL == wiphy) |
| 21810 | { |
| 21811 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 21812 | "%s: wiphy is Null", __func__); |
| 21813 | return -ENODEV; |
| 21814 | } |
| 21815 | |
| 21816 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 21817 | status = wlan_hdd_validate_context(pHddCtx); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 21818 | if (0 != status) |
| 21819 | { |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 21820 | return status; |
| 21821 | } |
| 21822 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 21823 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 21824 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 21825 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 21826 | 0 != pAdapter->survey_idx || |
| 21827 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 21828 | { |
| 21829 | /* The survey dump ops when implemented completely is expected to |
| 21830 | * return a survey of all channels and the ops is called by the |
| 21831 | * kernel with incremental values of the argument 'idx' till it |
| 21832 | * returns -ENONET. But we can only support the survey for the |
| 21833 | * operating channel for now. survey_idx is used to track |
| 21834 | * that the ops is called only once and then return -ENONET for |
| 21835 | * the next iteration |
| 21836 | */ |
| 21837 | pAdapter->survey_idx = 0; |
| 21838 | return -ENONET; |
| 21839 | } |
| 21840 | |
Mukul Sharma | 9d5233b | 2015-06-11 20:28:20 +0530 | [diff] [blame] | 21841 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 21842 | { |
| 21843 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 21844 | "%s: Roaming in progress, hence return ", __func__); |
| 21845 | return -ENONET; |
| 21846 | } |
| 21847 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 21848 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 21849 | |
| 21850 | wlan_hdd_get_snr(pAdapter, &snr); |
| 21851 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 21852 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 21853 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 21854 | TRACE_CODE_HDD_CFG80211_DUMP_SURVEY, |
| 21855 | pAdapter->sessionId, pAdapter->device_mode)); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 21856 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 21857 | hdd_wlan_get_freq(channel, &freq); |
| 21858 | |
| 21859 | |
Rajeev Kumar Sirasanagandla | 5b21a9c | 2018-01-08 17:05:11 +0530 | [diff] [blame] | 21860 | for (i = 0; i < HDD_NUM_NL80211_BANDS; i++) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 21861 | { |
| 21862 | if (NULL == wiphy->bands[i]) |
| 21863 | { |
| 21864 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 21865 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 21866 | continue; |
| 21867 | } |
| 21868 | |
| 21869 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 21870 | { |
| 21871 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 21872 | |
| 21873 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 21874 | { |
| 21875 | survey->channel = &band->channels[j]; |
| 21876 | /* The Rx BDs contain SNR values in dB for the received frames |
| 21877 | * while the supplicant expects noise. So we calculate and |
| 21878 | * return the value of noise (dBm) |
| 21879 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 21880 | */ |
| 21881 | survey->noise = rssi - snr; |
| 21882 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 21883 | filled = 1; |
| 21884 | } |
| 21885 | } |
| 21886 | } |
| 21887 | |
| 21888 | if (filled) |
| 21889 | pAdapter->survey_idx = 1; |
| 21890 | else |
| 21891 | { |
| 21892 | pAdapter->survey_idx = 0; |
| 21893 | return -ENONET; |
| 21894 | } |
| 21895 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 21896 | EXIT(); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 21897 | return 0; |
| 21898 | } |
| 21899 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 21900 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 21901 | struct net_device *dev, |
| 21902 | int idx, struct survey_info *survey) |
| 21903 | { |
| 21904 | int ret; |
| 21905 | |
| 21906 | vos_ssr_protect(__func__); |
| 21907 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 21908 | vos_ssr_unprotect(__func__); |
| 21909 | |
| 21910 | return ret; |
| 21911 | } |
| 21912 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 21913 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 21914 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 21915 | * this is called when cfg80211 driver resume |
| 21916 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 21917 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 21918 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 21919 | { |
| 21920 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 21921 | hdd_adapter_t *pAdapter; |
| 21922 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 21923 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 21924 | |
| 21925 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 21926 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 21927 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 21928 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 21929 | return 0; |
| 21930 | } |
| 21931 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 21932 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_CFG80211_RESUME_WLAN, |
| 21933 | NO_SESSION, pHddCtx->isWiphySuspended)); |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 21934 | |
Nishank Aggarwal | c11826c | 2016-12-15 18:54:10 +0530 | [diff] [blame] | 21935 | if (pHddCtx->is_ap_mode_wow_supported) |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 21936 | { |
| 21937 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 21938 | "%s: Resume SoftAP", __func__); |
| 21939 | hdd_set_wlan_suspend_mode(false); |
| 21940 | } |
| 21941 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 21942 | spin_lock(&pHddCtx->schedScan_lock); |
| 21943 | pHddCtx->isWiphySuspended = FALSE; |
| 21944 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 21945 | { |
| 21946 | spin_unlock(&pHddCtx->schedScan_lock); |
| 21947 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 21948 | "%s: Return resume is not due to PNO indication", __func__); |
| 21949 | return 0; |
| 21950 | } |
| 21951 | // Reset flag to avoid updatating cfg80211 data old results again |
| 21952 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 21953 | spin_unlock(&pHddCtx->schedScan_lock); |
| 21954 | |
| 21955 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 21956 | |
| 21957 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 21958 | { |
| 21959 | pAdapter = pAdapterNode->pAdapter; |
| 21960 | if ( (NULL != pAdapter) && |
| 21961 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 21962 | { |
| 21963 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 21964 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 21965 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 21966 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 21967 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 21968 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 21969 | { |
| 21970 | /* Acquire wakelock to handle the case where APP's tries to |
| 21971 | * suspend immediately after updating the scan results. Whis |
| 21972 | * results in app's is in suspended state and not able to |
| 21973 | * process the connect request to AP |
| 21974 | */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 21975 | hdd_prevent_suspend_timeout(2000, |
| 21976 | WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 21977 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 21978 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 21979 | |
| 21980 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 21981 | "%s : cfg80211 scan result database updated", __func__); |
| 21982 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 21983 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 21984 | return 0; |
| 21985 | |
| 21986 | } |
| 21987 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 21988 | pAdapterNode = pNext; |
| 21989 | } |
| 21990 | |
| 21991 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 21992 | "%s: Failed to find Adapter", __func__); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 21993 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 21994 | return 0; |
| 21995 | } |
| 21996 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 21997 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 21998 | { |
| 21999 | int ret; |
| 22000 | |
| 22001 | vos_ssr_protect(__func__); |
| 22002 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 22003 | vos_ssr_unprotect(__func__); |
| 22004 | |
| 22005 | return ret; |
| 22006 | } |
| 22007 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 22008 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 22009 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 22010 | * this is called when cfg80211 driver suspends |
| 22011 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 22012 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 22013 | struct cfg80211_wowlan *wow) |
| 22014 | { |
| 22015 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 22016 | int ret = 0; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 22017 | |
| 22018 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 22019 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 22020 | ret = wlan_hdd_validate_context(pHddCtx); |
| 22021 | if (0 != ret) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 22022 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 22023 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 22024 | } |
| 22025 | |
Nishank Aggarwal | c11826c | 2016-12-15 18:54:10 +0530 | [diff] [blame] | 22026 | if (pHddCtx->is_ap_mode_wow_supported) { |
Arun Khandavalli | 08bcafd | 2016-11-08 14:45:48 +0530 | [diff] [blame] | 22027 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 22028 | "%s: Suspend SoftAP", __func__); |
| 22029 | hdd_set_wlan_suspend_mode(true); |
| 22030 | } |
| 22031 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 22032 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 22033 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 22034 | TRACE_CODE_HDD_CFG80211_SUSPEND_WLAN, |
| 22035 | NO_SESSION, pHddCtx->isWiphySuspended)); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 22036 | pHddCtx->isWiphySuspended = TRUE; |
| 22037 | |
| 22038 | EXIT(); |
| 22039 | |
| 22040 | return 0; |
| 22041 | } |
| 22042 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 22043 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 22044 | struct cfg80211_wowlan *wow) |
| 22045 | { |
| 22046 | int ret; |
| 22047 | |
| 22048 | vos_ssr_protect(__func__); |
| 22049 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 22050 | vos_ssr_unprotect(__func__); |
| 22051 | |
| 22052 | return ret; |
| 22053 | } |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 22054 | |
| 22055 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 22056 | 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] | 22057 | void *pMsg, tANI_U32 evLen) |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 22058 | { |
| 22059 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 22060 | |
| 22061 | ENTER(); |
| 22062 | |
| 22063 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 22064 | return; |
| 22065 | } |
| 22066 | if (!pMsg) |
| 22067 | { |
| 22068 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 22069 | return; |
| 22070 | } |
| 22071 | |
Padma, Santhosh Kumar | f75c37b | 2016-01-25 10:36:08 +0530 | [diff] [blame] | 22072 | send_oem_data_rsp_msg(evLen, pMsg); |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 22073 | |
| 22074 | EXIT(); |
| 22075 | return; |
| 22076 | |
| 22077 | } |
| 22078 | |
| 22079 | 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] | 22080 | void *pMsg, tANI_U32 evLen) |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 22081 | { |
| 22082 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 22083 | |
| 22084 | ENTER(); |
| 22085 | |
| 22086 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 22087 | return; |
| 22088 | } |
| 22089 | |
Padma, Santhosh Kumar | f75c37b | 2016-01-25 10:36:08 +0530 | [diff] [blame] | 22090 | 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] | 22091 | |
| 22092 | switch(evType) { |
| 22093 | case SIR_HAL_START_OEM_DATA_RSP_IND_NEW: |
Padma, Santhosh Kumar | f75c37b | 2016-01-25 10:36:08 +0530 | [diff] [blame] | 22094 | wlan_hdd_cfg80211_oem_data_rsp_ind_new(ctx, pMsg, evLen); |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 22095 | break; |
| 22096 | default: |
| 22097 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 22098 | break; |
| 22099 | } |
| 22100 | EXIT(); |
| 22101 | } |
| 22102 | #endif |
| 22103 | |
Kanchanapally, Vidyullatha | 740d64e | 2016-05-03 15:25:54 +0530 | [diff] [blame] | 22104 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)) || \ |
| 22105 | defined(CFG80211_ABORT_SCAN) |
Kanchanapally, Vidyullatha | c473516 | 2016-02-09 17:49:39 +0530 | [diff] [blame] | 22106 | /** |
| 22107 | * __wlan_hdd_cfg80211_abort_scan() - cfg80211 abort scan api |
| 22108 | * @wiphy: Pointer to wiphy |
| 22109 | * @wdev: Pointer to wireless device structure |
| 22110 | * |
| 22111 | * This function is used to abort an ongoing scan |
| 22112 | * |
| 22113 | * Return: None |
| 22114 | */ |
| 22115 | static void __wlan_hdd_cfg80211_abort_scan(struct wiphy *wiphy, |
| 22116 | struct wireless_dev *wdev) |
| 22117 | { |
| 22118 | struct net_device *dev = wdev->netdev; |
| 22119 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 22120 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 22121 | int ret; |
| 22122 | |
| 22123 | ENTER(); |
| 22124 | |
| 22125 | if (NULL == adapter) { |
| 22126 | hddLog(VOS_TRACE_LEVEL_FATAL, FL("HDD adapter is NULL")); |
| 22127 | return; |
| 22128 | } |
| 22129 | |
| 22130 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 22131 | if (0 != ret) |
| 22132 | return; |
| 22133 | |
| 22134 | wlan_hdd_scan_abort(adapter); |
| 22135 | |
| 22136 | return; |
| 22137 | } |
| 22138 | |
| 22139 | /** |
| 22140 | * wlan_hdd_cfg80211_abort_scan - cfg80211 abort scan api |
| 22141 | * @wiphy: Pointer to wiphy |
| 22142 | * @wdev: Pointer to wireless device structure |
| 22143 | * |
| 22144 | * Return: None |
| 22145 | */ |
| 22146 | void wlan_hdd_cfg80211_abort_scan(struct wiphy *wiphy, |
| 22147 | struct wireless_dev *wdev) |
| 22148 | { |
| 22149 | vos_ssr_protect(__func__); |
| 22150 | __wlan_hdd_cfg80211_abort_scan(wiphy, wdev); |
| 22151 | vos_ssr_unprotect(__func__); |
| 22152 | |
| 22153 | return; |
| 22154 | } |
Kanchanapally, Vidyullatha | 740d64e | 2016-05-03 15:25:54 +0530 | [diff] [blame] | 22155 | #endif |
Kanchanapally, Vidyullatha | c473516 | 2016-02-09 17:49:39 +0530 | [diff] [blame] | 22156 | |
Abhishek Singh | 936c693 | 2017-11-07 17:28:23 +0530 | [diff] [blame] | 22157 | #ifdef CHANNEL_SWITCH_SUPPORTED |
| 22158 | /** |
| 22159 | * __wlan_hdd_cfg80211_channel_switch()- function to switch |
| 22160 | * channel in SAP/GO |
| 22161 | * @wiphy: wiphy pointer |
| 22162 | * @dev: dev pointer. |
| 22163 | * @csa_params: Change channel params |
| 22164 | * |
| 22165 | * This function is called to switch channel in SAP/GO |
| 22166 | * |
| 22167 | * Return: 0 if success else return non zero |
| 22168 | */ |
| 22169 | static int __wlan_hdd_cfg80211_channel_switch(struct wiphy *wiphy, |
| 22170 | struct net_device *dev, struct cfg80211_csa_settings *csa_params) |
| 22171 | { |
| 22172 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 22173 | hdd_context_t *hdd_ctx; |
| 22174 | uint8_t channel; |
| 22175 | int ret; |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 22176 | ptSapContext sap_ctx; |
Abhishek Singh | 936c693 | 2017-11-07 17:28:23 +0530 | [diff] [blame] | 22177 | v_CONTEXT_t vos_ctx; |
| 22178 | |
| 22179 | hddLog(LOGE, FL("Set Freq %d"), csa_params->chandef.chan->center_freq); |
| 22180 | |
| 22181 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 22182 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 22183 | if (ret) |
| 22184 | return ret; |
| 22185 | |
| 22186 | vos_ctx = (WLAN_HDD_GET_CTX(adapter))->pvosContext; |
| 22187 | if (!vos_ctx) { |
| 22188 | hddLog(LOGE, FL("Vos ctx is null")); |
| 22189 | return -EINVAL; |
| 22190 | } |
| 22191 | |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 22192 | if (WLAN_HDD_SOFTAP != adapter->device_mode) |
Abhishek Singh | 936c693 | 2017-11-07 17:28:23 +0530 | [diff] [blame] | 22193 | return -ENOTSUPP; |
| 22194 | |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 22195 | sap_ctx = VOS_GET_SAP_CB(vos_ctx); |
| 22196 | if (!sap_ctx) { |
| 22197 | hddLog(LOGE, FL("sap_ctx is NULL")); |
| 22198 | return -EINVAL; |
| 22199 | } |
| 22200 | |
| 22201 | ret = wlansap_chk_n_set_chan_change_in_progress(sap_ctx); |
| 22202 | if (ret) |
| 22203 | return ret; |
| 22204 | |
| 22205 | INIT_COMPLETION(sap_ctx->ecsa_info.chan_switch_comp); |
| 22206 | |
Abhishek Singh | 936c693 | 2017-11-07 17:28:23 +0530 | [diff] [blame] | 22207 | channel = vos_freq_to_chan(csa_params->chandef.chan->center_freq); |
Abhishek Singh | ceb6fe2 | 2017-11-27 13:53:18 +0530 | [diff] [blame] | 22208 | ret = wlansap_set_channel_change(vos_ctx, channel, false); |
Abhishek Singh | 936c693 | 2017-11-07 17:28:23 +0530 | [diff] [blame] | 22209 | |
Abhishek Singh | 10e17cf | 2018-03-12 14:34:22 +0530 | [diff] [blame] | 22210 | if (ret) { |
| 22211 | wlansap_reset_chan_change_in_progress(sap_ctx); |
| 22212 | complete(&sap_ctx->ecsa_info.chan_switch_comp); |
| 22213 | } |
| 22214 | |
Abhishek Singh | 936c693 | 2017-11-07 17:28:23 +0530 | [diff] [blame] | 22215 | return ret; |
| 22216 | } |
| 22217 | |
| 22218 | /** |
| 22219 | * wlan_hdd_cfg80211_channel_switch()- function to switch |
| 22220 | * channel in SAP/GO |
| 22221 | * @wiphy: wiphy pointer |
| 22222 | * @dev: dev pointer. |
| 22223 | * @csa_params: Change channel params |
| 22224 | * |
| 22225 | * This function is called to switch channel in SAP/GO |
| 22226 | * |
| 22227 | * Return: 0 if success else return non zero |
| 22228 | */ |
| 22229 | static int wlan_hdd_cfg80211_channel_switch(struct wiphy *wiphy, |
| 22230 | struct net_device *dev, struct cfg80211_csa_settings *csa_params) |
| 22231 | { |
| 22232 | int ret; |
| 22233 | |
| 22234 | vos_ssr_protect(__func__); |
| 22235 | ret = __wlan_hdd_cfg80211_channel_switch(wiphy, dev, csa_params); |
| 22236 | vos_ssr_unprotect(__func__); |
| 22237 | |
| 22238 | return ret; |
| 22239 | } |
| 22240 | #endif |
| 22241 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 22242 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 22243 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 22244 | { |
| 22245 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 22246 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 22247 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 22248 | .change_station = wlan_hdd_change_station, |
| 22249 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 22250 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 22251 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 22252 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 22253 | #else |
| 22254 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 22255 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 22256 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 22257 | #endif |
| 22258 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 22259 | .add_key = wlan_hdd_cfg80211_add_key, |
| 22260 | .get_key = wlan_hdd_cfg80211_get_key, |
| 22261 | .del_key = wlan_hdd_cfg80211_del_key, |
| 22262 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 22263 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 22264 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 22265 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 22266 | .scan = wlan_hdd_cfg80211_scan, |
| 22267 | .connect = wlan_hdd_cfg80211_connect, |
| 22268 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 22269 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 22270 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 22271 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 22272 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 22273 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 22274 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 22275 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 22276 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 22277 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 22278 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 22279 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 22280 | .set_txq_params = wlan_hdd_set_txq_params, |
| 22281 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 22282 | .get_station = wlan_hdd_cfg80211_get_station, |
| 22283 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 22284 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 22285 | .add_station = wlan_hdd_cfg80211_add_station, |
| 22286 | #ifdef FEATURE_WLAN_LFR |
| 22287 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 22288 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 22289 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 22290 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 22291 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 22292 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 22293 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 22294 | #ifdef FEATURE_WLAN_TDLS |
| 22295 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 22296 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 22297 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 22298 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 22299 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 22300 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 22301 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 22302 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 22303 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 22304 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 22305 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 22306 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 22307 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 22308 | #ifdef WLAN_NL80211_TESTMODE |
| 22309 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 22310 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 22311 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Kanchanapally, Vidyullatha | 740d64e | 2016-05-03 15:25:54 +0530 | [diff] [blame] | 22312 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)) || \ |
| 22313 | defined(CFG80211_ABORT_SCAN) |
Kanchanapally, Vidyullatha | c473516 | 2016-02-09 17:49:39 +0530 | [diff] [blame] | 22314 | .abort_scan = wlan_hdd_cfg80211_abort_scan, |
Kanchanapally, Vidyullatha | 740d64e | 2016-05-03 15:25:54 +0530 | [diff] [blame] | 22315 | #endif |
Abhishek Singh | 936c693 | 2017-11-07 17:28:23 +0530 | [diff] [blame] | 22316 | #ifdef CHANNEL_SWITCH_SUPPORTED |
| 22317 | .channel_switch = wlan_hdd_cfg80211_channel_switch, |
| 22318 | #endif |
| 22319 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 22320 | }; |
| 22321 | |